diff options
Diffstat (limited to 'src')
30 files changed, 159 insertions, 305 deletions
diff --git a/src/server/game/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp index 259e51eb471..161aefdfc67 100644 --- a/src/server/game/Chat/Chat.cpp +++ b/src/server/game/Chat/Chat.cpp @@ -308,7 +308,7 @@ bool ChatHandler::ExecuteCommandInTable(std::vector<ChatCommand> const& table, c fullcmd.c_str(), player->GetName().c_str(), player->GetGUID().ToString().c_str(), m_session->GetAccountId(), player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), - player->GetMap() ? player->GetMap()->GetMapName() : "Unknown", + player->FindMap() ? player->FindMap()->GetMapName() : "Unknown", areaId, areaName.c_str(), zoneName.c_str(), (player->GetSelectedUnit()) ? player->GetSelectedUnit()->GetName().c_str() : "", guid.ToString().c_str()); diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index f7260326857..b19b0068be6 100644 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -231,7 +231,7 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) case CONDITION_INSTANCE_INFO: { Map* map = object->GetMap(); - if (map && map->IsDungeon()) + if (map->IsDungeon()) { if (InstanceScript const* instance = ((InstanceMap*)map)->GetInstanceScript()) { diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 232f7cb58df..e9f9fdace3b 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -6920,7 +6920,7 @@ void Player::RewardReputation(Unit* victim, float rate) { // support for: Championing - http://www.wowwiki.com/Championing Map const* map = GetMap(); - if (map && map->IsNonRaidDungeon()) + if (map->IsNonRaidDungeon()) if (LFGDungeonEntry const* dungeon = GetLFGDungeon(map->GetId(), map->GetDifficulty())) if (dungeon->reclevel == 80) ChampioningFaction = GetChampioningFaction(); @@ -20264,7 +20264,7 @@ void Player::ResetInstances(uint8 method, bool isRaid) // if the map is loaded, reset it Map* map = sMapMgr->FindMap(p->GetMapId(), p->GetInstanceId()); if (map && map->IsDungeon()) - if (!((InstanceMap*)map)->Reset(method)) + if (!map->ToInstanceMap()->Reset(method)) { ++itr; continue; diff --git a/src/server/game/Miscellaneous/Formulas.h b/src/server/game/Miscellaneous/Formulas.h index aa9a738b5dc..6edc3d74a5d 100644 --- a/src/server/game/Miscellaneous/Formulas.h +++ b/src/server/game/Miscellaneous/Formulas.h @@ -175,7 +175,7 @@ namespace Trinity if (creature->isElite()) { // Elites in instances have a 2.75x XP bonus instead of the regular 2x world bonus. - if (u->GetMap() && u->GetMap()->IsDungeon()) + if (u->GetMap()->IsDungeon()) xpMod *= 2.75f; else xpMod *= 2.0f; diff --git a/src/server/scripts/Commands/cs_instance.cpp b/src/server/scripts/Commands/cs_instance.cpp index e51b7bcc594..5651aaa12ee 100644 --- a/src/server/scripts/Commands/cs_instance.cpp +++ b/src/server/scripts/Commands/cs_instance.cpp @@ -168,22 +168,22 @@ public: static bool HandleInstanceSaveDataCommand(ChatHandler* handler, char const* /*args*/) { Player* player = handler->GetSession()->GetPlayer(); - Map* map = player->GetMap(); - if (!map->IsDungeon()) + InstanceMap* map = player->GetMap()->ToInstanceMap(); + if (!map) { handler->PSendSysMessage(LANG_NOT_DUNGEON); handler->SetSentErrorMessage(true); return false; } - if (!((InstanceMap*)map)->GetInstanceScript()) + if (!map->GetInstanceScript()) { handler->PSendSysMessage(LANG_NO_INSTANCE_DATA); handler->SetSentErrorMessage(true); return false; } - ((InstanceMap*)map)->GetInstanceScript()->SaveToDB(); + map->GetInstanceScript()->SaveToDB(); return true; } @@ -225,15 +225,15 @@ public: return false; } - Map* map = player->GetMap(); - if (!map->IsDungeon()) + InstanceMap* map = player->GetMap()->ToInstanceMap(); + if (!map) { handler->PSendSysMessage(LANG_NOT_DUNGEON); handler->SetSentErrorMessage(true); return false; } - if (!map->ToInstanceMap()->GetInstanceScript()) + if (!map->GetInstanceScript()) { handler->PSendSysMessage(LANG_NO_INSTANCE_DATA); handler->SetSentErrorMessage(true); @@ -244,14 +244,14 @@ public: state = atoi(param2); // Reject improper values. - if (state > TO_BE_DECIDED || encounterId > map->ToInstanceMap()->GetInstanceScript()->GetEncounterCount()) + if (state > TO_BE_DECIDED || encounterId > map->GetInstanceScript()->GetEncounterCount()) { handler->PSendSysMessage(LANG_BAD_VALUE); handler->SetSentErrorMessage(true); return false; } - map->ToInstanceMap()->GetInstanceScript()->SetBossState(encounterId, (EncounterState)state); + map->GetInstanceScript()->SetBossState(encounterId, EncounterState(state)); std::string stateName = InstanceScript::GetBossStateName(state); handler->PSendSysMessage(LANG_COMMAND_INST_SET_BOSS_STATE, encounterId, state, stateName); return true; @@ -292,15 +292,15 @@ public: return false; } - Map* map = player->GetMap(); - if (!map->IsDungeon()) + InstanceMap* map = player->GetMap()->ToInstanceMap(); + if (!map) { handler->PSendSysMessage(LANG_NOT_DUNGEON); handler->SetSentErrorMessage(true); return false; } - if (!map->ToInstanceMap()->GetInstanceScript()) + if (!map->GetInstanceScript()) { handler->PSendSysMessage(LANG_NO_INSTANCE_DATA); handler->SetSentErrorMessage(true); @@ -309,14 +309,14 @@ public: encounterId = atoi(param1); - if (encounterId > map->ToInstanceMap()->GetInstanceScript()->GetEncounterCount()) + if (encounterId > map->GetInstanceScript()->GetEncounterCount()) { handler->PSendSysMessage(LANG_BAD_VALUE); handler->SetSentErrorMessage(true); return false; } - uint8 state = map->ToInstanceMap()->GetInstanceScript()->GetBossState(encounterId); + uint32 state = map->GetInstanceScript()->GetBossState(encounterId); std::string stateName = InstanceScript::GetBossStateName(state); handler->PSendSysMessage(LANG_COMMAND_INST_GET_BOSS_STATE, encounterId, state, stateName); return true; diff --git a/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp b/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp index 64513fece8b..c1470d3bc47 100644 --- a/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp +++ b/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp @@ -203,10 +203,6 @@ public: void AggroAllPlayers(Creature* temp) { Map::PlayerList const &PlList = me->GetMap()->GetPlayers(); - - if (PlList.isEmpty()) - return; - for (Map::PlayerList::const_iterator i = PlList.begin(); i != PlList.end(); ++i) { if (Player* player = i->GetSource()) diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp index 8965b64767a..0a287173ada 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp @@ -181,23 +181,21 @@ public: // temporary store for the best suitable beam reciever Unit* target = me; - if (Map* map = me->GetMap()) - { - Map::PlayerList const& players = map->GetPlayers(); + Map::PlayerList const& players = me->GetMap()->GetPlayers(); - // get the best suitable target - for (Map::PlayerList::const_iterator i = players.begin(); i != players.end(); ++i) - { - Player* p = i->GetSource(); - if (p && p->IsAlive() // alive - && (!target || target->GetDistance2d(portal)>p->GetDistance2d(portal)) // closer than current best - && !p->HasAura(PlayerDebuff[j]) // not exhausted - && !p->HasAura(PlayerBuff[(j + 1) % 3]) // not on another beam - && !p->HasAura(PlayerBuff[(j + 2) % 3]) - && IsBetween(me, p, portal)) // on the beam - target = p; - } + // get the best suitable target + for (Map::PlayerList::const_iterator i = players.begin(); i != players.end(); ++i) + { + Player* p = i->GetSource(); + if (p && p->IsAlive() // alive + && (!target || target->GetDistance2d(portal)>p->GetDistance2d(portal)) // closer than current best + && !p->HasAura(PlayerDebuff[j]) // not exhausted + && !p->HasAura(PlayerBuff[(j + 1) % 3]) // not on another beam + && !p->HasAura(PlayerBuff[(j + 2) % 3]) + && IsBetween(me, p, portal)) // on the beam + target = p; } + // buff the target if (target->GetTypeId() == TYPEID_PLAYER) target->AddAura(PlayerBuff[j], target); diff --git a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp index 87945ccf916..8aba0a15462 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp @@ -309,11 +309,7 @@ public: { if (WipeTimer <= diff) { - Map* map = me->GetMap(); - if (!map->IsDungeon()) - return; - - Map::PlayerList const &PlayerList = map->GetPlayers(); + Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers(); if (PlayerList.isEmpty()) return; @@ -518,8 +514,6 @@ public: uint32 NextStep(uint32 step) { - Creature* arca = ObjectAccessor::GetCreature(*me, ArcanagosGUID); - Map* map = me->GetMap(); switch (step) { case 0: return 9999999; @@ -527,21 +521,21 @@ public: me->Yell(SAY_DIALOG_MEDIVH_1, LANG_UNIVERSAL); return 10000; case 2: - if (arca) + if (Creature* arca = ObjectAccessor::GetCreature(*me, ArcanagosGUID)) arca->Yell(SAY_DIALOG_ARCANAGOS_2, LANG_UNIVERSAL); return 20000; case 3: me->Yell(SAY_DIALOG_MEDIVH_3, LANG_UNIVERSAL); return 10000; case 4: - if (arca) + if (Creature* arca = ObjectAccessor::GetCreature(*me, ArcanagosGUID)) arca->Yell(SAY_DIALOG_ARCANAGOS_4, LANG_UNIVERSAL); return 20000; case 5: me->Yell(SAY_DIALOG_MEDIVH_5, LANG_UNIVERSAL); return 20000; case 6: - if (arca) + if (Creature* arca = ObjectAccessor::GetCreature(*me, ArcanagosGUID)) arca->Yell(SAY_DIALOG_ARCANAGOS_6, LANG_UNIVERSAL); return 10000; case 7: @@ -555,15 +549,15 @@ public: me->TextEmote(EMOTE_DIALOG_MEDIVH_7); return 10000; case 10: - if (arca) + if (Creature* arca = ObjectAccessor::GetCreature(*me, ArcanagosGUID)) DoCast(arca, SPELL_CONFLAGRATION_BLAST, false); return 1000; case 11: - if (arca) + if (Creature* arca = ObjectAccessor::GetCreature(*me, ArcanagosGUID)) arca->Yell(SAY_DIALOG_ARCANAGOS_8, LANG_UNIVERSAL); return 5000; case 12: - if (arca) + if (Creature* arca = ObjectAccessor::GetCreature(*me, ArcanagosGUID)) { arca->GetMotionMaster()->MovePoint(0, -11010.82f, -1761.18f, 156.47f); arca->setActive(true); @@ -575,27 +569,27 @@ public: me->Yell(SAY_DIALOG_MEDIVH_9, LANG_UNIVERSAL); return 10000; case 14: + { me->SetVisible(false); me->ClearInCombat(); - if (map->IsDungeon()) + InstanceMap::PlayerList const &PlayerList = me->GetMap()->GetPlayers(); + for (InstanceMap::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) { - InstanceMap::PlayerList const &PlayerList = map->GetPlayers(); - for (InstanceMap::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + if (i->GetSource()->IsAlive()) { - if (i->GetSource()->IsAlive()) - { - if (i->GetSource()->GetQuestStatus(9645) == QUEST_STATUS_INCOMPLETE) - i->GetSource()->CompleteQuest(9645); - } + if (i->GetSource()->GetQuestStatus(9645) == QUEST_STATUS_INCOMPLETE) + i->GetSource()->CompleteQuest(9645); } } return 50000; + } case 15: - if (arca) + if (Creature* arca = ObjectAccessor::GetCreature(*me, ArcanagosGUID)) arca->DealDamage(arca, arca->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); return 5000; - default : return 9999999; + default: + return 9999999; } } diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp index 9b303fce89d..9c904dcada9 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp @@ -145,39 +145,13 @@ public: m_uiTransformTimer = MINUTE*IN_MILLISECONDS; } - // some targeting issues with the spell, so use this workaround as temporary solution - void DoWorkaroundForQuestCredit() - { - Map* map = me->GetMap(); - - if (!map || map->IsHeroic()) - return; - - Map::PlayerList const &lList = map->GetPlayers(); - - if (lList.isEmpty()) - return; - - SpellInfo const* spell = sSpellMgr->GetSpellInfo(SPELL_ORB_KILL_CREDIT); - - for (Map::PlayerList::const_iterator i = lList.begin(); i != lList.end(); ++i) - { - if (Player* player = i->GetSource()) - { - if (spell && spell->Effects[0].MiscValue) - player->KilledMonsterCredit(spell->Effects[0].MiscValue); - } - } - } - void UpdateAI(uint32 uiDiff) override { if (m_uiTransformTimer) { if (m_uiTransformTimer <= uiDiff) { - DoCast(me, SPELL_ORB_KILL_CREDIT, false); - DoWorkaroundForQuestCredit(); + DoCast(me, SPELL_ORB_KILL_CREDIT, true); // Transform and update entry, now ready for quest/read gossip DoCast(me, SPELL_TRANSFORM_TO_KAEL, false); diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp index 3df07562d50..2714d65774f 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp @@ -1293,8 +1293,8 @@ public: //if (GameObject* go = me->GetMap()->GetGameObject(uiDawnofLightGUID)) // Turn off dawn of light // go->SetPhaseMask(0, true); { - Map* map = me->GetMap(); // search players with in 50 yards for quest credit - Map::PlayerList const &PlayerList = map->GetPlayers(); + // search players with in 50 yards for quest credit + Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers(); if (!PlayerList.isEmpty()) { for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp index 14be8c51bc2..a78ad740c97 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp @@ -538,11 +538,7 @@ public: Player* SelectRandomPlayer(float range = 0.0f, bool checkLoS = true) { - Map* map = me->GetMap(); - if (!map->IsDungeon()) - return NULL; - - Map::PlayerList const &PlayerList = map->GetPlayers(); + Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers(); if (PlayerList.isEmpty()) return NULL; diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp index ae327dbb874..d0f8d9eab0f 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp @@ -551,13 +551,9 @@ public: bool OnGossipHello(Player* player, GameObject* go) override { - Map* map = go->GetMap(); - if (!map->IsDungeon()) - return true; - #if MAX_PLAYERS_IN_SPECTRAL_REALM > 0 uint8 SpectralPlayers = 0; - Map::PlayerList const &PlayerList = map->GetPlayers(); + Map::PlayerList const &PlayerList = go->GetMap()->GetPlayers(); for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) { if (i->GetSource() && i->GetSource()->GetPositionZ() < DEMON_REALM_Z + 5) @@ -688,12 +684,8 @@ public: void TeleportAllPlayersBack() { - Map* map = me->GetMap(); - if (!map->IsDungeon()) - return; - - Map::PlayerList const &playerList = map->GetPlayers(); - Position homePos = me->GetHomePosition(); + Map::PlayerList const &playerList = me->GetMap()->GetPlayers(); + Position const& homePos = me->GetHomePosition(); for (Map::PlayerList::const_iterator itr = playerList.begin(); itr != playerList.end(); ++itr) { Player* player = itr->GetSource(); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp index 780cf6646a3..33b8516657a 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp @@ -433,15 +433,11 @@ public: } //kill credit Creature for quest - Map* map = me->GetMap(); - Map::PlayerList const& players = map->GetPlayers(); - if (!players.isEmpty() && map->IsDungeon()) + Map::PlayerList const& players = me->GetMap()->GetPlayers(); + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) { - for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) - { - if (Player* player = itr->GetSource()) - player->KilledMonsterCredit(20156); - } + if (Player* player = itr->GetSource()) + player->KilledMonsterCredit(20156); } //alot will happen here, thrall and taretha talk, erozion appear at spot to explain diff --git a/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp b/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp index d8966ec76c1..b57d1b78de0 100644 --- a/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp +++ b/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp @@ -54,14 +54,10 @@ public: Player* GetPlayerInMap() { Map::PlayerList const& players = instance->GetPlayers(); - - if (!players.isEmpty()) + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) { - for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) - { - if (Player* player = itr->GetSource()) - return player; - } + if (Player* player = itr->GetSource()) + return player; } TC_LOG_DEBUG("scripts", "Instance Razorfen Kraul: GetPlayerInMap, but PlayerList is empty!"); return NULL; diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp index 463d1ee7e0b..8ccc5f0b4ce 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp @@ -143,8 +143,6 @@ class boss_ossirian : public CreatureScript Talk(SAY_AGGRO); Map* map = me->GetMap(); - if (!map->IsDungeon()) - return; WorldPacket data(SMSG_WEATHER, (4+4+4)); data << uint32(WEATHER_STATE_HEAVY_SANDSTORM) << float(1) << uint8(0); @@ -153,7 +151,7 @@ class boss_ossirian : public CreatureScript for (uint8 i = 0; i < NUM_TORNADOS; ++i) { Position Point = me->GetRandomPoint(RoomCenter, RoomRadius); - if (Creature* Tornado = me->GetMap()->SummonCreature(NPC_SAND_VORTEX, Point)) + if (Creature* Tornado = map->SummonCreature(NPC_SAND_VORTEX, Point)) Tornado->CastSpell(Tornado, SPELL_SAND_STORM, true); } diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp index f967bd6a217..8e84f1b4265 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp @@ -586,21 +586,10 @@ public: //WisperTimer if (WisperTimer <= diff) { - Map* map = me->GetMap(); - if (!map->IsDungeon()) - return; - //Play random sound to the zone - Map::PlayerList const &PlayerList = map->GetPlayers(); - - if (!PlayerList.isEmpty()) - { - for (Map::PlayerList::const_iterator itr = PlayerList.begin(); itr != PlayerList.end(); ++itr) - { - if (Player* pPlr = itr->GetSource()) - pPlr->PlayDirectSound(RANDOM_SOUND_WHISPER, pPlr); - } - } + Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers(); + for (Map::PlayerList::const_iterator itr = PlayerList.begin(); itr != PlayerList.end(); ++itr) + me->PlayDirectSound(RANDOM_SOUND_WHISPER, itr->GetSource()); //One random wisper every 90 - 300 seconds WisperTimer = urand(90000, 300000); diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp index cfed13a8f38..d8ebfbbd743 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp @@ -230,11 +230,7 @@ public: // Roll Insanity uint32 spell = GetSpellForPhaseMask(phase); uint32 spell2 = GetSpellForPhaseMask(nextPhase); - Map* map = me->GetMap(); - if (!map) - return; - - Map::PlayerList const &PlayerList = map->GetPlayers(); + Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers(); if (!PlayerList.isEmpty()) { for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp index 7cb2c0e5178..5890b9cbec7 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp @@ -185,7 +185,7 @@ public: who->RemoveAurasByType(SPELL_AURA_MOD_STEALTH); AttackStart(who); } - else if (me->GetMap()->IsDungeon()) + else { who->SetInCombatWith(me); me->AddThreat(who, 0.0f); diff --git a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/obsidian_sanctum.cpp b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/obsidian_sanctum.cpp index b4627d7f941..eac84d1f6c9 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/obsidian_sanctum.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/obsidian_sanctum.cpp @@ -652,23 +652,19 @@ class npc_acolyte_of_shadron : public CreatureScript if (ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SHADRON))) instance->SetBossState(DATA_PORTAL_OPEN, NOT_STARTED); - Map* map = me->GetMap(); - if (map->IsDungeon()) - { - Map::PlayerList const& PlayerList = map->GetPlayers(); + Map::PlayerList const& PlayerList = me->GetMap()->GetPlayers(); - if (PlayerList.isEmpty()) - return; + if (PlayerList.isEmpty()) + return; - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + { + if (i->GetSource()->IsAlive() && i->GetSource()->HasAura(SPELL_TWILIGHT_SHIFT) && !i->GetSource()->GetVictim()) { - if (i->GetSource()->IsAlive() && i->GetSource()->HasAura(SPELL_TWILIGHT_SHIFT) && !i->GetSource()->GetVictim()) - { - i->GetSource()->CastSpell(i->GetSource(), SPELL_TWILIGHT_SHIFT_REMOVAL_ALL, true); - i->GetSource()->CastSpell(i->GetSource(), SPELL_TWILIGHT_RESIDUE, true); - i->GetSource()->RemoveAurasDueToSpell(SPELL_TWILIGHT_SHIFT); - i->GetSource()->RemoveAurasDueToSpell(SPELL_TWILIGHT_SHIFT_ENTER); - } + i->GetSource()->CastSpell(i->GetSource(), SPELL_TWILIGHT_SHIFT_REMOVAL_ALL, true); + i->GetSource()->CastSpell(i->GetSource(), SPELL_TWILIGHT_RESIDUE, true); + i->GetSource()->RemoveAurasDueToSpell(SPELL_TWILIGHT_SHIFT); + i->GetSource()->RemoveAurasDueToSpell(SPELL_TWILIGHT_SHIFT_ENTER); } } @@ -740,26 +736,22 @@ class npc_acolyte_of_vesperon : public CreatureScript vesperon->RemoveAurasDueToSpell(SPELL_TWILIGHT_TORMENT_VESP); } - Map* map = me->GetMap(); - if (map->IsDungeon()) - { - Map::PlayerList const &PlayerList = map->GetPlayers(); + Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers(); - if (PlayerList.isEmpty()) - return; + if (PlayerList.isEmpty()) + return; - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + { + if (i->GetSource()->IsAlive() && i->GetSource()->HasAura(SPELL_TWILIGHT_SHIFT) && !i->GetSource()->GetVictim()) { - if (i->GetSource()->IsAlive() && i->GetSource()->HasAura(SPELL_TWILIGHT_SHIFT) && !i->GetSource()->GetVictim()) - { - i->GetSource()->CastSpell(i->GetSource(), SPELL_TWILIGHT_SHIFT_REMOVAL_ALL, true); - i->GetSource()->CastSpell(i->GetSource(), SPELL_TWILIGHT_RESIDUE, true); - i->GetSource()->RemoveAurasDueToSpell(SPELL_TWILIGHT_SHIFT); - i->GetSource()->RemoveAurasDueToSpell(SPELL_TWILIGHT_SHIFT_ENTER); - } - if (i->GetSource()->IsAlive() && i->GetSource()->HasAura(SPELL_TWILIGHT_TORMENT_VESP) && !i->GetSource()->GetVictim()) - i->GetSource()->RemoveAurasDueToSpell(SPELL_TWILIGHT_TORMENT_VESP); + i->GetSource()->CastSpell(i->GetSource(), SPELL_TWILIGHT_SHIFT_REMOVAL_ALL, true); + i->GetSource()->CastSpell(i->GetSource(), SPELL_TWILIGHT_RESIDUE, true); + i->GetSource()->RemoveAurasDueToSpell(SPELL_TWILIGHT_SHIFT); + i->GetSource()->RemoveAurasDueToSpell(SPELL_TWILIGHT_SHIFT_ENTER); } + if (i->GetSource()->IsAlive() && i->GetSource()->HasAura(SPELL_TWILIGHT_TORMENT_VESP) && !i->GetSource()->GetVictim()) + i->GetSource()->RemoveAurasDueToSpell(SPELL_TWILIGHT_TORMENT_VESP); } instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_TWILIGHT_TORMENT_VESP_ACO); diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp index c375e5c1b95..512016c6eeb 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp @@ -254,7 +254,7 @@ public: if (uiChargeTimer <= uiDiff) { Map::PlayerList const& players = me->GetMap()->GetPlayers(); - if (me->GetMap()->IsDungeon() && !players.isEmpty()) + if (!players.isEmpty()) { for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) { @@ -281,7 +281,7 @@ public: if (Unit* pPassenger = pVehicle->GetPassenger(SEAT_ID_0)) { Map::PlayerList const& players = me->GetMap()->GetPlayers(); - if (me->GetMap()->IsDungeon() && !players.isEmpty()) + if (!players.isEmpty()) { for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) { @@ -400,7 +400,7 @@ public: if (uiInterceptTimer <= uiDiff) { Map::PlayerList const& players = me->GetMap()->GetPlayers(); - if (me->GetMap()->IsDungeon() && !players.isEmpty()) + if (!players.isEmpty()) { for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) { @@ -867,7 +867,7 @@ public: else { Map::PlayerList const& players = me->GetMap()->GetPlayers(); - if (me->GetMap()->IsDungeon() && !players.isEmpty()) + if (!players.isEmpty()) { for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) { diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp index db0fcee22fa..e3e89d865ff 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp @@ -470,21 +470,11 @@ class spell_festergut_blighted_spores : public SpellScriptLoader if (target->HasAura(SPELL_ORANGE_BLIGHT_RESIDUE)) return; - if (target->GetMap() && !target->GetMap()->Is25ManRaid()) - { - if (target->GetQuestStatus(QUEST_RESIDUE_RENDEZVOUS_10) != QUEST_STATUS_INCOMPLETE) - return; - - target->CastSpell(target, SPELL_ORANGE_BLIGHT_RESIDUE, TRIGGERED_FULL_MASK); - } - - if (target->GetMap() && target->GetMap()->Is25ManRaid()) - { - if (target->GetQuestStatus(QUEST_RESIDUE_RENDEZVOUS_25) != QUEST_STATUS_INCOMPLETE) - return; + uint32 questId = target->GetMap()->Is25ManRaid() ? QUEST_RESIDUE_RENDEZVOUS_25 : QUEST_RESIDUE_RENDEZVOUS_10; + if (target->GetQuestStatus(questId) != QUEST_STATUS_INCOMPLETE) + return; - target->CastSpell(target, SPELL_ORANGE_BLIGHT_RESIDUE, TRIGGERED_FULL_MASK); - } + target->CastSpell(target, SPELL_ORANGE_BLIGHT_RESIDUE, TRIGGERED_FULL_MASK); } void Register() override diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp index c1d930cb62c..1a2ebd179fe 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp @@ -892,21 +892,11 @@ class spell_rotface_slime_spray : public SpellScriptLoader if (target->HasAura(SPELL_GREEN_BLIGHT_RESIDUE)) return; - if (target->GetMap() && !target->GetMap()->Is25ManRaid()) - { - if (target->GetQuestStatus(QUEST_RESIDUE_RENDEZVOUS_10) != QUEST_STATUS_INCOMPLETE) - return; - - target->CastSpell(target, SPELL_GREEN_BLIGHT_RESIDUE, TRIGGERED_FULL_MASK); - } - - if (target->GetMap() && target->GetMap()->Is25ManRaid()) - { - if (target->GetQuestStatus(QUEST_RESIDUE_RENDEZVOUS_25) != QUEST_STATUS_INCOMPLETE) - return; + uint32 questId = target->GetMap()->Is25ManRaid() ? QUEST_RESIDUE_RENDEZVOUS_25 : QUEST_RESIDUE_RENDEZVOUS_10; + if (target->GetQuestStatus(questId) != QUEST_STATUS_INCOMPLETE) + return; - target->CastSpell(target, SPELL_GREEN_BLIGHT_RESIDUE, TRIGGERED_FULL_MASK); - } + target->CastSpell(target, SPELL_GREEN_BLIGHT_RESIDUE, TRIGGERED_FULL_MASK); } void Register() override diff --git a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp index dd67f2b1ac0..3778d8d25a0 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp @@ -317,37 +317,30 @@ class boss_gothik : public CreatureScript bool CheckGroupSplitted() { - Map* map = me->GetMap(); - if (map && map->IsDungeon()) + bool checklife = false; + bool checkdead = false; + Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers(); + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) { - Map::PlayerList const &PlayerList = map->GetPlayers(); - if (!PlayerList.isEmpty()) + if (i->GetSource() && i->GetSource()->IsAlive() && + i->GetSource()->GetPositionX() <= POS_X_NORTH && + i->GetSource()->GetPositionX() >= POS_X_SOUTH && + i->GetSource()->GetPositionY() <= POS_Y_GATE && + i->GetSource()->GetPositionY() >= POS_Y_EAST) { - bool checklife = false; - bool checkdead = false; - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - { - if (i->GetSource() && i->GetSource()->IsAlive() && - i->GetSource()->GetPositionX() <= POS_X_NORTH && - i->GetSource()->GetPositionX() >= POS_X_SOUTH && - i->GetSource()->GetPositionY() <= POS_Y_GATE && - i->GetSource()->GetPositionY() >= POS_Y_EAST) - { - checklife = true; - } - else if (i->GetSource() && i->GetSource()->IsAlive() && - i->GetSource()->GetPositionX() <= POS_X_NORTH && - i->GetSource()->GetPositionX() >= POS_X_SOUTH && - i->GetSource()->GetPositionY() >= POS_Y_GATE && - i->GetSource()->GetPositionY() <= POS_Y_WEST) - { - checkdead = true; - } - - if (checklife && checkdead) - return true; - } + checklife = true; } + else if (i->GetSource() && i->GetSource()->IsAlive() && + i->GetSource()->GetPositionX() <= POS_X_NORTH && + i->GetSource()->GetPositionX() >= POS_X_SOUTH && + i->GetSource()->GetPositionY() >= POS_Y_GATE && + i->GetSource()->GetPositionY() <= POS_Y_WEST) + { + checkdead = true; + } + + if (checklife && checkdead) + return true; } return false; @@ -555,20 +548,13 @@ class npc_gothik_minion : public CreatureScript if (!_EnterEvadeMode()) return; - Map* map = me->GetMap(); - if (map->IsDungeon()) + Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers(); + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) { - Map::PlayerList const &PlayerList = map->GetPlayers(); - if (!PlayerList.isEmpty()) + if (i->GetSource() && i->GetSource()->IsAlive() && isOnSameSide(i->GetSource())) { - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - { - if (i->GetSource() && i->GetSource()->IsAlive() && isOnSameSide(i->GetSource())) - { - AttackStart(i->GetSource()); - return; - } - } + AttackStart(i->GetSource()); + return; } } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp index 64403ad40ca..7e005eff303 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp @@ -234,16 +234,12 @@ class boss_general_vezax : public CreatureScript void CheckShamanisticRage() { - Map* map = me->GetMap(); - if (map && map->IsDungeon()) - { - // If Shaman has Shamanistic Rage and use it during the fight, it will cast Corrupted Rage on him - Map::PlayerList const& Players = map->GetPlayers(); - for (Map::PlayerList::const_iterator itr = Players.begin(); itr != Players.end(); ++itr) - if (Player* player = itr->GetSource()) - if (player->HasSpell(SPELL_SHAMANTIC_RAGE)) - player->CastSpell(player, SPELL_CORRUPTED_RAGE, false); - } + // If Shaman has Shamanistic Rage and use it during the fight, it will cast Corrupted Rage on him + Map::PlayerList const& Players = me->GetMap()->GetPlayers(); + for (Map::PlayerList::const_iterator itr = Players.begin(); itr != Players.end(); ++itr) + if (Player* player = itr->GetSource()) + if (player->HasSpell(SPELL_SHAMANTIC_RAGE)) + player->CastSpell(player, SPELL_CORRUPTED_RAGE, false); } uint32 GetData(uint32 type) const override @@ -280,34 +276,28 @@ class boss_general_vezax : public CreatureScript */ Unit* CheckPlayersInRange(uint8 playersMin, float rangeMin, float rangeMax) { - Map* map = me->GetMap(); - if (map && map->IsDungeon()) + std::list<Player*> PlayerList; + Map::PlayerList const& Players = me->GetMap()->GetPlayers(); + for (Map::PlayerList::const_iterator itr = Players.begin(); itr != Players.end(); ++itr) { - std::list<Player*> PlayerList; - Map::PlayerList const& Players = map->GetPlayers(); - for (Map::PlayerList::const_iterator itr = Players.begin(); itr != Players.end(); ++itr) + if (Player* player = itr->GetSource()) { - if (Player* player = itr->GetSource()) - { - float distance = player->GetDistance(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()); - if (rangeMin > distance || distance > rangeMax) - continue; + float distance = player->GetDistance(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()); + if (rangeMin > distance || distance > rangeMax) + continue; - PlayerList.push_back(player); - } + PlayerList.push_back(player); } + } - if (PlayerList.empty()) - return NULL; - - size_t size = PlayerList.size(); - if (size < playersMin) - return NULL; + if (PlayerList.empty()) + return NULL; - return Trinity::Containers::SelectRandomContainerElement(PlayerList); - } + size_t size = PlayerList.size(); + if (size < playersMin) + return NULL; - return NULL; + return Trinity::Containers::SelectRandomContainerElement(PlayerList); } }; diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp index 94ec7acba1f..d2892541373 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp @@ -162,11 +162,6 @@ bool OutdoorPvPSI::HandleDropFlag(Player* player, uint32 spellId) // he dropped it further, summon mound GameObject* go = new GameObject; Map* map = player->GetMap(); - if (!map) - { - delete go; - return true; - } if (!go->Create(map->GenerateLowGuid<HighGuid::GameObject>(), SI_SILITHYST_MOUND, map, player->GetPhaseMask(), player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetOrientation(), 0, 0, 0, 0, 100, GO_STATE_READY)) { @@ -196,11 +191,6 @@ bool OutdoorPvPSI::HandleDropFlag(Player* player, uint32 spellId) // he dropped it further, summon mound GameObject* go = new GameObject; Map* map = player->GetMap(); - if (!map) - { - delete go; - return true; - } if (!go->Create(map->GenerateLowGuid<HighGuid::GameObject>(), SI_SILITHYST_MOUND, map, player->GetPhaseMask(), player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetOrientation(), 0, 0, 0, 0, 100, GO_STATE_READY)) { diff --git a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp index 263fd8340b9..6e43cfa2d0f 100644 --- a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp +++ b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp @@ -109,8 +109,7 @@ public: if (Inhibitmagic_Timer <= diff) { float dist; - Map* map = me->GetMap(); - Map::PlayerList const &PlayerList = map->GetPlayers(); + Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers(); for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) if (Player* i_pl = i->GetSource()) if (i_pl->IsAlive() && (dist = i_pl->GetDistance(me)) < 45) diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp index d0e12c87a55..b16a9630335 100644 --- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp +++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp @@ -182,8 +182,7 @@ class boss_grandmaster_vorpil : public CreatureScript break; case EVENT_DRAW_SHADOWS: { - Map* map = me->GetMap(); - Map::PlayerList const &PlayerList = map->GetPlayers(); + Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers(); for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) if (Player* i_pl = i->GetSource()) if (i_pl->IsAlive() && !i_pl->HasAura(SPELL_BANISH)) diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp index d817c08d7f2..787b191e23d 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp @@ -257,8 +257,7 @@ public: void EnterCombat(Unit* who) override { // remove old tainted cores to prevent cheating in phase 2 - Map* map = me->GetMap(); - Map::PlayerList const &PlayerList = map->GetPlayers(); + Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers(); for (Map::PlayerList::const_iterator itr = PlayerList.begin(); itr != PlayerList.end(); ++itr) if (Player* player = itr->GetSource()) player->DestroyItemCount(31088, 1, true); diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp index 5d967a3546f..253c601e228 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp @@ -788,8 +788,7 @@ public: if (Earthshock_Timer <= diff) { - Map* map = me->GetMap(); - Map::PlayerList const &PlayerList = map->GetPlayers(); + Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers(); for (Map::PlayerList::const_iterator itr = PlayerList.begin(); itr != PlayerList.end(); ++itr) { if (Player* i_pl = itr->GetSource()) diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp index 096777163a6..7c4dbdeaab1 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp @@ -259,8 +259,7 @@ public: if (CheckTimer <= diff)//check if there are players in melee range { InRange = false; - Map* map = me->GetMap(); - Map::PlayerList const &PlayerList = map->GetPlayers(); + Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers(); if (!PlayerList.isEmpty()) { for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) @@ -274,15 +273,11 @@ public: if (RotTimer) { - Map* map = me->GetMap(); - if (map->IsDungeon()) + Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers(); + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) { - Map::PlayerList const &PlayerList = map->GetPlayers(); - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - { - if (i->GetSource() && i->GetSource()->IsAlive() && me->HasInArc(diff/20000.f*float(M_PI)*2.f, i->GetSource()) && me->IsWithinDist(i->GetSource(), SPOUT_DIST) && !i->GetSource()->IsInWater()) - DoCast(i->GetSource(), SPELL_SPOUT, true); // only knock back players in arc, in 100yards, not in water - } + if (i->GetSource() && i->GetSource()->IsAlive() && me->HasInArc(diff/20000.f*float(M_PI)*2.f, i->GetSource()) && me->IsWithinDist(i->GetSource(), SPOUT_DIST) && !i->GetSource()->IsInWater()) + DoCast(i->GetSource(), SPELL_SPOUT, true); // only knock back players in arc, in 100yards, not in water } if (SpoutAnimTimer <= diff) |