码迷,mamicode.com
首页 > 其他好文 > 详细

T端带配置文件的魔兽世界BOSS被杀世界公告

时间:2014-05-26 18:24:32      阅读:374      评论:0      收藏:0      [点我收藏+]

标签:des   style   c   class   blog   code   

bubuko.com,布布扣
这个代码是Trinity的内核代码。

主要功能,。就是BOSS被杀死后,世界BOSS向所有的私服玩家都公告一次。公告的内容在SQL里面配置

适合使用在变态魔兽世界私服中。可以实现BOSS击杀公告。你也可以根据此代码扩展更改,实现击杀boss获得奖励什么的


 # HG changeset patch 
# User aa@aa-HP
# Date 1367859811 -10800
# Node ID cfa885e9e6e4c4e37f6799a45918b946546830a4
# Parent  0af922d0404643f4ebaac4d2b786c43aaf190967
# Project: DoomCore
Добавил систему анонс при убийстве босса
 
diff -r 0af922d04046 -r cfa885e9e6e4 src/server/game/Entities/Unit/Unit.cpp
--- a/src/server/game/Entities/Unit/Unit.cpp    Mon May 06 19:16:04 2013 +0300
+++ b/src/server/game/Entities/Unit/Unit.cpp    Mon May 06 20:03:31 2013 +0300
@@ -15354,6 +15354,9 @@
         // Call creature just died function
         if (creature->IsAIEnabled)
             creature->AI()->JustDied(this);
+            
+            if (creature)
+            sScriptMgr->AllCreatureJustDied(creature);
 
         if (TempSummon* summon = creature->ToTempSummon())
             if (Unit* summoner = summon->GetSummoner())
diff -r 0af922d04046 -r cfa885e9e6e4 src/server/game/Miscellaneous/Language.h
--- a/src/server/game/Miscellaneous/Language.h    Mon May 06 19:16:04 2013 +0300
+++ b/src/server/game/Miscellaneous/Language.h    Mon May 06 20:03:31 2013 +0300
@@ -1175,6 +1175,10 @@
     // Use for custom patches             11000-11999
     LANG_AUTO_BROADCAST                 = 11000,
     LANG_INVALID_REALMID                = 11001,
+    
+    // Boss kill announce 
+    LANG_BOSS_KILL_HISTORY_NORMAL       = 11008,
+    LANG_BOSS_KILL_HISTORY_HEROIC       = 11009,
 
     // NOT RESERVED IDS                   12000-1999999999
     // `db_script_string` table index     2000000000-2000009999 (MIN_DB_SCRIPT_STRING_ID-MAX_DB_SCRIPT_STRING_ID)
diff -r 0af922d04046 -r cfa885e9e6e4 src/server/game/Scripting/ScriptLoader.cpp
--- a/src/server/game/Scripting/ScriptLoader.cpp    Mon May 06 19:16:04 2013 +0300
+++ b/src/server/game/Scripting/ScriptLoader.cpp    Mon May 06 20:03:31 2013 +0300
@@ -1315,6 +1315,8 @@
 void AddSC_npc_title();
 //Top 5 Class Killers
 void AddSC_Top5_Killers();
+//Boss Kill Announcer
+void AddSC_boss_kill_history();
 #endif
 
 void AddCustomScripts()
@@ -1333,6 +1335,7 @@
     AddSC_title_granter();
     AddSC_npc_title();
     AddSC_Top5_Killers();
+    AddSC_boss_kill_history();
     
 #endif
 }
diff -r 0af922d04046 -r cfa885e9e6e4 src/server/game/Scripting/ScriptMgr.cpp
--- a/src/server/game/Scripting/ScriptMgr.cpp    Mon May 06 19:16:04 2013 +0300
+++ b/src/server/game/Scripting/ScriptMgr.cpp    Mon May 06 20:03:31 2013 +0300
@@ -217,6 +217,7 @@
     SCR_CLEAR(PlayerScript);
     SCR_CLEAR(GuildScript);
     SCR_CLEAR(GroupScript);
+    SCR_CLEAR(AllCreatureScript);
     SCR_CLEAR(UnitScript);
 
     #undef SCR_CLEAR
@@ -796,6 +797,11 @@
     tmpscript->OnUpdate(creature, diff);
 }
 
+void ScriptMgr::AllCreatureJustDied(Creature* creature)
+{
+    FOREACH_SCRIPT(AllCreatureScript)->AllCreatureJustDied(creature);
+}
+
 bool ScriptMgr::OnGossipHello(Player* player, GameObject* go)
 {
     ASSERT(player);
@@ -1432,6 +1438,12 @@
     ScriptRegistry<CreatureScript>::AddScript(this);
 }
 
+AllCreatureScript::AllCreatureScript(const char* name)
+    : ScriptObject(name)
+{
+    ScriptRegistry<AllCreatureScript>::AddScript(this);
+}
+
 GameObjectScript::GameObjectScript(const char* name)
     : ScriptObject(name)
 {
@@ -1536,6 +1548,7 @@
 template class ScriptRegistry<BattlegroundMapScript>;
 template class ScriptRegistry<ItemScript>;
 template class ScriptRegistry<CreatureScript>;
+template class ScriptRegistry<AllCreatureScript>;
 template class ScriptRegistry<GameObjectScript>;
 template class ScriptRegistry<AreaTriggerScript>;
 template class ScriptRegistry<BattlegroundScript>;
diff -r 0af922d04046 -r cfa885e9e6e4 src/server/game/Scripting/ScriptMgr.h
--- a/src/server/game/Scripting/ScriptMgr.h    Mon May 06 19:16:04 2013 +0300
+++ b/src/server/game/Scripting/ScriptMgr.h    Mon May 06 20:03:31 2013 +0300
@@ -450,6 +450,18 @@
         virtual CreatureAI* GetAI(Creature* /*creature*/) const { return NULL; }
 };
 
+class AllCreatureScript : public ScriptObject
+{
+    protected:
+
+        AllCreatureScript(const char* name);
+
+    public:
+               
+        // Called when creature dying
+        virtual void AllCreatureJustDied(Creature* /*creature*/) { }
+};
+
 class GameObjectScript : public ScriptObject, public UpdatableScript<GameObject>
 {
     protected:
@@ -928,6 +940,10 @@
         uint32 GetDialogStatus(Player* player, Creature* creature);
         CreatureAI* GetCreatureAI(Creature* creature);
         void OnCreatureUpdate(Creature* creature, uint32 diff);
+         
+         public: /* AllCreatureScript */
+
+        void AllCreatureJustDied(Creature* creature);
 
     public: /* GameObjectScript */
 
diff -r 0af922d04046 -r cfa885e9e6e4 src/server/game/World/World.cpp
--- a/src/server/game/World/World.cpp    Mon May 06 19:16:04 2013 +0300
+++ b/src/server/game/World/World.cpp    Mon May 06 20:03:31 2013 +0300
@@ -1197,6 +1197,14 @@
     
      // Management for LFG EveryWhere
     m_bool_configs[CONFIG_ON_LFG_EVERY_WHERE]  = ConfigMgr::GetBoolDefault("LFG.Everywhere", true);
+    
+     //Boss kill history system
+    m_bool_configs[CONFIG_BOSS_KILL_HISTORY_ENABLE] = ConfigMgr::GetBoolDefault("Boss.Kill.History.Enable", true);
+    m_int_configs[CONFIG_BOSS_KILL_HISTORY_GUILD_GROUP_10_COUNT] = ConfigMgr::GetIntDefault("Boss.Kill.History.Guild.Group.10",8);
+    m_int_configs[CONFIG_BOSS_KILL_HISTORY_GUILD_GROUP_25_COUNT] = ConfigMgr::GetIntDefault("Boss.Kill.History.Guild.Group.25",20);
+    m_int_configs[CONFIG_BOSS_KILL_HISTORY_REWARD_ENABLE] = ConfigMgr::GetBoolDefault("Boss.Kill.History.Reward.Enable", false);
+    m_int_configs[CONFIG_BOSS_KILL_HISTORY_REWARD_ITEM] = ConfigMgr::GetIntDefault("Boss.Kill.History.Reward.Item.Id",49426);
+    m_int_configs[CONFIG_BOSS_KILL_HISTORY_REWARD_ITEM_COUNT] = ConfigMgr::GetIntDefault("Boss.Kill.History.Reward.Item.Count",10);
 
     // AutoBroadcast
     m_bool_configs[CONFIG_AUTOBROADCAST] = ConfigMgr::GetBoolDefault("AutoBroadcast.On", false);
diff -r 0af922d04046 -r cfa885e9e6e4 src/server/game/World/World.h
--- a/src/server/game/World/World.h    Mon May 06 19:16:04 2013 +0300
+++ b/src/server/game/World/World.h    Mon May 06 20:03:31 2013 +0300
@@ -160,6 +160,8 @@
     CONFIG_UI_QUESTLEVELS_IN_DIALOGS,     // Should we add quest levels to the title in the NPC dialogs?
     CONFIG_EVENT_ANNOUNCE,
     CONFIG_ON_LFG_EVERY_WHERE,
+    CONFIG_BOSS_KILL_HISTORY_REWARD_ENABLE,
+    CONFIG_BOSS_KILL_HISTORY_ENABLE,
     BOOL_CONFIG_VALUE_COUNT
 };
 
@@ -322,6 +324,10 @@
     CONFIG_WINTERGRASP_BATTLETIME,
     CONFIG_WINTERGRASP_NOBATTLETIME,
     CONFIG_WINTERGRASP_RESTART_AFTER_CRASH,
+    CONFIG_BOSS_KILL_HISTORY_GUILD_GROUP_10_COUNT,
+    CONFIG_BOSS_KILL_HISTORY_GUILD_GROUP_25_COUNT,
+    CONFIG_BOSS_KILL_HISTORY_REWARD_ITEM,
+    CONFIG_BOSS_KILL_HISTORY_REWARD_ITEM_COUNT,
     INT_CONFIG_VALUE_COUNT
 };
 
diff -r 0af922d04046 -r cfa885e9e6e4 src/server/worldserver/worldserver.conf.dist
--- a/src/server/worldserver/worldserver.conf.dist    Mon May 06 19:16:04 2013 +0300
+++ b/src/server/worldserver/worldserver.conf.dist    Mon May 06 20:03:31 2013 +0300
@@ -2778,4 +2778,65 @@
 Channel.CityOnlyFlag = 1
 
 #
+###################################################################################################
+
+###################################################################################################
+# BOSS KILL HISTORY SYSTEM
+#
+#    Boss.Kill.History.Enable
+#        Description: Enables the boss kill history system.
+#        Important:   When you kiliing the boss, if youre in guild the world receive announcement,
+#                     that your guild killed this boss, on whisch difficult and the count of kills.
+#        Default:     1 - (Enabled)
+#                     0 - (Disabled)
+#
+
+Boss.Kill.History.Enable = 1
+
+#
+#    Boss.Kill.History.Reward.Enable
+#        Description: Enables or disables the reward system for BKH.
+#        Default:     0 - (Disabled)
+#                     1 - (Enabled)
+#
+
+Boss.Kill.History.Reward.Enable = 0
+
+#
+#    Boss.Kill.History.Reward.Item.Id
+#        Description: ID of the item, which all of party members will be rewarded on guild kill.
+#        Default:     1 - (Enabled)
+#                     0 - (Disabled)
+#
+
+Boss.Kill.History.Reward.Item.Id = 49426
+
+#
+#    Boss.Kill.History.Reward.Item.Count
+#        Description: Count of the items, which all of party members will be rewarded on guild kill.
+#        Default:     1 - (Enabled)
+#                     0 - (Disabled)
+#
+
+Boss.Kill.History.Reward.Item.Count = 10
+
+#
+#    Boss.Kill.History.Guild.Group.10
+#        Description: How many liverymen have to be in group
+#        Default:     8
+#                     
+#   
+
+Boss.Kill.History.Guild.Group.10 = 8
+
+#
+#    Boss.Kill.History.Guild.Group.25
+#        Description: How many liverymen have to be in group
+#        Default:     20
+#                     
+#   
+
+Boss.Kill.History.Guild.Group.25 = 20
+
+#
 ###################################################################################################
\ No newline at end of file


上面是C++代码文件

下面是SQL文件代码


DELETE FROM `trinity_string` WHERE `entry` IN (12010, 12011);
INSERT INTO `trinity_string` (`entry`, `content_default`, `content_loc8`) VALUES
(12010, |cFF00FFFF%s - %s (Normal, %u peoples) defeated by guild \"%s\", in %u person(s)|r, |cFF00FFFF%s - %s (Обычный режим на %u человек) повержен гильдией \"%s\", составом в %u человек.|r),
(12011, |cFF00FFFF%s - %s (Heroic, %u peoples) defeated by guild \"%s\", in %u person(s)|r, |cFF00FFFF%s - %s (Героический режим на %u человек) повержен гильдией \"%s\", составом в %u человек(а)|r);
bubuko.com,布布扣

 

T端带配置文件的魔兽世界BOSS被杀世界公告,布布扣,bubuko.com

T端带配置文件的魔兽世界BOSS被杀世界公告

标签:des   style   c   class   blog   code   

原文地址:http://www.cnblogs.com/needly/p/3752626.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!