Core/Misc: removed some useless map checks

This commit is contained in:
joschiwald
2015-10-04 14:53:05 +02:00
parent 705e5ea5d9
commit cf1e80e3d0
32 changed files with 169 additions and 320 deletions
@@ -2200,7 +2200,7 @@ bool AchievementMgr<T>::RequirementsSatisfied(AchievementCriteria const* achieve
return false;
//FIXME: work only for instances where max == min for players
if (((InstanceMap*)map)->GetMaxPlayers() != achievementCriteria->Entry->Asset.GroupSize)
if (map->ToInstanceMap()->GetMaxPlayers() != achievementCriteria->Entry->Asset.GroupSize)
return false;
break;
}
+1 -1
View File
@@ -346,7 +346,7 @@ bool ChatHandler::ExecuteCommandInTable(ChatCommand* table, const char* text, st
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());
+1 -1
View File
@@ -233,7 +233,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())
{
+2 -2
View File
@@ -6446,7 +6446,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->GetDifficultyID()))
if (dungeon->TargetLevel == 80)
ChampioningFaction = GetChampioningFaction();
@@ -19903,7 +19903,7 @@ void Player::ResetInstances(uint8 method, bool isRaid, bool isLegacy)
// 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;
+1 -1
View File
@@ -171,7 +171,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;
+14 -14
View File
@@ -170,22 +170,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;
}
@@ -227,15 +227,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);
@@ -246,14 +246,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));
handler->PSendSysMessage(LANG_COMMAND_INST_SET_BOSS_STATE, encounterId, state);
return true;
}
@@ -293,15 +293,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);
@@ -310,14 +310,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;
}
uint32 state = map->ToInstanceMap()->GetInstanceScript()->GetBossState(encounterId);
uint32 state = map->GetInstanceScript()->GetBossState(encounterId);
handler->PSendSysMessage(LANG_COMMAND_INST_GET_BOSS_STATE, encounterId, state);
return true;
}
@@ -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())
@@ -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);
@@ -310,11 +310,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;
@@ -554,8 +550,6 @@ public:
uint32 NextStep(uint32 step)
{
Creature* arca = ObjectAccessor::GetCreature(*me, ArcanagosGUID);
Map* map = me->GetMap();
switch (step)
{
case 0: return 9999999;
@@ -563,21 +557,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:
@@ -591,15 +585,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);
@@ -611,27 +605,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;
}
}
@@ -145,41 +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)
if (SpellEffectInfo const* effect = spell->GetEffect(EFFECT_0))
if (effect->MiscValue)
player->KilledMonsterCredit(effect->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);
@@ -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)
@@ -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;
@@ -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();
@@ -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
@@ -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;
@@ -144,8 +144,6 @@ class boss_ossirian : public CreatureScript
Talk(SAY_AGGRO);
Map* map = me->GetMap();
if (!map->IsDungeon())
return;
WorldPackets::Misc::Weather weather(WEATHER_STATE_HEAVY_SANDSTORM, 1.0f);
map->SendToPlayers(weather.Write());
@@ -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);
}
@@ -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);
@@ -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);
}
}
}
@@ -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);
@@ -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 = me->GetMap()->GetPlayers();
if (PlayerList.isEmpty())
return;
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
{
Map::PlayerList const& PlayerList = map->GetPlayers();
if (PlayerList.isEmpty())
return;
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 = me->GetMap()->GetPlayers();
if (PlayerList.isEmpty())
return;
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
{
Map::PlayerList const &PlayerList = map->GetPlayers();
if (PlayerList.isEmpty())
return;
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);
@@ -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)
{
@@ -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;
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);
}
if (target->GetMap() && target->GetMap()->Is25ManRaid())
{
if (target->GetQuestStatus(QUEST_RESIDUE_RENDEZVOUS_25) != 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
@@ -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;
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);
}
if (target->GetMap() && target->GetMap()->Is25ManRaid())
{
if (target->GetQuestStatus(QUEST_RESIDUE_RENDEZVOUS_25) != 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
@@ -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;
}
}
@@ -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;
return Trinity::Containers::SelectRandomContainerElement(PlayerList);
}
return NULL;
if (PlayerList.empty())
return NULL;
size_t size = PlayerList.size();
if (size < playersMin)
return NULL;
return Trinity::Containers::SelectRandomContainerElement(PlayerList);
}
};
@@ -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))
{
@@ -198,11 +193,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))
{
@@ -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)
@@ -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))
@@ -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);
@@ -787,8 +787,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())
@@ -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)
@@ -419,7 +419,7 @@ class boss_kaelthas : public CreatureScript
who->RemoveAurasByType(SPELL_AURA_MOD_STEALTH);
AttackStart(who);
}
else if (me->GetMap()->IsDungeon())
else
{
if (!instance->GetData(DATA_KAELTHASEVENT) && !Phase)
StartEvent();