*Add function GetPlayer and GetCreature for scripts. Please try to not use GetUnit in the future.

--HG--
branch : trunk
This commit is contained in:
megamage
2009-04-11 13:42:34 -05:00
parent 80e1a5faac
commit 9378a9cf21
56 changed files with 196 additions and 169 deletions
+2 -2
View File
@@ -33,7 +33,7 @@ void SummonList::DespawnEntry(uint32 entry)
{ {
for(iterator i = begin(); i != end(); ++i) for(iterator i = begin(); i != end(); ++i)
{ {
if(Creature *summon = (Creature*)Unit::GetUnit(*m_creature, *i)) if(Creature *summon = Unit::GetCreature(*m_creature, *i))
{ {
if(summon->GetEntry() == entry) if(summon->GetEntry() == entry)
{ {
@@ -55,7 +55,7 @@ void SummonList::DespawnAll()
{ {
for(iterator i = begin(); i != end(); ++i) for(iterator i = begin(); i != end(); ++i)
{ {
if(Creature *summon = (Creature*)Unit::GetUnit(*m_creature, *i)) if(Creature *summon = Unit::GetCreature(*m_creature, *i))
{ {
summon->setDeathState(JUST_DIED); summon->setDeathState(JUST_DIED);
summon->RemoveCorpse(); summon->RemoveCorpse();
@@ -382,7 +382,7 @@ struct TRINITY_DLL_DECL npc_injured_patientAI : public ScriptedAI
{ {
if(Doctorguid) if(Doctorguid)
{ {
Creature* Doctor = ((Creature*)Unit::GetUnit((*m_creature), Doctorguid)); Creature* Doctor = (Unit::GetCreature((*m_creature), Doctorguid));
if(Doctor) if(Doctor)
((npc_doctorAI*)Doctor->AI())->PatientSaved(m_creature, ((Player*)caster), Coord); ((npc_doctorAI*)Doctor->AI())->PatientSaved(m_creature, ((Player*)caster), Coord);
} }
@@ -430,7 +430,7 @@ struct TRINITY_DLL_DECL npc_injured_patientAI : public ScriptedAI
if(Doctorguid) if(Doctorguid)
{ {
Creature* Doctor = ((Creature*)Unit::GetUnit((*m_creature), Doctorguid)); Creature* Doctor = (Unit::GetCreature((*m_creature), Doctorguid));
if(Doctor) if(Doctor)
((npc_doctorAI*)Doctor->AI())->PatientDied(Coord); ((npc_doctorAI*)Doctor->AI())->PatientDied(Coord);
} }
@@ -476,7 +476,7 @@ void npc_doctorAI::BeginEvent(Player* player)
void npc_doctorAI::PatientDied(Location* Point) void npc_doctorAI::PatientDied(Location* Point)
{ {
Player* player = ((Player*)Unit::GetUnit((*m_creature), Playerguid)); Player* player = Unit::GetPlayer(Playerguid);
if(player && ((player->GetQuestStatus(6624) == QUEST_STATUS_INCOMPLETE) || (player->GetQuestStatus(6622) == QUEST_STATUS_INCOMPLETE))) if(player && ((player->GetQuestStatus(6624) == QUEST_STATUS_INCOMPLETE) || (player->GetQuestStatus(6622) == QUEST_STATUS_INCOMPLETE)))
{ {
PatientDiedCount++; PatientDiedCount++;
@@ -509,7 +509,7 @@ void npc_doctorAI::PatientSaved(Creature* soldier, Player* player, Location* Poi
std::list<uint64>::iterator itr; std::list<uint64>::iterator itr;
for(itr = Patients.begin(); itr != Patients.end(); ++itr) for(itr = Patients.begin(); itr != Patients.end(); ++itr)
{ {
Creature* Patient = ((Creature*)Unit::GetUnit((*m_creature), *itr)); Creature* Patient = (Unit::GetCreature((*m_creature), *itr));
if( Patient ) if( Patient )
Patient->setDeathState(JUST_DIED); Patient->setDeathState(JUST_DIED);
} }
@@ -54,7 +54,7 @@ struct TRINITY_DLL_DECL npc_professor_phizzlethorpeAI : public npc_escortAI
void WaypointReached(uint32 i) void WaypointReached(uint32 i)
{ {
Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); Player* player = Unit::GetPlayer(PlayerGUID);
switch(i) switch(i)
{ {
@@ -100,7 +100,7 @@ struct TRINITY_DLL_DECL npc_professor_phizzlethorpeAI : public npc_escortAI
{ {
if (PlayerGUID && !Completed ) if (PlayerGUID && !Completed )
{ {
Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); Player* player = Unit::GetPlayer(PlayerGUID);
if (player) if (player)
((Player*)player)->FailQuest(QUEST_SUNKEN_TREASURE); ((Player*)player)->FailQuest(QUEST_SUNKEN_TREASURE);
} }
@@ -59,7 +59,7 @@ struct TRINITY_DLL_DECL npc_torekAI : public npc_escortAI
void WaypointReached(uint32 i) void WaypointReached(uint32 i)
{ {
Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); Player* player = Unit::GetPlayer(PlayerGUID);
if (!player) if (!player)
return; return;
@@ -110,7 +110,7 @@ struct TRINITY_DLL_DECL npc_torekAI : public npc_escortAI
{ {
if (PlayerGUID && !Completed) if (PlayerGUID && !Completed)
{ {
if (Unit* player = Unit::GetUnit((*m_creature), PlayerGUID)) if (Player* player = Unit::GetPlayer(PlayerGUID))
((Player*)player)->FailQuest(QUEST_TOREK_ASSULT); ((Player*)player)->FailQuest(QUEST_TOREK_ASSULT);
} }
} }
@@ -193,7 +193,7 @@ struct TRINITY_DLL_DECL npc_ruul_snowhoofAI : public npc_escortAI
void WaypointReached(uint32 i) void WaypointReached(uint32 i)
{ {
Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); Player* player = Unit::GetPlayer(PlayerGUID);
if (!player) if (!player)
return; return;
@@ -246,7 +246,7 @@ struct TRINITY_DLL_DECL npc_ruul_snowhoofAI : public npc_escortAI
{ {
if (PlayerGUID) if (PlayerGUID)
{ {
Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); Player* player = Unit::GetPlayer(PlayerGUID);
if (player) if (player)
((Player*)player)->FailQuest(QUEST_FREEDOM_TO_RUUL); ((Player*)player)->FailQuest(QUEST_FREEDOM_TO_RUUL);
} }
@@ -306,7 +306,7 @@ struct TRINITY_DLL_DECL mob_rizzle_sprysprocketAI : public ScriptedAI
m_creature->AI_SendMoveToPacket(3706.39, -3969.15, 35.9118, 0, 0, 0); m_creature->AI_SendMoveToPacket(3706.39, -3969.15, 35.9118, 0, 0, 0);
} }
//begin swimming and summon depth charges //begin swimming and summon depth charges
Player* player = ((Player*)Unit::GetUnit((*m_creature), PlayerGUID)); Player* player = Unit::GetPlayer(PlayerGUID);
SendText(MSG_ESCAPE_NOTICE, player); SendText(MSG_ESCAPE_NOTICE, player);
DoCast(m_creature, SPELL_PERIODIC_DEPTH_CHARGE); DoCast(m_creature, SPELL_PERIODIC_DEPTH_CHARGE);
m_creature->SetUnitMovementFlags(MOVEMENTFLAG_FLYING2 | MOVEMENTFLAG_SWIMMING); m_creature->SetUnitMovementFlags(MOVEMENTFLAG_FLYING2 | MOVEMENTFLAG_SWIMMING);
@@ -331,7 +331,7 @@ struct TRINITY_DLL_DECL npc_magwinAI : public npc_escortAI
void WaypointReached(uint32 i) void WaypointReached(uint32 i)
{ {
Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); Player* player = Unit::GetPlayer(PlayerGUID);
if (!player) if (!player)
return; return;
@@ -371,7 +371,7 @@ struct TRINITY_DLL_DECL npc_magwinAI : public npc_escortAI
{ {
if (PlayerGUID) if (PlayerGUID)
{ {
Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); Player* player = Unit::GetPlayer(PlayerGUID);
if (player) if (player)
((Player*)player)->FailQuest(QUEST_A_CRY_FOR_HELP); ((Player*)player)->FailQuest(QUEST_A_CRY_FOR_HELP);
} }
@@ -247,7 +247,7 @@ struct TRINITY_DLL_DECL npc_twiggy_flatheadAI : public ScriptedAI
Player* pWarrior = NULL; Player* pWarrior = NULL;
if(PlayerGUID) if(PlayerGUID)
pWarrior = ((Player*)Unit::GetUnit((*m_creature), PlayerGUID)); pWarrior = Unit::GetPlayer(PlayerGUID);
if(!pWarrior) if(!pWarrior)
return; return;
@@ -261,7 +261,7 @@ struct TRINITY_DLL_DECL npc_twiggy_flatheadAI : public ScriptedAI
{ {
if (AffrayChallenger[i]) if (AffrayChallenger[i])
{ {
Creature* pCreature = (Creature*)Unit::GetUnit((*m_creature), AffrayChallenger[i]); Creature* pCreature = Unit::GetCreature((*m_creature), AffrayChallenger[i]);
if(pCreature) { if(pCreature) {
if(pCreature->isAlive()) if(pCreature->isAlive())
{ {
@@ -277,7 +277,7 @@ struct TRINITY_DLL_DECL npc_twiggy_flatheadAI : public ScriptedAI
if (BigWill) if (BigWill)
{ {
Creature* pCreature = (Creature*)Unit::GetUnit((*m_creature), BigWill); Creature* pCreature = Unit::GetCreature((*m_creature), BigWill);
if(pCreature) { if(pCreature) {
if(pCreature->isAlive()) { if(pCreature->isAlive()) {
pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT);
@@ -322,7 +322,7 @@ struct TRINITY_DLL_DECL npc_twiggy_flatheadAI : public ScriptedAI
{ {
if (AffrayChallenger[i]) if (AffrayChallenger[i])
{ {
Creature* pCreature = (Creature*)Unit::GetUnit((*m_creature), AffrayChallenger[i]); Creature* pCreature = Unit::GetCreature((*m_creature), AffrayChallenger[i]);
if((!pCreature || (!pCreature->isAlive())) && !Challenger_down[i]) if((!pCreature || (!pCreature->isAlive())) && !Challenger_down[i])
{ {
DoScriptText(SAY_TWIGGY_FLATHEAD_DOWN, m_creature); DoScriptText(SAY_TWIGGY_FLATHEAD_DOWN, m_creature);
@@ -338,7 +338,7 @@ struct TRINITY_DLL_DECL npc_twiggy_flatheadAI : public ScriptedAI
if (AffrayChallenger[Wave] && Wave < 6 && !EventBigWill) if (AffrayChallenger[Wave] && Wave < 6 && !EventBigWill)
{ {
DoScriptText(SAY_TWIGGY_FLATHEAD_FRAY, m_creature); DoScriptText(SAY_TWIGGY_FLATHEAD_FRAY, m_creature);
Creature* pCreature = (Creature*)Unit::GetUnit((*m_creature), AffrayChallenger[Wave]); Creature* pCreature = Unit::GetCreature((*m_creature), AffrayChallenger[Wave]);
if(pCreature && (pCreature->isAlive())) if(pCreature && (pCreature->isAlive()))
{ {
pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
@@ -365,7 +365,7 @@ struct TRINITY_DLL_DECL npc_twiggy_flatheadAI : public ScriptedAI
} }
else if (Wave >= 6 && EventBigWill && BigWill) else if (Wave >= 6 && EventBigWill && BigWill)
{ {
Creature* pCreature = (Creature*)Unit::GetUnit((*m_creature), BigWill); Creature* pCreature = Unit::GetCreature((*m_creature), BigWill);
if (!pCreature || !pCreature->isAlive()) if (!pCreature || !pCreature->isAlive())
{ {
DoScriptText(SAY_TWIGGY_FLATHEAD_OVER, m_creature); DoScriptText(SAY_TWIGGY_FLATHEAD_OVER, m_creature);
@@ -414,7 +414,7 @@ struct TRINITY_DLL_DECL npc_wizzlecrank_shredderAI : public npc_escortAI
void WaypointReached(uint32 i) void WaypointReached(uint32 i)
{ {
Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); Player* player = Unit::GetPlayer(PlayerGUID);
if(!player) if(!player)
return; return;
@@ -462,7 +462,7 @@ struct TRINITY_DLL_DECL npc_wizzlecrank_shredderAI : public npc_escortAI
{ {
if (PlayerGUID && !Completed) if (PlayerGUID && !Completed)
{ {
Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); Player* player = Unit::GetPlayer(PlayerGUID);
if (player) if (player)
((Player*)player)->FailQuest(QUEST_ESCAPE); ((Player*)player)->FailQuest(QUEST_ESCAPE);
} }
@@ -26,7 +26,7 @@ EndScriptData */
#define GETGO(obj, guid) GameObject* obj = GameObject::GetGameObject(*m_creature, guid) #define GETGO(obj, guid) GameObject* obj = GameObject::GetGameObject(*m_creature, guid)
#define GETUNIT(unit, guid) Unit* unit = Unit::GetUnit(*m_creature, guid) #define GETUNIT(unit, guid) Unit* unit = Unit::GetUnit(*m_creature, guid)
#define GETCRE(cre, guid) Creature* cre = (Creature*)Unit::GetUnit(*m_creature, guid) #define GETCRE(cre, guid) Creature* cre = Unit::GetCreature(*m_creature, guid)
#define HPPCT(unit) unit->GetHealth()*100 / unit->GetMaxHealth() #define HPPCT(unit) unit->GetHealth()*100 / unit->GetMaxHealth()
/************* Quotes and Sounds ***********************/ /************* Quotes and Sounds ***********************/
@@ -515,9 +515,9 @@ struct TRINITY_DLL_DECL boss_illidan_stormrageAI : public ScriptedAI
if(Conversation[count].creature == ILLIDAN_STORMRAGE) if(Conversation[count].creature == ILLIDAN_STORMRAGE)
creature = m_creature; creature = m_creature;
else if(Conversation[count].creature == AKAMA) else if(Conversation[count].creature == AKAMA)
creature = ((Creature*)Unit::GetUnit((*m_creature), AkamaGUID)); creature = (Unit::GetCreature((*m_creature), AkamaGUID));
else if(Conversation[count].creature == MAIEV_SHADOWSONG) else if(Conversation[count].creature == MAIEV_SHADOWSONG)
creature = ((Creature*)Unit::GetUnit((*m_creature), MaievGUID)); creature = (Unit::GetCreature((*m_creature), MaievGUID));
if(creature) if(creature)
{ {
@@ -213,7 +213,7 @@ struct TRINITY_DLL_DECL boss_reliquary_of_soulsAI : public ScriptedAI
Creature* Essence; Creature* Essence;
if(EssenceGUID) if(EssenceGUID)
{ {
Essence = (Creature*)Unit::GetUnit(*m_creature, EssenceGUID); Essence = Unit::GetCreature(*m_creature, EssenceGUID);
if(!Essence) if(!Essence)
{ {
EnterEvadeMode(); EnterEvadeMode();
@@ -624,7 +624,7 @@ void npc_enslaved_soulAI::JustDied(Unit *killer)
{ {
if(ReliquaryGUID) if(ReliquaryGUID)
{ {
Creature* Reliquary = ((Creature*)Unit::GetUnit((*m_creature), ReliquaryGUID)); Creature* Reliquary = (Unit::GetCreature((*m_creature), ReliquaryGUID));
if(Reliquary) if(Reliquary)
((boss_reliquary_of_soulsAI*)Reliquary->AI())->SoulDeathCount++; ((boss_reliquary_of_soulsAI*)Reliquary->AI())->SoulDeathCount++;
} }
@@ -200,7 +200,7 @@ struct TRINITY_DLL_DECL boss_shade_of_akamaAI : public ScriptedAI
{ {
for(std::list<uint64>::iterator itr = Sorcerers.begin(); itr != Sorcerers.end(); ++itr) for(std::list<uint64>::iterator itr = Sorcerers.begin(); itr != Sorcerers.end(); ++itr)
{ {
if(Creature* Sorcerer = ((Creature*)Unit::GetUnit(*m_creature, *itr))) if(Creature* Sorcerer = (Unit::GetCreature(*m_creature, *itr)))
if(Sorcerer->isAlive()) if(Sorcerer->isAlive())
{ {
Sorcerer->SetVisibility(VISIBILITY_OFF); Sorcerer->SetVisibility(VISIBILITY_OFF);
@@ -248,7 +248,7 @@ struct TRINITY_DLL_DECL boss_shade_of_akamaAI : public ScriptedAI
for(std::list<uint64>::iterator itr = Channelers.begin(); itr != Channelers.end(); ++itr) for(std::list<uint64>::iterator itr = Channelers.begin(); itr != Channelers.end(); ++itr)
{ {
Creature* Channeler = NULL; Creature* Channeler = NULL;
Channeler = ((Creature*)Unit::GetUnit(*m_creature, *itr)); Channeler = (Unit::GetCreature(*m_creature, *itr));
if (Channeler) if (Channeler)
{ {
@@ -372,7 +372,7 @@ struct TRINITY_DLL_DECL boss_shade_of_akamaAI : public ScriptedAI
} }
for(std::list<uint64>::iterator itr = Channelers.begin(); itr != Channelers.end(); ++itr) for(std::list<uint64>::iterator itr = Channelers.begin(); itr != Channelers.end(); ++itr)
if(Creature* Channeler = ((Creature*)Unit::GetUnit(*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);
} }
@@ -484,7 +484,7 @@ struct TRINITY_DLL_DECL boss_shade_of_akamaAI : public ScriptedAI
void mob_ashtongue_channelerAI::JustDied(Unit* killer) void mob_ashtongue_channelerAI::JustDied(Unit* killer)
{ {
Creature* Shade = ((Creature*)Unit::GetUnit((*m_creature), ShadeGUID)); Creature* Shade = (Unit::GetCreature((*m_creature), ShadeGUID));
if(Shade && Shade->isAlive()) if(Shade && Shade->isAlive())
((boss_shade_of_akamaAI*)Shade->AI())->IncrementDeathCount(); ((boss_shade_of_akamaAI*)Shade->AI())->IncrementDeathCount();
else error_log("SD2 ERROR: Channeler dead but unable to increment DeathCount for Shade of Akama."); else error_log("SD2 ERROR: Channeler dead but unable to increment DeathCount for Shade of Akama.");
@@ -492,7 +492,7 @@ void mob_ashtongue_channelerAI::JustDied(Unit* killer)
void mob_ashtongue_sorcererAI::JustDied(Unit* killer) void mob_ashtongue_sorcererAI::JustDied(Unit* killer)
{ {
Creature* Shade = ((Creature*)Unit::GetUnit((*m_creature), ShadeGUID)); Creature* Shade = (Unit::GetCreature((*m_creature), ShadeGUID));
if(Shade && Shade->isAlive()) if(Shade && Shade->isAlive())
((boss_shade_of_akamaAI*)Shade->AI())->IncrementDeathCount(m_creature->GetGUID()); ((boss_shade_of_akamaAI*)Shade->AI())->IncrementDeathCount(m_creature->GetGUID());
else error_log("SD2 ERROR: Sorcerer dead but unable to increment DeathCount for Shade of Akama."); else error_log("SD2 ERROR: Sorcerer dead but unable to increment DeathCount for Shade of Akama.");
@@ -561,7 +561,7 @@ struct TRINITY_DLL_DECL npc_akamaAI : public ScriptedAI
if(!ShadeGUID) if(!ShadeGUID)
return; return;
Creature* Shade = ((Creature*)Unit::GetUnit((*m_creature), ShadeGUID)); Creature* Shade = (Unit::GetCreature((*m_creature), ShadeGUID));
if(Shade) if(Shade)
{ {
pInstance->SetData(DATA_SHADEOFAKAMAEVENT, IN_PROGRESS); pInstance->SetData(DATA_SHADEOFAKAMAEVENT, IN_PROGRESS);
@@ -618,7 +618,7 @@ struct TRINITY_DLL_DECL npc_akamaAI : public ScriptedAI
if(ShadeGUID && !StartCombat) if(ShadeGUID && !StartCombat)
{ {
Creature* Shade = ((Creature*)Unit::GetUnit((*m_creature), ShadeGUID)); Creature* Shade = (Unit::GetCreature((*m_creature), ShadeGUID));
if(Shade && Shade->isAlive()) if(Shade && Shade->isAlive())
{ {
if(((boss_shade_of_akamaAI*)Shade->AI())->IsBanished) if(((boss_shade_of_akamaAI*)Shade->AI())->IsBanished)
@@ -268,7 +268,7 @@ struct TRINITY_DLL_DECL npc_volcanoAI : public ScriptedAI
if(CheckTimer < diff) if(CheckTimer < diff)
{ {
uint64 SupremusGUID = pInstance->GetData64(DATA_SUPREMUS); uint64 SupremusGUID = pInstance->GetData64(DATA_SUPREMUS);
Creature* Supremus = ((Creature*)Unit::GetUnit((*m_creature), SupremusGUID)); Creature* Supremus = (Unit::GetCreature((*m_creature), SupremusGUID));
if(!Eruption && !((boss_supremusAI*)Supremus->AI())->Phase1) if(!Eruption && !((boss_supremusAI*)Supremus->AI())->Phase1)
{ {
Eruption = true; Eruption = true;
@@ -82,7 +82,7 @@ struct TRINITY_DLL_DECL mob_doom_blossomAI : public ScriptedAI
{ {
DoZoneInCombat(); DoZoneInCombat();
Creature* Teron = ((Creature*)Unit::GetUnit((*m_creature), TeronGUID)); Creature* Teron = (Unit::GetCreature((*m_creature), TeronGUID));
if((Teron) && (!Teron->isAlive() || Teron->IsInEvadeMode())) if((Teron) && (!Teron->isAlive() || Teron->IsInEvadeMode()))
Despawn(); Despawn();
} }
@@ -184,7 +184,7 @@ struct TRINITY_DLL_DECL mob_shadowy_constructAI : public ScriptedAI
if(CheckTeronTimer < diff) if(CheckTeronTimer < diff)
{ {
Creature* Teron = ((Creature*)Unit::GetUnit((*m_creature), TeronGUID)); Creature* Teron = (Unit::GetCreature((*m_creature), TeronGUID));
if(!Teron || !Teron->isAlive() || Teron->IsInEvadeMode()) if(!Teron || !Teron->isAlive() || Teron->IsInEvadeMode())
m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
@@ -194,7 +194,7 @@ struct TRINITY_DLL_DECL boss_najentusAI : public ScriptedAI
bool GOHello_go_najentus_spine(Player *player, GameObject* _GO) bool GOHello_go_najentus_spine(Player *player, GameObject* _GO)
{ {
if(ScriptedInstance* pInstance = (ScriptedInstance*)_GO->GetInstanceData()) if(ScriptedInstance* pInstance = (ScriptedInstance*)_GO->GetInstanceData())
if(Creature* Najentus = (Creature*)Unit::GetUnit(*_GO, pInstance->GetData64(DATA_HIGHWARLORDNAJENTUS))) if(Creature* Najentus = Unit::GetCreature(*_GO, pInstance->GetData64(DATA_HIGHWARLORDNAJENTUS)))
if(((boss_najentusAI*)Najentus->AI())->RemoveImpalingSpine()) if(((boss_najentusAI*)Najentus->AI())->RemoveImpalingSpine())
{ {
player->CastSpell(player, SPELL_CREATE_NAJENTUS_SPINE, true); player->CastSpell(player, SPELL_CREATE_NAJENTUS_SPINE, true);
@@ -218,7 +218,7 @@ struct TRINITY_DLL_DECL mob_illidari_councilAI : public ScriptedAI
Creature* pMember = NULL; Creature* pMember = NULL;
for(uint8 i = 0; i < 4; ++i) for(uint8 i = 0; i < 4; ++i)
{ {
if(pMember = ((Creature*)Unit::GetUnit((*m_creature), Council[i]))) if(pMember = (Unit::GetCreature((*m_creature), Council[i])))
{ {
if(!pMember->isAlive()) if(!pMember->isAlive())
{ {
@@ -232,7 +232,7 @@ struct TRINITY_DLL_DECL mob_illidari_councilAI : public ScriptedAI
if(pInstance) if(pInstance)
{ {
pInstance->SetData(DATA_ILLIDARICOUNCILEVENT, NOT_STARTED); pInstance->SetData(DATA_ILLIDARICOUNCILEVENT, NOT_STARTED);
if(Creature* VoiceTrigger = ((Creature*)Unit::GetUnit(*m_creature, pInstance->GetData64(DATA_BLOOD_ELF_COUNCIL_VOICE)))) if(Creature* VoiceTrigger = (Unit::GetCreature(*m_creature, pInstance->GetData64(DATA_BLOOD_ELF_COUNCIL_VOICE))))
VoiceTrigger->AI()->EnterEvadeMode(); VoiceTrigger->AI()->EnterEvadeMode();
} }
@@ -259,7 +259,7 @@ struct TRINITY_DLL_DECL mob_illidari_councilAI : public ScriptedAI
Council[3] = pInstance->GetData64(DATA_VERASDARKSHADOW); Council[3] = pInstance->GetData64(DATA_VERASDARKSHADOW);
// Start the event for the Voice Trigger // Start the event for the Voice Trigger
if(Creature* VoiceTrigger = ((Creature*)Unit::GetUnit(*m_creature, pInstance->GetData64(DATA_BLOOD_ELF_COUNCIL_VOICE)))) if(Creature* VoiceTrigger = (Unit::GetCreature(*m_creature, pInstance->GetData64(DATA_BLOOD_ELF_COUNCIL_VOICE))))
{ {
((mob_blood_elf_council_voice_triggerAI*)VoiceTrigger->AI())->LoadCouncilGUIDs(); ((mob_blood_elf_council_voice_triggerAI*)VoiceTrigger->AI())->LoadCouncilGUIDs();
((mob_blood_elf_council_voice_triggerAI*)VoiceTrigger->AI())->EventStarted = true; ((mob_blood_elf_council_voice_triggerAI*)VoiceTrigger->AI())->EventStarted = true;
@@ -294,7 +294,7 @@ struct TRINITY_DLL_DECL mob_illidari_councilAI : public ScriptedAI
{ {
if(pInstance) if(pInstance)
{ {
if(Creature* VoiceTrigger = ((Creature*)Unit::GetUnit(*m_creature, pInstance->GetData64(DATA_BLOOD_ELF_COUNCIL_VOICE)))) if(Creature* VoiceTrigger = (Unit::GetCreature(*m_creature, pInstance->GetData64(DATA_BLOOD_ELF_COUNCIL_VOICE))))
VoiceTrigger->DealDamage(VoiceTrigger, VoiceTrigger->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); VoiceTrigger->DealDamage(VoiceTrigger, VoiceTrigger->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
pInstance->SetData(DATA_ILLIDARICOUNCILEVENT, DONE); pInstance->SetData(DATA_ILLIDARICOUNCILEVENT, DONE);
} }
@@ -302,7 +302,7 @@ struct TRINITY_DLL_DECL mob_illidari_councilAI : public ScriptedAI
return; return;
} }
Creature* pMember = ((Creature*)Unit::GetUnit(*m_creature, Council[DeathCount])); Creature* pMember = (Unit::GetCreature(*m_creature, Council[DeathCount]));
if(pMember && pMember->isAlive()) if(pMember && pMember->isAlive())
pMember->DealDamage(pMember, pMember->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); pMember->DealDamage(pMember, pMember->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
++DeathCount; ++DeathCount;
@@ -319,7 +319,7 @@ struct TRINITY_DLL_DECL mob_illidari_councilAI : public ScriptedAI
{ {
if(Council[i]) if(Council[i])
{ {
if(Creature* Member = ((Creature*)Unit::GetUnit((*m_creature), Council[i]))) if(Creature* Member = (Unit::GetCreature((*m_creature), Council[i])))
{ {
// This is the evade/death check. // This is the evade/death check.
if(Member->isAlive() && !Member->getVictim()) if(Member->isAlive() && !Member->getVictim())
@@ -364,7 +364,7 @@ struct TRINITY_DLL_DECL boss_illidari_councilAI : public ScriptedAI
{ {
if(pInstance) if(pInstance)
{ {
Creature* Controller = ((Creature*)Unit::GetUnit(*m_creature, pInstance->GetData64(DATA_ILLIDARICOUNCIL))); Creature* Controller = (Unit::GetCreature(*m_creature, pInstance->GetData64(DATA_ILLIDARICOUNCIL)));
if(Controller) if(Controller)
((mob_illidari_councilAI*)Controller->AI())->StartEvent(who); ((mob_illidari_councilAI*)Controller->AI())->StartEvent(who);
} }
@@ -216,7 +216,7 @@ struct TRINITY_DLL_DECL npc_grimstoneAI : public npc_escortAI
if (RingBossGUID) if (RingBossGUID)
{ {
Creature *boss = (Creature*)Unit::GetUnit(*m_creature,RingBossGUID); Creature *boss = Unit::GetCreature(*m_creature,RingBossGUID);
if (boss && !boss->isAlive() && boss->isDead()) if (boss && !boss->isAlive() && boss->isDead())
{ {
RingBossGUID = 0; RingBossGUID = 0;
@@ -229,7 +229,7 @@ struct TRINITY_DLL_DECL npc_grimstoneAI : public npc_escortAI
for(uint8 i = 0; i < MOB_AMOUNT; i++) for(uint8 i = 0; i < MOB_AMOUNT; i++)
{ {
Creature *mob = (Creature*)Unit::GetUnit(*m_creature,RingMobGUID[i]); Creature *mob = Unit::GetCreature(*m_creature,RingMobGUID[i]);
if (mob && !mob->isAlive() && mob->isDead()) if (mob && !mob->isAlive() && mob->isDead())
{ {
RingMobGUID[i] = 0; RingMobGUID[i] = 0;
@@ -173,7 +173,7 @@ struct TRINITY_DLL_DECL mob_doomfireAI : public ScriptedAI
bool suicide = true; bool suicide = true;
if(ArchimondeGUID) if(ArchimondeGUID)
{ {
Creature* Archimonde = ((Creature*)Unit::GetUnit((*m_creature), ArchimondeGUID)); Creature* Archimonde = (Unit::GetCreature((*m_creature), ArchimondeGUID));
if(Archimonde && Archimonde->isAlive()) if(Archimonde && Archimonde->isAlive())
{ {
suicide = false; suicide = false;
@@ -381,7 +381,7 @@ void hyjalAI::Reset()
return; return;
for(std::list<uint64>::iterator itr = CreatureList.begin(); itr != CreatureList.end(); ++itr) for(std::list<uint64>::iterator itr = CreatureList.begin(); itr != CreatureList.end(); ++itr)
if(Creature* cr = ((Creature*)Unit::GetUnit(*m_creature, *itr))) if(Creature* cr = (Unit::GetCreature(*m_creature, *itr)))
cr->SetVisibility(VISIBILITY_ON); cr->SetVisibility(VISIBILITY_ON);
CreatureList.clear();*/ CreatureList.clear();*/
@@ -747,7 +747,7 @@ void hyjalAI::DeSpawnVeins()
if(!pInstance)return; if(!pInstance)return;
if(Faction == 1) if(Faction == 1)
{ {
Creature* pUnit=(Creature*)Unit::GetUnit((*m_creature),pInstance->GetData64(DATA_JAINAPROUDMOORE)); Creature* pUnit=Unit::GetCreature((*m_creature),pInstance->GetData64(DATA_JAINAPROUDMOORE));
if (!pUnit)return; if (!pUnit)return;
hyjalAI* ai = ((hyjalAI*)pUnit->AI()); hyjalAI* ai = ((hyjalAI*)pUnit->AI());
if(!ai)return; if(!ai)return;
@@ -759,7 +759,7 @@ void hyjalAI::DeSpawnVeins()
} }
}else if (Faction) }else if (Faction)
{ {
Creature* pUnit=(Creature*)Unit::GetUnit((*m_creature),pInstance->GetData64(DATA_THRALL)); Creature* pUnit=Unit::GetCreature((*m_creature),pInstance->GetData64(DATA_THRALL));
if (!pUnit)return; if (!pUnit)return;
hyjalAI* ai = ((hyjalAI*)pUnit->AI()); hyjalAI* ai = ((hyjalAI*)pUnit->AI());
if(!ai)return; if(!ai)return;
@@ -367,7 +367,7 @@ struct TRINITY_DLL_DECL npc_thrall_old_hillsbradAI : public npc_escortAI
//trigger taretha to run down outside //trigger taretha to run down outside
if (uint64 TarethaGUID = pInstance->GetData64(DATA_TARETHA)) if (uint64 TarethaGUID = pInstance->GetData64(DATA_TARETHA))
{ {
if (Creature* Taretha = ((Creature*)Unit::GetUnit(*m_creature, TarethaGUID))) if (Creature* Taretha = (Unit::GetCreature(*m_creature, TarethaGUID)))
((npc_escortAI*)(Taretha->AI()))->Start(false, false, true, PlayerGUID); ((npc_escortAI*)(Taretha->AI()))->Start(false, false, true, PlayerGUID);
} }
@@ -833,7 +833,7 @@ bool GossipSelect_npc_taretha(Player *player, Creature *_Creature, uint32 sender
if (uint64 ThrallGUID = pInstance->GetData64(DATA_THRALL)) if (uint64 ThrallGUID = pInstance->GetData64(DATA_THRALL))
{ {
Creature* Thrall = ((Creature*)Unit::GetUnit((*_Creature), ThrallGUID)); Creature* Thrall = (Unit::GetCreature((*_Creature), ThrallGUID));
if(Thrall) if(Thrall)
((npc_thrall_old_hillsbradAI*)Thrall->AI())->StartWP(); ((npc_thrall_old_hillsbradAI*)Thrall->AI())->StartWP();
} }
@@ -134,7 +134,7 @@ struct TRINITY_DLL_DECL boss_fathomlord_karathressAI : public ScriptedAI
if(RAdvisors[i]) if(RAdvisors[i])
{ {
pAdvisor = ((Creature*)Unit::GetUnit((*m_creature), RAdvisors[i])); pAdvisor = (Unit::GetCreature((*m_creature), RAdvisors[i]));
if(pAdvisor && !pAdvisor->isAlive()) if(pAdvisor && !pAdvisor->isAlive())
{ {
pAdvisor->Respawn(); pAdvisor->Respawn();
@@ -280,7 +280,7 @@ struct TRINITY_DLL_DECL boss_fathomlord_karathressAI : public ScriptedAI
for(uint8 i = 0; i < 4; ++i) for(uint8 i = 0; i < 4; ++i)
if(Advisors[i]) if(Advisors[i])
{ {
Advisor = ((Creature*)Unit::GetUnit(*m_creature, Advisors[i])); Advisor = (Unit::GetCreature(*m_creature, Advisors[i]));
if(Advisor) if(Advisor)
{ {
if(Advisor->isAlive()) if(Advisor->isAlive())
@@ -145,7 +145,7 @@ struct TRINITY_DLL_DECL boss_hydross_the_unstableAI : public ScriptedAI
{ {
for(uint8 i=0;i<2;i++) for(uint8 i=0;i<2;i++)
{ {
Creature* mob = (Creature*)Unit::GetUnit(*m_creature,beams[i]); Creature* mob = Unit::GetCreature(*m_creature,beams[i]);
if(mob) if(mob)
{ {
mob->setDeathState(DEAD); mob->setDeathState(DEAD);
@@ -206,7 +206,7 @@ struct TRINITY_DLL_DECL boss_leotheras_the_blindAI : public ScriptedAI
{ {
for(uint8 i = 0; i < 3; i++) for(uint8 i = 0; i < 3; i++)
{ {
Creature *add = (Creature*)Unit::GetUnit(*m_creature,SpellBinderGUID[i]); Creature *add = Unit::GetCreature(*m_creature,SpellBinderGUID[i]);
if (add && add->isAlive()) if (add && add->isAlive())
{ {
add->setDeathState(DEAD); add->setDeathState(DEAD);
@@ -81,7 +81,7 @@ struct TRINITY_DLL_DECL 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>::iterator i = Striders.begin(); i != Striders.end(); ++i)
if(Creature *strider = (Creature*)Unit::GetUnit(*m_creature, *i)) if(Creature *strider = Unit::GetCreature(*m_creature, *i))
{ {
strider->SetLootRecipient(NULL); strider->SetLootRecipient(NULL);
strider->DealDamage(strider,strider->GetMaxHealth(),NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); strider->DealDamage(strider,strider->GetMaxHealth(),NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
@@ -76,7 +76,7 @@ struct TRINITY_DLL_DECL npc_prospector_anvilwardAI : public npc_escortAI
// Pure Virtual Functions // Pure Virtual Functions
void WaypointReached(uint32 i) void WaypointReached(uint32 i)
{ {
Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); Player* player = Unit::GetPlayer(PlayerGUID);
if(!player) if(!player)
return; return;
@@ -372,7 +372,7 @@ struct TRINITY_DLL_DECL master_kelerun_bloodmournAI : public ScriptedAI
if ( timer < diff ) { if ( timer < diff ) {
Creature* paladinSpawn; Creature* paladinSpawn;
paladinSpawn = ((Creature*)Unit::GetUnit((*m_creature), paladinGuid[paladinPhase])); paladinSpawn = (Unit::GetCreature((*m_creature), paladinGuid[paladinPhase]));
if ( paladinSpawn ) { if ( paladinSpawn ) {
((npc_secondTrialAI*)paladinSpawn->AI())->Activate(m_creature->GetGUID()); ((npc_secondTrialAI*)paladinSpawn->AI())->Activate(m_creature->GetGUID());
@@ -472,7 +472,7 @@ void npc_secondTrialAI::JustDied(Unit* Killer) {
if (Killer->GetTypeId() == TYPEID_PLAYER) if (Killer->GetTypeId() == TYPEID_PLAYER)
{ {
Creature* Summoner; Creature* Summoner;
Summoner = ((Creature*)Unit::GetUnit((*m_creature), summonerGuid)); Summoner = (Unit::GetCreature((*m_creature), summonerGuid));
if ( Summoner ) if ( Summoner )
((master_kelerun_bloodmournAI*)Summoner->AI())->SecondTrialKill(); ((master_kelerun_bloodmournAI*)Summoner->AI())->SecondTrialKill();
@@ -593,7 +593,7 @@ struct TRINITY_DLL_DECL npc_apprentice_mirvedaAI : public ScriptedAI
{ {
if (PlayerGUID) if (PlayerGUID)
{ {
Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); Player* player = Unit::GetPlayer(PlayerGUID);
if (player) if (player)
((Player*)player)->FailQuest(QUEST_UNEXPECTED_RESULT); ((Player*)player)->FailQuest(QUEST_UNEXPECTED_RESULT);
} }
@@ -605,7 +605,7 @@ struct TRINITY_DLL_DECL npc_apprentice_mirvedaAI : public ScriptedAI
{ {
if (PlayerGUID) if (PlayerGUID)
{ {
Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); Player* player = Unit::GetPlayer(PlayerGUID);
if(player) if(player)
((Player*)player)->CompleteQuest(QUEST_UNEXPECTED_RESULT); ((Player*)player)->CompleteQuest(QUEST_UNEXPECTED_RESULT);
} }
@@ -709,7 +709,7 @@ struct TRINITY_DLL_DECL npc_infused_crystalAI : public Scripted_NoMovementAI
{ {
if (PlayerGUID && !Completed) if (PlayerGUID && !Completed)
{ {
Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); Player* player = Unit::GetPlayer(PlayerGUID);
if (player) if (player)
((Player*)player)->FailQuest(QUEST_POWERING_OUR_DEFENSES); ((Player*)player)->FailQuest(QUEST_POWERING_OUR_DEFENSES);
} }
@@ -723,7 +723,7 @@ struct TRINITY_DLL_DECL npc_infused_crystalAI : public Scripted_NoMovementAI
Completed = true; Completed = true;
if (PlayerGUID) if (PlayerGUID)
{ {
Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); Player* player = Unit::GetPlayer(PlayerGUID);
if(player) if(player)
((Player*)player)->CompleteQuest(QUEST_POWERING_OUR_DEFENSES); ((Player*)player)->CompleteQuest(QUEST_POWERING_OUR_DEFENSES);
} }
@@ -155,7 +155,7 @@ struct TRINITY_DLL_DECL npc_ranger_lilathaAI : public npc_escortAI
void WaypointReached(uint32 i) void WaypointReached(uint32 i)
{ {
Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); Player* player = Unit::GetPlayer(PlayerGUID);
if (!player) if (!player)
return; return;
@@ -223,7 +223,7 @@ struct TRINITY_DLL_DECL npc_ranger_lilathaAI : public npc_escortAI
{ {
if (PlayerGUID) if (PlayerGUID)
{ {
Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); Player* player = Unit::GetPlayer(PlayerGUID);
if (player) if (player)
((Player*)player)->FailQuest(QUEST_ESCAPE_FROM_THE_CATACOMBS); ((Player*)player)->FailQuest(QUEST_ESCAPE_FROM_THE_CATACOMBS);
} }
@@ -134,7 +134,7 @@ struct TRINITY_DLL_DECL boss_kelidan_the_breakerAI : public ScriptedAI
} }
for(int i=0; i<5; ++i) for(int i=0; i<5; ++i)
{ {
Creature *channeler = (Creature*)Unit::GetUnit(*m_creature, Channelers[i]); Creature *channeler = Unit::GetCreature(*m_creature, Channelers[i]);
if(who && channeler && !channeler->isInCombat()) if(who && channeler && !channeler->isInCombat())
channeler->AI()->AttackStart(who); channeler->AI()->AttackStart(who);
} }
@@ -144,7 +144,7 @@ struct TRINITY_DLL_DECL boss_kelidan_the_breakerAI : public ScriptedAI
{ {
for(int i=0; i<5; ++i) for(int i=0; i<5; ++i)
{ {
Creature *channeler = (Creature*)Unit::GetUnit(*m_creature, Channelers[i]); Creature *channeler = Unit::GetCreature(*m_creature, Channelers[i]);
if(channeler && channeler->isAlive()) if(channeler && channeler->isAlive())
return; return;
} }
@@ -160,7 +160,7 @@ struct TRINITY_DLL_DECL boss_kelidan_the_breakerAI : public ScriptedAI
int i; int i;
for(i=0; i<5; ++i) for(i=0; i<5; ++i)
{ {
Creature *channeler = (Creature*)Unit::GetUnit(*m_creature, Channelers[i]); Creature *channeler = Unit::GetCreature(*m_creature, Channelers[i]);
if(channeler && channeler->GetGUID()==channeler1->GetGUID()) if(channeler && channeler->GetGUID()==channeler1->GetGUID())
break; break;
} }
@@ -171,7 +171,7 @@ struct TRINITY_DLL_DECL boss_kelidan_the_breakerAI : public ScriptedAI
{ {
for(int i=0; i<5; ++i) for(int i=0; i<5; ++i)
{ {
Creature *channeler = (Creature*)Unit::GetUnit(*m_creature, Channelers[i]); Creature *channeler = Unit::GetCreature(*m_creature, Channelers[i]);
if(!channeler || channeler->isDead()) if(!channeler || channeler->isDead())
channeler = m_creature->SummonCreature(ENTRY_CHANNELER,ShadowmoonChannelers[i][0],ShadowmoonChannelers[i][1],ShadowmoonChannelers[i][2],ShadowmoonChannelers[i][3],TEMPSUMMON_CORPSE_TIMED_DESPAWN,300000); channeler = m_creature->SummonCreature(ENTRY_CHANNELER,ShadowmoonChannelers[i][0],ShadowmoonChannelers[i][1],ShadowmoonChannelers[i][2],ShadowmoonChannelers[i][3],TEMPSUMMON_CORPSE_TIMED_DESPAWN,300000);
if(channeler) if(channeler)
@@ -127,7 +127,7 @@ struct TRINITY_DLL_DECL boss_nazanAI : public ScriptedAI
if(flight) // phase 1 - the flight if(flight) // phase 1 - the flight
{ {
Creature *Vazruden = (Creature*)Unit::GetUnit(*m_creature,VazrudenGUID); Creature *Vazruden = Unit::GetCreature(*m_creature,VazrudenGUID);
if(Fly_Timer < diff || !(Vazruden && Vazruden->isAlive() && (Vazruden->GetHealth()*5 > Vazruden->GetMaxHealth()))) if(Fly_Timer < diff || !(Vazruden && Vazruden->isAlive() && (Vazruden->GetHealth()*5 > Vazruden->GetMaxHealth())))
{ {
flight = false; flight = false;
@@ -279,8 +279,8 @@ struct TRINITY_DLL_DECL boss_vazruden_the_heraldAI : public ScriptedAI
{ {
if(summoned) if(summoned)
{ {
Creature *Nazan = (Creature*)Unit::GetUnit(*m_creature, NazanGUID); Creature *Nazan = Unit::GetCreature(*m_creature, NazanGUID);
Creature *Vazruden = (Creature*)Unit::GetUnit(*m_creature, VazrudenGUID); Creature *Vazruden = Unit::GetCreature(*m_creature, VazrudenGUID);
if(Nazan || (Nazan = (Creature *)FindCreature(ENTRY_NAZAN, 5000, m_creature))) if(Nazan || (Nazan = (Creature *)FindCreature(ENTRY_NAZAN, 5000, m_creature)))
{ {
Nazan->SetLootRecipient(NULL); Nazan->SetLootRecipient(NULL);
@@ -381,8 +381,8 @@ struct TRINITY_DLL_DECL boss_vazruden_the_heraldAI : public ScriptedAI
default: // adds do the job now default: // adds do the job now
if(check < diff) if(check < diff)
{ {
Creature *Nazan = (Creature*)Unit::GetUnit(*m_creature, NazanGUID); Creature *Nazan = Unit::GetCreature(*m_creature, NazanGUID);
Creature *Vazruden = (Creature*)Unit::GetUnit(*m_creature, VazrudenGUID); Creature *Vazruden = Unit::GetCreature(*m_creature, VazrudenGUID);
if(Nazan && Nazan->isAlive() || Vazruden && Vazruden->isAlive()) if(Nazan && Nazan->isAlive() || Vazruden && Vazruden->isAlive())
{ {
if(Nazan && Nazan->getVictim() || Vazruden && Vazruden->getVictim()) if(Nazan && Nazan->getVictim() || Vazruden && Vazruden->getVictim())
@@ -506,7 +506,7 @@ bool GOHello_go_Manticron_Cube(Player *player, GameObject* _GO)
ScriptedInstance* pInstance =(ScriptedInstance*)_GO->GetInstanceData(); ScriptedInstance* pInstance =(ScriptedInstance*)_GO->GetInstanceData();
if(!pInstance) return true; if(!pInstance) return true;
if(pInstance->GetData(DATA_MAGTHERIDON_EVENT) != IN_PROGRESS) return true; if(pInstance->GetData(DATA_MAGTHERIDON_EVENT) != IN_PROGRESS) return true;
Creature *Magtheridon =(Creature*)Unit::GetUnit(*_GO, pInstance->GetData64(DATA_MAGTHERIDON)); Creature *Magtheridon =Unit::GetCreature(*_GO, pInstance->GetData64(DATA_MAGTHERIDON));
if(!Magtheridon || !Magtheridon->isAlive()) return true; if(!Magtheridon || !Magtheridon->isAlive()) return true;
// if exhausted or already channeling return // if exhausted or already channeling return
@@ -339,7 +339,7 @@ struct TRINITY_DLL_DECL mob_fel_orc_convertAI : public ScriptedAI
{ {
if (pInstance->GetData64(DATA_NETHEKURSE)) if (pInstance->GetData64(DATA_NETHEKURSE))
{ {
Creature *pKurse = (Creature*)Unit::GetUnit(*m_creature,pInstance->GetData64(DATA_NETHEKURSE)); Creature *pKurse = Unit::GetCreature(*m_creature,pInstance->GetData64(DATA_NETHEKURSE));
if (pKurse) if (pKurse)
((boss_grand_warlock_nethekurseAI*)pKurse->AI())->DoYellForPeonAggro(); ((boss_grand_warlock_nethekurseAI*)pKurse->AI())->DoYellForPeonAggro();
} }
@@ -356,7 +356,7 @@ struct TRINITY_DLL_DECL mob_fel_orc_convertAI : public ScriptedAI
{ {
if (pInstance->GetData64(DATA_NETHEKURSE)) if (pInstance->GetData64(DATA_NETHEKURSE))
{ {
Creature *pKurse = (Creature*)Unit::GetUnit(*m_creature,pInstance->GetData64(DATA_NETHEKURSE)); Creature *pKurse = Unit::GetCreature(*m_creature,pInstance->GetData64(DATA_NETHEKURSE));
if (pKurse) if (pKurse)
((boss_grand_warlock_nethekurseAI*)pKurse->AI())->DoYellForPeonDeath(); ((boss_grand_warlock_nethekurseAI*)pKurse->AI())->DoYellForPeonDeath();
} }
@@ -275,7 +275,7 @@ struct TRINITY_DLL_DECL npc_wounded_blood_elfAI : public npc_escortAI
void WaypointReached(uint32 i) void WaypointReached(uint32 i)
{ {
Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); Player* player = Unit::GetPlayer(PlayerGUID);
if (!player) if (!player)
return; return;
@@ -305,7 +305,7 @@ struct TRINITY_DLL_DECL npc_wounded_blood_elfAI : public npc_escortAI
case 27: case 27:
DoScriptText(SAY_ELF_COMPLETE, m_creature, player); DoScriptText(SAY_ELF_COMPLETE, m_creature, player);
// Award quest credit // Award quest credit
Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); Player* player = Unit::GetPlayer(PlayerGUID);
if (player && player->GetTypeId() == TYPEID_PLAYER) if (player && player->GetTypeId() == TYPEID_PLAYER)
((Player*)player)->GroupEventHappens(QUEST_ROAD_TO_FALCON_WATCH,m_creature); ((Player*)player)->GroupEventHappens(QUEST_ROAD_TO_FALCON_WATCH,m_creature);
break; break;
@@ -337,7 +337,7 @@ struct TRINITY_DLL_DECL npc_wounded_blood_elfAI : public npc_escortAI
if (PlayerGUID) if (PlayerGUID)
{ {
// If NPC dies, player fails the quest // If NPC dies, player fails the quest
Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); Player* player = Unit::GetPlayer(PlayerGUID);
if (player && player->GetTypeId() == TYPEID_PLAYER) if (player && player->GetTypeId() == TYPEID_PLAYER)
((Player*)player)->FailQuest(QUEST_ROAD_TO_FALCON_WATCH); ((Player*)player)->FailQuest(QUEST_ROAD_TO_FALCON_WATCH);
} }
@@ -278,7 +278,7 @@ struct TRINITY_DLL_DECL boss_attumenAI : public ScriptedAI
{ {
if( (m_creature->GetHealth()*100)/m_creature->GetMaxHealth() < 25) if( (m_creature->GetHealth()*100)/m_creature->GetMaxHealth() < 25)
{ {
Creature *pMidnight = (Creature*)Unit::GetUnit(*m_creature, Midnight); Creature *pMidnight = Unit::GetCreature(*m_creature, Midnight);
if(pMidnight && pMidnight->GetTypeId() == TYPEID_UNIT) if(pMidnight && pMidnight->GetTypeId() == TYPEID_UNIT)
{ {
((boss_midnightAI*)(pMidnight->AI()))->Mount(m_creature); ((boss_midnightAI*)(pMidnight->AI()))->Mount(m_creature);
@@ -211,7 +211,7 @@ struct TRINITY_DLL_DECL boss_moroesAI : public ScriptedAI
AddGUID[i] = pCreature->GetGUID(); AddGUID[i] = pCreature->GetGUID();
break; break;
case 1: case 1:
pCreature = ((Creature*)Unit::GetUnit((*m_creature), AddGUID[i])); pCreature = (Unit::GetCreature((*m_creature), AddGUID[i]));
if (pCreature) if (pCreature)
{ {
pCreature->Respawn(); pCreature->Respawn();
@@ -219,7 +219,7 @@ struct TRINITY_DLL_DECL boss_moroesAI : public ScriptedAI
} }
break; break;
case 2: case 2:
pCreature = ((Creature*)Unit::GetUnit((*m_creature), AddGUID[i])); pCreature = (Unit::GetCreature((*m_creature), AddGUID[i]));
if (!pCreature->IsInEvadeMode()) if (!pCreature->IsInEvadeMode())
pCreature->AI()->EnterEvadeMode(); pCreature->AI()->EnterEvadeMode();
break; break;
@@ -281,7 +281,7 @@ struct TRINITY_DLL_DECL boss_moroesAI : public ScriptedAI
Creature* Temp = NULL; Creature* Temp = NULL;
if (AddGUID[i]) if (AddGUID[i])
{ {
Temp = (Creature*)Unit::GetUnit((*m_creature),AddGUID[i]); Temp = Unit::GetCreature((*m_creature),AddGUID[i]);
if (Temp && Temp->isAlive()) if (Temp && Temp->isAlive())
if (!Temp->getVictim() ) if (!Temp->getVictim() )
Temp->AI()->AttackStart(m_creature->getVictim()); Temp->AI()->AttackStart(m_creature->getVictim());
@@ -390,7 +390,7 @@ struct TRINITY_DLL_DECL boss_moroes_guestAI : public ScriptedAI
return; return;
GuestGUID[0] = pInstance->GetData64(DATA_MOROES); GuestGUID[0] = pInstance->GetData64(DATA_MOROES);
Creature* Moroes = ((Creature*)Unit::GetUnit((*m_creature), GuestGUID[0])); Creature* Moroes = (Unit::GetCreature((*m_creature), GuestGUID[0]));
if(Moroes) if(Moroes)
{ {
for(uint8 i = 0; i < 3; ++i) for(uint8 i = 0; i < 3; ++i)
@@ -91,7 +91,7 @@ struct TRINITY_DLL_DECL mob_kilrekAI : public ScriptedAI
return; return;
} }
Creature* Terestian = ((Creature*)Unit::GetUnit(*m_creature, pInstance->GetData64(DATA_TERESTIAN))); Creature* Terestian = (Unit::GetCreature(*m_creature, pInstance->GetData64(DATA_TERESTIAN)));
if(Terestian && !Terestian->getVictim()) if(Terestian && !Terestian->getVictim())
Terestian->AddThreat(who, 1.0f); Terestian->AddThreat(who, 1.0f);
} }
@@ -213,7 +213,7 @@ struct TRINITY_DLL_DECL boss_terestianAI : public ScriptedAI
if(pInstance) if(pInstance)
{ {
// Put Kil'rek in combat against our target so players don't skip him // Put Kil'rek in combat against our target so players don't skip him
Creature* Kilrek = ((Creature*)Unit::GetUnit(*m_creature, pInstance->GetData64(DATA_KILREK))); Creature* Kilrek = (Unit::GetCreature(*m_creature, pInstance->GetData64(DATA_KILREK)));
if(Kilrek && !Kilrek->getVictim()) if(Kilrek && !Kilrek->getVictim())
Kilrek->AddThreat(who, 1.0f); Kilrek->AddThreat(who, 1.0f);
@@ -263,7 +263,7 @@ struct TRINITY_DLL_DECL boss_terestianAI : public ScriptedAI
uint64 KilrekGUID = pInstance->GetData64(DATA_KILREK); uint64 KilrekGUID = pInstance->GetData64(DATA_KILREK);
else ERROR_INST_DATA(m_creature); else ERROR_INST_DATA(m_creature);
Creature* Kilrek = ((Creature*)Unit::GetUnit((*m_creature), KilrekGUID)); Creature* Kilrek = (Unit::GetCreature((*m_creature), KilrekGUID));
if(SummonKilrek && Kilrek) if(SummonKilrek && Kilrek)
{ {
Kilrek->Respawn(); Kilrek->Respawn();
@@ -221,7 +221,7 @@ struct TRINITY_DLL_DECL mob_titoAI : public ScriptedAI
{ {
if(DorotheeGUID) if(DorotheeGUID)
{ {
Creature* Dorothee = ((Creature*)Unit::GetUnit((*m_creature), DorotheeGUID)); Creature* Dorothee = (Unit::GetCreature((*m_creature), DorotheeGUID));
if(Dorothee && Dorothee->isAlive()) if(Dorothee && Dorothee->isAlive())
{ {
((boss_dorotheeAI*)Dorothee->AI())->TitoDied = true; ((boss_dorotheeAI*)Dorothee->AI())->TitoDied = true;
@@ -1054,7 +1054,7 @@ struct TRINITY_DLL_DECL boss_romuloAI : public ScriptedAI
DoScriptText(SAY_ROMULO_AGGRO, m_creature); DoScriptText(SAY_ROMULO_AGGRO, m_creature);
if(JulianneGUID) if(JulianneGUID)
{ {
Creature* Julianne = ((Creature*)Unit::GetUnit((*m_creature), JulianneGUID)); Creature* Julianne = (Unit::GetCreature((*m_creature), JulianneGUID));
if(Julianne && Julianne->getVictim()) if(Julianne && Julianne->getVictim())
{ {
m_creature->AddThreat(Julianne->getVictim(), 1.0f); m_creature->AddThreat(Julianne->getVictim(), 1.0f);
@@ -1104,7 +1104,7 @@ void boss_julianneAI::DamageTaken(Unit* done_by, uint32 &damage)
if(!IsFakingDeath) if(!IsFakingDeath)
{ {
Creature* Romulo = ((Creature*)Unit::GetUnit((*m_creature), RomuloGUID)); Creature* Romulo = (Unit::GetCreature((*m_creature), RomuloGUID));
if(Romulo && Romulo->isAlive() && !((boss_romuloAI*)Romulo->AI())->IsFakingDeath) if(Romulo && Romulo->isAlive() && !((boss_romuloAI*)Romulo->AI())->IsFakingDeath)
{ {
((boss_romuloAI*)Romulo->AI())->ResurrectTimer = 10000; ((boss_romuloAI*)Romulo->AI())->ResurrectTimer = 10000;
@@ -1143,7 +1143,7 @@ void boss_romuloAI::DamageTaken(Unit* done_by, uint32 &damage)
if(Phase == PHASE_BOTH) if(Phase == PHASE_BOTH)
{ {
Creature* Julianne = ((Creature*)Unit::GetUnit((*m_creature), JulianneGUID)); Creature* Julianne = (Unit::GetCreature((*m_creature), JulianneGUID));
if(Julianne && Julianne->isAlive() && !((boss_julianneAI*)Julianne->AI())->IsFakingDeath) if(Julianne && Julianne->isAlive() && !((boss_julianneAI*)Julianne->AI())->IsFakingDeath)
{ {
((boss_julianneAI*)Julianne->AI())->ResurrectTimer = 10000; ((boss_julianneAI*)Julianne->AI())->ResurrectTimer = 10000;
@@ -1163,7 +1163,7 @@ void boss_romuloAI::DamageTaken(Unit* done_by, uint32 &damage)
} }
else else
{ {
Creature* Julianne = ((Creature*)Unit::GetUnit((*m_creature), JulianneGUID)); Creature* Julianne = (Unit::GetCreature((*m_creature), JulianneGUID));
if(Julianne) if(Julianne)
{ {
Resurrect(Julianne); Resurrect(Julianne);
@@ -1231,7 +1231,7 @@ void boss_julianneAI::UpdateAI(const uint32 diff)
{ {
if(ResurrectTimer < diff) if(ResurrectTimer < diff)
{ {
Creature* Romulo = ((Creature*)Unit::GetUnit((*m_creature), RomuloGUID)); Creature* Romulo = (Unit::GetCreature((*m_creature), RomuloGUID));
if(Romulo && ((boss_romuloAI*)Romulo->AI())->IsFakingDeath) if(Romulo && ((boss_romuloAI*)Romulo->AI())->IsFakingDeath)
{ {
DoScriptText(SAY_JULIANNE_RESURRECT, m_creature); DoScriptText(SAY_JULIANNE_RESURRECT, m_creature);
@@ -1265,7 +1265,7 @@ void boss_julianneAI::UpdateAI(const uint32 diff)
{ {
if(rand()%2 == 1 && SummonedRomulo) if(rand()%2 == 1 && SummonedRomulo)
{ {
Creature* Romulo = ((Creature*)Unit::GetUnit((*m_creature), RomuloGUID)); Creature* Romulo = (Unit::GetCreature((*m_creature), RomuloGUID));
if(Romulo && Romulo->isAlive() && !((boss_romuloAI*)Romulo->AI())->IsFakingDeath) if(Romulo && Romulo->isAlive() && !((boss_romuloAI*)Romulo->AI())->IsFakingDeath)
DoCast(Romulo, SPELL_ETERNAL_AFFECTION); DoCast(Romulo, SPELL_ETERNAL_AFFECTION);
else else
@@ -1287,7 +1287,7 @@ void boss_romuloAI::UpdateAI(const uint32 diff)
{ {
if(ResurrectTimer < diff) if(ResurrectTimer < diff)
{ {
Creature* Julianne = ((Creature*)Unit::GetUnit((*m_creature), JulianneGUID)); Creature* Julianne = (Unit::GetCreature((*m_creature), JulianneGUID));
if(Julianne && ((boss_julianneAI*)Julianne->AI())->IsFakingDeath) if(Julianne && ((boss_julianneAI*)Julianne->AI())->IsFakingDeath)
{ {
DoScriptText(SAY_ROMULO_RESURRECT, m_creature); DoScriptText(SAY_ROMULO_RESURRECT, m_creature);
@@ -529,7 +529,7 @@ struct TRINITY_DLL_DECL mob_felkael_phoenixAI : public ScriptedAI
{ {
if (pInstance) if (pInstance)
{ {
Creature *boss = ((Creature*)Unit::GetUnit((*m_creature),pInstance->GetData64(DATA_KAEL))); Creature *boss = (Unit::GetCreature((*m_creature),pInstance->GetData64(DATA_KAEL)));
if (boss) if (boss)
{ {
phase = ((boss_felblood_kaelthasAI*)boss->AI())->Phase; phase = ((boss_felblood_kaelthasAI*)boss->AI())->Phase;
@@ -657,7 +657,7 @@ struct TRINITY_DLL_DECL mob_arcane_sphereAI : public ScriptedAI
{ {
if (pInstance) if (pInstance)
{ {
Creature *boss = (Creature*)Unit::GetUnit((*m_creature),pInstance->GetData64(DATA_KAEL)); Creature *boss = Unit::GetCreature((*m_creature),pInstance->GetData64(DATA_KAEL));
if(boss) if(boss)
{ {
if(!((boss_felblood_kaelthasAI*)boss->AI())->Phase || boss->isDead()) if(!((boss_felblood_kaelthasAI*)boss->AI())->Phase || boss->isDead())
@@ -186,7 +186,7 @@ struct TRINITY_DLL_DECL boss_priestess_delrissaAI : public ScriptedAI
} }
for(uint8 i = 0; i < Adds.size(); ++i) for(uint8 i = 0; i < Adds.size(); ++i)
{ {
Creature* pAdd = ((Creature*)Unit::GetUnit(*m_creature, Adds[i]->guid)); Creature* pAdd = (Unit::GetCreature(*m_creature, Adds[i]->guid));
if(pAdd && pAdd->isAlive()) if(pAdd && pAdd->isAlive())
{ {
pAdd->AI()->EnterEvadeMode(); pAdd->AI()->EnterEvadeMode();
@@ -370,7 +370,7 @@ struct TRINITY_DLL_DECL boss_priestess_guestAI : public ScriptedAI
UsedPotion = false; UsedPotion = false;
if(pInstance) if(pInstance)
{ {
Creature *boss = ((Creature*)Unit::GetUnit(*m_creature, pInstance->GetData64(DATA_DELRISSA))); Creature *boss = (Unit::GetCreature(*m_creature, pInstance->GetData64(DATA_DELRISSA)));
if (boss && boss->isDead()) if (boss && boss->isDead())
boss->Respawn(); boss->Respawn();
} }
@@ -387,7 +387,7 @@ struct TRINITY_DLL_DECL boss_priestess_guestAI : public ScriptedAI
return; return;
} }
Creature* Delrissa = ((Creature*)Unit::GetUnit(*m_creature, pInstance->GetData64(DATA_DELRISSA))); Creature* Delrissa = (Unit::GetCreature(*m_creature, pInstance->GetData64(DATA_DELRISSA)));
if(Delrissa) if(Delrissa)
{ {
((boss_priestess_delrissaAI*)Delrissa->AI())->KilledLackey(); ((boss_priestess_delrissaAI*)Delrissa->AI())->KilledLackey();
@@ -406,7 +406,7 @@ struct TRINITY_DLL_DECL boss_priestess_guestAI : public ScriptedAI
return; return;
} }
Creature* Delrissa = ((Creature*)Unit::GetUnit(*m_creature, pInstance->GetData64(DATA_DELRISSA))); Creature* Delrissa = (Unit::GetCreature(*m_creature, pInstance->GetData64(DATA_DELRISSA)));
if(Delrissa) if(Delrissa)
Delrissa->AI()->KilledUnit(victim); Delrissa->AI()->KilledUnit(victim);
} }
@@ -419,7 +419,7 @@ struct TRINITY_DLL_DECL boss_priestess_guestAI : public ScriptedAI
return; return;
} }
Creature* Delrissa = ((Creature*)Unit::GetUnit(*m_creature, pInstance->GetData64(DATA_DELRISSA))); Creature* Delrissa = (Unit::GetCreature(*m_creature, pInstance->GetData64(DATA_DELRISSA)));
if(Delrissa) if(Delrissa)
{ {
Group = ((boss_priestess_delrissaAI*)Delrissa->AI())->Adds; Group = ((boss_priestess_delrissaAI*)Delrissa->AI())->Adds;
@@ -649,13 +649,13 @@ struct TRINITY_DLL_DECL boss_ellris_duskhallowAI : public boss_priestess_guestAI
/*void mob_fizzleAI::JustDied(Unit* killer) /*void mob_fizzleAI::JustDied(Unit* killer)
{ {
if(Creature* Ellris = ((Creature*)Unit::GetUnit(*m_creature, EllrisGUID))) if(Creature* Ellris = (Unit::GetCreature(*m_creature, EllrisGUID)))
((boss_ellris_duskhallowAI*)Ellris->AI())->ImpGUID = 0; ((boss_ellris_duskhallowAI*)Ellris->AI())->ImpGUID = 0;
} }
void mob_fizzleAI::KilledUnit(Unit* victim) void mob_fizzleAI::KilledUnit(Unit* victim)
{ {
if(Creature* Ellris = ((Creature*)Unit::GetUnit(*m_creature, EllrisGUID))) if(Creature* Ellris = (Unit::GetCreature(*m_creature, EllrisGUID)))
((boss_ellris_duskhallowAI*)Ellris->AI())->KilledUnit(victim); ((boss_ellris_duskhallowAI*)Ellris->AI())->KilledUnit(victim);
}*/ }*/
@@ -1060,13 +1060,13 @@ struct TRINITY_DLL_DECL boss_garaxxasAI : public boss_priestess_guestAI
/*void mob_sliverAI::JustDied(Unit* killer) /*void mob_sliverAI::JustDied(Unit* killer)
{ {
if(Creature* Garaxxas = ((Creature*)Unit::GetUnit(*m_creature, GaraxxasGUID))) if(Creature* Garaxxas = (Unit::GetCreature(*m_creature, GaraxxasGUID)))
((boss_garaxxasAI*)Garaxxas->AI())->SliverGUID = 0; ((boss_garaxxasAI*)Garaxxas->AI())->SliverGUID = 0;
} }
void mob_sliverAI::KilledUnit(Unit* victim) void mob_sliverAI::KilledUnit(Unit* victim)
{ {
if(Creature* Garaxxas = ((Creature*)Unit::GetUnit(*m_creature, GaraxxasGUID))) if(Creature* Garaxxas = (Unit::GetCreature(*m_creature, GaraxxasGUID)))
((boss_garaxxasAI*)Garaxxas->AI())->KilledUnit(victim); ((boss_garaxxasAI*)Garaxxas->AI())->KilledUnit(victim);
}*/ }*/
@@ -174,8 +174,8 @@ struct TRINITY_DLL_DECL boss_selin_fireheartAI : public ScriptedAI
//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>::iterator itr = Crystals.begin(); itr != Crystals.end(); ++itr)
{ {
//Creature* pCrystal = ((Creature*)Unit::GetUnit(*m_creature, FelCrystals[i])); //Creature* pCrystal = (Unit::GetCreature(*m_creature, FelCrystals[i]));
Creature* pCrystal = ((Creature*)Unit::GetUnit(*m_creature, *itr)); Creature* pCrystal = (Unit::GetCreature(*m_creature, *itr));
if( pCrystal && pCrystal->isAlive()) if( pCrystal && pCrystal->isAlive())
pCrystal->DealDamage(pCrystal, pCrystal->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); pCrystal->DealDamage(pCrystal, pCrystal->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
} }
@@ -351,7 +351,7 @@ struct TRINITY_DLL_DECL mob_fel_crystalAI : public ScriptedAI
m_creature->RemoveAurasDueToSpell(SPELL_MANA_RAGE); m_creature->RemoveAurasDueToSpell(SPELL_MANA_RAGE);
if(ScriptedInstance* pInstance = ((ScriptedInstance*)m_creature->GetInstanceData())) if(ScriptedInstance* pInstance = ((ScriptedInstance*)m_creature->GetInstanceData()))
{ {
Creature* Selin = ((Creature*)Unit::GetUnit(*m_creature, pInstance->GetData64(DATA_SELIN))); Creature* Selin = (Unit::GetCreature(*m_creature, pInstance->GetData64(DATA_SELIN)));
if(Selin && Selin->isAlive()) if(Selin && Selin->isAlive())
{ {
if(((boss_selin_fireheartAI*)Selin->AI())->CrystalGUID == m_creature->GetGUID()) if(((boss_selin_fireheartAI*)Selin->AI())->CrystalGUID == m_creature->GetGUID())
@@ -422,9 +422,9 @@ struct TRINITY_DLL_DECL npc_commander_dawnforgeAI : public ScriptedAI
// Emote Ardonis and Pathaleon // Emote Ardonis and Pathaleon
void Turn_to_Pathaleons_Image() void Turn_to_Pathaleons_Image()
{ {
Unit *ardonis = Unit::GetUnit(*m_creature,ardonisGUID); Creature *ardonis = Unit::GetCreature(*m_creature,ardonisGUID);
Unit *pathaleon = Unit::GetUnit(*m_creature,pathaleonGUID); Creature *pathaleon = Unit::GetCreature(*m_creature,pathaleonGUID);
Player *player = (Player*)Unit::GetUnit(*m_creature,playerGUID); Player *player = Unit::GetPlayer(playerGUID);
if (!ardonis || !pathaleon || !player) if (!ardonis || !pathaleon || !player)
return; return;
@@ -450,7 +450,7 @@ struct TRINITY_DLL_DECL npc_commander_dawnforgeAI : public ScriptedAI
{ {
if (Unit *ardonis = Unit::GetUnit(*m_creature,ardonisGUID)) if (Unit *ardonis = Unit::GetUnit(*m_creature,ardonisGUID))
{ {
Player *player = (Player*)Unit::GetUnit(*m_creature,playerGUID); Player *player = Unit::GetPlayer(playerGUID);
if (!player) if (!player)
return; return;
@@ -507,7 +507,7 @@ struct TRINITY_DLL_DECL npc_commander_dawnforgeAI : public ScriptedAI
Unit *ardonis = Unit::GetUnit(*m_creature,ardonisGUID); Unit *ardonis = Unit::GetUnit(*m_creature,ardonisGUID);
Unit *pathaleon = Unit::GetUnit(*m_creature,pathaleonGUID); Unit *pathaleon = Unit::GetUnit(*m_creature,pathaleonGUID);
Player *player = (Player*)Unit::GetUnit(*m_creature,playerGUID); Player *player = Unit::GetPlayer(playerGUID);
if (!ardonis || !player) if (!ardonis || !player)
{ {
@@ -915,14 +915,14 @@ struct TRINITY_DLL_DECL npc_bessyAI : public npc_escortAI
{ {
if (PlayerGUID) if (PlayerGUID)
{ {
if (Unit* player = Unit::GetUnit((*m_creature), PlayerGUID)) if (Player* player = Unit::GetPlayer(PlayerGUID))
((Player*)player)->FailQuest(Q_ALMABTRIEB); ((Player*)player)->FailQuest(Q_ALMABTRIEB);
} }
} }
void WaypointReached(uint32 i) void WaypointReached(uint32 i)
{ {
Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); Player* player = Unit::GetPlayer(PlayerGUID);
if (!player) if (!player)
return; return;
@@ -49,7 +49,7 @@ npc_willixAI(Creature *c) : npc_escortAI(c) {}
void WaypointReached(uint32 i) void WaypointReached(uint32 i)
{ {
Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); Player* player = Unit::GetPlayer(PlayerGUID);
if (!player) if (!player)
return; return;
@@ -114,7 +114,7 @@ npc_willixAI(Creature *c) : npc_escortAI(c) {}
{ {
if (PlayerGUID) if (PlayerGUID)
{ {
if (Unit* player = Unit::GetUnit((*m_creature), PlayerGUID)) if (Player* player = Unit::GetPlayer(PlayerGUID))
((Player*)player)->FailQuest(QUEST_WILLIX_THE_IMPORTER); ((Player*)player)->FailQuest(QUEST_WILLIX_THE_IMPORTER);
} }
} }
@@ -464,7 +464,7 @@ struct TRINITY_DLL_DECL boss_headless_horsemanAI : public ScriptedAI
if (withhead) if (withhead)
SaySound(SAY_PLAYER_DEATH); SaySound(SAY_PLAYER_DEATH);
else { //maybe possible when player dies from conflagration else { //maybe possible when player dies from conflagration
Creature *Head = (Creature*)Unit::GetUnit((*m_creature), headGUID); Creature *Head = Unit::GetCreature((*m_creature), headGUID);
if (Head) if (Head)
((mob_headAI*)Head->AI())->SaySound(SAY_PLAYER_DEATH); ((mob_headAI*)Head->AI())->SaySound(SAY_PLAYER_DEATH);
} }
@@ -666,7 +666,7 @@ struct TRINITY_DLL_DECL boss_headless_horsemanAI : public ScriptedAI
{ {
if (Phase > 1) --Phase; if (Phase > 1) --Phase;
else Phase = 1; else Phase = 1;
Creature* Head = (Creature*)Unit::GetUnit((*m_creature), headGUID); Creature* Head = Unit::GetCreature((*m_creature), headGUID);
if (Head && Head->isAlive()) if (Head && Head->isAlive())
{ {
((mob_headAI*)Head->AI())->Phase = Phase; ((mob_headAI*)Head->AI())->Phase = Phase;
@@ -697,7 +697,7 @@ void mob_headAI::Disappear()
return; return;
if (bodyGUID) if (bodyGUID)
{ {
Creature *body = (Creature*)Unit::GetUnit((*m_creature), bodyGUID); Creature *body = Unit::GetCreature((*m_creature), bodyGUID);
if(body && body->isAlive()) if(body && body->isAlive())
{ {
withbody = true; withbody = true;
@@ -128,7 +128,7 @@ struct TRINITY_DLL_DECL mob_mature_netherwing_drakeAI : public ScriptedAI
DoScriptText(SAY_JUST_EATEN, m_creature); DoScriptText(SAY_JUST_EATEN, m_creature);
if(PlayerGUID) if(PlayerGUID)
{ {
Player* plr = ((Player*)Unit::GetUnit((*m_creature), PlayerGUID)); Player* plr = Unit::GetPlayer(PlayerGUID);
if(plr && plr->GetQuestStatus(10804) == QUEST_STATUS_INCOMPLETE) if(plr && plr->GetQuestStatus(10804) == QUEST_STATUS_INCOMPLETE)
{ {
plr->KilledMonster(22131, m_creature->GetGUID()); plr->KilledMonster(22131, m_creature->GetGUID());
@@ -257,7 +257,7 @@ struct TRINITY_DLL_DECL mob_enslaved_netherwing_drakeAI : public ScriptedAI
Tapped = false; Tapped = false;
if(PlayerGUID) if(PlayerGUID)
{ {
Player* plr = ((Player*)Unit::GetUnit((*m_creature), PlayerGUID)); Player* plr = Unit::GetPlayer(PlayerGUID);
if(plr && plr->GetQuestStatus(10854) == QUEST_STATUS_INCOMPLETE) if(plr && plr->GetQuestStatus(10854) == QUEST_STATUS_INCOMPLETE)
{ {
plr->KilledMonster(22316, m_creature->GetGUID()); plr->KilledMonster(22316, m_creature->GetGUID());
@@ -355,7 +355,7 @@ struct TRINITY_DLL_DECL mob_dragonmaw_peonAI : public ScriptedAI
{ {
if(PlayerGUID) if(PlayerGUID)
{ {
Player* plr = ((Player*)Unit::GetUnit((*m_creature), PlayerGUID)); Player* plr = Unit::GetPlayer(PlayerGUID);
if(plr && plr->GetQuestStatus(11020) == QUEST_STATUS_INCOMPLETE) if(plr && plr->GetQuestStatus(11020) == QUEST_STATUS_INCOMPLETE)
plr->KilledMonster(23209, m_creature->GetGUID()); plr->KilledMonster(23209, m_creature->GetGUID());
} }
@@ -699,7 +699,7 @@ struct TRINITY_DLL_DECL npc_overlord_morghorAI : public ScriptedAI
Illidan->SetVisibility(VISIBILITY_OFF); Illidan->SetVisibility(VISIBILITY_OFF);
if(PlayerGUID) if(PlayerGUID)
{ {
Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); Player* player = Unit::GetPlayer(PlayerGUID);
DoScriptText(OVERLORD_SAY_1, m_creature, player); DoScriptText(OVERLORD_SAY_1, m_creature, player);
} }
ConversationTimer = 4200; ConversationTimer = 4200;
@@ -867,7 +867,7 @@ struct TRINITY_DLL_DECL npc_earthmender_wildaAI : public npc_escortAI
void Aggro(Unit *who) void Aggro(Unit *who)
{ {
Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); Player* player = Unit::GetPlayer(PlayerGUID);
if(who->GetTypeId() == TYPEID_UNIT && who->GetEntry() == NPC_COILSKAR_ASSASSIN) if(who->GetTypeId() == TYPEID_UNIT && who->GetEntry() == NPC_COILSKAR_ASSASSIN)
DoScriptText(SAY_AGGRO2, m_creature, player); DoScriptText(SAY_AGGRO2, m_creature, player);
@@ -882,7 +882,7 @@ struct TRINITY_DLL_DECL npc_earthmender_wildaAI : public npc_escortAI
void WaypointReached(uint32 i) void WaypointReached(uint32 i)
{ {
Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); Player* player = Unit::GetPlayer(PlayerGUID);
if (!player) if (!player)
return; return;
@@ -951,7 +951,7 @@ struct TRINITY_DLL_DECL npc_earthmender_wildaAI : public npc_escortAI
void SummonAssassin() void SummonAssassin()
{ {
Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); Player* player = Unit::GetPlayer(PlayerGUID);
Unit* CoilskarAssassin = m_creature->SummonCreature(NPC_COILSKAR_ASSASSIN, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), m_creature->GetOrientation(), TEMPSUMMON_DEAD_DESPAWN, 0); Unit* CoilskarAssassin = m_creature->SummonCreature(NPC_COILSKAR_ASSASSIN, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), m_creature->GetOrientation(), TEMPSUMMON_DEAD_DESPAWN, 0);
if( CoilskarAssassin ) if( CoilskarAssassin )
@@ -970,7 +970,7 @@ struct TRINITY_DLL_DECL npc_earthmender_wildaAI : public npc_escortAI
{ {
if (PlayerGUID && !Completed) if (PlayerGUID && !Completed)
{ {
Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); Player* player = Unit::GetPlayer(PlayerGUID);
if (player) if (player)
((Player*)player)->FailQuest(QUEST_ESCAPE_FROM_COILSKAR_CISTERN); ((Player*)player)->FailQuest(QUEST_ESCAPE_FROM_COILSKAR_CISTERN);
} }
@@ -1287,7 +1287,7 @@ struct TRINITY_DLL_DECL mob_torloth_the_magnificentAI : public ScriptedAI
if(TorlothAnim[AnimationCount].Creature == 1) if(TorlothAnim[AnimationCount].Creature == 1)
{ {
pCreature = ((Creature*)Unit::GetUnit(*m_creature, LordIllidanGUID)); pCreature = (Unit::GetCreature(*m_creature, LordIllidanGUID));
if(!pCreature) if(!pCreature)
return; return;
@@ -1307,7 +1307,7 @@ struct TRINITY_DLL_DECL mob_torloth_the_magnificentAI : public ScriptedAI
m_creature->RemoveFlag(UNIT_FIELD_BYTES_1,8); m_creature->RemoveFlag(UNIT_FIELD_BYTES_1,8);
break; break;
case 5: case 5:
if(Player* AggroTarget = ((Player*)Unit::GetUnit((*m_creature), AggroTargetGUID))) if(Player* AggroTarget = (Unit::GetPlayer(AggroTargetGUID)))
{ {
m_creature->SetUInt64Value(UNIT_FIELD_TARGET, AggroTarget->GetGUID()); m_creature->SetUInt64Value(UNIT_FIELD_TARGET, AggroTarget->GetGUID());
m_creature->AddThreat(AggroTarget, 1); m_creature->AddThreat(AggroTarget, 1);
@@ -1315,7 +1315,7 @@ struct TRINITY_DLL_DECL mob_torloth_the_magnificentAI : public ScriptedAI
} }
break; break;
case 6: case 6:
if(Player* AggroTarget = ((Player*)Unit::GetUnit((*m_creature), AggroTargetGUID))) if(Player* AggroTarget = (Unit::GetPlayer(AggroTargetGUID)))
{ {
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
m_creature->clearUnitState(UNIT_STAT_ROOT); m_creature->clearUnitState(UNIT_STAT_ROOT);
@@ -1390,7 +1390,7 @@ struct TRINITY_DLL_DECL mob_torloth_the_magnificentAI : public ScriptedAI
break; break;
} }
if(Creature* LordIllidan = ((Creature*)Unit::GetUnit(*m_creature, LordIllidanGUID))) if(Creature* LordIllidan = (Unit::GetCreature(*m_creature, LordIllidanGUID)))
{ {
DoScriptText(END_TEXT, LordIllidan, slayer); DoScriptText(END_TEXT, LordIllidan, slayer);
LordIllidan->AI()->EnterEvadeMode(); LordIllidan->AI()->EnterEvadeMode();
@@ -1483,7 +1483,7 @@ struct TRINITY_DLL_DECL npc_lord_illidan_stormrageAI : public ScriptedAI
{ {
if(PlayerGUID) if(PlayerGUID)
{ {
if(Player* pTarget = ((Player*)Unit::GetUnit((*m_creature), PlayerGUID))) if(Player* pTarget = Unit::GetPlayer(PlayerGUID))
{ {
float x, y, z; float x, y, z;
pTarget->GetPosition(x,y,z); pTarget->GetPosition(x,y,z);
@@ -1508,7 +1508,7 @@ struct TRINITY_DLL_DECL npc_lord_illidan_stormrageAI : public ScriptedAI
void CheckEventFail() void CheckEventFail()
{ {
Player* pPlayer = ((Player*)Unit::GetUnit((*m_creature), PlayerGUID)); Player* pPlayer = Unit::GetPlayer(PlayerGUID);
if(!pPlayer) if(!pPlayer)
return; return;
@@ -1525,7 +1525,7 @@ struct TRINITY_DLL_DECL npc_lord_illidan_stormrageAI : public ScriptedAI
for(Group::member_citerator itr = members.begin(); itr!= members.end(); itr++) for(Group::member_citerator itr = members.begin(); itr!= members.end(); itr++)
{ {
GroupMember = ((Player*)Unit::GetUnit((*m_creature), itr->guid)); GroupMember = (Unit::GetPlayer(itr->guid));
if(!GroupMember) if(!GroupMember)
continue; continue;
if(!GroupMember->IsWithinDistInMap(m_creature, EVENT_AREA_RADIUS) && GroupMember->GetQuestStatus(QUEST_BATTLE_OF_THE_CRIMSON_WATCH) == QUEST_STATUS_INCOMPLETE) if(!GroupMember->IsWithinDistInMap(m_creature, EVENT_AREA_RADIUS) && GroupMember->GetQuestStatus(QUEST_BATTLE_OF_THE_CRIMSON_WATCH) == QUEST_STATUS_INCOMPLETE)
@@ -1551,7 +1551,7 @@ struct TRINITY_DLL_DECL npc_lord_illidan_stormrageAI : public ScriptedAI
{ {
for(Group::member_citerator itr = members.begin(); itr!= members.end(); itr++) for(Group::member_citerator itr = members.begin(); itr!= members.end(); itr++)
{ {
GroupMember = ((Player*)Unit::GetUnit((*m_creature), itr->guid)); GroupMember = Unit::GetPlayer(itr->guid);
if(GroupMember && GroupMember->GetQuestStatus(QUEST_BATTLE_OF_THE_CRIMSON_WATCH) == QUEST_STATUS_INCOMPLETE) if(GroupMember && GroupMember->GetQuestStatus(QUEST_BATTLE_OF_THE_CRIMSON_WATCH) == QUEST_STATUS_INCOMPLETE)
{ {
@@ -1603,7 +1603,7 @@ struct TRINITY_DLL_DECL npc_lord_illidan_stormrageAI : public ScriptedAI
void mob_illidari_spawnAI::JustDied(Unit *slayer) void mob_illidari_spawnAI::JustDied(Unit *slayer)
{ {
m_creature->RemoveCorpse(); m_creature->RemoveCorpse();
if(Creature* LordIllidan = ((Creature*)Unit::GetUnit(*m_creature, LordIllidanGUID))) if(Creature* LordIllidan = (Unit::GetCreature(*m_creature, LordIllidanGUID)))
if(LordIllidan) if(LordIllidan)
((npc_lord_illidan_stormrageAI*)LordIllidan->AI())->LiveCounter(); ((npc_lord_illidan_stormrageAI*)LordIllidan->AI())->LiveCounter();
} }
@@ -311,7 +311,7 @@ public:
case 56: DoScriptText(WHISP21, m_creature, pTemp); case 56: DoScriptText(WHISP21, m_creature, pTemp);
if( PlayerGUID ) if( PlayerGUID )
{ {
Unit* player = ((Creature*)Unit::GetUnit((*m_creature), PlayerGUID)); Unit* player = (Unit::GetCreature((*m_creature), PlayerGUID));
if( player && player->GetTypeId() == TYPEID_PLAYER ) if( player && player->GetTypeId() == TYPEID_PLAYER )
((Player*)player)->GroupEventHappens(10211,m_creature); ((Player*)player)->GroupEventHappens(10211,m_creature);
} }
@@ -472,7 +472,7 @@ struct TRINITY_DLL_DECL npc_dirty_larryAI : public ScriptedAI
uint32 NextStep(uint32 Step) uint32 NextStep(uint32 Step)
{ {
Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); Player* player = Unit::GetPlayer(PlayerGUID);
switch(Step) switch(Step)
{ {
@@ -506,7 +506,7 @@ struct TRINITY_DLL_DECL npc_dirty_larryAI : public ScriptedAI
if(Attack) if(Attack)
{ {
Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); Player* player = Unit::GetPlayer(PlayerGUID);
m_creature->setFaction(14); m_creature->setFaction(14);
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
if(player) if(player)
@@ -558,7 +558,7 @@ struct TRINITY_DLL_DECL npc_dirty_larryAI : public ScriptedAI
m_creature->DeleteThreatList(); m_creature->DeleteThreatList();
m_creature->CombatStop(); m_creature->CombatStop();
m_creature->GetMotionMaster()->MoveTargetedHome(); m_creature->GetMotionMaster()->MoveTargetedHome();
Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); Player* player = Unit::GetPlayer(PlayerGUID);
if(player) if(player)
((Player*)player)->GroupEventHappens(QUEST_WBI, m_creature); ((Player*)player)->GroupEventHappens(QUEST_WBI, m_creature);
} }
@@ -116,7 +116,7 @@ struct TRINITY_DLL_DECL npc_deathstalker_erlandAI : public npc_escortAI
void WaypointReached(uint32 i) void WaypointReached(uint32 i)
{ {
Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); Player* player = Unit::GetPlayer(PlayerGUID);
if (!player) if (!player)
return; return;
@@ -95,7 +95,7 @@ struct TRINITY_DLL_DECL npc_kaya_flathoofAI : public npc_escortAI
void WaypointReached(uint32 i) void WaypointReached(uint32 i)
{ {
Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); Player* player = Unit::GetPlayer(PlayerGUID);
if(!player) if(!player)
return; return;
@@ -129,7 +129,7 @@ struct TRINITY_DLL_DECL npc_kaya_flathoofAI : public npc_escortAI
{ {
if (PlayerGUID) if (PlayerGUID)
{ {
Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); Player* player = Unit::GetPlayer(PlayerGUID);
if (player) if (player)
((Player*)player)->FailQuest(QUEST_PK); ((Player*)player)->FailQuest(QUEST_PK);
} }
@@ -537,7 +537,7 @@ struct TRINITY_DLL_DECL boss_alythessAI : public Scripted_NoMovementAI
uint32 IntroStep(uint32 step) uint32 IntroStep(uint32 step)
{ {
Creature* Sacrolash = (Creature*)Unit::GetUnit((*m_creature),pInstance->GetData64(DATA_SACROLASH)); Creature* Sacrolash = Unit::GetCreature((*m_creature),pInstance->GetData64(DATA_SACROLASH));
switch (step) switch (step)
{ {
case 0: DoPlaySoundToSet(m_creature,SOUND_INTRO); return 0; case 0: DoPlaySoundToSet(m_creature,SOUND_INTRO); return 0;
@@ -387,7 +387,7 @@ struct TRINITY_DLL_DECL npc_OOX17AI : public npc_escortAI
void WaypointReached(uint32 i) void WaypointReached(uint32 i)
{ {
Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); Player* player = Unit::GetPlayer(PlayerGUID);
if (!player) if (!player)
return; return;
@@ -440,7 +440,7 @@ struct TRINITY_DLL_DECL npc_OOX17AI : public npc_escortAI
{ {
if (PlayerGUID) if (PlayerGUID)
{ {
if (Unit* player = Unit::GetUnit((*m_creature), PlayerGUID)) if (Player* player = Unit::GetPlayer(PlayerGUID))
((Player*)player)->FailQuest(Q_OOX17); ((Player*)player)->FailQuest(Q_OOX17);
} }
} }
@@ -1253,7 +1253,7 @@ void flesh_tentacleAI::JustDied(Unit* killer)
return; return;
} }
Creature* Cthun = (Creature*)Unit::GetUnit(*m_creature, Parent); Creature* Cthun = Unit::GetCreature(*m_creature, Parent);
if (Cthun) if (Cthun)
((cthunAI*)(Cthun->AI()))->FleshTentcleKilled(); ((cthunAI*)(Cthun->AI()))->FleshTentcleKilled();
@@ -378,7 +378,7 @@ struct TRINITY_DLL_DECL npc_isla_starmaneAI : public npc_escortAI
void WaypointReached(uint32 i) void WaypointReached(uint32 i)
{ {
Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); Player* player = Unit::GetPlayer(PlayerGUID);
if(!player) if(!player)
return; return;
@@ -421,7 +421,7 @@ struct TRINITY_DLL_DECL npc_isla_starmaneAI : public npc_escortAI
{ {
if (PlayerGUID) if (PlayerGUID)
{ {
Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); Player* player = Unit::GetPlayer(PlayerGUID);
if (player && !Completed) if (player && !Completed)
{ {
if(((Player*)player)->GetTeam() == ALLIANCE) if(((Player*)player)->GetTeam() == ALLIANCE)
@@ -46,7 +46,7 @@ npc_swiftmountainAI(Creature *c) : npc_escortAI(c) {}
void WaypointReached(uint32 i) void WaypointReached(uint32 i)
{ {
Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); Player* player = Unit::GetPlayer(PlayerGUID);
if (!player) if (!player)
return; return;
@@ -86,7 +86,7 @@ npc_swiftmountainAI(Creature *c) : npc_escortAI(c) {}
{ {
if (PlayerGUID) if (PlayerGUID)
{ {
if (Unit* player = Unit::GetUnit((*m_creature), PlayerGUID)) if (Player* player = Unit::GetPlayer(PlayerGUID))
((Player*)player)->FailQuest(QUEST_HOMEWARD_BOUND); ((Player*)player)->FailQuest(QUEST_HOMEWARD_BOUND);
} }
} }
@@ -51,7 +51,7 @@ struct TRINITY_DLL_DECL npc_ameAI : public npc_escortAI
void WaypointReached(uint32 i) void WaypointReached(uint32 i)
{ {
Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); Player* player = Unit::GetPlayer(PlayerGUID);
if (!player) if (!player)
return; return;
@@ -100,7 +100,7 @@ struct TRINITY_DLL_DECL npc_ameAI : public npc_escortAI
{ {
if (PlayerGUID) if (PlayerGUID)
{ {
if (Unit* player = Unit::GetUnit((*m_creature), PlayerGUID)) if (Player* player = Unit::GetPlayer(PlayerGUID))
((Player*)player)->FailQuest(QUEST_CHASING_AME); ((Player*)player)->FailQuest(QUEST_CHASING_AME);
} }
} }
@@ -44,7 +44,7 @@ struct TRINITY_DLL_DECL npc_defias_traitorAI : public npc_escortAI
void WaypointReached(uint32 i) void WaypointReached(uint32 i)
{ {
Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); Player* player = Unit::GetPlayer(PlayerGUID);
if (!player) if (!player)
return; return;
@@ -92,8 +92,8 @@ struct TRINITY_DLL_DECL npc_defias_traitorAI : public npc_escortAI
{ {
if (PlayerGUID) if (PlayerGUID)
{ {
if (Unit* player = Unit::GetUnit((*m_creature), PlayerGUID)) if (Player* player = Unit::GetPlayer(PlayerGUID))
((Player*)player)->FailQuest(QUEST_DEFIAS_BROTHERHOOD); player->FailQuest(QUEST_DEFIAS_BROTHERHOOD);
} }
} }
@@ -287,7 +287,7 @@ struct TRINITY_DLL_DECL npc_kayra_longmaneAI : public npc_escortAI
void WaypointReached(uint32 i) void WaypointReached(uint32 i)
{ {
Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); Player* player = Unit::GetPlayer(PlayerGUID);
switch(i) switch(i)
{ {
@@ -308,7 +308,7 @@ struct TRINITY_DLL_DECL npc_kayra_longmaneAI : public npc_escortAI
case 26: DoScriptText(SAY_PROGRESS_6, m_creature, player); case 26: DoScriptText(SAY_PROGRESS_6, m_creature, player);
Completed = true; Completed = true;
if(player) if(player)
((Player*)player)->GroupEventHappens(QUEST_EFU, m_creature); player->GroupEventHappens(QUEST_EFU, m_creature);
break; break;
} }
} }
@@ -317,9 +317,9 @@ struct TRINITY_DLL_DECL npc_kayra_longmaneAI : public npc_escortAI
{ {
if (PlayerGUID && !Completed) if (PlayerGUID && !Completed)
{ {
Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); Player* player = Unit::GetPlayer(PlayerGUID);
if (player && !Completed) if (player && !Completed)
((Player*)player)->FailQuest(QUEST_EFU); player->FailQuest(QUEST_EFU);
} }
} }
@@ -312,7 +312,7 @@ struct TRINITY_DLL_DECL boss_hex_lord_malacrassAI : public ScriptedAI
{ {
for(uint8 i = 0; i < 4; ++i) for(uint8 i = 0; i < 4; ++i)
{ {
Creature *pCreature = ((Creature*)Unit::GetUnit((*m_creature), AddGUID[i])); Creature *pCreature = (Unit::GetCreature((*m_creature), AddGUID[i]));
if(!pCreature || !pCreature->isAlive()) if(!pCreature || !pCreature->isAlive())
{ {
if(pCreature) pCreature->setDeathState(DEAD); if(pCreature) pCreature->setDeathState(DEAD);
@@ -114,7 +114,7 @@ struct TRINITY_DLL_DECL npc_zulaman_hostageAI : public ScriptedAI
void Aggro(Unit *who) {} void Aggro(Unit *who) {}
void JustDied(Unit *) void JustDied(Unit *)
{ {
Player* player = (Player*)Unit::GetUnit(*m_creature, PlayerGUID); Player* player = Unit::GetPlayer(PlayerGUID);
if(player) player->SendLoot(m_creature->GetGUID(), LOOT_CORPSE); if(player) player->SendLoot(m_creature->GetGUID(), LOOT_CORPSE);
} }
void UpdateAI(const uint32 diff) void UpdateAI(const uint32 diff)
+1 -1
View File
@@ -124,7 +124,7 @@ bool AssistDelayEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
{ {
while (!m_assistants.empty()) while (!m_assistants.empty())
{ {
Creature* assistant = (Creature*)Unit::GetUnit(m_owner, *m_assistants.begin()); Creature* assistant = Unit::GetCreature(m_owner, *m_assistants.begin());
m_assistants.pop_front(); m_assistants.pop_front();
if (assistant && assistant->CanAssistTo(&m_owner, victim)) if (assistant && assistant->CanAssistTo(&m_owner, victim))
+10
View File
@@ -10436,6 +10436,16 @@ Unit* Unit::GetUnit(WorldObject& object, uint64 guid)
return ObjectAccessor::GetUnit(object,guid); return ObjectAccessor::GetUnit(object,guid);
} }
Player* Unit::GetPlayer(uint64 guid)
{
return ObjectAccessor::FindPlayer(guid);
}
Creature* Unit::GetCreature(WorldObject& object, uint64 guid)
{
return ObjectAccessor::GetCreature(object, guid);
}
bool Unit::isVisibleForInState( Player const* u, bool inVisibleList ) const bool Unit::isVisibleForInState( Player const* u, bool inVisibleList ) const
{ {
return isVisibleForOrDetect(u, false, inVisibleList, false); return isVisibleForOrDetect(u, false, inVisibleList, false);
+17
View File
@@ -1363,6 +1363,8 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
void addFollower(FollowerReference* pRef) { m_FollowingRefManager.insertFirst(pRef); } void addFollower(FollowerReference* pRef) { m_FollowingRefManager.insertFirst(pRef); }
void removeFollower(FollowerReference* /*pRef*/ ) { /* nothing to do yet */ } void removeFollower(FollowerReference* /*pRef*/ ) { /* nothing to do yet */ }
static Unit* GetUnit(WorldObject& object, uint64 guid); static Unit* GetUnit(WorldObject& object, uint64 guid);
static Player* GetPlayer(uint64 guid);
static Creature* GetCreature(WorldObject& object, uint64 guid);
MotionMaster* GetMotionMaster() { return &i_motionMaster; } MotionMaster* GetMotionMaster() { return &i_motionMaster; }
@@ -1509,5 +1511,20 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
uint32 m_reducedThreatPercent; uint32 m_reducedThreatPercent;
uint64 m_misdirectionTargetGUID; uint64 m_misdirectionTargetGUID;
}; };
namespace Trinity
{
template<class T>
void RandomResizeList(std::list<T> &_list, uint32 _size)
{
while(_list.size() > _size)
{
typename std::list<T>::iterator itr = _list.begin();
advance(itr, urand(0, _list.size() - 1));
_list.erase(itr);
}
}
}
#endif #endif