diff options
| author | joschiwald <joschiwald.trinity@gmail.com> | 2015-10-04 14:53:05 +0200 |
|---|---|---|
| committer | joschiwald <joschiwald.trinity@gmail.com> | 2015-10-04 14:53:05 +0200 |
| commit | cf1e80e3d09067ca4d0078a8113a09227a9f91ae (patch) | |
| tree | a953e93c050b91d72208f5c25e61372ef09d7e92 /src/server/scripts/Northrend | |
| parent | 705e5ea5d9ff5344b89be5aa5e0b6504acff5502 (diff) | |
Core/Misc: removed some useless map checks
Diffstat (limited to 'src/server/scripts/Northrend')
8 files changed, 88 insertions, 147 deletions
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 89d872c25e5..f28b9eb1c63 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp @@ -215,21 +215,14 @@ public: } // Roll Insanity - Map* map = me->GetMap(); - if (!map) - return; - - Map::PlayerList const &PlayerList = map->GetPlayers(); - if (!PlayerList.isEmpty()) + Map::PlayerList const& players = me->GetMap()->GetPlayers(); + for (Map::PlayerList::const_iterator i = players.begin(); i != players.end(); ++i) { - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + if (Player* player = i->GetSource()) { - if (Player* player = i->GetSource()) - { - for (uint32 index = 0; index <= 4; ++index) - player->RemoveAurasDueToSpell(SPELL_INSANITY_TARGET + index); - player->CastSpell(player, SPELL_INSANITY_TARGET + nextPhase - 173, true); - } + for (uint32 index = 0; index <= 4; ++index) + player->RemoveAurasDueToSpell(SPELL_INSANITY_TARGET + index); + player->CastSpell(player, SPELL_INSANITY_TARGET + nextPhase - 173, true); } } } 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 3862f4b92f3..8d88e1959ba 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 e9a1efa74e2..e5ae0eefd60 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 38238072a70..c911738776c 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp @@ -466,21 +466,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 a38e8baf024..17d1e87a22c 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp @@ -893,21 +893,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 cc13455c23f..7328a5fb6c5 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); } }; |
