Use GUIDs instead of "global" pointers in zone scripts.

This commit is like that: 7714 / rce505237e4aa

And use const_iterators where it is possible.

--HG--
branch : trunk
This commit is contained in:
Anubisss
2010-04-02 15:41:37 +02:00
parent 7c4f2f520f
commit 08b4748e62
85 changed files with 289 additions and 256 deletions
@@ -230,7 +230,7 @@ struct boss_chromaggusAI : public ScriptedAI
if (Affliction_Timer <= diff) if (Affliction_Timer <= diff)
{ {
std::list<HostileReference*> threatlist = m_creature->getThreatManager().getThreatList(); std::list<HostileReference*> threatlist = m_creature->getThreatManager().getThreatList();
for (std::list<HostileReference*>::iterator i = threatlist.begin(); i != threatlist.end(); ++i) for (std::list<HostileReference*>::const_iterator i = threatlist.begin(); i != threatlist.end(); ++i)
{ {
Unit* pUnit; Unit* pUnit;
if ((*i) && (*i)->getSource()) if ((*i) && (*i)->getSource())
@@ -189,7 +189,7 @@ struct boss_victor_nefariusAI : public ScriptedAI
//Trinity::Singleton<MapManager>::Instance().GetMap(m_creature->GetMapId(), m_creature)->GetPlayers().begin(); //Trinity::Singleton<MapManager>::Instance().GetMap(m_creature->GetMapId(), m_creature)->GetPlayers().begin();
/* /*
list <Player*>::iterator i = MapManager::Instance().GetMap(m_creature->GetMapId(), m_creature)->GetPlayers().begin(); list <Player*>::const_iterator i = MapManager::Instance().GetMap(m_creature->GetMapId(), m_creature)->GetPlayers().begin();
for (i = MapManager::Instance().GetMap(m_creature->GetMapId(), m_creature)->GetPlayers().begin(); i != MapManager::Instance().GetMap(m_creature->GetMapId(), m_creature)->GetPlayers().end(); ++i) for (i = MapManager::Instance().GetMap(m_creature->GetMapId(), m_creature)->GetPlayers().begin(); i != MapManager::Instance().GetMap(m_creature->GetMapId(), m_creature)->GetPlayers().end(); ++i)
{ {
@@ -155,8 +155,6 @@ struct npc_ranger_lilathaAI : public npc_escortAI
{ {
npc_ranger_lilathaAI(Creature *c) : npc_escortAI(c) {} npc_ranger_lilathaAI(Creature *c) : npc_escortAI(c) {}
std::list<GameObject*> CageList;
void WaypointReached(uint32 i) void WaypointReached(uint32 i)
{ {
Player* pPlayer = GetPlayerForEscort(); Player* pPlayer = GetPlayerForEscort();
@@ -131,7 +131,7 @@ struct npc_blastmaster_emi_shortfuseAI : public npc_escortAI
if (GoSummonList.empty()) if (GoSummonList.empty())
return; return;
for(std::list<uint64>::iterator itr = GoSummonList.begin(); itr != GoSummonList.end(); ++itr) for(std::list<uint64>::const_iterator itr = GoSummonList.begin(); itr != GoSummonList.end(); ++itr)
{ {
if (GameObject* pGo = GameObject::GetGameObject(*m_creature, *itr)) if (GameObject* pGo = GameObject::GetGameObject(*m_creature, *itr))
{ {
@@ -186,14 +186,14 @@ struct npc_blastmaster_emi_shortfuseAI : public npc_escortAI
pInstance->HandleGameObject(NULL,false,pGo); pInstance->HandleGameObject(NULL,false,pGo);
if (!GoSummonList.empty()) if (!GoSummonList.empty())
for(std::list<uint64>::iterator itr = GoSummonList.begin(); itr != GoSummonList.end(); ++itr) for(std::list<uint64>::const_iterator itr = GoSummonList.begin(); itr != GoSummonList.end(); ++itr)
{ {
if (GameObject* pGo = GameObject::GetGameObject(*m_creature, *itr)) if (GameObject* pGo = GameObject::GetGameObject(*m_creature, *itr))
pGo->RemoveFromWorld(); pGo->RemoveFromWorld();
} }
if (!SummonList.empty()) if (!SummonList.empty())
for(std::list<uint64>::iterator itr = SummonList.begin(); itr != SummonList.end(); ++itr) for(std::list<uint64>::const_iterator itr = SummonList.begin(); itr != SummonList.end(); ++itr)
{ {
if (Creature* pSummon = Unit::GetCreature(*m_creature, *itr)) if (Creature* pSummon = Unit::GetCreature(*m_creature, *itr))
{ {
@@ -246,7 +246,7 @@ struct boss_attumenAI : public ScriptedAI
Unit *pTarget; Unit *pTarget;
std::list<HostileReference *> t_list = m_creature->getThreatManager().getThreatList(); std::list<HostileReference *> t_list = m_creature->getThreatManager().getThreatList();
std::vector<Unit *> target_list; std::vector<Unit *> target_list;
for (std::list<HostileReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) for (std::list<HostileReference *>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
{ {
pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid());
if (pTarget && !pTarget->IsWithinDist(m_creature, ATTACK_DISTANCE, false)) if (pTarget && !pTarget->IsWithinDist(m_creature, ATTACK_DISTANCE, false))
@@ -153,7 +153,7 @@ struct boss_moroesAI : public ScriptedAI
AddList.erase((AddList.begin())+(rand()%AddList.size())); AddList.erase((AddList.begin())+(rand()%AddList.size()));
uint8 i = 0; uint8 i = 0;
for (std::vector<uint32>::iterator itr = AddList.begin(); itr != AddList.end(); ++itr) for (std::vector<uint32>::const_iterator itr = AddList.begin(); itr != AddList.end(); ++itr)
{ {
uint32 entry = *itr; uint32 entry = *itr;
@@ -274,7 +274,7 @@ struct boss_moroesAI : public ScriptedAI
{ {
std::list<Unit*> pTargets; std::list<Unit*> pTargets;
SelectTargetList(pTargets, 5, SELECT_TARGET_RANDOM, m_creature->GetMeleeReach()*5, true); SelectTargetList(pTargets, 5, SELECT_TARGET_RANDOM, m_creature->GetMeleeReach()*5, true);
for (std::list<Unit*>::iterator i = pTargets.begin(); i != pTargets.end(); ++i) for (std::list<Unit*>::const_iterator i = pTargets.begin(); i != pTargets.end(); ++i)
if(!m_creature->IsWithinMeleeRange(*i)) if(!m_creature->IsWithinMeleeRange(*i))
{ {
DoCast(*i, SPELL_BLIND); DoCast(*i, SPELL_BLIND);
@@ -242,7 +242,7 @@ struct boss_malchezaarAI : public ScriptedAI
void InfernalCleanup() void InfernalCleanup()
{ {
//Infernal Cleanup //Infernal Cleanup
for (std::vector<uint64>::iterator itr = infernals.begin(); itr != infernals.end(); ++itr) for (std::vector<uint64>::const_iterator itr = infernals.begin(); itr != infernals.end(); ++itr)
if (Unit *pInfernal = Unit::GetUnit(*m_creature, *itr)) if (Unit *pInfernal = Unit::GetUnit(*m_creature, *itr))
if (pInfernal->isAlive()) if (pInfernal->isAlive())
{ {
@@ -288,7 +288,7 @@ struct boss_malchezaarAI : public ScriptedAI
return; return;
//begin + 1, so we don't target the one with the highest threat //begin + 1, so we don't target the one with the highest threat
std::list<HostileReference *>::iterator itr = t_list.begin(); std::list<HostileReference *>::const_iterator itr = t_list.begin();
std::advance(itr, 1); std::advance(itr, 1);
for (; itr != t_list.end(); ++itr) //store the threat list in a different container for (; itr != t_list.end(); ++itr) //store the threat list in a different container
if (Unit *pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid())) if (Unit *pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()))
@@ -300,7 +300,7 @@ struct boss_malchezaarAI : public ScriptedAI
targets.erase(targets.begin()+rand()%targets.size()); targets.erase(targets.begin()+rand()%targets.size());
uint32 i = 0; uint32 i = 0;
for (std::vector<Unit *>::iterator iter = targets.begin(); iter != targets.end(); ++iter, ++i) for (std::vector<Unit *>::const_iterator iter = targets.begin(); iter != targets.end(); ++iter, ++i)
if (Unit *pTarget = *iter) if (Unit *pTarget = *iter)
{ {
enfeeble_targets[i] = pTarget->GetGUID(); enfeeble_targets[i] = pTarget->GetGUID();
@@ -181,7 +181,7 @@ struct boss_aranAI : public ScriptedAI
return; return;
//store the threat list in a different container //store the threat list in a different container
for (std::list<HostileReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) for (std::list<HostileReference *>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
{ {
Unit *pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); Unit *pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid());
//only on alive players //only on alive players
@@ -194,7 +194,7 @@ struct boss_aranAI : public ScriptedAI
targets.erase(targets.begin()+rand()%targets.size()); targets.erase(targets.begin()+rand()%targets.size());
uint32 i = 0; uint32 i = 0;
for (std::vector<Unit*>::iterator itr = targets.begin(); itr!= targets.end(); ++itr) for (std::vector<Unit*>::const_iterator itr = targets.begin(); itr!= targets.end(); ++itr)
{ {
if (*itr) if (*itr)
{ {
@@ -178,7 +178,7 @@ struct boss_felblood_kaelthasAI : public ScriptedAI
return; return;
std::list<HostileReference*>& m_threatlist = m_creature->getThreatManager().getThreatList(); std::list<HostileReference*>& m_threatlist = m_creature->getThreatManager().getThreatList();
std::list<HostileReference*>::iterator i = m_threatlist.begin(); std::list<HostileReference*>::const_iterator i = m_threatlist.begin();
for (i = m_threatlist.begin(); i != m_threatlist.end(); ++i) for (i = m_threatlist.begin(); i != m_threatlist.end(); ++i)
{ {
Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid()); Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid());
@@ -196,7 +196,7 @@ struct boss_felblood_kaelthasAI : public ScriptedAI
float y = KaelLocations[0][1]; float y = KaelLocations[0][1];
m_creature->GetMap()->CreatureRelocation(m_creature, x, y, LOCATION_Z, 0.0f); m_creature->GetMap()->CreatureRelocation(m_creature, x, y, LOCATION_Z, 0.0f);
//m_creature->SendMonsterMove(x, y, LOCATION_Z, 0, 0, 0); // causes some issues... //m_creature->SendMonsterMove(x, y, LOCATION_Z, 0, 0, 0); // causes some issues...
std::list<HostileReference*>::iterator i = m_creature->getThreatManager().getThreatList().begin(); std::list<HostileReference*>::const_iterator i = m_creature->getThreatManager().getThreatList().begin();
for (i = m_creature->getThreatManager().getThreatList().begin(); i!= m_creature->getThreatManager().getThreatList().end(); ++i) for (i = m_creature->getThreatManager().getThreatList().begin(); i!= m_creature->getThreatManager().getThreatList().end(); ++i)
{ {
Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid()); Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid());
@@ -208,7 +208,7 @@ struct boss_felblood_kaelthasAI : public ScriptedAI
void CastGravityLapseKnockUp() void CastGravityLapseKnockUp()
{ {
std::list<HostileReference*>::iterator i = m_creature->getThreatManager().getThreatList().begin(); std::list<HostileReference*>::const_iterator i = m_creature->getThreatManager().getThreatList().begin();
for (i = m_creature->getThreatManager().getThreatList().begin(); i!= m_creature->getThreatManager().getThreatList().end(); ++i) for (i = m_creature->getThreatManager().getThreatList().begin(); i!= m_creature->getThreatManager().getThreatList().end(); ++i)
{ {
Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid()); Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid());
@@ -220,7 +220,7 @@ struct boss_felblood_kaelthasAI : public ScriptedAI
void CastGravityLapseFly() // Use Fly Packet hack for now as players can't cast "fly" spells unless in map 530. Has to be done a while after they get knocked into the air... void CastGravityLapseFly() // Use Fly Packet hack for now as players can't cast "fly" spells unless in map 530. Has to be done a while after they get knocked into the air...
{ {
std::list<HostileReference*>::iterator i = m_creature->getThreatManager().getThreatList().begin(); std::list<HostileReference*>::const_iterator i = m_creature->getThreatManager().getThreatList().begin();
for (i = m_creature->getThreatManager().getThreatList().begin(); i!= m_creature->getThreatManager().getThreatList().end(); ++i) for (i = m_creature->getThreatManager().getThreatList().begin(); i!= m_creature->getThreatManager().getThreatList().end(); ++i)
{ {
Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid()); Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid());
@@ -240,7 +240,7 @@ struct boss_felblood_kaelthasAI : public ScriptedAI
void RemoveGravityLapse() void RemoveGravityLapse()
{ {
std::list<HostileReference*>::iterator i = m_creature->getThreatManager().getThreatList().begin(); std::list<HostileReference*>::const_iterator i = m_creature->getThreatManager().getThreatList().begin();
for (i = m_creature->getThreatManager().getThreatList().begin(); i!= m_creature->getThreatManager().getThreatList().end(); ++i) for (i = m_creature->getThreatManager().getThreatList().begin(); i!= m_creature->getThreatManager().getThreatList().end(); ++i)
{ {
Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid()); Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid());
@@ -172,7 +172,7 @@ struct boss_priestess_delrissaAI : public ScriptedAI
LackeyEntryList.erase(LackeyEntryList.begin() + rand()%LackeyEntryList.size()); LackeyEntryList.erase(LackeyEntryList.begin() + rand()%LackeyEntryList.size());
//summon all the remaining in vector //summon all the remaining in vector
for (std::vector<uint32>::iterator itr = LackeyEntryList.begin(); itr != LackeyEntryList.end(); ++itr) for (std::vector<uint32>::const_iterator itr = LackeyEntryList.begin(); itr != LackeyEntryList.end(); ++itr)
{ {
if (Creature* pAdd = m_creature->SummonCreature((*itr), LackeyLocations[j][0], LackeyLocations[j][1], fZLocation, fOrientation, TEMPSUMMON_CORPSE_DESPAWN, 0)) if (Creature* pAdd = m_creature->SummonCreature((*itr), LackeyLocations[j][0], LackeyLocations[j][1], fZLocation, fOrientation, TEMPSUMMON_CORPSE_DESPAWN, 0))
m_auiLackeyGUID[j] = pAdd->GetGUID(); m_auiLackeyGUID[j] = pAdd->GetGUID();
@@ -182,7 +182,7 @@ struct boss_priestess_delrissaAI : public ScriptedAI
} }
else else
{ {
for (std::vector<uint32>::iterator itr = LackeyEntryList.begin(); itr != LackeyEntryList.end(); ++itr) for (std::vector<uint32>::const_iterator itr = LackeyEntryList.begin(); itr != LackeyEntryList.end(); ++itr)
{ {
Unit* pAdd = Unit::GetUnit(*m_creature, m_auiLackeyGUID[j]); Unit* pAdd = Unit::GetUnit(*m_creature, m_auiLackeyGUID[j]);
@@ -797,7 +797,7 @@ struct boss_yazzaiAI : public boss_priestess_lackey_commonAI
{ {
bool InMeleeRange = false; bool InMeleeRange = false;
std::list<HostileReference*>& t_list = m_creature->getThreatManager().getThreatList(); std::list<HostileReference*>& t_list = m_creature->getThreatManager().getThreatList();
for (std::list<HostileReference*>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
{ {
if (Unit *pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid())) if (Unit *pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()))
{ {
@@ -877,7 +877,7 @@ struct boss_warlord_salarisAI : public boss_priestess_lackey_commonAI
{ {
bool InMeleeRange = false; bool InMeleeRange = false;
std::list<HostileReference*>& t_list = m_creature->getThreatManager().getThreatList(); std::list<HostileReference*>& t_list = m_creature->getThreatManager().getThreatList();
for (std::list<HostileReference*>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
{ {
if (Unit *pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid())) if (Unit *pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()))
{ {
@@ -1124,7 +1124,7 @@ struct boss_apokoAI : public boss_priestess_lackey_commonAI
if (Healing_Wave_Timer <= diff) if (Healing_Wave_Timer <= diff)
{ {
// std::vector<Add*>::iterator itr = Group.begin() + rand()%Group.size(); // std::vector<Add*>::const_iterator itr = Group.begin() + rand()%Group.size();
// uint64 guid = (*itr)->guid; // uint64 guid = (*itr)->guid;
// if (guid) // if (guid)
// { // {
@@ -89,7 +89,7 @@ struct boss_selin_fireheartAI : public ScriptedAI
if (pInstance) if (pInstance)
{ {
//for (uint8 i = 0; i < CRYSTALS_NUMBER; ++i) //for (uint8 i = 0; i < CRYSTALS_NUMBER; ++i)
for (std::list<uint64>::iterator itr = Crystals.begin(); itr != Crystals.end(); ++itr) for (std::list<uint64>::const_iterator itr = Crystals.begin(); itr != Crystals.end(); ++itr)
{ {
//Unit* pUnit = Unit::GetUnit(*m_creature, FelCrystals[i]); //Unit* pUnit = Unit::GetUnit(*m_creature, FelCrystals[i]);
Unit* pUnit = Unit::GetUnit(*m_creature, *itr); Unit* pUnit = Unit::GetUnit(*m_creature, *itr);
@@ -132,7 +132,7 @@ struct boss_selin_fireheartAI : public ScriptedAI
Unit* pCrystal = NULL; Unit* pCrystal = NULL;
Unit* CrystalChosen = NULL; Unit* CrystalChosen = NULL;
//for (uint8 i = 0; i < CRYSTALS_NUMBER; ++i) //for (uint8 i = 0; i < CRYSTALS_NUMBER; ++i)
for (std::list<uint64>::iterator itr = Crystals.begin(); itr != Crystals.end(); ++itr) for (std::list<uint64>::const_iterator itr = Crystals.begin(); itr != Crystals.end(); ++itr)
{ {
pCrystal = NULL; pCrystal = NULL;
//pCrystal = Unit::GetUnit(*m_creature, FelCrystals[i]); //pCrystal = Unit::GetUnit(*m_creature, FelCrystals[i]);
@@ -169,7 +169,7 @@ struct boss_selin_fireheartAI : public ScriptedAI
return; return;
//for (uint8 i = 0; i < CRYSTALS_NUMBER; ++i) //for (uint8 i = 0; i < CRYSTALS_NUMBER; ++i)
for (std::list<uint64>::iterator itr = Crystals.begin(); itr != Crystals.end(); ++itr) for (std::list<uint64>::const_iterator itr = Crystals.begin(); itr != Crystals.end(); ++itr)
{ {
//Creature* pCrystal = (Unit::GetCreature(*m_creature, FelCrystals[i])); //Creature* pCrystal = (Unit::GetCreature(*m_creature, FelCrystals[i]));
Creature* pCrystal = Unit::GetCreature(*m_creature, *itr); Creature* pCrystal = Unit::GetCreature(*m_creature, *itr);
@@ -41,7 +41,7 @@ struct instance_magisters_terrace : public ScriptedInstance
uint32 DelrissaDeathCount; uint32 DelrissaDeathCount;
std::list<uint64> FelCrystals; std::list<uint64> FelCrystals;
std::list<uint64>::iterator CrystalItr; std::list<uint64>::const_iterator CrystalItr;
uint64 SelinGUID; uint64 SelinGUID;
uint64 DelrissaGUID; uint64 DelrissaGUID;
@@ -77,7 +77,7 @@ struct boss_sulfuronAI : public ScriptedAI
std::list<Creature*> pList = DoFindFriendlyMissingBuff(45.0f,SPELL_INSPIRE); std::list<Creature*> pList = DoFindFriendlyMissingBuff(45.0f,SPELL_INSPIRE);
if (!pList.empty()) if (!pList.empty())
{ {
std::list<Creature*>::iterator i = pList.begin(); std::list<Creature*>::const_iterator i = pList.begin();
advance(i, (rand()%pList.size())); advance(i, (rand()%pList.size()));
pTarget = (*i); pTarget = (*i);
} }
@@ -735,7 +735,7 @@ struct npc_scarlet_ghoulAI : public ScriptedAI
if (!MinionList.empty()) if (!MinionList.empty())
{ {
for (std::list<Creature*>::iterator itr = MinionList.begin(); itr != MinionList.end(); ++itr) for (std::list<Creature*>::const_iterator itr = MinionList.begin(); itr != MinionList.end(); ++itr)
{ {
if (CAST_CRE(*itr)->GetOwner()->GetGUID() == m_creature->GetOwner()->GetGUID()) if (CAST_CRE(*itr)->GetOwner()->GetGUID() == m_creature->GetOwner()->GetGUID())
{ {
@@ -504,7 +504,7 @@ struct boss_headless_horsemanAI : public ScriptedAI
if (PlayerList.isEmpty()) return NULL; if (PlayerList.isEmpty()) return NULL;
std::list<Player*> temp; std::list<Player*> temp;
std::list<Player*>::iterator j; std::list<Player*>::const_iterator j;
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 ((m_creature->IsWithinLOSInMap(i->getSource()) || !checkLoS) && m_creature->getVictim() != i->getSource() && if ((m_creature->IsWithinLOSInMap(i->getSource()) || !checkLoS) && m_creature->getVictim() != i->getSource() &&
@@ -559,7 +559,7 @@ struct boss_headless_horsemanAI : public ScriptedAI
caster->GetMotionMaster()->Clear(false); caster->GetMotionMaster()->Clear(false);
caster->GetMotionMaster()->MoveFollow(m_creature,6,urand(0,5)); caster->GetMotionMaster()->MoveFollow(m_creature,6,urand(0,5));
//DoResetThreat();//not sure if need //DoResetThreat();//not sure if need
std::list<HostileReference*>::iterator itr; std::list<HostileReference*>::const_iterator itr;
for (itr = caster->getThreatManager().getThreatList().begin(); itr != caster->getThreatManager().getThreatList().end(); ++itr) for (itr = caster->getThreatManager().getThreatList().begin(); itr != caster->getThreatManager().getThreatList().end(); ++itr)
{ {
Unit* pUnit = Unit::GetUnit((*m_creature), (*itr)->getUnitGuid()); Unit* pUnit = Unit::GetUnit((*m_creature), (*itr)->getUnitGuid());
@@ -103,7 +103,7 @@ struct instance_scarlet_monastery : public ScriptedInstance
m_auiEncounter[1] = data; m_auiEncounter[1] = data;
if (data == DONE) if (data == DONE)
{ {
for (std::set<uint64>::iterator itr = HorsemanAdds.begin(); itr != HorsemanAdds.end(); ++itr) for (std::set<uint64>::const_iterator itr = HorsemanAdds.begin(); itr != HorsemanAdds.end(); ++itr)
{ {
Creature* add = instance->GetCreature(*itr); Creature* add = instance->GetCreature(*itr);
if (add && add->isAlive()) if (add && add->isAlive())
+27 -14
View File
@@ -266,36 +266,41 @@ struct npc_lord_gregor_lescovarAI : public npc_escortAI
{ {
npc_lord_gregor_lescovarAI(Creature* pCreature) : npc_escortAI(pCreature) npc_lord_gregor_lescovarAI(Creature* pCreature) : npc_escortAI(pCreature)
{ {
pMarzon = NULL;
pTyrion = NULL;
pCreature->RestoreFaction(); pCreature->RestoreFaction();
} }
uint32 uiTimer; uint32 uiTimer;
uint32 uiPhase; uint32 uiPhase;
Creature* pMarzon; uint64 MarzonGUID;
Creature* pTyrion;
void Reset() void Reset()
{ {
uiTimer = 0; uiTimer = 0;
uiPhase = 0; uiPhase = 0;
MarzonGUID = 0;
} }
void EnterEvadeMode() void EnterEvadeMode()
{ {
m_creature->DisappearAndDie(); m_creature->DisappearAndDie();
if (pMarzon && pMarzon->isAlive()) if (Creature *pMarzon = Unit::GetCreature(*m_creature, MarzonGUID))
{
if (pMarzon->isAlive())
pMarzon->DisappearAndDie(); pMarzon->DisappearAndDie();
} }
}
void EnterCombat(Unit* pWho) void EnterCombat(Unit* pWho)
{ {
if (pMarzon && pMarzon->isAlive() && !pMarzon->isInCombat()) if (Creature *pMarzon = Unit::GetCreature(*m_creature, MarzonGUID))
{
if (pMarzon->isAlive() && !pMarzon->isInCombat())
pMarzon->AI()->AttackStart(pWho); pMarzon->AI()->AttackStart(pWho);
} }
}
void WaypointReached(uint32 uiPointId) void WaypointReached(uint32 uiPointId)
{ {
@@ -309,8 +314,11 @@ struct npc_lord_gregor_lescovarAI : public npc_escortAI
break; break;
case 16: case 16:
SetEscortPaused(true); SetEscortPaused(true);
if (pMarzon = m_creature->SummonCreature(NPC_MARZON_BLADE,-8411.360352, 480.069733, 123.760895, 4.941504, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1000)) if (Creature *pMarzon = m_creature->SummonCreature(NPC_MARZON_BLADE,-8411.360352, 480.069733, 123.760895, 4.941504, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1000))
{
pMarzon->GetMotionMaster()->MovePoint(0,-8408.000977, 468.611450, 123.759903); pMarzon->GetMotionMaster()->MovePoint(0,-8408.000977, 468.611450, 123.759903);
MarzonGUID = pMarzon->GetGUID();
}
uiTimer = 2000; uiTimer = 2000;
uiPhase = 4; uiPhase = 4;
break; break;
@@ -323,7 +331,7 @@ struct npc_lord_gregor_lescovarAI : public npc_escortAI
m_creature->GetCreatureListWithEntryInGrid(GuardList,NPC_STORMWIND_ROYAL,8.0f); m_creature->GetCreatureListWithEntryInGrid(GuardList,NPC_STORMWIND_ROYAL,8.0f);
if (!GuardList.empty()) if (!GuardList.empty())
{ {
for (std::list<Creature*>::iterator itr = GuardList.begin(); itr != GuardList.end(); ++itr) for (std::list<Creature*>::const_iterator itr = GuardList.begin(); itr != GuardList.end(); ++itr)
{ {
if (Creature* pGuard = *itr) if (Creature* pGuard = *itr)
pGuard->DisappearAndDie(); pGuard->DisappearAndDie();
@@ -361,7 +369,7 @@ struct npc_lord_gregor_lescovarAI : public npc_escortAI
uiPhase = 0; uiPhase = 0;
break; break;
case 5: case 5:
if (pMarzon) if (Creature *pMarzon = Unit::GetCreature(*m_creature, MarzonGUID))
DoScriptText(SAY_MARZON_1, pMarzon); DoScriptText(SAY_MARZON_1, pMarzon);
uiTimer = 3000; uiTimer = 3000;
uiPhase = 6; uiPhase = 6;
@@ -376,7 +384,7 @@ struct npc_lord_gregor_lescovarAI : public npc_escortAI
case 7: case 7:
if (Creature* pTyrion = m_creature->FindNearestCreature(NPC_TYRION, 20.0f, true)) if (Creature* pTyrion = m_creature->FindNearestCreature(NPC_TYRION, 20.0f, true))
DoScriptText(SAY_TYRION_2, pTyrion); DoScriptText(SAY_TYRION_2, pTyrion);
if (pMarzon) if (Creature *pMarzon = Unit::GetCreature(*m_creature, MarzonGUID))
pMarzon->setFaction(14); pMarzon->setFaction(14);
m_creature->setFaction(14); m_creature->setFaction(14);
uiTimer = 0; uiTimer = 0;
@@ -498,13 +506,9 @@ struct npc_tyrion_spybotAI : public npc_escortAI
uint32 uiTimer; uint32 uiTimer;
uint32 uiPhase; uint32 uiPhase;
Creature* pTyrion;
Creature* pLescovar;
void Reset() void Reset()
{ {
pLescovar = NULL;
pTyrion = NULL;
uiTimer = 0; uiTimer = 0;
uiPhase = 0; uiPhase = 0;
} }
@@ -547,8 +551,11 @@ struct npc_tyrion_spybotAI : public npc_escortAI
uiPhase = 2; uiPhase = 2;
break; break;
case 2: case 2:
/*
FIXME: Why have this if pTyrion not declared?
if (pTyrion) if (pTyrion)
DoScriptText(SAY_TYRION_1, pTyrion); DoScriptText(SAY_TYRION_1, pTyrion);
*/
uiTimer = 3000; uiTimer = 3000;
uiPhase = 3; uiPhase = 3;
break; break;
@@ -579,8 +586,11 @@ struct npc_tyrion_spybotAI : public npc_escortAI
uiPhase = 0; uiPhase = 0;
break; break;
case 8: case 8:
/*
FIXME: Why have this if pLescovar not declared?
if (pLescovar) if (pLescovar)
DoScriptText(SAY_LESCOVAR_1, pLescovar); DoScriptText(SAY_LESCOVAR_1, pLescovar);
*/
uiTimer = 3000; uiTimer = 3000;
uiPhase = 9; uiPhase = 9;
break; break;
@@ -590,12 +600,15 @@ struct npc_tyrion_spybotAI : public npc_escortAI
uiPhase = 10; uiPhase = 10;
break; break;
case 10: case 10:
/*
FIXME: Why have this if pLescovar not declared?
if (pLescovar && pLescovar->isAlive()) if (pLescovar && pLescovar->isAlive())
{ {
if (Player* pPlayer = GetPlayerForEscort()) if (Player* pPlayer = GetPlayerForEscort())
CAST_AI(npc_lord_gregor_lescovarAI,pLescovar->AI())->Start(false, false, pPlayer->GetGUID()); CAST_AI(npc_lord_gregor_lescovarAI,pLescovar->AI())->Start(false, false, pPlayer->GetGUID());
CAST_AI(npc_lord_gregor_lescovarAI, pLescovar->AI())->SetMaxPlayerDistance(200.0f); CAST_AI(npc_lord_gregor_lescovarAI, pLescovar->AI())->SetMaxPlayerDistance(200.0f);
} }
*/
m_creature->DisappearAndDie(); m_creature->DisappearAndDie();
uiTimer = 0; uiTimer = 0;
uiPhase = 0; uiPhase = 0;
@@ -251,7 +251,7 @@ struct instance_stratholme : public ScriptedInstance
HandleGameObject(portGauntletGUID, false); HandleGameObject(portGauntletGUID, false);
uint32 count = abomnationGUID.size(); uint32 count = abomnationGUID.size();
for (std::set<uint64>::iterator i = abomnationGUID.begin(); i != abomnationGUID.end(); ++i) for (std::set<uint64>::const_iterator i = abomnationGUID.begin(); i != abomnationGUID.end(); ++i)
{ {
if (Creature* pAbom = instance->GetCreature(*i)) if (Creature* pAbom = instance->GetCreature(*i))
{ {
@@ -313,7 +313,7 @@ struct boss_brutallusAI : public ScriptedAI
{ {
std::list<Unit*> pTargets; std::list<Unit*> pTargets;
SelectTargetList(pTargets, 10, SELECT_TARGET_RANDOM, 100, true); SelectTargetList(pTargets, 10, SELECT_TARGET_RANDOM, 100, true);
for (std::list<Unit*>::iterator i = pTargets.begin(); i != pTargets.end(); ++i) for (std::list<Unit*>::const_iterator i = pTargets.begin(); i != pTargets.end(); ++i)
if(!(*i)->HasAura(SPELL_BURN)) if(!(*i)->HasAura(SPELL_BURN))
{ {
(*i)->CastSpell((*i), SPELL_BURN, true); (*i)->CastSpell((*i), SPELL_BURN, true);
@@ -533,7 +533,7 @@ struct boss_felmystAI : public ScriptedAI
cell.Visit(pair, cSearcher, *(m_creature->GetMap())); cell.Visit(pair, cSearcher, *(m_creature->GetMap()));
} }
for (std::list<Creature*>::iterator i = templist.begin(); i != templist.end(); ++i) for (std::list<Creature*>::const_iterator i = templist.begin(); i != templist.end(); ++i)
{ {
if (entry == MOB_VAPOR_TRAIL && Phase == PHASE_FLIGHT) if (entry == MOB_VAPOR_TRAIL && Phase == PHASE_FLIGHT)
{ {
@@ -302,7 +302,7 @@ struct boss_kalecgosAI : public ScriptedAI
{ {
std::list<HostileReference*> &m_threatlist = me->getThreatManager().getThreatList(); std::list<HostileReference*> &m_threatlist = me->getThreatManager().getThreatList();
std::list<Unit*> targetList; std::list<Unit*> targetList;
for (std::list<HostileReference*>::iterator itr = m_threatlist.begin(); itr!= m_threatlist.end(); ++itr) for (std::list<HostileReference*>::const_iterator itr = m_threatlist.begin(); itr!= m_threatlist.end(); ++itr)
if((*itr)->getTarget() && (*itr)->getTarget()->GetTypeId() == TYPEID_PLAYER && (*itr)->getTarget()->GetGUID() != me->getVictim()->GetGUID() && !(*itr)->getTarget()->HasAura(AURA_SPECTRAL_EXHAUSTION) && (*itr)->getTarget()->GetPositionZ() > me->GetPositionZ()-5) if((*itr)->getTarget() && (*itr)->getTarget()->GetTypeId() == TYPEID_PLAYER && (*itr)->getTarget()->GetGUID() != me->getVictim()->GetGUID() && !(*itr)->getTarget()->HasAura(AURA_SPECTRAL_EXHAUSTION) && (*itr)->getTarget()->GetPositionZ() > me->GetPositionZ()-5)
targetList.push_back((*itr)->getTarget()); targetList.push_back((*itr)->getTarget());
if(targetList.empty()) if(targetList.empty())
@@ -310,7 +310,7 @@ struct boss_kalecgosAI : public ScriptedAI
SpectralBlastTimer = 1000; SpectralBlastTimer = 1000;
return; return;
} }
std::list<Unit*>::iterator i = targetList.begin(); std::list<Unit*>::const_iterator i = targetList.begin();
advance(i, rand()%targetList.size()); advance(i, rand()%targetList.size());
if((*i)) if((*i))
{ {
@@ -614,7 +614,7 @@ struct boss_sathrovarrAI : public ScriptedAI
if (ResetThreat <= diff) if (ResetThreat <= diff)
{ {
for (std::list<HostileReference*>::iterator itr = me->getThreatManager().getThreatList().begin(); itr != me->getThreatManager().getThreatList().end(); ++itr) for (std::list<HostileReference*>::const_iterator itr = me->getThreatManager().getThreatList().begin(); itr != me->getThreatManager().getThreatList().end(); ++itr)
{ {
if(Unit* pUnit = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid())) if(Unit* pUnit = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()))
{ {
@@ -946,7 +946,7 @@ struct mob_hand_of_the_deceiverAI : public ScriptedAI
Creature* Portal = DoSpawnCreature(CREATURE_FELFIRE_PORTAL, 0, 0,0, 0, TEMPSUMMON_TIMED_DESPAWN, 20000); Creature* Portal = DoSpawnCreature(CREATURE_FELFIRE_PORTAL, 0, 0,0, 0, TEMPSUMMON_TIMED_DESPAWN, 20000);
if (Portal) if (Portal)
{ {
std::list<HostileReference*>::iterator itr; std::list<HostileReference*>::const_iterator itr;
for (itr = m_creature->getThreatManager().getThreatList().begin(); itr != m_creature->getThreatManager().getThreatList().end(); ++itr) for (itr = m_creature->getThreatManager().getThreatList().begin(); itr != m_creature->getThreatManager().getThreatList().end(); ++itr)
{ {
Unit* pUnit = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); Unit* pUnit = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid());
@@ -96,7 +96,7 @@ struct instance_uldaman : public ScriptedInstance
void ActivateStoneKeepers() void ActivateStoneKeepers()
{ {
for (std::vector<uint64>::iterator i = stoneKeeper.begin(); i != stoneKeeper.end(); ++i) for (std::vector<uint64>::const_iterator i = stoneKeeper.begin(); i != stoneKeeper.end(); ++i)
{ {
Creature *pTarget = instance->GetCreature(*i); Creature *pTarget = instance->GetCreature(*i);
if (!pTarget || !pTarget->isAlive() || pTarget->getFaction()==14) if (!pTarget || !pTarget->isAlive() || pTarget->getFaction()==14)
@@ -116,7 +116,7 @@ struct instance_uldaman : public ScriptedInstance
if (!archaedas) if (!archaedas)
return; return;
for (std::vector<uint64>::iterator i = archaedasWallMinions.begin(); i != archaedasWallMinions.end(); ++i) for (std::vector<uint64>::const_iterator i = archaedasWallMinions.begin(); i != archaedasWallMinions.end(); ++i)
{ {
Creature *pTarget = instance->GetCreature(*i); Creature *pTarget = instance->GetCreature(*i);
if (!pTarget || !pTarget->isAlive() || pTarget->getFaction()==14) if (!pTarget || !pTarget->isAlive() || pTarget->getFaction()==14)
@@ -131,7 +131,7 @@ struct instance_uldaman : public ScriptedInstance
void DeActivateMinions() void DeActivateMinions()
{ {
// first despawn any aggroed wall minions // first despawn any aggroed wall minions
for (std::vector<uint64>::iterator i = archaedasWallMinions.begin(); i != archaedasWallMinions.end(); ++i) for (std::vector<uint64>::const_iterator i = archaedasWallMinions.begin(); i != archaedasWallMinions.end(); ++i)
{ {
Creature *pTarget = instance->GetCreature(*i); Creature *pTarget = instance->GetCreature(*i);
if (!pTarget || pTarget->isDead() || pTarget->getFaction()!=14) if (!pTarget || pTarget->isDead() || pTarget->getFaction()!=14)
@@ -141,7 +141,7 @@ struct instance_uldaman : public ScriptedInstance
} }
// Vault Walkers // Vault Walkers
for (std::vector<uint64>::iterator i = vaultWalker.begin(); i != vaultWalker.end(); ++i) for (std::vector<uint64>::const_iterator i = vaultWalker.begin(); i != vaultWalker.end(); ++i)
{ {
Creature *pTarget = instance->GetCreature(*i); Creature *pTarget = instance->GetCreature(*i);
if (!pTarget || pTarget->isDead() || pTarget->getFaction()!=14) if (!pTarget || pTarget->isDead() || pTarget->getFaction()!=14)
@@ -151,7 +151,7 @@ struct instance_uldaman : public ScriptedInstance
} }
// Earthen Guardians // Earthen Guardians
for (std::vector<uint64>::iterator i = earthenGuardian.begin(); i != earthenGuardian.end(); ++i) for (std::vector<uint64>::const_iterator i = earthenGuardian.begin(); i != earthenGuardian.end(); ++i)
{ {
Creature *pTarget = instance->GetCreature(*i); Creature *pTarget = instance->GetCreature(*i);
if (!pTarget || pTarget->isDead() || pTarget->getFaction()!=14) if (!pTarget || pTarget->isDead() || pTarget->getFaction()!=14)
@@ -177,7 +177,7 @@ struct instance_uldaman : public ScriptedInstance
void RespawnMinions() void RespawnMinions()
{ {
// first respawn any aggroed wall minions // first respawn any aggroed wall minions
for (std::vector<uint64>::iterator i = archaedasWallMinions.begin(); i != archaedasWallMinions.end(); ++i) for (std::vector<uint64>::const_iterator i = archaedasWallMinions.begin(); i != archaedasWallMinions.end(); ++i)
{ {
Creature *pTarget = instance->GetCreature(*i); Creature *pTarget = instance->GetCreature(*i);
if (pTarget && pTarget->isDead()) if (pTarget && pTarget->isDead())
@@ -189,7 +189,7 @@ struct instance_uldaman : public ScriptedInstance
} }
// Vault Walkers // Vault Walkers
for (std::vector<uint64>::iterator i = vaultWalker.begin(); i != vaultWalker.end(); ++i) for (std::vector<uint64>::const_iterator i = vaultWalker.begin(); i != vaultWalker.end(); ++i)
{ {
Creature *pTarget = instance->GetCreature(*i); Creature *pTarget = instance->GetCreature(*i);
if (pTarget && pTarget->isDead()) if (pTarget && pTarget->isDead())
@@ -201,7 +201,7 @@ struct instance_uldaman : public ScriptedInstance
} }
// Earthen Guardians // Earthen Guardians
for (std::vector<uint64>::iterator i = earthenGuardian.begin(); i != earthenGuardian.end(); ++i) for (std::vector<uint64>::const_iterator i = earthenGuardian.begin(); i != earthenGuardian.end(); ++i)
{ {
Creature *pTarget = instance->GetCreature(*i); Creature *pTarget = instance->GetCreature(*i);
if (pTarget && pTarget->isDead()) if (pTarget && pTarget->isDead())
@@ -197,7 +197,7 @@ struct boss_akilzonAI : public ScriptedAI
cell.Visit(p, grid_unit_searcher, *(m_creature->GetMap())); cell.Visit(p, grid_unit_searcher, *(m_creature->GetMap()));
} }
//dealdamege //dealdamege
for (std::list<Unit*>::iterator i = tempUnitMap.begin(); i != tempUnitMap.end(); ++i) for (std::list<Unit*>::const_iterator i = tempUnitMap.begin(); i != tempUnitMap.end(); ++i)
{ {
if (!Cloud->IsWithinDist(*i, 6, false)) if (!Cloud->IsWithinDist(*i, 6, false))
{ {
@@ -306,7 +306,7 @@ struct boss_hex_lord_malacrassAI : public ScriptedAI
AddList.erase(AddList.begin()+rand()%AddList.size()); AddList.erase(AddList.begin()+rand()%AddList.size());
uint8 i = 0; uint8 i = 0;
for (std::vector<uint32>::iterator itr = AddList.begin(); itr != AddList.end(); ++itr, ++i) for (std::vector<uint32>::const_iterator itr = AddList.begin(); itr != AddList.end(); ++itr, ++i)
AddEntry[i] = *itr; AddEntry[i] = *itr;
} }
@@ -246,7 +246,7 @@ struct boss_janalaiAI : public ScriptedAI
if (!templist.size()) if (!templist.size())
return false; return false;
for (std::list<Creature*>::iterator i = templist.begin(); i != templist.end(); ++i) for (std::list<Creature*>::const_iterator i = templist.begin(); i != templist.end(); ++i)
{ {
if (uiAction == 1) if (uiAction == 1)
(*i)->SetDisplayId(10056); (*i)->SetDisplayId(10056);
@@ -275,7 +275,7 @@ struct boss_janalaiAI : public ScriptedAI
cell.Visit(pair, cSearcher, *(m_creature->GetMap())); cell.Visit(pair, cSearcher, *(m_creature->GetMap()));
} }
for (std::list<Creature*>::iterator i = templist.begin(); i != templist.end(); ++i) for (std::list<Creature*>::const_iterator i = templist.begin(); i != templist.end(); ++i)
{ {
(*i)->CastSpell(*i, SPELL_FIRE_BOMB_DAMAGE, true); (*i)->CastSpell(*i, SPELL_FIRE_BOMB_DAMAGE, true);
(*i)->RemoveAllAuras(); (*i)->RemoveAllAuras();
@@ -510,7 +510,7 @@ struct mob_amanishi_hatcherAI : public ScriptedAI
//error_log("Eggs %d at %d", templist.size(), side); //error_log("Eggs %d at %d", templist.size(), side);
for (std::list<Creature*>::iterator i = templist.begin(); i != templist.end() && num > 0; ++i) for (std::list<Creature*>::const_iterator i = templist.begin(); i != templist.end() && num > 0; ++i)
if ((*i)->GetDisplayId() != 11686) if ((*i)->GetDisplayId() != 11686)
{ {
(*i)->CastSpell(*i, SPELL_HATCH_EGG, false); (*i)->CastSpell(*i, SPELL_HATCH_EGG, false);
@@ -167,7 +167,7 @@ struct boss_nalorakkAI : public ScriptedAI
if (!templist.size()) if (!templist.size())
return; return;
for (std::list<Creature*>::iterator i = templist.begin(); i != templist.end(); ++i) for (std::list<Creature*>::const_iterator i = templist.begin(); i != templist.end(); ++i)
{ {
if ((*i) && m_creature->IsWithinDistInMap((*i),25)) if ((*i) && m_creature->IsWithinDistInMap((*i),25))
{ {
@@ -218,7 +218,7 @@ struct boss_mandokirAI : public ScriptedAI
{ {
TargetInRange = 0; TargetInRange = 0;
std::list<HostileReference*>::iterator i = m_creature->getThreatManager().getThreatList().begin(); std::list<HostileReference*>::const_iterator i = m_creature->getThreatManager().getThreatList().begin();
for (; i != m_creature->getThreatManager().getThreatList().end(); ++i) for (; i != m_creature->getThreatManager().getThreatList().end(); ++i)
{ {
Unit* pUnit = Unit::GetUnit(*m_creature, (*i)->getUnitGuid()); Unit* pUnit = Unit::GetUnit(*m_creature, (*i)->getUnitGuid());
+2 -2
View File
@@ -488,7 +488,7 @@ struct npc_geezleAI : public ScriptedAI
Trinity::PlayerListSearcher<Trinity::AnyPlayerInObjectRangeCheck> searcher(m_creature, players, checker); Trinity::PlayerListSearcher<Trinity::AnyPlayerInObjectRangeCheck> searcher(m_creature, players, checker);
m_creature->VisitNearbyWorldObject(radius, searcher); m_creature->VisitNearbyWorldObject(radius, searcher);
for (std::list<Player*>::iterator itr = players.begin(); itr != players.end(); ++itr) for (std::list<Player*>::const_iterator itr = players.begin(); itr != players.end(); ++itr)
{ {
if((*itr)->GetQuestStatus(QUEST_TREES_COMPANY)==QUEST_STATUS_INCOMPLETE if((*itr)->GetQuestStatus(QUEST_TREES_COMPANY)==QUEST_STATUS_INCOMPLETE
&&(*itr)->HasAura(SPELL_TREE_DISGUISE) ) &&(*itr)->HasAura(SPELL_TREE_DISGUISE) )
@@ -505,7 +505,7 @@ struct npc_geezleAI : public ScriptedAI
if (!FlagList.empty()) if (!FlagList.empty())
{ {
for (std::list<GameObject*>::iterator itr = FlagList.begin(); itr != FlagList.end(); ++itr) for (std::list<GameObject*>::const_iterator itr = FlagList.begin(); itr != FlagList.end(); ++itr)
{ {
if (despawn) if (despawn)
{ {
+1 -1
View File
@@ -72,7 +72,7 @@ struct boss_azuregosAI : public ScriptedAI
{ {
DoScriptText(SAY_TELEPORT, m_creature); DoScriptText(SAY_TELEPORT, m_creature);
std::list<HostileReference*>& m_threatlist = m_creature->getThreatManager().getThreatList(); std::list<HostileReference*>& m_threatlist = m_creature->getThreatManager().getThreatList();
std::list<HostileReference*>::iterator i = m_threatlist.begin(); std::list<HostileReference*>::const_iterator i = m_threatlist.begin();
for (i = m_threatlist.begin(); i!= m_threatlist.end(); ++i) for (i = m_threatlist.begin(); i!= m_threatlist.end(); ++i)
{ {
Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid()); Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid());
@@ -307,7 +307,7 @@ struct boss_archimondeAI : public hyjal_trashAI
return false; return false;
std::list<Unit*> targets; std::list<Unit*> targets;
std::list<HostileReference*>::iterator itr = m_threatlist.begin(); std::list<HostileReference*>::const_iterator itr = m_threatlist.begin();
for (; itr != m_threatlist.end(); ++itr) for (; itr != m_threatlist.end(); ++itr)
{ {
Unit* pUnit = Unit::GetUnit((*m_creature), (*itr)->getUnitGuid()); Unit* pUnit = Unit::GetUnit((*m_creature), (*itr)->getUnitGuid());
@@ -153,7 +153,7 @@ struct boss_kazrogalAI : public hyjal_trashAI
m_creature->CastCustomSpell(m_creature, SPELL_MARK, NULL, NULL, NULL, false, NULL, NULL, m_creature->GetGUID()); m_creature->CastCustomSpell(m_creature, SPELL_MARK, NULL, NULL, NULL, false, NULL, NULL, m_creature->GetGUID());
std::list<HostileReference *> t_list = m_creature->getThreatManager().getThreatList(); std::list<HostileReference *> t_list = m_creature->getThreatManager().getThreatList();
for (std::list<HostileReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) for (std::list<HostileReference *>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
{ {
Unit *pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); Unit *pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid());
if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER && pTarget->getPowerType() == POWER_MANA) if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER && pTarget->getPowerType() == POWER_MANA)
@@ -950,7 +950,7 @@ void hyjalAI::HideNearPos(float x, float y)
if (!creatures.empty()) if (!creatures.empty())
{ {
for (std::list<Creature*>::iterator itr = creatures.begin(); itr != creatures.end(); ++itr) for (std::list<Creature*>::const_iterator itr = creatures.begin(); itr != creatures.end(); ++itr)
{ {
(*itr)->SetVisibility(VISIBILITY_OFF); (*itr)->SetVisibility(VISIBILITY_OFF);
(*itr)->setFaction(35);//make them friendly so mobs won't attack them (*itr)->setFaction(35);//make them friendly so mobs won't attack them
@@ -1007,7 +1007,7 @@ void hyjalAI::WaypointReached(uint32 i)
if (!creatures.empty()) if (!creatures.empty())
{ {
for (std::list<Creature*>::iterator itr = creatures.begin(); itr != creatures.end(); ++itr) for (std::list<Creature*>::const_iterator itr = creatures.begin(); itr != creatures.end(); ++itr)
{ {
if ((*itr) && (*itr)->isAlive() && (*itr) != m_creature && (*itr)->GetEntry() != JAINA) if ((*itr) && (*itr)->isAlive() && (*itr) != m_creature && (*itr)->GetEntry() != JAINA)
{ {
@@ -1048,7 +1048,7 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff)
if (!creatures.empty()) if (!creatures.empty())
{ {
for (std::list<Creature*>::iterator itr = creatures.begin(); itr != creatures.end(); ++itr) for (std::list<Creature*>::const_iterator itr = creatures.begin(); itr != creatures.end(); ++itr)
{ {
if ((*itr) && (*itr)->isAlive()) if ((*itr) && (*itr)->isAlive())
{ {
@@ -220,7 +220,7 @@ struct instance_mount_hyjal : public ScriptedInstance
{ {
if (!m_uiAncientGemGUID.empty()) if (!m_uiAncientGemGUID.empty())
{ {
for (std::list<uint64>::iterator itr = m_uiAncientGemGUID.begin(); itr != m_uiAncientGemGUID.end(); ++itr) for (std::list<uint64>::const_iterator itr = m_uiAncientGemGUID.begin(); itr != m_uiAncientGemGUID.end(); ++itr)
{ {
//don't know how long it expected //don't know how long it expected
DoRespawnGameObject(*itr,DAY); DoRespawnGameObject(*itr,DAY);
+4 -4
View File
@@ -784,7 +784,7 @@ struct mob_qiraj_war_spawnAI : public ScriptedAI
uint32 SpellTimer1, SpellTimer2, SpellTimer3,SpellTimer4; uint32 SpellTimer1, SpellTimer2, SpellTimer3,SpellTimer4;
bool Timers; bool Timers;
bool hasTarget; bool hasTarget;
Unit* trigger;
void Reset() void Reset()
{ {
MobGUID = 0; MobGUID = 0;
@@ -861,7 +861,7 @@ struct mob_qiraj_war_spawnAI : public ScriptedAI
if(pTarget) if(pTarget)
m_creature->AI()->AttackStart(pTarget); m_creature->AI()->AttackStart(pTarget);
} }
if (!(trigger = m_creature->FindNearestCreature(15379,100))) if (!(m_creature->FindNearestCreature(15379,100)))
DoCast(m_creature, 33652); DoCast(m_creature, 33652);
if (!UpdateVictim()) if (!UpdateVictim())
@@ -966,7 +966,7 @@ struct npc_anachronos_quest_triggerAI : public ScriptedAI
const Group::MemberSlotList members = EventGroup->GetMemberSlots(); const Group::MemberSlotList members = EventGroup->GetMemberSlots();
for (Group::member_citerator itr = members.begin(); itr!= members.end(); itr++) for (Group::member_citerator itr = members.begin(); itr!= members.end(); ++itr)
{ {
GroupMember = (Unit::GetPlayer(itr->guid)); GroupMember = (Unit::GetPlayer(itr->guid));
if(!GroupMember) if(!GroupMember)
@@ -1039,7 +1039,7 @@ bool GOQuestAccept_GO_crystalline_tear(Player* plr, GameObject* go, Quest const*
Unit *Merithra = Anachronos_Quest_Trigger->SummonCreature(15378,-8034.535,1535.14,2.61,0,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,150000); Unit *Merithra = Anachronos_Quest_Trigger->SummonCreature(15378,-8034.535,1535.14,2.61,0,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,150000);
Unit *Caelestrasz = Anachronos_Quest_Trigger->SummonCreature(15379,-8032.767, 1533.148,2.61, 1.5,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,150000); Unit *Caelestrasz = Anachronos_Quest_Trigger->SummonCreature(15379,-8032.767, 1533.148,2.61, 1.5,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,150000);
Unit *Arygos = Anachronos_Quest_Trigger->SummonCreature(15380,-8034.52, 1537.843, 2.61, 5.7,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,150000); Unit *Arygos = Anachronos_Quest_Trigger->SummonCreature(15380,-8034.52, 1537.843, 2.61, 5.7,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,150000);
Unit *Fandral = Anachronos_Quest_Trigger->SummonCreature(15382,-8028.462, 1535.843, 2.61, 3.141592,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,215000); /* Unit *Fandral = */ Anachronos_Quest_Trigger->SummonCreature(15382,-8028.462, 1535.843, 2.61, 3.141592,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,215000);
Creature *Anachronos = Anachronos_Quest_Trigger->SummonCreature(15381,-8028.75, 1538.795, 2.61, 4,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,220000); Creature *Anachronos = Anachronos_Quest_Trigger->SummonCreature(15381,-8028.75, 1538.795, 2.61, 4,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,220000);
if(Merithra) if(Merithra)
+4 -3
View File
@@ -461,7 +461,7 @@ struct npc_toogaAI : public FollowerAI
uint32 m_uiPostEventTimer; uint32 m_uiPostEventTimer;
uint32 m_uiPhasePostEvent; uint32 m_uiPhasePostEvent;
Unit* pTorta; uint64 TortaGUID;
void Reset() void Reset()
{ {
@@ -469,7 +469,7 @@ struct npc_toogaAI : public FollowerAI
m_uiPostEventTimer = 1000; m_uiPostEventTimer = 1000;
m_uiPhasePostEvent = 0; m_uiPhasePostEvent = 0;
pTorta = NULL; TortaGUID = 0;
} }
void MoveInLineOfSight(Unit *pWho) void MoveInLineOfSight(Unit *pWho)
@@ -486,7 +486,7 @@ struct npc_toogaAI : public FollowerAI
pPlayer->GroupEventHappens(QUEST_TOOGA, m_creature); pPlayer->GroupEventHappens(QUEST_TOOGA, m_creature);
} }
pTorta = pWho; TortaGUID = pWho->GetGUID();
SetFollowComplete(true); SetFollowComplete(true);
} }
} }
@@ -514,6 +514,7 @@ struct npc_toogaAI : public FollowerAI
{ {
m_uiPostEventTimer = 5000; m_uiPostEventTimer = 5000;
Unit *pTorta = Unit::GetUnit(*m_creature, TortaGUID);
if (!pTorta || !pTorta->isAlive()) if (!pTorta || !pTorta->isAlive())
{ {
//something happened, so just complete //something happened, so just complete
@@ -541,10 +541,10 @@ struct cthunAI : public Scripted_NoMovementAI
if (Stomach_Map.empty()) if (Stomach_Map.empty())
return NULL; return NULL;
UNORDERED_MAP<uint64, bool>::iterator i = Stomach_Map.begin(); UNORDERED_MAP<uint64, bool>::const_iterator i = Stomach_Map.begin();
std::list<Unit*> temp; std::list<Unit*> temp;
std::list<Unit*>::iterator j; std::list<Unit*>::const_iterator j;
//Get all players in map //Get all players in map
while (i != Stomach_Map.end()) while (i != Stomach_Map.end())
@@ -654,7 +654,7 @@ struct cthunAI : public Scripted_NoMovementAI
//Place all units in threat list on outside of stomach //Place all units in threat list on outside of stomach
Stomach_Map.clear(); Stomach_Map.clear();
std::list<HostileReference*>::iterator i = m_creature->getThreatManager().getThreatList().begin(); std::list<HostileReference*>::const_iterator i = m_creature->getThreatManager().getThreatList().begin();
for (; i != m_creature->getThreatManager().getThreatList().end(); ++i) for (; i != m_creature->getThreatManager().getThreatList().end(); ++i)
{ {
//Outside stomach //Outside stomach
@@ -320,7 +320,7 @@ struct boss_twinemperorsAI : public ScriptedAI
Creature *nearb = NULL; Creature *nearb = NULL;
for (std::list<Creature*>::iterator iter = lUnitList.begin(); iter != lUnitList.end(); ++iter) for (std::list<Creature*>::const_iterator iter = lUnitList.begin(); iter != lUnitList.end(); ++iter)
{ {
Creature *c = *iter; Creature *c = *iter;
if (c) if (c)
@@ -145,7 +145,7 @@ struct aqsentinelAI : public ScriptedAI
if (assistList.empty()) if (assistList.empty())
return; return;
for (std::list<Creature*>::iterator iter = assistList.begin(); iter != assistList.end(); ++iter) for (std::list<Creature*>::const_iterator iter = assistList.begin(); iter != assistList.end(); ++iter)
AddBuddyToList((*iter)->GetGUID()); AddBuddyToList((*iter)->GetGUID());
} }
@@ -249,7 +249,7 @@ struct aqsentinelAI : public ScriptedAI
Unit *GetHatedManaUser() const Unit *GetHatedManaUser() const
{ {
std::list<HostileReference*>::iterator i; std::list<HostileReference*>::const_iterator i;
for (i = m_creature->getThreatManager().getThreatList().begin(); i != m_creature->getThreatManager().getThreatList().end(); ++i) for (i = m_creature->getThreatManager().getThreatList().begin(); i != m_creature->getThreatManager().getThreatList().end(); ++i)
{ {
Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid()); Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid());
+4 -3
View File
@@ -175,14 +175,14 @@ struct npc_ringoAI : public FollowerAI
uint32 m_uiEndEventProgress; uint32 m_uiEndEventProgress;
uint32 m_uiEndEventTimer; uint32 m_uiEndEventTimer;
Unit* pSpraggle; uint64 SpraggleGUID;
void Reset() void Reset()
{ {
m_uiFaintTimer = urand(30000, 60000); m_uiFaintTimer = urand(30000, 60000);
m_uiEndEventProgress = 0; m_uiEndEventProgress = 0;
m_uiEndEventTimer = 1000; m_uiEndEventTimer = 1000;
pSpraggle = NULL; SpraggleGUID = 0;
} }
void MoveInLineOfSight(Unit *pWho) void MoveInLineOfSight(Unit *pWho)
@@ -199,7 +199,7 @@ struct npc_ringoAI : public FollowerAI
pPlayer->GroupEventHappens(QUEST_A_LITTLE_HELP, m_creature); pPlayer->GroupEventHappens(QUEST_A_LITTLE_HELP, m_creature);
} }
pSpraggle = pWho; SpraggleGUID = pWho->GetGUID();
SetFollowComplete(true); SetFollowComplete(true);
} }
} }
@@ -244,6 +244,7 @@ struct npc_ringoAI : public FollowerAI
{ {
if (m_uiEndEventTimer <= uiDiff) if (m_uiEndEventTimer <= uiDiff)
{ {
Unit *pSpraggle = Unit::GetUnit(*m_creature, SpraggleGUID);
if (!pSpraggle || !pSpraggle->isAlive()) if (!pSpraggle || !pSpraggle->isAlive())
{ {
SetFollowComplete(); SetFollowComplete();
@@ -205,7 +205,7 @@ struct boss_volazjAI : public ScriptedAI
Summons.Despawn(summon); Summons.Despawn(summon);
// Check if all summons in this phase killed // Check if all summons in this phase killed
for(SummonList::const_iterator iter = Summons.begin(); iter!=Summons.end(); iter++) for(SummonList::const_iterator iter = Summons.begin(); iter!=Summons.end(); ++iter)
{ {
if(Creature *visage = Unit::GetCreature(*m_creature, *iter)) if(Creature *visage = Unit::GetCreature(*m_creature, *iter))
{ {
@@ -209,7 +209,7 @@ struct boss_taldaramAI : public ScriptedAI
Unit *pTarget = NULL; Unit *pTarget = NULL;
std::list<HostileReference *> t_list = m_creature->getThreatManager().getThreatList(); std::list<HostileReference *> t_list = m_creature->getThreatManager().getThreatList();
std::vector<Unit *> target_list; std::vector<Unit *> target_list;
for (std::list<HostileReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) for (std::list<HostileReference *>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
{ {
pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid());
// exclude pets & totems // exclude pets & totems
@@ -131,7 +131,7 @@ struct boss_black_knightAI : public ScriptedAI
if (SummonList.empty()) if (SummonList.empty())
return; return;
for(std::list<uint64>::iterator itr = SummonList.begin(); itr != SummonList.end(); ++itr) for(std::list<uint64>::const_iterator itr = SummonList.begin(); itr != SummonList.end(); ++itr)
{ {
if (Creature* pTemp = Unit::GetCreature(*m_creature, *itr)) if (Creature* pTemp = Unit::GetCreature(*m_creature, *itr))
if (pTemp) if (pTemp)
@@ -171,7 +171,7 @@ struct instance_trial_of_the_champion : public ScriptedInstance
m_auiEncounter[0] = uiData; m_auiEncounter[0] = uiData;
if (uiData == IN_PROGRESS) if (uiData == IN_PROGRESS)
{ {
for(std::list<uint64>::iterator itr = VehicleList.begin(); itr != VehicleList.end(); ++itr) for(std::list<uint64>::const_iterator itr = VehicleList.begin(); itr != VehicleList.end(); ++itr)
if (Creature* pSummon = instance->GetCreature(*itr)) if (Creature* pSummon = instance->GetCreature(*itr))
pSummon->RemoveFromWorld(); pSummon->RemoveFromWorld();
}else if (uiData == DONE) }else if (uiData == DONE)
@@ -141,7 +141,7 @@ struct npc_announcer_toc5AI : public ScriptedAI
break; break;
} }
for(std::list<uint64>::iterator itr = TempList.begin(); itr != TempList.end(); ++itr) for(std::list<uint64>::const_iterator itr = TempList.begin(); itr != TempList.end(); ++itr)
if (Creature* pSummon = Unit::GetCreature(*m_creature, *itr)) if (Creature* pSummon = Unit::GetCreature(*m_creature, *itr))
AggroAllPlayers(pSummon); AggroAllPlayers(pSummon);
}else if (uiLesserChampions == 9) }else if (uiLesserChampions == 9)
@@ -416,7 +416,7 @@ struct npc_announcer_toc5AI : public ScriptedAI
case 3: case 3:
if (!Champion1List.empty()) if (!Champion1List.empty())
{ {
for(std::list<uint64>::iterator itr = Champion1List.begin(); itr != Champion1List.end(); ++itr) for(std::list<uint64>::const_iterator itr = Champion1List.begin(); itr != Champion1List.end(); ++itr)
if (Creature* pSummon = Unit::GetCreature(*m_creature, *itr)) if (Creature* pSummon = Unit::GetCreature(*m_creature, *itr))
AggroAllPlayers(pSummon); AggroAllPlayers(pSummon);
NextStep(0,false); NextStep(0,false);
+4 -2
View File
@@ -48,7 +48,6 @@ struct npc_warmage_violetstandAI : public Scripted_NoMovementAI
npc_warmage_violetstandAI(Creature* pCreature) : Scripted_NoMovementAI(pCreature){} npc_warmage_violetstandAI(Creature* pCreature) : Scripted_NoMovementAI(pCreature){}
uint32 m_uiTimer; //Timer until recast uint32 m_uiTimer; //Timer until recast
std::list<Creature *> orbList;
void Reset() void Reset()
{ {
@@ -69,10 +68,12 @@ struct npc_warmage_violetstandAI : public Scripted_NoMovementAI
switch(me->GetEntry()) switch(me->GetEntry())
{ {
case NPC_WARMAGE_SARINA: case NPC_WARMAGE_SARINA:
{
std::list<Creature*> orbList;
GetCreatureListWithEntryInGrid(orbList, m_creature, NPC_TRANSITUS_SHIELD_DUMMY, 32.0f); GetCreatureListWithEntryInGrid(orbList, m_creature, NPC_TRANSITUS_SHIELD_DUMMY, 32.0f);
if (!orbList.empty()) if (!orbList.empty())
{ {
for (std::list<Creature*>::iterator itr = orbList.begin(); itr != orbList.end(); ++itr) for (std::list<Creature*>::const_iterator itr = orbList.begin(); itr != orbList.end(); ++itr)
{ {
if (Creature* pOrb = *itr) if (Creature* pOrb = *itr)
if (pOrb->GetPositionY() < 1000) if (pOrb->GetPositionY() < 1000)
@@ -80,6 +81,7 @@ struct npc_warmage_violetstandAI : public Scripted_NoMovementAI
} }
} }
m_uiTimer = 90000; m_uiTimer = 90000;
}
break; break;
case NPC_WARMAGE_HALISTER: case NPC_WARMAGE_HALISTER:
case NPC_WARMAGE_ILSUDRIA: case NPC_WARMAGE_ILSUDRIA:
@@ -106,7 +106,7 @@ struct boss_novosAI : public Scripted_NoMovementAI
luiCrystals.push_back(pInstance->GetData64(DATA_NOVOS_CRYSTAL_2)); luiCrystals.push_back(pInstance->GetData64(DATA_NOVOS_CRYSTAL_2));
luiCrystals.push_back(pInstance->GetData64(DATA_NOVOS_CRYSTAL_3)); luiCrystals.push_back(pInstance->GetData64(DATA_NOVOS_CRYSTAL_3));
luiCrystals.push_back(pInstance->GetData64(DATA_NOVOS_CRYSTAL_4)); luiCrystals.push_back(pInstance->GetData64(DATA_NOVOS_CRYSTAL_4));
for (std::list<uint64>::iterator itr = luiCrystals.begin(); itr != luiCrystals.end(); ++itr) for (std::list<uint64>::const_iterator itr = luiCrystals.begin(); itr != luiCrystals.end(); ++itr)
{ {
if (GameObject* pTemp = pInstance->instance->GetGameObject(*itr)) if (GameObject* pTemp = pInstance->instance->GetGameObject(*itr))
pTemp->SetGoState(GO_STATE_READY); pTemp->SetGoState(GO_STATE_READY);
@@ -123,7 +123,7 @@ struct boss_novosAI : public Scripted_NoMovementAI
DoCast(SPELL_ARCANE_FIELD); DoCast(SPELL_ARCANE_FIELD);
if (pInstance) if (pInstance)
{ {
for (std::list<uint64>::iterator itr = luiCrystals.begin(); itr != luiCrystals.end(); ++itr) for (std::list<uint64>::const_iterator itr = luiCrystals.begin(); itr != luiCrystals.end(); ++itr)
{ {
if (GameObject *pTemp = pInstance->instance->GetGameObject(*itr)) if (GameObject *pTemp = pInstance->instance->GetGameObject(*itr))
pTemp->SetGoState(GO_STATE_ACTIVE); pTemp->SetGoState(GO_STATE_ACTIVE);
@@ -147,7 +147,7 @@ struct boss_tharon_jaAI : public ScriptedAI
DoScriptText(RAND(SAY_FLESH_1,SAY_FLESH_2),m_creature); DoScriptText(RAND(SAY_FLESH_1,SAY_FLESH_2),m_creature);
m_creature->SetDisplayId(MODEL_FLESH); m_creature->SetDisplayId(MODEL_FLESH);
std::list<HostileReference*>& threatlist = m_creature->getThreatManager().getThreatList(); std::list<HostileReference*>& threatlist = m_creature->getThreatManager().getThreatList();
for (std::list<HostileReference*>::iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) for (std::list<HostileReference*>::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
{ {
Unit *pTemp = Unit::GetUnit((*m_creature),(*itr)->getUnitGuid()); Unit *pTemp = Unit::GetUnit((*m_creature),(*itr)->getUnitGuid());
if (pTemp && pTemp->GetTypeId() == TYPEID_PLAYER) if (pTemp && pTemp->GetTypeId() == TYPEID_PLAYER)
@@ -203,7 +203,7 @@ struct boss_tharon_jaAI : public ScriptedAI
uiRainOfFireTimer = urand(14*IN_MILISECONDS,18*IN_MILISECONDS); uiRainOfFireTimer = urand(14*IN_MILISECONDS,18*IN_MILISECONDS);
uiShadowVolleyTimer = urand(8*IN_MILISECONDS,10*IN_MILISECONDS); uiShadowVolleyTimer = urand(8*IN_MILISECONDS,10*IN_MILISECONDS);
std::list<HostileReference*>& threatlist = m_creature->getThreatManager().getThreatList(); std::list<HostileReference*>& threatlist = m_creature->getThreatManager().getThreatList();
for (std::list<HostileReference*>::iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) for (std::list<HostileReference*>::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
{ {
Unit *pTemp = Unit::GetUnit((*m_creature),(*itr)->getUnitGuid()); Unit *pTemp = Unit::GetUnit((*m_creature),(*itr)->getUnitGuid());
if (pTemp && pTemp->GetTypeId() == TYPEID_PLAYER) if (pTemp && pTemp->GetTypeId() == TYPEID_PLAYER)
+31 -25
View File
@@ -156,11 +156,8 @@ struct npc_emilyAI : public npc_escortAI
uint64 RWORGGUID; uint64 RWORGGUID;
uint64 MrfloppyGUID; uint64 MrfloppyGUID;
Creature* Mrfloppy;
Creature* RWORG;
bool Completed; bool Completed;
void JustSummoned(Creature* pSummoned) void JustSummoned(Creature* pSummoned)
{ {
if (Creature* Mrfloppy = GetClosestCreatureWithEntry(m_creature, NPC_MRFLOPPY, 50.0f)) if (Creature* Mrfloppy = GetClosestCreatureWithEntry(m_creature, NPC_MRFLOPPY, 50.0f))
@@ -177,41 +174,56 @@ struct npc_emilyAI : public npc_escortAI
switch (i) switch (i)
{ {
case 9: case 9:
Mrfloppy = GetClosestCreatureWithEntry(m_creature, NPC_MRFLOPPY, 100.0f); if (Creature *Mrfloppy = GetClosestCreatureWithEntry(m_creature, NPC_MRFLOPPY, 100.0f))
MrfloppyGUID = Mrfloppy->GetGUID();
break; break;
case 10: case 10:
if (Mrfloppy) if (Creature *Mrfloppy = Unit::GetCreature(*m_creature, MrfloppyGUID))
{ {
DoScriptText(SAY_WORGHAGGRO1, m_creature); DoScriptText(SAY_WORGHAGGRO1, m_creature);
m_creature->SummonCreature(NPC_HUNGRY_WORG,m_creature->GetPositionX()+5,m_creature->GetPositionY()+2,m_creature->GetPositionZ()+1,3.229f,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,120000); m_creature->SummonCreature(NPC_HUNGRY_WORG,m_creature->GetPositionX()+5,m_creature->GetPositionY()+2,m_creature->GetPositionZ()+1,3.229f,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,120000);
} }
break; break;
case 11: case 11:
if (Creature *Mrfloppy = Unit::GetCreature(*m_creature, MrfloppyGUID))
Mrfloppy->GetMotionMaster()->MoveFollow(m_creature, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); Mrfloppy->GetMotionMaster()->MoveFollow(m_creature, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
break; break;
case 17: case 17:
if (Creature *Mrfloppy = Unit::GetCreature(*m_creature, MrfloppyGUID))
Mrfloppy->GetMotionMaster()->MovePoint(0, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ()); Mrfloppy->GetMotionMaster()->MovePoint(0, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ());
DoScriptText(SAY_WORGRAGGRO3, m_creature); DoScriptText(SAY_WORGRAGGRO3, m_creature);
RWORG = m_creature->SummonCreature(NPC_RAVENOUS_WORG,m_creature->GetPositionX()+10,m_creature->GetPositionY()+8,m_creature->GetPositionZ()+2,3.229f,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,120000); if (Creature *RWORG = m_creature->SummonCreature(NPC_RAVENOUS_WORG,m_creature->GetPositionX()+10,m_creature->GetPositionY()+8,m_creature->GetPositionZ()+2,3.229f,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,120000))
{
RWORG->setFaction(35); RWORG->setFaction(35);
RWORGGUID = RWORG->GetGUID();
}
break; break;
case 18: case 18:
if (Mrfloppy) if (Creature *Mrfloppy = Unit::GetCreature(*m_creature, MrfloppyGUID))
{ {
if (Creature *RWORG = Unit::GetCreature(*m_creature, RWORGGUID))
RWORG->GetMotionMaster()->MovePoint(0, Mrfloppy->GetPositionX(), Mrfloppy->GetPositionY(), Mrfloppy->GetPositionZ()); RWORG->GetMotionMaster()->MovePoint(0, Mrfloppy->GetPositionX(), Mrfloppy->GetPositionY(), Mrfloppy->GetPositionZ());
DoCast(Mrfloppy,SPELL_MRFLOPPY); DoCast(Mrfloppy,SPELL_MRFLOPPY);
} }
break; break;
case 19: case 19:
if (Creature *Mrfloppy = Unit::GetCreature(*m_creature, MrfloppyGUID))
{
if (Mrfloppy->HasAura(SPELL_MRFLOPPY, 0)) if (Mrfloppy->HasAura(SPELL_MRFLOPPY, 0))
{
if (Creature *RWORG = Unit::GetCreature(*m_creature, RWORGGUID))
Mrfloppy->EnterVehicle(RWORG); Mrfloppy->EnterVehicle(RWORG);
}
}
break; break;
case 20: case 20:
if (Mrfloppy) if (Creature *RWORG = Unit::GetCreature(*m_creature, RWORGGUID))
RWORG->HandleEmoteCommand(34); RWORG->HandleEmoteCommand(34);
break; break;
case 21: case 21:
if (Mrfloppy) if (Creature *Mrfloppy = Unit::GetCreature(*m_creature, MrfloppyGUID))
{
if (Creature *RWORG = Unit::GetCreature(*m_creature, RWORGGUID))
{ {
RWORG->Kill(Mrfloppy); RWORG->Kill(Mrfloppy);
Mrfloppy->ExitVehicle(); Mrfloppy->ExitVehicle();
@@ -219,16 +231,21 @@ struct npc_emilyAI : public npc_escortAI
RWORG->GetMotionMaster()->MovePoint(0, RWORG->GetPositionX()+10,RWORG->GetPositionY()+80,RWORG->GetPositionZ()); RWORG->GetMotionMaster()->MovePoint(0, RWORG->GetPositionX()+10,RWORG->GetPositionY()+80,RWORG->GetPositionZ());
DoScriptText(SAY_VICTORY2, m_creature); DoScriptText(SAY_VICTORY2, m_creature);
} }
}
break; break;
case 22: case 22:
if (Mrfloppy && Mrfloppy->isDead()) if (Creature *Mrfloppy = Unit::GetCreature(*m_creature, MrfloppyGUID))
{ {
if (Mrfloppy->isDead())
{
if (Creature *RWORG = Unit::GetCreature(*m_creature, RWORGGUID))
RWORG->DisappearAndDie(); RWORG->DisappearAndDie();
m_creature->GetMotionMaster()->MovePoint(0, Mrfloppy->GetPositionX(), Mrfloppy->GetPositionY(), Mrfloppy->GetPositionZ()); m_creature->GetMotionMaster()->MovePoint(0, Mrfloppy->GetPositionX(), Mrfloppy->GetPositionY(), Mrfloppy->GetPositionZ());
Mrfloppy->setDeathState(ALIVE); Mrfloppy->setDeathState(ALIVE);
Mrfloppy->GetMotionMaster()->MoveFollow(m_creature, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); Mrfloppy->GetMotionMaster()->MoveFollow(m_creature, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
DoScriptText(SAY_VICTORY3, m_creature); DoScriptText(SAY_VICTORY3, m_creature);
} }
}
break; break;
case 24: case 24:
if (pPlayer) if (pPlayer)
@@ -244,7 +261,7 @@ struct npc_emilyAI : public npc_escortAI
break; break;
case 27: case 27:
m_creature->DisappearAndDie(); m_creature->DisappearAndDie();
if (Mrfloppy) if (Creature *Mrfloppy = Unit::GetCreature(*m_creature, MrfloppyGUID))
Mrfloppy->DisappearAndDie(); Mrfloppy->DisappearAndDie();
break; break;
} }
@@ -258,8 +275,8 @@ struct npc_emilyAI : public npc_escortAI
void Reset() void Reset()
{ {
m_uiChatTimer = 4000; m_uiChatTimer = 4000;
Mrfloppy = NULL; MrfloppyGUID = 0;
RWORG = NULL; RWORGGUID = 0;
} }
void UpdateAI(const uint32 uiDiff) void UpdateAI(const uint32 uiDiff)
@@ -278,7 +295,6 @@ struct npc_emilyAI : public npc_escortAI
} }
}; };
bool QuestAccept_npc_emily(Player* pPlayer, Creature* pCreature, Quest const* quest) bool QuestAccept_npc_emily(Player* pPlayer, Creature* pCreature, Quest const* quest)
{ {
if (quest->GetQuestId() == QUEST_PERILOUS_ADVENTURE) if (quest->GetQuestId() == QUEST_PERILOUS_ADVENTURE)
@@ -310,17 +326,7 @@ struct npc_mrfloppyAI : public ScriptedAI
uint64 RWORGGUID; uint64 RWORGGUID;
uint64 HWORGGUID; uint64 HWORGGUID;
Creature* HWORG; void Reset() {}
Creature* RWORG;
Creature* Emily;
void Reset()
{
HWORG = NULL;
RWORG = NULL;
Emily = NULL;
}
void EnterCombat(Unit* Who) void EnterCombat(Unit* Who)
{ {
@@ -281,7 +281,7 @@ struct boss_kelthuzadAI : public BossAI
me->setFaction(35); me->setFaction(35);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NOT_SELECTABLE); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NOT_SELECTABLE);
std::map<uint64, float>::iterator itr; std::map<uint64, float>::const_iterator itr;
for (itr = chained.begin(); itr != chained.end(); ++itr) for (itr = chained.begin(); itr != chained.end(); ++itr)
{ {
if (Player* charmed = Unit::GetPlayer((*itr).first)) if (Player* charmed = Unit::GetPlayer((*itr).first))
@@ -326,7 +326,7 @@ struct boss_kelthuzadAI : public BossAI
_JustDied(); _JustDied();
DoScriptText(SAY_DEATH, m_creature); DoScriptText(SAY_DEATH, m_creature);
std::map<uint64, float>::iterator itr; std::map<uint64, float>::const_iterator itr;
for (itr = chained.begin(); itr != chained.end(); ++itr) for (itr = chained.begin(); itr != chained.end(); ++itr)
{ {
if (Player* pPlayer = Unit::GetPlayer((*itr).first)) if (Player* pPlayer = Unit::GetPlayer((*itr).first))
@@ -573,7 +573,7 @@ struct boss_kelthuzadAI : public BossAI
} }
} }
} }
itr++; ++itr;
} }
if (chained.empty()) if (chained.empty())
@@ -597,7 +597,7 @@ struct boss_kelthuzadAI : public BossAI
if (!unitList.empty()) if (!unitList.empty())
{ {
std::vector<Unit*>::iterator itr = unitList.begin(); std::vector<Unit*>::const_iterator itr = unitList.begin();
advance(itr, rand()%unitList.size()); advance(itr, rand()%unitList.size());
DoCast(*itr, SPELL_MANA_DETONATION); DoCast(*itr, SPELL_MANA_DETONATION);
DoScriptText(RAND(SAY_SPECIAL_1,SAY_SPECIAL_2,SAY_SPECIAL_3), me); DoScriptText(RAND(SAY_SPECIAL_1,SAY_SPECIAL_2,SAY_SPECIAL_3), me);
@@ -111,7 +111,7 @@ struct boss_patchwerkAI : public BossAI
//amount of HP within melee distance //amount of HP within melee distance
uint32 MostHP = 0; uint32 MostHP = 0;
Unit* pMostHPTarget = NULL; Unit* pMostHPTarget = NULL;
std::list<HostileReference*>::iterator i = me->getThreatManager().getThreatList().begin(); std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin();
for (; i != me->getThreatManager().getThreatList().end(); ++i) for (; i != me->getThreatManager().getThreatList().end(); ++i)
{ {
Unit *pTarget = (*i)->getTarget(); Unit *pTarget = (*i)->getTarget();
@@ -202,7 +202,7 @@ struct boss_sapphironAI : public BossAI
void ClearIceBlock() void ClearIceBlock()
{ {
for (IceBlockMap::iterator itr = iceblocks.begin(); itr != iceblocks.end(); ++itr) for (IceBlockMap::const_iterator itr = iceblocks.begin(); itr != iceblocks.end(); ++itr)
{ {
if (Player* pPlayer = Unit::GetPlayer(itr->first)) if (Player* pPlayer = Unit::GetPlayer(itr->first))
pPlayer->RemoveAura(SPELL_ICEBOLT); pPlayer->RemoveAura(SPELL_ICEBOLT);
@@ -291,7 +291,7 @@ struct boss_sapphironAI : public BossAI
case EVENT_ICEBOLT: case EVENT_ICEBOLT:
{ {
std::vector<Unit*> targets; std::vector<Unit*> targets;
std::list<HostileReference*>::iterator i = me->getThreatManager().getThreatList().begin(); std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin();
for (; i != me->getThreatManager().getThreatList().end(); ++i) for (; i != me->getThreatManager().getThreatList().end(); ++i)
if ((*i)->getTarget()->GetTypeId() == TYPEID_PLAYER && !(*i)->getTarget()->HasAura(SPELL_ICEBOLT)) if ((*i)->getTarget()->GetTypeId() == TYPEID_PLAYER && !(*i)->getTarget()->HasAura(SPELL_ICEBOLT))
targets.push_back((*i)->getTarget()); targets.push_back((*i)->getTarget());
@@ -300,7 +300,7 @@ struct boss_sapphironAI : public BossAI
iceboltCount = 0; iceboltCount = 0;
else else
{ {
std::vector<Unit*>::iterator itr = targets.begin(); std::vector<Unit*>::const_iterator itr = targets.begin();
advance(itr, rand()%targets.size()); advance(itr, rand()%targets.size());
iceblocks.insert(std::make_pair((*itr)->GetGUID(), 0)); iceblocks.insert(std::make_pair((*itr)->GetGUID(), 0));
DoCast(*itr, SPELL_ICEBOLT); DoCast(*itr, SPELL_ICEBOLT);
@@ -348,7 +348,7 @@ struct boss_sapphironAI : public BossAI
{ {
DoZoneInCombat(); // make sure everyone is in threatlist DoZoneInCombat(); // make sure everyone is in threatlist
std::vector<Unit*> targets; std::vector<Unit*> targets;
std::list<HostileReference*>::iterator i = me->getThreatManager().getThreatList().begin(); std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin();
for (; i != me->getThreatManager().getThreatList().end(); ++i) for (; i != me->getThreatManager().getThreatList().end(); ++i)
{ {
Unit *pTarget = (*i)->getTarget(); Unit *pTarget = (*i)->getTarget();
@@ -362,7 +362,7 @@ struct boss_sapphironAI : public BossAI
continue; continue;
} }
for (IceBlockMap::iterator itr = iceblocks.begin(); itr != iceblocks.end(); ++itr) for (IceBlockMap::const_iterator itr = iceblocks.begin(); itr != iceblocks.end(); ++itr)
{ {
if (GameObject* pGo = GameObject::GetGameObject(*me, itr->second)) if (GameObject* pGo = GameObject::GetGameObject(*me, itr->second))
{ {
@@ -379,7 +379,7 @@ struct boss_sapphironAI : public BossAI
me->CastSpell(me, SPELL_FROST_EXPLOSION, true); me->CastSpell(me, SPELL_FROST_EXPLOSION, true);
for (std::vector<Unit*>::iterator itr = targets.begin(); itr != targets.end(); ++itr) for (std::vector<Unit*>::const_iterator itr = targets.begin(); itr != targets.end(); ++itr)
(*itr)->ApplySpellImmune(0, IMMUNITY_ID, SPELL_FROST_EXPLOSION, false); (*itr)->ApplySpellImmune(0, IMMUNITY_ID, SPELL_FROST_EXPLOSION, false);
} }
}; };
@@ -161,7 +161,7 @@ struct boss_keristraszaAI : public ScriptedAI
if (uiCheckIntenseColdTimer < diff && !bMoreThanTwoIntenseCold) if (uiCheckIntenseColdTimer < diff && !bMoreThanTwoIntenseCold)
{ {
std::list<HostileReference*> ThreatList = m_creature->getThreatManager().getThreatList(); std::list<HostileReference*> ThreatList = m_creature->getThreatManager().getThreatList();
for (std::list<HostileReference*>::const_iterator itr = ThreatList.begin(); itr != ThreatList.end(); itr++) for (std::list<HostileReference*>::const_iterator itr = ThreatList.begin(); itr != ThreatList.end(); ++itr)
{ {
Unit *pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); Unit *pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid());
if (!pTarget || pTarget->GetTypeId() != TYPEID_PLAYER) if (!pTarget || pTarget->GetTypeId() != TYPEID_PLAYER)
@@ -179,7 +179,7 @@ struct boss_ormorokAI : public ScriptedAI
case 3: Healer = CLASS_DRUID; break; case 3: Healer = CLASS_DRUID; break;
case 4: Healer = CLASS_SHAMAN; break; case 4: Healer = CLASS_SHAMAN; break;
} }
std::list<HostileReference*>::iterator i = m_creature->getThreatManager().getThreatList().begin(); std::list<HostileReference*>::const_iterator i = m_creature->getThreatManager().getThreatList().begin();
for (; i != m_creature->getThreatManager().getThreatList().end(); ++i) for (; i != m_creature->getThreatManager().getThreatList().end(); ++i)
{ {
Unit* pTemp = Unit::GetUnit((*m_creature),(*i)->getUnitGuid()); Unit* pTemp = Unit::GetUnit((*m_creature),(*i)->getUnitGuid());
@@ -152,7 +152,7 @@ struct boss_ionarAI : public ScriptedAI
if (m_lSparkGUIDList.empty()) if (m_lSparkGUIDList.empty())
return; return;
for (std::list<uint64>::iterator itr = m_lSparkGUIDList.begin(); itr != m_lSparkGUIDList.end(); ++itr) for (std::list<uint64>::const_iterator itr = m_lSparkGUIDList.begin(); itr != m_lSparkGUIDList.end(); ++itr)
{ {
if (Creature* pTemp = m_creature->GetMap()->GetCreature(*itr)) if (Creature* pTemp = m_creature->GetMap()->GetCreature(*itr))
{ {
@@ -173,7 +173,7 @@ struct boss_ionarAI : public ScriptedAI
Position pos; Position pos;
m_creature->GetPosition(&pos); m_creature->GetPosition(&pos);
for (std::list<uint64>::iterator itr = m_lSparkGUIDList.begin(); itr != m_lSparkGUIDList.end(); ++itr) for (std::list<uint64>::const_iterator itr = m_lSparkGUIDList.begin(); itr != m_lSparkGUIDList.end(); ++itr)
{ {
if (Creature* pSpark = Unit::GetCreature(*m_creature, *itr)) if (Creature* pSpark = Unit::GetCreature(*m_creature, *itr))
{ {
@@ -169,7 +169,7 @@ struct boss_volkhanAI : public ScriptedAI
if (m_lGolemGUIDList.empty()) if (m_lGolemGUIDList.empty())
return; return;
for (std::list<uint64>::iterator itr = m_lGolemGUIDList.begin(); itr != m_lGolemGUIDList.end(); ++itr) for (std::list<uint64>::const_iterator itr = m_lGolemGUIDList.begin(); itr != m_lGolemGUIDList.end(); ++itr)
{ {
if (Creature* pTemp = Unit::GetCreature(*m_creature, *itr)) if (Creature* pTemp = Unit::GetCreature(*m_creature, *itr))
{ {
@@ -186,7 +186,7 @@ struct boss_volkhanAI : public ScriptedAI
if (m_lGolemGUIDList.empty()) if (m_lGolemGUIDList.empty())
return; return;
for (std::list<uint64>::iterator itr = m_lGolemGUIDList.begin(); itr != m_lGolemGUIDList.end(); ++itr) for (std::list<uint64>::const_iterator itr = m_lGolemGUIDList.begin(); itr != m_lGolemGUIDList.end(); ++itr)
{ {
if (Creature* pTemp = Unit::GetCreature(*m_creature, *itr)) if (Creature* pTemp = Unit::GetCreature(*m_creature, *itr))
{ {
@@ -162,7 +162,7 @@ struct mob_tribuna_controllerAI : public ScriptedAI
if (!lKaddrakGUIDList.empty()) if (!lKaddrakGUIDList.empty())
{ {
uint32 uiPositionCounter = 0; uint32 uiPositionCounter = 0;
for (std::list<Creature*>::iterator itr = lKaddrakGUIDList.begin(); itr != lKaddrakGUIDList.end(); ++itr) for (std::list<Creature*>::const_iterator itr = lKaddrakGUIDList.begin(); itr != lKaddrakGUIDList.end(); ++itr)
{ {
if ((*itr)->isAlive()) if ((*itr)->isAlive())
{ {
@@ -277,7 +277,7 @@ struct npc_brann_hosAI : public npc_escortAI
{ {
if (lDwarfGUIDList.empty()) if (lDwarfGUIDList.empty())
return; return;
for (std::list<uint64>::iterator itr = lDwarfGUIDList.begin(); itr != lDwarfGUIDList.end(); ++itr) for (std::list<uint64>::const_iterator itr = lDwarfGUIDList.begin(); itr != lDwarfGUIDList.end(); ++itr)
{ {
Creature* pTemp = Unit::GetCreature(*m_creature, pInstance ? (*itr) : 0); Creature* pTemp = Unit::GetCreature(*m_creature, pInstance ? (*itr) : 0);
if (pTemp && pTemp->isAlive()) if (pTemp && pTemp->isAlive())
@@ -166,7 +166,7 @@ struct boss_algalonAI : public ScriptedAI
if (m_lCollapsingStarGUIDList.empty()) if (m_lCollapsingStarGUIDList.empty())
return; return;
for(std::list<uint64>::iterator itr = m_lCollapsingStarGUIDList.begin(); itr != m_lCollapsingStarGUIDList.end(); ++itr) for(std::list<uint64>::const_iterator itr = m_lCollapsingStarGUIDList.begin(); itr != m_lCollapsingStarGUIDList.end(); ++itr)
{ {
if (Creature* pTemp = Unit::GetCreature(*m_creature, *itr)) if (Creature* pTemp = Unit::GetCreature(*m_creature, *itr))
{ {
@@ -187,7 +187,7 @@ struct boss_razorscaleAI : public BossAI
std::list<Unit*> pTargets; std::list<Unit*> pTargets;
SelectTargetList(pTargets, RAID_MODE(3,9), SELECT_TARGET_RANDOM, 100, true); SelectTargetList(pTargets, RAID_MODE(3,9), SELECT_TARGET_RANDOM, 100, true);
uint8 i = 0; uint8 i = 0;
for (std::list<Unit*>::iterator itr = pTargets.begin(); itr != pTargets.end();) for (std::list<Unit*>::const_iterator itr = pTargets.begin(); itr != pTargets.end();)
{ {
if (m_creature->HasInArc(M_PI, *itr)) if (m_creature->HasInArc(M_PI, *itr))
{ {
@@ -236,7 +236,7 @@ struct boss_ichoronAI : public ScriptedAI
bool bIsWaterElementsAlive = false; bool bIsWaterElementsAlive = false;
if (!m_waterElements.empty()) if (!m_waterElements.empty())
{ {
for (std::list<uint64>::iterator itr = m_waterElements.begin(); itr != m_waterElements.end(); ++itr) for (std::list<uint64>::const_iterator itr = m_waterElements.begin(); itr != m_waterElements.end(); ++itr)
if (Creature* pTemp = Unit::GetCreature(*m_creature, *itr)) if (Creature* pTemp = Unit::GetCreature(*m_creature, *itr))
if (pTemp->isAlive()) if (pTemp->isAlive())
{ {
@@ -100,7 +100,7 @@ struct boss_xevozzAI : public ScriptedAI
if (assistList.empty()) if (assistList.empty())
return; return;
for(std::list<Creature*>::iterator iter = assistList.begin(); iter != assistList.end(); ++iter) for(std::list<Creature*>::const_iterator iter = assistList.begin(); iter != assistList.end(); ++iter)
{ {
if (Creature* pSphere = *iter) if (Creature* pSphere = *iter)
pSphere->Kill(pSphere, false); pSphere->Kill(pSphere, false);
@@ -105,7 +105,7 @@ struct npc_sinclariAI : public ScriptedAI
std::list<Creature*> GuardList; std::list<Creature*> GuardList;
m_creature->GetCreatureListWithEntryInGrid(GuardList, NPC_VIOLET_HOLD_GUARD, 40.0f); m_creature->GetCreatureListWithEntryInGrid(GuardList, NPC_VIOLET_HOLD_GUARD, 40.0f);
if (!GuardList.empty()) if (!GuardList.empty())
for (std::list<Creature*>::iterator itr = GuardList.begin(); itr != GuardList.end(); ++itr) for (std::list<Creature*>::const_iterator itr = GuardList.begin(); itr != GuardList.end(); ++itr)
{ {
if (Creature* pGuard = *itr) if (Creature* pGuard = *itr)
{ {
@@ -122,7 +122,7 @@ struct npc_sinclariAI : public ScriptedAI
std::list<Creature*> GuardList; std::list<Creature*> GuardList;
m_creature->GetCreatureListWithEntryInGrid(GuardList, NPC_VIOLET_HOLD_GUARD, 40.0f); m_creature->GetCreatureListWithEntryInGrid(GuardList, NPC_VIOLET_HOLD_GUARD, 40.0f);
if (!GuardList.empty()) if (!GuardList.empty())
for (std::list<Creature*>::iterator itr = GuardList.begin(); itr != GuardList.end(); ++itr) for (std::list<Creature*>::const_iterator itr = GuardList.begin(); itr != GuardList.end(); ++itr)
{ {
if (Creature* pGuard = *itr) if (Creature* pGuard = *itr)
{ {
+27 -15
View File
@@ -37,11 +37,11 @@ struct npc_drakuru_shacklesAI : public ScriptedAI
{ {
npc_drakuru_shacklesAI(Creature* pCreature) : ScriptedAI(pCreature) {} npc_drakuru_shacklesAI(Creature* pCreature) : ScriptedAI(pCreature) {}
Unit* Rageclaw; uint64 RageclawGUID;
void Reset() void Reset()
{ {
Rageclaw = NULL; RageclawGUID = 0;
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
float x, y, z; float x, y, z;
@@ -50,13 +50,15 @@ struct npc_drakuru_shacklesAI : public ScriptedAI
if (Unit* summon = m_creature->SummonCreature(NPC_RAGECLAW, x, y, z, if (Unit* summon = m_creature->SummonCreature(NPC_RAGECLAW, x, y, z,
0, TEMPSUMMON_DEAD_DESPAWN, 1000)) 0, TEMPSUMMON_DEAD_DESPAWN, 1000))
{ {
Rageclaw = summon; RageclawGUID = summon->GetGUID();
LockRageclaw(); LockRageclaw();
} }
} }
void LockRageclaw() void LockRageclaw()
{ {
Unit *Rageclaw = Unit::GetCreature(*m_creature, RageclawGUID);
// pointer check not needed
m_creature->SetInFront(Rageclaw); m_creature->SetInFront(Rageclaw);
Rageclaw->SetInFront(m_creature); Rageclaw->SetInFront(m_creature);
@@ -69,6 +71,8 @@ struct npc_drakuru_shacklesAI : public ScriptedAI
if (!pWho) if (!pWho)
return; return;
Creature *Rageclaw = Unit::GetCreature(*m_creature, RageclawGUID);
// pointer check not needed
DoCast(Rageclaw, SPELL_FREE_RAGECLAW, true); DoCast(Rageclaw, SPELL_FREE_RAGECLAW, true);
m_creature->setDeathState(DEAD); m_creature->setDeathState(DEAD);
@@ -78,7 +82,7 @@ struct npc_drakuru_shacklesAI : public ScriptedAI
{ {
if (pSpell->Id == SPELL_UNLOCK_SHACKLE) if (pSpell->Id == SPELL_UNLOCK_SHACKLE)
{ {
if (Rageclaw) if (Creature *Rageclaw = Unit::GetCreature(*m_creature, RageclawGUID))
UnlockRageclaw(pCaster); UnlockRageclaw(pCaster);
else else
m_creature->setDeathState(JUST_DIED); m_creature->setDeathState(JUST_DIED);
@@ -240,10 +244,9 @@ struct npc_gurgthockAI : public ScriptedAI
{ {
npc_gurgthockAI(Creature* pCreature) : ScriptedAI(pCreature) npc_gurgthockAI(Creature* pCreature) : ScriptedAI(pCreature)
{ {
pSummon = NULL;
} }
Unit* pSummon; uint64 SummonGUID;
std::list<uint64> SummonList; std::list<uint64> SummonList;
@@ -257,6 +260,7 @@ struct npc_gurgthockAI : public ScriptedAI
void Reset() void Reset()
{ {
SummonGUID = 0;
m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER);
uiTimer = 0; uiTimer = 0;
uiPhase = 0; uiPhase = 0;
@@ -275,7 +279,7 @@ struct npc_gurgthockAI : public ScriptedAI
m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER);
for(std::list<uint64>::iterator itr = SummonList.begin(); itr != SummonList.end(); ++itr) for(std::list<uint64>::const_iterator itr = SummonList.begin(); itr != SummonList.end(); ++itr)
{ {
if (Creature* pTemp = Unit::GetCreature(*m_creature, *itr)) if (Creature* pTemp = Unit::GetCreature(*m_creature, *itr))
if (pTemp) if (pTemp)
@@ -344,15 +348,16 @@ struct npc_gurgthockAI : public ScriptedAI
switch(uiPhase) switch(uiPhase)
{ {
case 1: case 1:
pSummon = m_creature->SummonCreature(NPC_ORINOKO_TUSKBREAKER, SpawnPosition[0], TEMPSUMMON_CORPSE_DESPAWN, 1000); if (Creature *pSummon = m_creature->SummonCreature(NPC_ORINOKO_TUSKBREAKER, SpawnPosition[0], TEMPSUMMON_CORPSE_DESPAWN, 1000))
SummonGUID = pSummon->GetGUID();
uiPhase = 2; uiPhase = 2;
uiTimer = 4000; uiTimer = 4000;
break; break;
case 2: case 2:
if (pSummon) if (Creature *pSummon = Unit::GetCreature(*m_creature, SummonGUID))
pSummon->GetMotionMaster()->MoveJump(5776.319824, -2981.005371, 273.100037, 10.0f, 20.0f); pSummon->GetMotionMaster()->MoveJump(5776.319824, -2981.005371, 273.100037, 10.0f, 20.0f);
uiPhase = 0; uiPhase = 0;
pSummon = NULL; SummonGUID = 0;
break; break;
case 3: case 3:
DoScriptText(SAY_QUEST_ACCEPT_KORRAK_2, m_creature); DoScriptText(SAY_QUEST_ACCEPT_KORRAK_2, m_creature);
@@ -360,7 +365,8 @@ struct npc_gurgthockAI : public ScriptedAI
uiPhase = 4; uiPhase = 4;
break; break;
case 4: case 4:
pSummon = m_creature->SummonCreature(NPC_KORRAK_BLOODRAGER, SpawnPosition[0], TEMPSUMMON_CORPSE_DESPAWN, 1000); if (Creature *pSummon = m_creature->SummonCreature(NPC_KORRAK_BLOODRAGER, SpawnPosition[0], TEMPSUMMON_CORPSE_DESPAWN, 1000))
SummonGUID = pSummon->GetGUID();
uiTimer = 3000; uiTimer = 3000;
uiPhase = 0; uiPhase = 0;
break; break;
@@ -454,7 +460,7 @@ struct npc_orinoko_tuskbreakerAI : public ScriptedAI
uint32 uiBattleShoutTimer; uint32 uiBattleShoutTimer;
uint32 uiFishyScentTimer; uint32 uiFishyScentTimer;
Unit* pAffected; uint64 AffectedGUID;
uint64 uiWhisker; uint64 uiWhisker;
void Reset() void Reset()
@@ -465,7 +471,7 @@ struct npc_orinoko_tuskbreakerAI : public ScriptedAI
uiBattleShoutTimer = 0; uiBattleShoutTimer = 0;
uiFishyScentTimer = 20000; uiFishyScentTimer = 20000;
uiWhisker = 0; uiWhisker = 0;
pAffected = NULL; AffectedGUID = 0;
} }
void EnterEvadeMode() void EnterEvadeMode()
@@ -509,8 +515,11 @@ struct npc_orinoko_tuskbreakerAI : public ScriptedAI
if (uiFishyScentTimer <= uiDiff) if (uiFishyScentTimer <= uiDiff)
{ {
if (pAffected = SelectUnit(SELECT_TARGET_RANDOM,0)) if (Unit *pAffected = SelectUnit(SELECT_TARGET_RANDOM,0))
{
DoCast(pAffected, SPELL_FISHY_SCENT); DoCast(pAffected, SPELL_FISHY_SCENT);
AffectedGUID = pAffected->GetGUID();
}
uiFishyScentTimer = 20000; uiFishyScentTimer = 20000;
} else uiFishyScentTimer -= uiDiff; } else uiFishyScentTimer -= uiDiff;
@@ -535,8 +544,11 @@ struct npc_orinoko_tuskbreakerAI : public ScriptedAI
pSummon->AI()->AttackStart(m_creature->getVictim()); pSummon->AI()->AttackStart(m_creature->getVictim());
break; break;
case NPC_HUNGRY_PENGUIN: case NPC_HUNGRY_PENGUIN:
if (pAffected && pAffected->isAlive()) if(Unit *pAffected = Unit::GetUnit(*m_creature, AffectedGUID))
{
if (pAffected->isAlive())
pSummon->AI()->AttackStart(pAffected); pSummon->AI()->AttackStart(pAffected);
}
break; break;
} }
} }
@@ -122,7 +122,7 @@ struct boss_blackheart_the_inciterAI : public ScriptedAI
DoCast(m_creature, SPELL_INCITE_CHAOS); DoCast(m_creature, SPELL_INCITE_CHAOS);
std::list<HostileReference *> t_list = m_creature->getThreatManager().getThreatList(); std::list<HostileReference *> t_list = m_creature->getThreatManager().getThreatList();
for (std::list<HostileReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) for (std::list<HostileReference *>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
{ {
Unit *pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); Unit *pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid());
if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER) if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER)
@@ -68,7 +68,7 @@ struct boss_murmurAI : public ScriptedAI
void SonicBoomEffect() void SonicBoomEffect()
{ {
std::list<HostileReference *> t_list = m_creature->getThreatManager().getThreatList(); std::list<HostileReference *> t_list = m_creature->getThreatManager().getThreatList();
for (std::list<HostileReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) for (std::list<HostileReference *>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
{ {
Unit *pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); Unit *pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid());
if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER) if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER)
@@ -153,7 +153,7 @@ struct boss_murmurAI : public ScriptedAI
if (ThunderingStorm_Timer <= diff) if (ThunderingStorm_Timer <= diff)
{ {
std::list<HostileReference*>& m_threatlist = m_creature->getThreatManager().getThreatList(); std::list<HostileReference*>& m_threatlist = m_creature->getThreatManager().getThreatList();
for (std::list<HostileReference*>::iterator i = m_threatlist.begin(); i != m_threatlist.end(); ++i) for (std::list<HostileReference*>::const_iterator i = m_threatlist.begin(); i != m_threatlist.end(); ++i)
if (Unit *pTarget = Unit::GetUnit((*m_creature),(*i)->getUnitGuid())) if (Unit *pTarget = Unit::GetUnit((*m_creature),(*i)->getUnitGuid()))
if (pTarget->isAlive() && !m_creature->IsWithinDist(pTarget, 35, false)) if (pTarget->isAlive() && !m_creature->IsWithinDist(pTarget, 35, false))
DoCast(pTarget, SPELL_THUNDERING_STORM, true); DoCast(pTarget, SPELL_THUNDERING_STORM, true);
@@ -176,7 +176,7 @@ struct boss_murmurAI : public ScriptedAI
if (!m_creature->IsWithinMeleeRange(m_creature->getVictim())) if (!m_creature->IsWithinMeleeRange(m_creature->getVictim()))
{ {
std::list<HostileReference*>& m_threatlist = m_creature->getThreatManager().getThreatList(); std::list<HostileReference*>& m_threatlist = m_creature->getThreatManager().getThreatList();
for (std::list<HostileReference*>::iterator i = m_threatlist.begin(); i != m_threatlist.end(); ++i) for (std::list<HostileReference*>::const_iterator i = m_threatlist.begin(); i != m_threatlist.end(); ++i)
if (Unit *pTarget = Unit::GetUnit((*m_creature),(*i)->getUnitGuid())) if (Unit *pTarget = Unit::GetUnit((*m_creature),(*i)->getUnitGuid()))
if (pTarget->isAlive() && m_creature->IsWithinMeleeRange(pTarget)) if (pTarget->isAlive() && m_creature->IsWithinMeleeRange(pTarget))
{ {
@@ -136,7 +136,7 @@ struct boss_gurtogg_bloodboilAI : public ScriptedAI
return; return;
std::list<Unit *> targets; std::list<Unit *> targets;
std::list<HostileReference *>::iterator itr = m_threatlist.begin(); std::list<HostileReference *>::const_iterator itr = m_threatlist.begin();
for (; itr!= m_threatlist.end(); ++itr) //store the threat list in a different container for (; itr!= m_threatlist.end(); ++itr) //store the threat list in a different container
{ {
Unit *pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); Unit *pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid());
@@ -154,7 +154,7 @@ struct boss_gurtogg_bloodboilAI : public ScriptedAI
/*SpellEntry const *spellInfo = GetSpellStore()->LookupEntry(SPELL_BLOODBOIL); /*SpellEntry const *spellInfo = GetSpellStore()->LookupEntry(SPELL_BLOODBOIL);
if (spellInfo) if (spellInfo)
{ {
for (std::list<Unit *>::iterator itr = targets.begin(); itr != targets.end(); ++itr) for (std::list<Unit *>::const_iterator itr = targets.begin(); itr != targets.end(); ++itr)
{ {
Unit *pTarget = *itr; Unit *pTarget = *itr;
if (!pTarget) return; if (!pTarget) return;
@@ -501,7 +501,7 @@ struct boss_illidan_stormrageAI : public ScriptedAI
void DeleteFromThreatList(uint64 TargetGUID) void DeleteFromThreatList(uint64 TargetGUID)
{ {
for (std::list<HostileReference*>::iterator itr = m_creature->getThreatManager().getThreatList().begin(); itr != m_creature->getThreatManager().getThreatList().end(); ++itr) for (std::list<HostileReference*>::const_iterator itr = m_creature->getThreatManager().getThreatList().begin(); itr != m_creature->getThreatManager().getThreatList().end(); ++itr)
{ {
if ((*itr)->getUnitGuid() == TargetGUID) if ((*itr)->getUnitGuid() == TargetGUID)
{ {
@@ -1072,13 +1072,13 @@ struct npc_akama_illidanAI : public ScriptedAI
{ {
std::list<HostileReference*>& threatList = m_creature->getThreatManager().getThreatList(); std::list<HostileReference*>& threatList = m_creature->getThreatManager().getThreatList();
std::vector<Unit*> eliteList; std::vector<Unit*> eliteList;
for (std::list<HostileReference*>::iterator itr = threatList.begin(); itr != threatList.end(); ++itr) for (std::list<HostileReference*>::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr)
{ {
Unit* pUnit = Unit::GetUnit((*m_creature), (*itr)->getUnitGuid()); Unit* pUnit = Unit::GetUnit((*m_creature), (*itr)->getUnitGuid());
if (pUnit && pUnit->GetEntry() == ILLIDARI_ELITE) if (pUnit && pUnit->GetEntry() == ILLIDARI_ELITE)
eliteList.push_back(pUnit); eliteList.push_back(pUnit);
} }
for (std::vector<Unit*>::iterator itr = eliteList.begin(); itr != eliteList.end(); ++itr) for (std::vector<Unit*>::const_iterator itr = eliteList.begin(); itr != eliteList.end(); ++itr)
(*itr)->setDeathState(JUST_DIED); (*itr)->setDeathState(JUST_DIED);
EnterEvadeMode(); EnterEvadeMode();
} }
@@ -189,8 +189,8 @@ struct boss_reliquary_of_soulsAI : public ScriptedAI
return; return;
std::list<HostileReference*>& m_threatlist = pTarget->getThreatManager().getThreatList(); std::list<HostileReference*>& m_threatlist = pTarget->getThreatManager().getThreatList();
std::list<HostileReference*>::iterator itr = m_threatlist.begin(); std::list<HostileReference*>::const_iterator itr = m_threatlist.begin();
for (; itr != m_threatlist.end(); itr++) for (; itr != m_threatlist.end(); ++itr)
{ {
Unit* pUnit = Unit::GetUnit((*m_creature), (*itr)->getUnitGuid()); Unit* pUnit = Unit::GetUnit((*m_creature), (*itr)->getUnitGuid());
if (pUnit) if (pUnit)
@@ -390,7 +390,7 @@ struct boss_essence_of_sufferingAI : public ScriptedAI
if (m_threatlist.empty()) if (m_threatlist.empty())
return; // No point continuing if empty threatlist. return; // No point continuing if empty threatlist.
std::list<Unit*> targets; std::list<Unit*> targets;
std::list<HostileReference*>::iterator itr = m_threatlist.begin(); std::list<HostileReference*>::const_iterator itr = m_threatlist.begin();
for (; itr != m_threatlist.end(); ++itr) for (; itr != m_threatlist.end(); ++itr)
{ {
Unit* pUnit = Unit::GetUnit((*m_creature), (*itr)->getUnitGuid()); Unit* pUnit = Unit::GetUnit((*m_creature), (*itr)->getUnitGuid());
@@ -259,7 +259,7 @@ struct boss_shade_of_akamaAI : public ScriptedAI
if (!Channelers.empty()) if (!Channelers.empty())
{ {
for (std::list<uint64>::iterator itr = Channelers.begin(); itr != Channelers.end(); ++itr) for (std::list<uint64>::const_iterator itr = Channelers.begin(); itr != Channelers.end(); ++itr)
{ {
Creature* Channeler = (Unit::GetCreature(*m_creature, *itr)); Creature* Channeler = (Unit::GetCreature(*m_creature, *itr));
if (Channeler) if (Channeler)
@@ -347,7 +347,7 @@ struct boss_shade_of_akamaAI : public ScriptedAI
if (!ChannelerList.empty()) if (!ChannelerList.empty())
{ {
for (std::list<Creature*>::iterator itr = ChannelerList.begin(); itr != ChannelerList.end(); ++itr) for (std::list<Creature*>::const_iterator itr = ChannelerList.begin(); itr != ChannelerList.end(); ++itr)
{ {
CAST_AI(mob_ashtongue_channelerAI, (*itr)->AI())->ShadeGUID = m_creature->GetGUID(); CAST_AI(mob_ashtongue_channelerAI, (*itr)->AI())->ShadeGUID = m_creature->GetGUID();
Channelers.push_back((*itr)->GetGUID()); Channelers.push_back((*itr)->GetGUID());
@@ -365,7 +365,7 @@ struct boss_shade_of_akamaAI : public ScriptedAI
return; return;
} }
for (std::list<uint64>::iterator itr = Channelers.begin(); itr != Channelers.end(); ++itr) for (std::list<uint64>::const_iterator itr = Channelers.begin(); itr != Channelers.end(); ++itr)
if (Creature* Channeler = (Unit::GetCreature(*m_creature, *itr))) if (Creature* Channeler = (Unit::GetCreature(*m_creature, *itr)))
Channeler->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); Channeler->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
} }
@@ -743,7 +743,7 @@ struct npc_akamaAI : public ScriptedAI
if (!BrokenList.empty()) if (!BrokenList.empty())
{ {
bool Yelled = false; bool Yelled = false;
for (std::list<uint64>::iterator itr = BrokenList.begin(); itr != BrokenList.end(); ++itr) for (std::list<uint64>::const_iterator itr = BrokenList.begin(); itr != BrokenList.end(); ++itr)
if (Creature* pUnit = Unit::GetCreature(*m_creature, *itr)) if (Creature* pUnit = Unit::GetCreature(*m_creature, *itr))
{ {
if (!Yelled) if (!Yelled)
@@ -760,7 +760,7 @@ struct npc_akamaAI : public ScriptedAI
case 3: case 3:
if (!BrokenList.empty()) if (!BrokenList.empty())
{ {
for (std::list<uint64>::iterator itr = BrokenList.begin(); itr != BrokenList.end(); ++itr) for (std::list<uint64>::const_iterator itr = BrokenList.begin(); itr != BrokenList.end(); ++itr)
if (Creature* pUnit = Unit::GetCreature(*m_creature, *itr)) if (Creature* pUnit = Unit::GetCreature(*m_creature, *itr))
// This is the incorrect spell, but can't seem to find the right one. // This is the incorrect spell, but can't seem to find the right one.
pUnit->CastSpell(pUnit, 39656, true); pUnit->CastSpell(pUnit, 39656, true);
@@ -771,7 +771,7 @@ struct npc_akamaAI : public ScriptedAI
case 4: case 4:
if (!BrokenList.empty()) if (!BrokenList.empty())
{ {
for (std::list<uint64>::iterator itr = BrokenList.begin(); itr != BrokenList.end(); ++itr) for (std::list<uint64>::const_iterator itr = BrokenList.begin(); itr != BrokenList.end(); ++itr)
if (Creature* pUnit = Unit::GetCreature((*m_creature), *itr)) if (Creature* pUnit = Unit::GetCreature((*m_creature), *itr))
pUnit->MonsterYell(SAY_BROKEN_FREE_02, LANG_UNIVERSAL, 0); pUnit->MonsterYell(SAY_BROKEN_FREE_02, LANG_UNIVERSAL, 0);
} }
@@ -150,7 +150,7 @@ struct boss_supremusAI : public ScriptedAI
Unit *pTarget = NULL; Unit *pTarget = NULL;
std::list<HostileReference*>& m_threatlist = m_creature->getThreatManager().getThreatList(); std::list<HostileReference*>& m_threatlist = m_creature->getThreatManager().getThreatList();
std::list<HostileReference*>::iterator i = m_threatlist.begin(); std::list<HostileReference*>::const_iterator i = m_threatlist.begin();
for (i = m_threatlist.begin(); i!= m_threatlist.end(); ++i) for (i = m_threatlist.begin(); i!= m_threatlist.end(); ++i)
{ {
Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid()); Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid());
@@ -145,7 +145,7 @@ struct mob_shadowy_constructAI : public ScriptedAI
std::list<HostileReference*>& m_threatlist = m_creature->getThreatManager().getThreatList(); std::list<HostileReference*>& m_threatlist = m_creature->getThreatManager().getThreatList();
if (m_threatlist.empty()) if (m_threatlist.empty())
return; // No threat list. Don't continue. return; // No threat list. Don't continue.
std::list<HostileReference*>::iterator itr = m_threatlist.begin(); std::list<HostileReference*>::const_iterator itr = m_threatlist.begin();
std::list<Unit*> targets; std::list<Unit*> targets;
for (; itr != m_threatlist.end(); ++itr) for (; itr != m_threatlist.end(); ++itr)
{ {
@@ -283,7 +283,7 @@ struct boss_teron_gorefiendAI : public ScriptedAI
if (!Blossom) return; if (!Blossom) return;
std::list<HostileReference*>& m_threatlist = m_creature->getThreatManager().getThreatList(); std::list<HostileReference*>& m_threatlist = m_creature->getThreatManager().getThreatList();
std::list<HostileReference*>::iterator i = m_threatlist.begin(); std::list<HostileReference*>::const_iterator i = m_threatlist.begin();
for (i = m_threatlist.begin(); i != m_threatlist.end(); ++i) for (i = m_threatlist.begin(); i != m_threatlist.end(); ++i)
{ {
Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid()); Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid());
@@ -175,7 +175,7 @@ struct boss_najentusAI : public ScriptedAI
//DoCast(m_creature, SPELL_NEEDLE_SPINE, true); //DoCast(m_creature, SPELL_NEEDLE_SPINE, true);
std::list<Unit*> pTargets; std::list<Unit*> pTargets;
SelectTargetList(pTargets, 3, SELECT_TARGET_RANDOM, 80, true); SelectTargetList(pTargets, 3, SELECT_TARGET_RANDOM, 80, true);
for (std::list<Unit*>::iterator i = pTargets.begin(); i != pTargets.end(); ++i) for (std::list<Unit*>::const_iterator i = pTargets.begin(); i != pTargets.end(); ++i)
DoCast(*i, 39835, true); DoCast(*i, 39835, true);
events.ScheduleEvent(EVENT_NEEDLE, urand(15000,25000), GCD_CAST); events.ScheduleEvent(EVENT_NEEDLE, urand(15000,25000), GCD_CAST);
events.DelayEvents(1500, GCD_CAST); events.DelayEvents(1500, GCD_CAST);
@@ -440,7 +440,7 @@ struct boss_lady_vashjAI : public ScriptedAI
bool InMeleeRange = false; bool InMeleeRange = false;
Unit *pTarget; Unit *pTarget;
std::list<HostileReference *> t_list = m_creature->getThreatManager().getThreatList(); std::list<HostileReference *> t_list = m_creature->getThreatManager().getThreatList();
for (std::list<HostileReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) for (std::list<HostileReference *>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
{ {
pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid());
//if in melee range //if in melee range
@@ -480,14 +480,14 @@ struct boss_leotheras_the_blindAI : public ScriptedAI
{ {
std::list<HostileReference *>& ThreatList = m_creature->getThreatManager().getThreatList(); std::list<HostileReference *>& ThreatList = m_creature->getThreatManager().getThreatList();
std::vector<Unit *> TargetList; std::vector<Unit *> TargetList;
for (std::list<HostileReference *>::iterator itr = ThreatList.begin(); itr != ThreatList.end(); ++itr) for (std::list<HostileReference *>::const_iterator itr = ThreatList.begin(); itr != ThreatList.end(); ++itr)
{ {
Unit *tempTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); Unit *tempTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid());
if (tempTarget && tempTarget->GetTypeId() == TYPEID_PLAYER && tempTarget->GetGUID() != m_creature->getVictim()->GetGUID() && TargetList.size()<5) if (tempTarget && tempTarget->GetTypeId() == TYPEID_PLAYER && tempTarget->GetGUID() != m_creature->getVictim()->GetGUID() && TargetList.size()<5)
TargetList.push_back(tempTarget); TargetList.push_back(tempTarget);
} }
SpellEntry *spell = GET_SPELL(SPELL_INSIDIOUS_WHISPER); SpellEntry *spell = GET_SPELL(SPELL_INSIDIOUS_WHISPER);
for (std::vector<Unit *>::iterator itr = TargetList.begin(); itr != TargetList.end(); ++itr) for (std::vector<Unit *>::const_iterator itr = TargetList.begin(); itr != TargetList.end(); ++itr)
{ {
if ((*itr) && (*itr)->isAlive()) if ((*itr) && (*itr)->isAlive())
{ {
@@ -223,7 +223,7 @@ struct boss_morogrim_tidewalkerAI : public ScriptedAI
Unit *pTarget; Unit *pTarget;
using std::set; using std::set;
set<int>list; set<int>list;
set<int>::iterator itr; set<int>::const_iterator itr;
for (uint8 i = 0; i < 4; ++i) for (uint8 i = 0; i < 4; ++i)
{ {
counter = 0; counter = 0;
@@ -262,7 +262,7 @@ struct boss_morogrim_tidewalkerAI : public ScriptedAI
Unit* pGlobuleTarget; Unit* pGlobuleTarget;
using std::set; using std::set;
set<int>globulelist; set<int>globulelist;
set<int>::iterator itr; set<int>::const_iterator itr;
for (uint8 g = 0; g < 4; g++) //one unit can't cast more than one spell per update, so some players have to cast for us XD for (uint8 g = 0; g < 4; g++) //one unit can't cast more than one spell per update, so some players have to cast for us XD
{ {
counter = 0; counter = 0;
@@ -78,7 +78,7 @@ struct boss_the_black_stalkerAI : public ScriptedAI
void JustDied(Unit *who) void JustDied(Unit *who)
{ {
for (std::list<uint64>::iterator i = Striders.begin(); i != Striders.end(); ++i) for (std::list<uint64>::const_iterator i = Striders.begin(); i != Striders.end(); ++i)
if (Creature *strider = Unit::GetCreature(*m_creature, *i)) if (Creature *strider = Unit::GetCreature(*m_creature, *i))
strider->DisappearAndDie(); strider->DisappearAndDie();
} }
@@ -708,7 +708,7 @@ struct boss_krosh_firehandAI : public ScriptedAI
Unit *pTarget; Unit *pTarget;
std::list<HostileReference *> t_list = m_creature->getThreatManager().getThreatList(); std::list<HostileReference *> t_list = m_creature->getThreatManager().getThreatList();
std::vector<Unit *> target_list; std::vector<Unit *> target_list;
for (std::list<HostileReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) for (std::list<HostileReference *>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
{ {
pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid());
//15 yard radius minimum //15 yard radius minimum
@@ -135,7 +135,7 @@ struct instance_magtheridons_lair : public ScriptedInstance
if (m_auiEncounter[1] != NOT_STARTED) if (m_auiEncounter[1] != NOT_STARTED)
{ {
m_auiEncounter[1] = NOT_STARTED; m_auiEncounter[1] = NOT_STARTED;
for (std::set<uint64>::iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i) for (std::set<uint64>::const_iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i)
{ {
if (Creature *Channeler = instance->GetCreature(*i)) if (Creature *Channeler = instance->GetCreature(*i))
{ {
@@ -154,7 +154,7 @@ struct instance_magtheridons_lair : public ScriptedInstance
{ {
m_auiEncounter[1] = IN_PROGRESS; m_auiEncounter[1] = IN_PROGRESS;
// Let all five channelers aggro. // Let all five channelers aggro.
for (std::set<uint64>::iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i) for (std::set<uint64>::const_iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i)
{ {
Creature *Channeler = instance->GetCreature(*i); Creature *Channeler = instance->GetCreature(*i);
if (Channeler && Channeler->isAlive()) if (Channeler && Channeler->isAlive())
@@ -171,7 +171,7 @@ struct instance_magtheridons_lair : public ScriptedInstance
} }
break; break;
case DONE: // Add buff and check if all channelers are dead. case DONE: // Add buff and check if all channelers are dead.
for (std::set<uint64>::iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i) for (std::set<uint64>::const_iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i)
{ {
Creature *Channeler = instance->GetCreature(*i); Creature *Channeler = instance->GetCreature(*i);
if (Channeler && Channeler->isAlive()) if (Channeler && Channeler->isAlive())
@@ -187,7 +187,7 @@ struct instance_magtheridons_lair : public ScriptedInstance
break; break;
case DATA_COLLAPSE: case DATA_COLLAPSE:
// true - collapse / false - reset // true - collapse / false - reset
for (std::set<uint64>::iterator i = ColumnGUID.begin(); i != ColumnGUID.end(); ++i) for (std::set<uint64>::const_iterator i = ColumnGUID.begin(); i != ColumnGUID.end(); ++i)
DoUseDoorOrButton(*i); DoUseDoorOrButton(*i);
break; break;
default: default:
@@ -222,7 +222,7 @@ struct instance_magtheridons_lair : public ScriptedInstance
{ {
if (RespawnTimer <= diff) if (RespawnTimer <= diff)
{ {
for (std::set<uint64>::iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i) for (std::set<uint64>::const_iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i)
{ {
if (Creature *Channeler = instance->GetCreature(*i)) if (Creature *Channeler = instance->GetCreature(*i))
{ {
@@ -144,7 +144,7 @@ struct boss_warchief_kargath_bladefistAI : public ScriptedAI
void removeAdds() void removeAdds()
{ {
for (std::vector<uint64>::iterator itr = adds.begin(); itr!= adds.end(); ++itr) for (std::vector<uint64>::const_iterator itr = adds.begin(); itr!= adds.end(); ++itr)
{ {
Unit* temp = Unit::GetUnit((*m_creature),*itr); Unit* temp = Unit::GetUnit((*m_creature),*itr);
if (temp && temp->isAlive()) if (temp && temp->isAlive())
@@ -156,7 +156,7 @@ struct boss_warchief_kargath_bladefistAI : public ScriptedAI
} }
adds.clear(); adds.clear();
for (std::vector<uint64>::iterator itr = assassins.begin(); itr!= assassins.end(); ++itr) for (std::vector<uint64>::const_iterator itr = assassins.begin(); itr!= assassins.end(); ++itr)
{ {
Unit* temp = Unit::GetUnit((*m_creature),*itr); Unit* temp = Unit::GetUnit((*m_creature),*itr);
if (temp && temp->isAlive()) if (temp && temp->isAlive())
+6 -6
View File
@@ -79,7 +79,7 @@ struct npc_manaforge_control_consoleAI : public ScriptedAI
Wave = false; Wave = false;
someplayer = 0; someplayer = 0;
goConsole = 0; goConsole = 0;
Creature* add = NULL; add = NULL;
} }
void EnterCombat(Unit *who) { return; } void EnterCombat(Unit *who) { return; }
@@ -296,8 +296,7 @@ bool GOHello_go_manaforge_control_console(Player* pPlayer, GameObject* pGo)
pPlayer->SendPreparedQuest(pGo->GetGUID()); pPlayer->SendPreparedQuest(pGo->GetGUID());
} }
Creature* manaforge; Creature* manaforge = NULL;
manaforge = NULL;
switch(pGo->GetAreaId()) switch(pGo->GetAreaId())
{ {
@@ -696,6 +695,7 @@ struct mob_phase_hunterAI : public ScriptedAI
float HpPercent; float HpPercent;
Player *pPlayer; Player *pPlayer;
uint64 PlayerGUID;
uint32 ManaBurnTimer; uint32 ManaBurnTimer;
@@ -707,7 +707,7 @@ struct mob_phase_hunterAI : public ScriptedAI
WeakPercent = 25 + (rand() % 16); // 25-40 WeakPercent = 25 + (rand() % 16); // 25-40
HpPercent = 0.0f; HpPercent = 0.0f;
pPlayer = NULL; PlayerGUID = 0;
ManaBurnTimer = 5000 + (rand() % 3 * 1000); // 5-8 sec cd ManaBurnTimer = 5000 + (rand() % 3 * 1000); // 5-8 sec cd
@@ -718,7 +718,7 @@ struct mob_phase_hunterAI : public ScriptedAI
void EnterCombat(Unit *who) void EnterCombat(Unit *who)
{ {
if (who->GetTypeId() == TYPEID_PLAYER) if (who->GetTypeId() == TYPEID_PLAYER)
pPlayer = CAST_PLR(who); PlayerGUID = who->GetGUID();
} }
void SpellHit(Unit *caster, const SpellEntry *spell) void SpellHit(Unit *caster, const SpellEntry *spell)
@@ -765,7 +765,7 @@ struct mob_phase_hunterAI : public ScriptedAI
ManaBurnTimer = 3500; ManaBurnTimer = 3500;
} else ManaBurnTimer -= diff; } else ManaBurnTimer -= diff;
if (pPlayer) // start: support for quest 10190 if (Player *pPlayer = Unit::GetPlayer(PlayerGUID)) // start: support for quest 10190
{ {
if (!Weak && m_creature->GetHealth() < (m_creature->GetMaxHealth() / 100 * WeakPercent) if (!Weak && m_creature->GetHealth() < (m_creature->GetMaxHealth() / 100 * WeakPercent)
&& pPlayer->GetQuestStatus(QUEST_RECHARGING_THE_BATTERIES) == QUEST_STATUS_INCOMPLETE) && pPlayer->GetQuestStatus(QUEST_RECHARGING_THE_BATTERIES) == QUEST_STATUS_INCOMPLETE)
+2 -2
View File
@@ -1496,7 +1496,7 @@ struct npc_lord_illidan_stormrageAI : public ScriptedAI
const Group::MemberSlotList members = EventGroup->GetMemberSlots(); const Group::MemberSlotList members = EventGroup->GetMemberSlots();
for (Group::member_citerator itr = members.begin(); itr!= members.end(); itr++) for (Group::member_citerator itr = members.begin(); itr!= members.end(); ++itr)
{ {
GroupMember = (Unit::GetPlayer(itr->guid)); GroupMember = (Unit::GetPlayer(itr->guid));
if (!GroupMember) if (!GroupMember)
@@ -1522,7 +1522,7 @@ struct npc_lord_illidan_stormrageAI : public ScriptedAI
if (GroupMemberCount == DeadMemberCount) if (GroupMemberCount == DeadMemberCount)
{ {
for (Group::member_citerator itr = members.begin(); itr!= members.end(); itr++) for (Group::member_citerator itr = members.begin(); itr!= members.end(); ++itr)
{ {
GroupMember = Unit::GetPlayer(itr->guid); GroupMember = Unit::GetPlayer(itr->guid);
@@ -851,7 +851,7 @@ struct boss_kaelthasAI : public ScriptedAI
//GravityLapse_Timer //GravityLapse_Timer
if (GravityLapse_Timer <= diff) if (GravityLapse_Timer <= diff)
{ {
std::list<HostileReference*>::iterator i = m_creature->getThreatManager().getThreatList().begin(); std::list<HostileReference*>::const_iterator i = m_creature->getThreatManager().getThreatList().begin();
switch (GravityLapse_Phase) switch (GravityLapse_Phase)
{ {
case 0: case 0:
@@ -1197,7 +1197,7 @@ struct boss_grand_astromancer_capernianAI : public advisorbase_ai
bool InMeleeRange = false; bool InMeleeRange = false;
Unit *pTarget = NULL; Unit *pTarget = NULL;
std::list<HostileReference*>& m_threatlist = m_creature->getThreatManager().getThreatList(); std::list<HostileReference*>& m_threatlist = m_creature->getThreatManager().getThreatList();
for (std::list<HostileReference*>::iterator i = m_threatlist.begin(); i!= m_threatlist.end(); ++i) for (std::list<HostileReference*>::const_iterator i = m_threatlist.begin(); i!= m_threatlist.end(); ++i)
{ {
Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid()); Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid());
//if in melee range //if in melee range
@@ -111,7 +111,7 @@ struct boss_void_reaverAI : public ScriptedAI
Unit *pTarget = NULL; Unit *pTarget = NULL;
std::list<HostileReference *> t_list = m_creature->getThreatManager().getThreatList(); std::list<HostileReference *> t_list = m_creature->getThreatManager().getThreatList();
std::vector<Unit *> target_list; std::vector<Unit *> target_list;
for (std::list<HostileReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) for (std::list<HostileReference *>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
{ {
pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid());
if (!pTarget) if (!pTarget)
+2 -2
View File
@@ -738,7 +738,7 @@ void npc_doctorAI::PatientSaved(Creature* soldier, Player* pPlayer, Location* Po
{ {
if (!Patients.empty()) if (!Patients.empty())
{ {
std::list<uint64>::iterator itr; std::list<uint64>::const_iterator itr;
for (itr = Patients.begin(); itr != Patients.end(); ++itr) for (itr = Patients.begin(); itr != Patients.end(); ++itr)
{ {
if (Creature* Patient = Unit::GetCreature((*m_creature), *itr)) if (Creature* Patient = Unit::GetCreature((*m_creature), *itr))
@@ -1804,7 +1804,7 @@ struct npc_ebon_gargoyleAI : CasterAI
Trinity::AnyUnfriendlyUnitInObjectRangeCheck u_check(m_creature, m_creature, 30); Trinity::AnyUnfriendlyUnitInObjectRangeCheck u_check(m_creature, m_creature, 30);
Trinity::UnitListSearcher<Trinity::AnyUnfriendlyUnitInObjectRangeCheck> searcher(m_creature, targets, u_check); Trinity::UnitListSearcher<Trinity::AnyUnfriendlyUnitInObjectRangeCheck> searcher(m_creature, targets, u_check);
m_creature->VisitNearbyObject(30, searcher); m_creature->VisitNearbyObject(30, searcher);
for (std::list<Unit*>::iterator iter = targets.begin(); iter != targets.end(); ++iter) for (std::list<Unit*>::const_iterator iter = targets.begin(); iter != targets.end(); ++iter)
if((*iter)->GetAura(49206,owner->GetGUID())) if((*iter)->GetAura(49206,owner->GetGUID()))
{ {
me->Attack((*iter),false); me->Attack((*iter),false);