diff options
Diffstat (limited to 'src/server/game/Events/GameEventMgr.cpp')
-rwxr-xr-x | src/server/game/Events/GameEventMgr.cpp | 90 |
1 files changed, 45 insertions, 45 deletions
diff --git a/src/server/game/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp index d4d6bccfe67..004dd9d5e2d 100755 --- a/src/server/game/Events/GameEventMgr.cpp +++ b/src/server/game/Events/GameEventMgr.cpp @@ -203,7 +203,7 @@ void GameEventMgr::LoadFromDB() { uint32 oldMSTime = getMSTime(); - QueryResult result = WorldDatabase.Query("SELECT eventEntry,UNIX_TIMESTAMP(start_time),UNIX_TIMESTAMP(end_time),occurence,length,holiday,description,world_event FROM game_event"); + QueryResult result = WorldDatabase.Query("SELECT eventEntry, UNIX_TIMESTAMP(start_time), UNIX_TIMESTAMP(end_time), occurence, length, holiday, description, world_event FROM game_event"); if (!result) { mGameEvent.clear(); @@ -238,7 +238,7 @@ void GameEventMgr::LoadFromDB() if (pGameEvent.length == 0 && pGameEvent.state == GAMEEVENT_NORMAL) // length>0 is validity check { - sLog->outErrorDb("`game_event` game event id (%i) isn't a world event and has length = 0, thus it can't be used.",event_id); + sLog->outErrorDb("`game_event` game event id (%i) isn't a world event and has length = 0, thus it can't be used.", event_id); continue; } @@ -246,7 +246,7 @@ void GameEventMgr::LoadFromDB() { if (!sHolidaysStore.LookupEntry(pGameEvent.holiday_id)) { - sLog->outErrorDb("`game_event` game event id (%i) have not existed holiday id %u.",event_id,pGameEvent.holiday_id); + sLog->outErrorDb("`game_event` game event id (%i) have not existed holiday id %u.", event_id, pGameEvent.holiday_id); pGameEvent.holiday_id = HOLIDAY_NONE; } } @@ -385,7 +385,7 @@ void GameEventMgr::LoadFromDB() if (internal_event_id < 0 || internal_event_id >= int32(mGameEventCreatureGuids.size())) { - sLog->outErrorDb("`game_event_creature` game event id (%i) is out of range compared to max event id in `game_event`",event_id); + sLog->outErrorDb("`game_event_creature` game event id (%i) is out of range compared to max event id in `game_event`", event_id); continue; } @@ -428,7 +428,7 @@ void GameEventMgr::LoadFromDB() if (internal_event_id < 0 || internal_event_id >= int32(mGameEventGameobjectGuids.size())) { - sLog->outErrorDb("`game_event_gameobject` game event id (%i) is out of range compared to max event id in `game_event`",event_id); + sLog->outErrorDb("`game_event_gameobject` game event id (%i) is out of range compared to max event id in `game_event`", event_id); continue; } @@ -469,7 +469,7 @@ void GameEventMgr::LoadFromDB() if (event_id >= mGameEventModelEquip.size()) { - sLog->outErrorDb("`game_event_model_equip` game event id (%u) is out of range compared to max event id in `game_event`",event_id); + sLog->outErrorDb("`game_event_model_equip` game event id (%u) is out of range compared to max event id in `game_event`", event_id); continue; } @@ -526,7 +526,7 @@ void GameEventMgr::LoadFromDB() if (event_id >= mGameEventCreatureQuests.size()) { - sLog->outErrorDb("`game_event_creature_quest` game event id (%u) is out of range compared to max event id in `game_event`",event_id); + sLog->outErrorDb("`game_event_creature_quest` game event id (%u) is out of range compared to max event id in `game_event`", event_id); continue; } @@ -567,7 +567,7 @@ void GameEventMgr::LoadFromDB() if (event_id >= mGameEventGameObjectQuests.size()) { - sLog->outErrorDb("`game_event_gameobject_quest` game event id (%u) is out of range compared to max event id in `game_event`",event_id); + sLog->outErrorDb("`game_event_gameobject_quest` game event id (%u) is out of range compared to max event id in `game_event`", event_id); continue; } @@ -609,7 +609,7 @@ void GameEventMgr::LoadFromDB() if (event_id >= mGameEvent.size()) { - sLog->outErrorDb("`game_event_quest_condition` game event id (%u) is out of range compared to max event id in `game_event`",event_id); + sLog->outErrorDb("`game_event_quest_condition` game event id (%u) is out of range compared to max event id in `game_event`", event_id); continue; } @@ -650,7 +650,7 @@ void GameEventMgr::LoadFromDB() if (event_id >= mGameEvent.size()) { - sLog->outErrorDb("`game_event_condition` game event id (%u) is out of range compared to max event id in `game_event`",event_id); + sLog->outErrorDb("`game_event_condition` game event id (%u) is out of range compared to max event id in `game_event`", event_id); continue; } @@ -692,7 +692,7 @@ void GameEventMgr::LoadFromDB() if (event_id >= mGameEvent.size()) { - sLog->outErrorDb("`game_event_condition_save` game event id (%u) is out of range compared to max event id in `game_event`",event_id); + sLog->outErrorDb("`game_event_condition_save` game event id (%u) is out of range compared to max event id in `game_event`", event_id); continue; } @@ -703,7 +703,7 @@ void GameEventMgr::LoadFromDB() } else { - sLog->outErrorDb("game_event_condition_save contains not present condition evt id %u cond id %u",event_id, condition); + sLog->outErrorDb("game_event_condition_save contains not present condition evt id %u cond id %u", event_id, condition); continue; } @@ -741,11 +741,11 @@ void GameEventMgr::LoadFromDB() if (event_id >= mGameEvent.size()) { - sLog->outErrorDb("`game_event_npcflag` game event id (%u) is out of range compared to max event id in `game_event`",event_id); + sLog->outErrorDb("`game_event_npcflag` game event id (%u) is out of range compared to max event id in `game_event`", event_id); continue; } - mGameEventNPCFlags[event_id].push_back(GuidNPCFlagPair(guid,npcflag)); + mGameEventNPCFlags[event_id].push_back(GuidNPCFlagPair(guid, npcflag)); ++count; } @@ -779,7 +779,7 @@ void GameEventMgr::LoadFromDB() if (event_id >= mGameEventVendors.size()) { - sLog->outErrorDb("`game_event_npc_vendor` game event id (%u) is out of range compared to max event id in `game_event`",event_id); + sLog->outErrorDb("`game_event_npc_vendor` game event id (%u) is out of range compared to max event id in `game_event`", event_id); continue; } @@ -845,7 +845,7 @@ void GameEventMgr::LoadFromDB() if (event_id >= mGameEvent.size()) { - sLog->outErrorDb("`game_event_battleground_holiday` game event id (%u) is out of range compared to max event id in `game_event`",event_id); + sLog->outErrorDb("`game_event_battleground_holiday` game event id (%u) is out of range compared to max event id in `game_event`", event_id); continue; } @@ -887,7 +887,7 @@ void GameEventMgr::LoadFromDB() if (internal_event_id < 0 || internal_event_id >= int32(mGameEventPoolIds.size())) { - sLog->outErrorDb("`game_event_pool` game event id (%i) is out of range compared to max event id in `game_event`",event_id); + sLog->outErrorDb("`game_event_pool` game event id (%i) is out of range compared to max event id in `game_event`", event_id); continue; } @@ -962,11 +962,11 @@ uint32 GameEventMgr::StartSystem() // return the next void GameEventMgr::StartArenaSeason() { - QueryResult result = WorldDatabase.PQuery("SELECT eventEntry FROM game_event_arena_seasons WHERE season = '%i'",sWorld->getIntConfig(CONFIG_ARENA_SEASON_ID)); + QueryResult result = WorldDatabase.PQuery("SELECT eventEntry FROM game_event_arena_seasons WHERE season = '%i'", sWorld->getIntConfig(CONFIG_ARENA_SEASON_ID)); if (!result) { - sLog->outError("ArenaSeason (%i) must be an existant Arena Season",sWorld->getIntConfig(CONFIG_ARENA_SEASON_ID)); + sLog->outError("ArenaSeason (%i) must be an existant Arena Season", sWorld->getIntConfig(CONFIG_ARENA_SEASON_ID)); return; } @@ -974,8 +974,8 @@ void GameEventMgr::StartArenaSeason() uint16 eventId = fields[0].GetUInt16(); - StartEvent(eventId,true); - sLog->outString("Arena Season %i started...",sWorld->getIntConfig(CONFIG_ARENA_SEASON_ID)); + StartEvent(eventId, true); + sLog->outString("Arena Season %i started...", sWorld->getIntConfig(CONFIG_ARENA_SEASON_ID)); sLog->outString(); } @@ -989,7 +989,7 @@ uint32 GameEventMgr::Update() // return the next e { // must do the activating first, and after that the deactivating // so first queue it - //sLog->outErrorDb("Checking event %u",itr); + //sLog->outErrorDb("Checking event %u", itr); if (CheckOneGameEvent(itr)) { // if the world event is in NEXTPHASE state, and the time has passed to finish this event, then do so @@ -1010,14 +1010,14 @@ uint32 GameEventMgr::Update() // return the next e // changed, save to DB the gameevent state, will be updated in next update cycle SaveWorldEventStateToDB(itr); - //sLog->outDebug("GameEvent %u is active",itr->first); + //sLog->outDebug("GameEvent %u is active", itr->first); // queue for activation if (!IsActiveEvent(itr)) activate.insert(itr); } else { - //sLog->outDebug("GameEvent %u is not active",itr->first); + //sLog->outDebug("GameEvent %u is not active", itr->first); if (IsActiveEvent(itr)) deactivate.insert(itr); else @@ -1109,14 +1109,14 @@ void GameEventMgr::UpdateEventNPCFlags(uint16 event_id) // get the creature data from the low guid to get the entry, to be able to find out the whole guid if (CreatureData const* data = sObjectMgr->GetCreatureData(itr->first)) { - Creature * cr = HashMapHolder<Creature>::Find(MAKE_NEW_GUID(itr->first,data->id,HIGHGUID_UNIT)); + Creature * cr = HashMapHolder<Creature>::Find(MAKE_NEW_GUID(itr->first, data->id, HIGHGUID_UNIT)); // if we found the creature, modify its npcflag if (cr) { uint32 npcflag = GetNPCFlag(cr); if (const CreatureTemplate * ci = cr->GetCreatureInfo()) npcflag |= ci->npcflag; - cr->SetUInt32Value(UNIT_NPC_FLAGS,npcflag); + cr->SetUInt32Value(UNIT_NPC_FLAGS, npcflag); // reset gossip options, since the flag change might have added / removed some //cr->ResetGossipOptions(); } @@ -1168,7 +1168,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id) if (!map->Instanceable() && map->IsLoaded(data->posX, data->posY)) { Creature* pCreature = new Creature; - //sLog->outDebug("Spawning creature %u",*itr); + //sLog->outDebug("Spawning creature %u", *itr); if (!pCreature->LoadFromDB(*itr, map)) delete pCreature; else @@ -1234,7 +1234,7 @@ void GameEventMgr::GameEventUnspawn(int16 event_id) for (GuidList::iterator itr = mGameEventCreatureGuids[internal_event_id].begin(); itr != mGameEventCreatureGuids[internal_event_id].end(); ++itr) { // check if it's needed by another event, if so, don't remove - if (event_id > 0 && hasCreatureActiveEventExcept(*itr,event_id)) + if (event_id > 0 && hasCreatureActiveEventExcept(*itr, event_id)) continue; // Remove the creature from grid if (CreatureData const* data = sObjectMgr->GetCreatureData(*itr)) @@ -1256,7 +1256,7 @@ void GameEventMgr::GameEventUnspawn(int16 event_id) for (GuidList::iterator itr = mGameEventGameobjectGuids[internal_event_id].begin(); itr != mGameEventGameobjectGuids[internal_event_id].end(); ++itr) { // check if it's needed by another event, if so, don't remove - if (event_id >0 && hasGameObjectActiveEventExcept(*itr,event_id)) + if (event_id >0 && hasGameObjectActiveEventExcept(*itr, event_id)) continue; // Remove the gameobject from grid if (GameObjectData const* data = sObjectMgr->GetGOData(*itr)) @@ -1269,7 +1269,7 @@ void GameEventMgr::GameEventUnspawn(int16 event_id) } if (internal_event_id < 0 || internal_event_id >= int32(mGameEventPoolIds.size())) { - sLog->outError("GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventPoolIds element %u (size: " SIZEFMTD ")",internal_event_id,mGameEventPoolIds.size()); + sLog->outError("GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventPoolIds element %u (size: " SIZEFMTD ")", internal_event_id, mGameEventPoolIds.size()); return; } @@ -1289,7 +1289,7 @@ void GameEventMgr::ChangeEquipOrModel(int16 event_id, bool activate) continue; // Update if spawned - Creature* pCreature = ObjectAccessor::GetObjectInWorld(MAKE_NEW_GUID(itr->first, data->id,HIGHGUID_UNIT), (Creature*)NULL); + Creature* pCreature = ObjectAccessor::GetObjectInWorld(MAKE_NEW_GUID(itr->first, data->id, HIGHGUID_UNIT), (Creature*)NULL); if (pCreature) { if (activate) @@ -1304,8 +1304,8 @@ void GameEventMgr::ChangeEquipOrModel(int16 event_id, bool activate) { pCreature->SetDisplayId(itr->second.modelid); pCreature->SetNativeDisplayId(itr->second.modelid); - pCreature->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS,minfo->bounding_radius); - pCreature->SetFloatValue(UNIT_FIELD_COMBATREACH,minfo->combat_reach); + pCreature->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, minfo->bounding_radius); + pCreature->SetFloatValue(UNIT_FIELD_COMBATREACH, minfo->combat_reach); } } } @@ -1319,8 +1319,8 @@ void GameEventMgr::ChangeEquipOrModel(int16 event_id, bool activate) { pCreature->SetDisplayId(itr->second.modelid_prev); pCreature->SetNativeDisplayId(itr->second.modelid_prev); - pCreature->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS,minfo->bounding_radius); - pCreature->SetFloatValue(UNIT_FIELD_COMBATREACH,minfo->combat_reach); + pCreature->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, minfo->bounding_radius); + pCreature->SetFloatValue(UNIT_FIELD_COMBATREACH, minfo->combat_reach); } } } @@ -1331,7 +1331,7 @@ void GameEventMgr::ChangeEquipOrModel(int16 event_id, bool activate) if (data2 && activate) { CreatureTemplate const *cinfo = sObjectMgr->GetCreatureTemplate(data2->id); - uint32 displayID = sObjectMgr->ChooseDisplayId(0,cinfo,data2); + uint32 displayID = sObjectMgr->ChooseDisplayId(0, cinfo, data2); CreatureModelInfo const *minfo = sObjectMgr->GetCreatureModelRandomGender(displayID); if (data2->equipmentId == 0) @@ -1423,13 +1423,13 @@ void GameEventMgr::UpdateEventQuests(uint16 event_id, bool activate) for (itr = mGameEventCreatureQuests[event_id].begin(); itr != mGameEventCreatureQuests[event_id].end(); ++itr) { QuestRelations* CreatureQuestMap = sObjectMgr->GetCreatureQuestRelationMap(); - if (activate) // Add the pair(id,quest) to the multimap + if (activate) // Add the pair(id, quest) to the multimap CreatureQuestMap->insert(QuestRelations::value_type(itr->first, itr->second)); else { - if (!hasCreatureQuestActiveEventExcept(itr->second,event_id)) + if (!hasCreatureQuestActiveEventExcept(itr->second, event_id)) { - // Remove the pair(id,quest) from the multimap + // Remove the pair(id, quest) from the multimap QuestRelations::iterator qitr = CreatureQuestMap->find(itr->first); if (qitr == CreatureQuestMap->end()) continue; @@ -1448,13 +1448,13 @@ void GameEventMgr::UpdateEventQuests(uint16 event_id, bool activate) for (itr = mGameEventGameObjectQuests[event_id].begin(); itr != mGameEventGameObjectQuests[event_id].end(); ++itr) { QuestRelations* GameObjectQuestMap = sObjectMgr->GetGOQuestRelationMap(); - if (activate) // Add the pair(id,quest) to the multimap + if (activate) // Add the pair(id, quest) to the multimap GameObjectQuestMap->insert(QuestRelations::value_type(itr->first, itr->second)); else { - if (!hasGameObjectQuestActiveEventExcept(itr->second,event_id)) + if (!hasGameObjectQuestActiveEventExcept(itr->second, event_id)) { - // Remove the pair(id,quest) from the multimap + // Remove the pair(id, quest) from the multimap QuestRelations::iterator qitr = GameObjectQuestMap->find(itr->first); if (qitr == GameObjectQuestMap->end()) continue; @@ -1512,7 +1512,7 @@ void GameEventMgr::HandleQuestComplete(uint32 quest_id) // not in correct phase, return if (mGameEvent[event_id].state != GAMEEVENT_WORLD_CONDITIONS) return; - std::map<uint32,GameEventFinishCondition>::iterator citr = mGameEvent[event_id].conditions.find(condition); + std::map<uint32, GameEventFinishCondition>::iterator citr = mGameEvent[event_id].conditions.find(condition); // condition is registered if (citr != mGameEvent[event_id].conditions.end()) { @@ -1552,7 +1552,7 @@ void GameEventMgr::HandleQuestComplete(uint32 quest_id) bool GameEventMgr::CheckOneGameEventConditions(uint16 event_id) { - for (std::map<uint32,GameEventFinishCondition>::iterator itr = mGameEvent[event_id].conditions.begin(); itr != mGameEvent[event_id].conditions.end(); ++itr) + for (std::map<uint32, GameEventFinishCondition>::iterator itr = mGameEvent[event_id].conditions.begin(); itr != mGameEvent[event_id].conditions.end(); ++itr) if (itr->second.done < itr->second.reqNum) // return false if a condition doesn't match return false; @@ -1585,7 +1585,7 @@ void GameEventMgr::SaveWorldEventStateToDB(uint16 event_id) void GameEventMgr::SendWorldStateUpdate(Player * plr, uint16 event_id) { - std::map<uint32,GameEventFinishCondition>::iterator itr; + std::map<uint32, GameEventFinishCondition>::iterator itr; for (itr = mGameEvent[event_id].conditions.begin(); itr !=mGameEvent[event_id].conditions.end(); ++itr) { if (itr->second.done_world_state) |