Index: Chat.cpp===================================================================
--- Chat.cpp (revision 353)
+++ Chat.cpp (working copy)
@@ -459,6 +459,7 @@
{ "spell_threats", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellThreatsCommand, "", NULL },
{ "spell_disabled", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellDisabledCommand, "", NULL }, //禁止某个技能,数据库重载
{ "player_loot_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadPlayerLootTemplateCommand, "", NULL }, //重载玩家掉率
+ { "creature_addtemp", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadCreatureAddtempCommand, "", NULL }, //重载灾变系统
{ NULL, 0, false, NULL, "", NULL }
};
@@ -644,6 +645,7 @@
{ "trade", SEC_MODERATOR, false, &ChatHandler::HandleTradeCommand, "", NULL }, //普通玩家积分交易系统
{ "sj", SEC_PLAYER, false, &ChatHandler::HandleWorldCast, "", NULL }, //世界聊天命令
{ "kan", SEC_PLAYER, false, &ChatHandler::HandleWorldKan, "", NULL }, //装备查看命令
+ { "addtemp", SEC_GAMEMASTER, false, &ChatHandler::HandleTempAddSpwCommand, "", NULL },//灾变系统
{ "damage", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDamageCommand, "", NULL },
{ "combatstop", SEC_GAMEMASTER, false, &ChatHandler::HandleCombatStopCommand, "", NULL },
{ "flusharenapoints",SEC_ADMINISTRATOR, false, &ChatHandler::HandleFlushArenaPointsCommand, "", NULL },
Index: Chat.h
===================================================================
--- Chat.h (revision 353)
+++ Chat.h (working copy)
@@ -259,6 +259,7 @@
bool HandleTradeCommand(const char* args); //普通玩家积分交易系统
bool HandleWorldCast(const char* args); //世界聊天命令
bool HandleWorldKan(const char* args); //查看装备命令
+ bool HandleTempAddSpwCommand(const char* args);//灾变系统
bool HandleModifyRepCommand(const char* args);
bool HandleModifyArenaCommand(const char* args);
bool HandleModifyPhaseCommand(const char* args);
@@ -388,6 +389,7 @@
bool HandleReloadSpellPetAurasCommand(const char* args);
bool HandleReloadSpellDisabledCommand(const char* args); //禁止某个技能数据库从载
bool HandleReloadPlayerLootTemplateCommand(const char* args); //重载玩家掉率
+ bool HandleReloadCreatureAddtempCommand(const char* args); //重载灾变秒年2 2系统
bool HandleResetAchievementsCommand(const char * args);
bool HandleResetAllCommand(const char * args);
Index: Level3.cpp
===================================================================
--- Level3.cpp (revision 353)
+++ Level3.cpp (working copy)
@@ -165,6 +165,7 @@
HandleReloadSpellPetAurasCommand("a");
HandleReloadSpellDisabledCommand("a"); //禁止某个技能数据库重载
HandleReloadPlayerLootTemplateCommand("a"); //重载玩家掉率
+ HandleReloadCreatureAddtempCommand("a"); //重载灾变系统
return true;
}
@@ -773,6 +774,17 @@
return true;
}
+bool ChatHandler::HandleReloadCreatureAddtempCommand(const char* /*arg*/) //重载玩家掉率
+{
+ sLog.outString( "Re-Loading Creature Addtemp table...");
+
+ objmgr.LoadCreatureAddtemp();
+
+ SendGlobalSysMessage("DB table `creature_addtemp` reloaded.");
+
+ return true;
+}
+
bool ChatHandler::HandleReloadLocalesAchievementRewardCommand(const char*)
{
sLog.outString( "Re-Loading Locales Achievement Reward Data..." );
@@ -5930,6 +5942,35 @@
return true;
}//装备查看命令(试衣间)
+bool ChatHandler::HandleTempAddSpwCommand(const char* args)//灾变系统
+{
+ Player *chr = m_session->GetPlayer();
+ ObjectMgr::CreatureAddtempMap const& cAddtemp = objmgr.GetCreatureAddtemp();
+
+ for (ObjectMgr::CreatureAddtempMap::const_iterator itr = cAddtemp.begin(); itr != cAddtemp.end(); ++itr)
+ {
+ uint32 id = itr->second.id;
+ float x = itr->second.posX;
+ float y = itr->second.posY;
+ float z = itr->second.posZ;
+ float ang = itr->second.orientation;
+ uint32 spawntimesecs = itr->second.spawntimesecs;
+ chr->SummonCreature(id,x,y,z,ang,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,spawntimesecs);
+ }
+
+ //float x = chr->GetPositionX();
+ //float y = chr->GetPositionY();
+ //float z = chr->GetPositionZ();
+ //float ang = chr->GetOrientation();
+
+ //uint32 id = atoi(charID);
+
+ //chr->SummonCreature(id,x,y,z,ang,TEMPSUMMON_CORPSE_DESPAWN,5000);
+ PSendSysMessage("The Calamity Event Happend");
+
+ return true;
+}
+
bool ChatHandler::HandleCastDistCommand(const char* args)
{
if(!*args)
Index: ObjectMgr.cpp
===================================================================
--- ObjectMgr.cpp (revision 353)
+++ ObjectMgr.cpp (working copy)
@@ -7049,6 +7049,65 @@
sLog.outString( ">> Loaded %u player loot template from `player_loot_template`", total_count);
}//重载玩家掉率
+void ObjectMgr::LoadCreatureAddtemp() //灾变系统
+{
+ m_Creature_Addtemp.clear();
+ QueryResult *result = WorldDatabase.Query("SELECT guid, id, map, position_x, position_y, position_z, orientation, spawntimesecs FROM creature_addtemp");
+
+ uint32 total_count = 0;
+
+ if( !result )
+ {
+ barGoLink bar( 1 );
+ bar.step();
+
+ sLog.outString();
+ sLog.outString( ">> Loaded %u creature addtemp", total_count );
+ return;
+ }
+
+ barGoLink bar( result->GetRowCount() );
+
+ Field* fields;
+ do
+ {
+ CreatureAddtemp temp; //定义内存
+ bar.step();
+ fields = result->Fetch();
+ uint32 guid = fields[0].GetUInt32();
+ uint32 entry = fields[1].GetUInt32();
+ CreatureInfo const* cInfo = GetCreatureTemplate(entry);
+ if(!cInfo)
+ {
+ sLog.outErrorDb("Table `creature_addtemp` has creature (GUID: %u) with non existing creature entry(Creature_template) %u, skipped.", guid, entry);
+ continue;
+ }
+ temp.id = entry;
+ temp.mapid = fields[2].GetUInt32();
+ temp.posX = fields[3].GetFloat();
+ temp.posY = fields[4].GetFloat();
+ temp.posZ = fields[5].GetFloat();
+ temp.orientation = fields[6].GetFloat();
+ temp.spawntimesecs = fields[7].GetUInt32();
+
+ if(cInfo->flags_extra & CREATURE_FLAG_EXTRA_INSTANCE_BIND)
+ {
+ MapEntry const* map = sMapStore.LookupEntry(temp.mapid);
+ if(!map || !map->IsDungeon())
+ sLog.outErrorDb("Table `creature` have creature (GUID: %u Entry: %u) with `creature_template`.`flags_extra` including CREATURE_FLAG_EXTRA_INSTANCE_BIND but creature are not in instance.",guid,temp.id);
+ }
+
+ m_Creature_Addtemp[guid] = temp; //把值放到内存
+
+ ++total_count;
+ } while ( result->NextRow() );
+
+ delete result;
+
+ sLog.outString();
+ sLog.outString( ">> Loaded %u creature addtemp from `creature_addtemp`", total_count);
+}//重载灾变系统
+
void ObjectMgr::LoadFishingBaseSkillLevel()
{
mFishingBaseForArea.clear(); // for reload case
Index: ObjectMgr.h
===================================================================
--- ObjectMgr.h (revision 353)
+++ ObjectMgr.h (working copy)
@@ -81,6 +81,18 @@
uint32 chance;
};
+struct CreatureAddtemp //灾变系统
+{
+ uint32 guid;
+ uint32 id;
+ uint32 mapid;
+ float posX;
+ float posY;
+ float posZ;
+ float orientation;
+ uint32 spawntimesecs;
+};
+
struct ScriptInfo
{
uint32 id;
@@ -324,8 +336,10 @@
typedef UNORDERED_MAP<uint32, Quest*> QuestMap;
typedef UNORDERED_MAP<uint32, AreaTrigger> AreaTriggerMap;
+
+ typedef UNORDERED_MAP<uint32, CreatureAddtemp> CreatureAddtempMap;//灾变系统
typedef UNORDERED_MAP<uint32, uint32> AreaTriggerScriptMap;
typedef UNORDERED_MAP<uint32, ReputationOnKillEntry> RepOnKillMap;
@@ -422,6 +436,16 @@
}
QuestMap const& GetQuestTemplates() const { return mQuestTemplates; }
+ CreatureAddtemp const* GetCreatureAddtemp(uint32 id) const //灾变系统
+ {
+ CreatureAddtempMap::const_iterator itr = m_Creature_Addtemp.find(id);
+ //return itr != m_Creature_Addtemp.end() ? itr->second : NULL;
+ if( itr != m_Creature_Addtemp.end( ) )
+ return &itr->second;
+ return NULL;
+ }
+ CreatureAddtempMap const& GetCreatureAddtemp() const { return m_Creature_Addtemp; }
+
uint32 GetQuestForAreaTrigger(uint32 Trigger_ID) const
{
QuestAreaTriggerMap::const_iterator itr = mQuestAreaTriggerMap.find(Trigger_ID);
@@ -751,6 +775,8 @@
return result;
}
+ void LoadCreatureAddtemp(); //重载灾变系统
+
int GetIndexForLocale(LocaleConstant loc);
LocaleConstant GetLocaleForIndex(int i);
@@ -881,6 +907,8 @@
typedef UNORDERED_MAP<uint32, PlayerLootTemplate> PlayerLootTemplateMap;//玩家掉率系统的内存地图定义
PlayerLootTemplateMap m_Player_Loot_Template;
+
+ CreatureAddtempMap m_Creature_Addtemp;//灾变系统
GraveYardMap mGraveYardMap;
Index: World.cpp
===================================================================
--- World.cpp (revision 353)
+++ World.cpp (working copy)
@@ -1304,6 +1304,9 @@
sLog.outString( "Loading Player Loot Template..." );//玩家掉落系统
objmgr.LoadPlayerLootTemplate();
+ sLog.outString( "Loading Creature Addtemp..." );//灾变系统
+ objmgr.LoadCreatureAddtemp();
+
sLog.outString( "Loading Loot Tables..." );
sLog.outString();
LoadLootTables();
|