aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormegamage <none@none>2009-06-04 17:03:43 -0500
committermegamage <none@none>2009-06-04 17:03:43 -0500
commit08e48f508497c1fbc94c1f1567b8cdc2ebf8dd08 (patch)
treedae4035d27b871da42f77d30c611cccc7a0930e9
parent0f531569a0b006df4f874605b25fad64344211bd (diff)
*Use dynamic cast for ai cast.
--HG-- branch : trunk
-rw-r--r--src/bindings/scripts/include/sc_creature.h2
-rw-r--r--src/bindings/scripts/scripts/examples/example_escort.cpp6
-rw-r--r--src/bindings/scripts/scripts/npc/npcs_special.cpp14
-rw-r--r--src/bindings/scripts/scripts/zone/arathi_highlands/arathi_highlands.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/ashenvale_forest/ashenvale.cpp4
-rw-r--r--src/bindings/scripts/scripts/zone/aunchindoun/auchenai_crypts/boss_exarch_maladaar.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/aunchindoun/mana_tombs/boss_nexusprince_shaffar.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/boss_grandmaster_vorpil.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/azshara/azshara.cpp4
-rw-r--r--src/bindings/scripts/scripts/zone/azuremyst_isle/azuremyst_isle.cpp4
-rw-r--r--src/bindings/scripts/scripts/zone/barrens/the_barrens.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/black_temple/boss_illidan.cpp26
-rw-r--r--src/bindings/scripts/scripts/zone/black_temple/boss_reliquary_of_souls.cpp4
-rw-r--r--src/bindings/scripts/scripts/zone/black_temple/boss_shade_of_akama.cpp18
-rw-r--r--src/bindings/scripts/scripts/zone/black_temple/boss_teron_gorefiend.cpp4
-rw-r--r--src/bindings/scripts/scripts/zone/black_temple/boss_warlord_najentus.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/black_temple/illidari_council.cpp6
-rw-r--r--src/bindings/scripts/scripts/zone/blackrock_depths/blackrock_depths.cpp8
-rw-r--r--src/bindings/scripts/scripts/zone/blackwing_lair/boss_vaelastrasz.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/blackwing_lair/boss_victor_nefarius.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_archimonde.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.cpp48
-rw-r--r--src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjal_trash.cpp4
-rw-r--r--src/bindings/scripts/scripts/zone/caverns_of_time/old_hillsbrad/old_hillsbrad.cpp16
-rw-r--r--src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_fathomlord_karathress.cpp8
-rw-r--r--src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_lady_vashj.cpp14
-rw-r--r--src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_leotheras_the_blind.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/coilfang_resevoir/steam_vault/boss_warlord_kalithresh.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/eastern_plaguelands/the_scarlet_enclave.cpp6
-rw-r--r--src/bindings/scripts/scripts/zone/eversong_woods/eversong_woods.cpp16
-rw-r--r--src/bindings/scripts/scripts/zone/feralas/feralas.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/ghostlands/ghostlands.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/gruuls_lair/boss_high_king_maulgar.cpp8
-rw-r--r--src/bindings/scripts/scripts/zone/hellfire_citadel/blood_furnace/boss_kelidan_the_breaker.cpp6
-rw-r--r--src/bindings/scripts/scripts/zone/hellfire_citadel/magtheridons_lair/boss_magtheridon.cpp6
-rw-r--r--src/bindings/scripts/scripts/zone/hellfire_citadel/shattered_halls/boss_nethekurse.cpp4
-rw-r--r--src/bindings/scripts/scripts/zone/hellfire_citadel/shattered_halls/boss_warbringer_omrogg.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/hellfire_peninsula/hellfire_peninsula.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/karazhan/boss_midnight.cpp4
-rw-r--r--src/bindings/scripts/scripts/zone/karazhan/boss_moroes.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/karazhan/boss_prince_malchezaar.cpp6
-rw-r--r--src/bindings/scripts/scripts/zone/karazhan/boss_terestian_illhoof.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/karazhan/bosses_opera.cpp28
-rw-r--r--src/bindings/scripts/scripts/zone/karazhan/karazhan.cpp10
-rw-r--r--src/bindings/scripts/scripts/zone/magisters_terrace/boss_priestess_delrissa.cpp14
-rw-r--r--src/bindings/scripts/scripts/zone/magisters_terrace/boss_selin_fireheart.cpp8
-rw-r--r--src/bindings/scripts/scripts/zone/moonglade/moonglade.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/netherstorm/netherstorm.cpp8
-rw-r--r--src/bindings/scripts/scripts/zone/orgrimmar/orgrimmar.cpp4
-rw-r--r--src/bindings/scripts/scripts/zone/razorfen_kraul/razorfen_kraul.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/scarlet_monastery/boss_headless_horseman.cpp20
-rw-r--r--src/bindings/scripts/scripts/zone/shadowfang_keep/shadowfang_keep.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/shadowmoon_valley/shadowmoon_valley.cpp24
-rw-r--r--src/bindings/scripts/scripts/zone/shattrath/shattrath_city.cpp4
-rw-r--r--src/bindings/scripts/scripts/zone/silverpine_forest/silverpine_forest.cpp4
-rw-r--r--src/bindings/scripts/scripts/zone/stonetalon_mountains/stonetalon_mountains.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/stormwind/stormwind_city.cpp6
-rw-r--r--src/bindings/scripts/scripts/zone/sunwell_plateau/boss_kalecgos.cpp16
-rw-r--r--src/bindings/scripts/scripts/zone/sunwell_plateau/boss_kiljaeden.cpp12
-rw-r--r--src/bindings/scripts/scripts/zone/tanaris/tanaris.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/teldrassil/teldrassil.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/tempest_keep/botanica/boss_warp_splinter.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_cthun.cpp28
-rw-r--r--src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_skeram.cpp4
-rw-r--r--src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_twinemperors.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/terokkar_forest/terokkar_forest.cpp4
-rw-r--r--src/bindings/scripts/scripts/zone/thousand_needles/thousand_needles.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/tirisfal_glades/tirisfal_glades.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/undercity/undercity.cpp4
-rw-r--r--src/bindings/scripts/scripts/zone/ungoro_crater/ungoro_crater.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/boss_ingvar_the_plunderer.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/boss_keleseth.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/westfall/westfall.cpp4
-rw-r--r--src/bindings/scripts/scripts/zone/zangarmarsh/zangarmarsh.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/zulaman/zulaman.cpp4
-rw-r--r--src/bindings/scripts/scripts/zone/zulfarrak/zulfarrak.cpp2
76 files changed, 259 insertions, 257 deletions
diff --git a/src/bindings/scripts/include/sc_creature.h b/src/bindings/scripts/include/sc_creature.h
index 964e25b51eb..615cbb115f0 100644
--- a/src/bindings/scripts/include/sc_creature.h
+++ b/src/bindings/scripts/include/sc_creature.h
@@ -17,9 +17,11 @@
#ifdef USE_DYNAMIC_CAST
#define CAST_PLR(a) (dynamic_cast<Player*>(a))
#define CAST_CRE(a) (dynamic_cast<Creature*>(a))
+#define CAST_AI(a,b) (dynamic_cast<a*>(b))
#else
#define CAST_PLR(a) (static_cast<Player*>(a))
#define CAST_CRE(a) (static_cast<Creature*>(a))
+#define CAST_AI(a,b) (static_cast<a*>(b))
#endif
class ScriptedInstance;
diff --git a/src/bindings/scripts/scripts/examples/example_escort.cpp b/src/bindings/scripts/scripts/examples/example_escort.cpp
index a18e43dd5b3..334a85be954 100644
--- a/src/bindings/scripts/scripts/examples/example_escort.cpp
+++ b/src/bindings/scripts/scripts/examples/example_escort.cpp
@@ -186,7 +186,7 @@ bool GossipSelect_example_escort(Player *player, Creature *_Creature, uint32 sen
if (action == GOSSIP_ACTION_INFO_DEF+1)
{
player->CLOSE_GOSSIP_MENU();
- ((npc_escortAI*)(_Creature->AI()))->Start(true, true, true, player->GetGUID());
+ CAST_AI(npc_escortAI, (_Creature->AI()))->Start(true, true, true, player->GetGUID());
return true; // prevent mangos core handling
}
@@ -194,7 +194,7 @@ bool GossipSelect_example_escort(Player *player, Creature *_Creature, uint32 sen
if (action == GOSSIP_ACTION_INFO_DEF+2)
{
player->CLOSE_GOSSIP_MENU();
- ((npc_escortAI*)(_Creature->AI()))->Start(false, false, false, player->GetGUID());
+ CAST_AI(npc_escortAI, (_Creature->AI()))->Start(false, false, false, player->GetGUID());
return true; // prevent mangos core handling
}
@@ -202,7 +202,7 @@ bool GossipSelect_example_escort(Player *player, Creature *_Creature, uint32 sen
if (action == GOSSIP_ACTION_INFO_DEF+3)
{
player->CLOSE_GOSSIP_MENU();
- ((npc_escortAI*)(_Creature->AI()))->Start(false, true, false, player->GetGUID());
+ CAST_AI(npc_escortAI, (_Creature->AI()))->Start(false, true, false, player->GetGUID());
return true; // prevent mangos core handling
}
diff --git a/src/bindings/scripts/scripts/npc/npcs_special.cpp b/src/bindings/scripts/scripts/npc/npcs_special.cpp
index 09aee5fd49e..3c0429ee4f3 100644
--- a/src/bindings/scripts/scripts/npc/npcs_special.cpp
+++ b/src/bindings/scripts/scripts/npc/npcs_special.cpp
@@ -118,7 +118,7 @@ CreatureAI* GetAI_npc_chicken_cluck(Creature *_Creature)
bool QuestAccept_npc_chicken_cluck(Player *player, Creature *_Creature, const Quest *_Quest )
{
if(_Quest->GetQuestId() == QUEST_CLUCK)
- ((npc_chicken_cluckAI*)_Creature->AI())->Reset();
+ CAST_AI(npc_chicken_cluckAI, _Creature->AI())->Reset();
return true;
}
@@ -126,7 +126,7 @@ bool QuestAccept_npc_chicken_cluck(Player *player, Creature *_Creature, const Qu
bool QuestComplete_npc_chicken_cluck(Player *player, Creature *_Creature, const Quest *_Quest)
{
if(_Quest->GetQuestId() == QUEST_CLUCK)
- ((npc_chicken_cluckAI*)_Creature->AI())->Reset();
+ CAST_AI(npc_chicken_cluckAI, _Creature->AI())->Reset();
return true;
}
@@ -366,7 +366,7 @@ struct TRINITY_DLL_DECL npc_injured_patientAI : public ScriptedAI
if (Doctorguid)
{
if(Creature* Doctor = Unit::GetCreature(*m_creature, Doctorguid))
- ((npc_doctorAI*)Doctor->AI())->PatientSaved(m_creature, CAST_PLR(caster), Coord);
+ CAST_AI(npc_doctorAI, Doctor->AI())->PatientSaved(m_creature, CAST_PLR(caster), Coord);
}
}
@@ -424,7 +424,7 @@ struct TRINITY_DLL_DECL npc_injured_patientAI : public ScriptedAI
if (Doctorguid)
{
if(Creature* Doctor = Unit::GetCreature((*m_creature), Doctorguid))
- ((npc_doctorAI*)Doctor->AI())->PatientDied(Coord);
+ CAST_AI(npc_doctorAI, Doctor->AI())->PatientDied(Coord);
}
}
}
@@ -561,10 +561,10 @@ void npc_doctorAI::UpdateAI(const uint32 diff)
Patient->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE);
Patients.push_back(Patient->GetGUID());
- ((npc_injured_patientAI*)Patient->AI())->Doctorguid = m_creature->GetGUID();
+ CAST_AI(npc_injured_patientAI, Patient->AI())->Doctorguid = m_creature->GetGUID();
if (Point)
- ((npc_injured_patientAI*)Patient->AI())->Coord = Point;
+ CAST_AI(npc_injured_patientAI, Patient->AI())->Coord = Point;
Coordinates.erase(itr);
}
@@ -577,7 +577,7 @@ void npc_doctorAI::UpdateAI(const uint32 diff)
bool QuestAccept_npc_doctor(Player *player, Creature *creature, Quest const *quest )
{
if ((quest->GetQuestId() == 6624) || (quest->GetQuestId() == 6622))
- ((npc_doctorAI*)creature->AI())->BeginEvent(player);
+ CAST_AI(npc_doctorAI, creature->AI())->BeginEvent(player);
return true;
}
diff --git a/src/bindings/scripts/scripts/zone/arathi_highlands/arathi_highlands.cpp b/src/bindings/scripts/scripts/zone/arathi_highlands/arathi_highlands.cpp
index 7fa6b6580d2..2e80e6e4c6e 100644
--- a/src/bindings/scripts/scripts/zone/arathi_highlands/arathi_highlands.cpp
+++ b/src/bindings/scripts/scripts/zone/arathi_highlands/arathi_highlands.cpp
@@ -117,7 +117,7 @@ bool QuestAccept_npc_professor_phizzlethorpe(Player* player, Creature* creature,
if (quest->GetQuestId() == QUEST_SUNKEN_TREASURE)
{
DoScriptText(SAY_PROGRESS_1, creature, player);
- ((npc_escortAI*)(creature->AI()))->Start(false, false, false, player->GetGUID());
+ CAST_AI(npc_escortAI, (creature->AI()))->Start(false, false, false, player->GetGUID());
creature->setFaction(113);
}
return true;
diff --git a/src/bindings/scripts/scripts/zone/ashenvale_forest/ashenvale.cpp b/src/bindings/scripts/scripts/zone/ashenvale_forest/ashenvale.cpp
index 1c987d72737..73e89f8c7ca 100644
--- a/src/bindings/scripts/scripts/zone/ashenvale_forest/ashenvale.cpp
+++ b/src/bindings/scripts/scripts/zone/ashenvale_forest/ashenvale.cpp
@@ -144,7 +144,7 @@ bool QuestAccept_npc_torek(Player* player, Creature* creature, Quest const* ques
if (quest->GetQuestId() == QUEST_TOREK_ASSULT)
{
//TODO: find companions, make them follow Torek, at any time (possibly done by mangos/database in future?)
- ((npc_escortAI*)(creature->AI()))->Start(true, true, true, player->GetGUID());
+ CAST_AI(npc_escortAI, (creature->AI()))->Start(true, true, true, player->GetGUID());
DoScriptText(SAY_READY, creature, player);
creature->setFaction(113);
}
@@ -244,7 +244,7 @@ bool QuestAccept_npc_ruul_snowhoof(Player* player, Creature* creature, Quest con
if (quest->GetQuestId() == QUEST_FREEDOM_TO_RUUL)
{
creature->setFaction(113);
- ((npc_escortAI*)(creature->AI()))->Start(true, true, false, player->GetGUID());
+ CAST_AI(npc_escortAI, (creature->AI()))->Start(true, true, false, player->GetGUID());
}
return true;
}
diff --git a/src/bindings/scripts/scripts/zone/aunchindoun/auchenai_crypts/boss_exarch_maladaar.cpp b/src/bindings/scripts/scripts/zone/aunchindoun/auchenai_crypts/boss_exarch_maladaar.cpp
index fb81cde9f6b..68a3f60a197 100644
--- a/src/bindings/scripts/scripts/zone/aunchindoun/auchenai_crypts/boss_exarch_maladaar.cpp
+++ b/src/bindings/scripts/scripts/zone/aunchindoun/auchenai_crypts/boss_exarch_maladaar.cpp
@@ -206,7 +206,7 @@ struct TRINITY_DLL_DECL boss_exarch_maladaarAI : public ScriptedAI
if (Unit *target = Unit::GetUnit(*m_creature,soulholder))
{
- ((mob_stolen_soulAI*)summoned->AI())->SetMyClass(soulclass);
+ CAST_AI(mob_stolen_soulAI, summoned->AI())->SetMyClass(soulclass);
summoned->AI()->AttackStart(target);
}
}
diff --git a/src/bindings/scripts/scripts/zone/aunchindoun/mana_tombs/boss_nexusprince_shaffar.cpp b/src/bindings/scripts/scripts/zone/aunchindoun/mana_tombs/boss_nexusprince_shaffar.cpp
index 4b76c35eaff..ae54ea543f2 100644
--- a/src/bindings/scripts/scripts/zone/aunchindoun/mana_tombs/boss_nexusprince_shaffar.cpp
+++ b/src/bindings/scripts/scripts/zone/aunchindoun/mana_tombs/boss_nexusprince_shaffar.cpp
@@ -291,7 +291,7 @@ struct TRINITY_DLL_DECL mob_ethereal_beaconAI : public ScriptedAI
{
Unit *Shaffar = me->FindNearestCreature(ENTRY_SHAFFAR, 100);
if(Shaffar)
- ((boss_nexusprince_shaffarAI*)(CAST_CRE(Shaffar)->AI()))->RemoveBeaconFromList(m_creature);
+ CAST_AI(boss_nexusprince_shaffarAI, (CAST_CRE(Shaffar)->AI()))->RemoveBeaconFromList(m_creature);
}
void UpdateAI(const uint32 diff)
diff --git a/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/boss_grandmaster_vorpil.cpp b/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/boss_grandmaster_vorpil.cpp
index 52e5a3e8915..f0120627ecd 100644
--- a/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/boss_grandmaster_vorpil.cpp
+++ b/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/boss_grandmaster_vorpil.cpp
@@ -203,7 +203,7 @@ struct TRINITY_DLL_DECL boss_grandmaster_vorpilAI : public ScriptedAI
void JustSummoned(Creature *summoned)
{
if (summoned && summoned->GetEntry() == MOB_VOID_TRAVELER)
- ((mob_voidtravelerAI*)summoned->AI())->Vorpil = m_creature;
+ CAST_AI(mob_voidtravelerAI, summoned->AI())->Vorpil = m_creature;
}
void KilledUnit(Unit *victim)
diff --git a/src/bindings/scripts/scripts/zone/azshara/azshara.cpp b/src/bindings/scripts/scripts/zone/azshara/azshara.cpp
index 4412d0bff12..c1125ef0dd9 100644
--- a/src/bindings/scripts/scripts/zone/azshara/azshara.cpp
+++ b/src/bindings/scripts/scripts/zone/azshara/azshara.cpp
@@ -417,8 +417,8 @@ bool GossipSelect_mob_rizzle_sprysprocket(Player *player, Creature *_Creature, u
{
player->CLOSE_GOSSIP_MENU();
_Creature->CastSpell(player, SPELL_GIVE_SOUTHFURY_MOONSTONE, true);
- ((mob_rizzle_sprysprocketAI*)_Creature->AI())->Must_Die_Timer = 3000;
- ((mob_rizzle_sprysprocketAI*)_Creature->AI())->Must_Die = true;
+ CAST_AI(mob_rizzle_sprysprocketAI, _Creature->AI())->Must_Die_Timer = 3000;
+ CAST_AI(mob_rizzle_sprysprocketAI, _Creature->AI())->Must_Die = true;
}
return true;
}
diff --git a/src/bindings/scripts/scripts/zone/azuremyst_isle/azuremyst_isle.cpp b/src/bindings/scripts/scripts/zone/azuremyst_isle/azuremyst_isle.cpp
index bf723692881..320a1610827 100644
--- a/src/bindings/scripts/scripts/zone/azuremyst_isle/azuremyst_isle.cpp
+++ b/src/bindings/scripts/scripts/zone/azuremyst_isle/azuremyst_isle.cpp
@@ -280,7 +280,7 @@ bool GossipSelect_npc_engineer_spark_overgrind(Player *player, Creature *_Creatu
{
player->CLOSE_GOSSIP_MENU();
_Creature->setFaction(FACTION_HOSTILE);
- ((npc_engineer_spark_overgrindAI*)_Creature->AI())->AttackStart(player);
+ CAST_AI(npc_engineer_spark_overgrindAI, _Creature->AI())->AttackStart(player);
}
return true;
}
@@ -401,7 +401,7 @@ bool QuestAccept_npc_magwin(Player* player, Creature* creature, Quest const* que
if (quest->GetQuestId() == QUEST_A_CRY_FOR_SAY_HELP)
{
creature->setFaction(113);
- ((npc_escortAI*)(creature->AI()))->Start(true, true, false, player->GetGUID());
+ CAST_AI(npc_escortAI, (creature->AI()))->Start(true, true, false, player->GetGUID());
}
return true;
}
diff --git a/src/bindings/scripts/scripts/zone/barrens/the_barrens.cpp b/src/bindings/scripts/scripts/zone/barrens/the_barrens.cpp
index bcbeb9aed0b..f8b92d4f077 100644
--- a/src/bindings/scripts/scripts/zone/barrens/the_barrens.cpp
+++ b/src/bindings/scripts/scripts/zone/barrens/the_barrens.cpp
@@ -499,7 +499,7 @@ bool QuestAccept_npc_wizzlecrank_shredder(Player* player, Creature* creature, Qu
if (quest->GetQuestId() == QUEST_ESCAPE)
{
creature->setFaction(FACTION_RATCHET);
- ((npc_escortAI*)(creature->AI()))->Start(true, true, false, player->GetGUID());
+ CAST_AI(npc_escortAI, (creature->AI()))->Start(true, true, false, player->GetGUID());
}
return true;
}
diff --git a/src/bindings/scripts/scripts/zone/black_temple/boss_illidan.cpp b/src/bindings/scripts/scripts/zone/black_temple/boss_illidan.cpp
index 6d404127e94..224bd94a56b 100644
--- a/src/bindings/scripts/scripts/zone/black_temple/boss_illidan.cpp
+++ b/src/bindings/scripts/scripts/zone/black_temple/boss_illidan.cpp
@@ -1086,8 +1086,8 @@ struct TRINITY_DLL_DECL npc_akama_illidanAI : public ScriptedAI
Illidan->SetInFront(m_creature);
m_creature->GetMotionMaster()->MoveIdle();
Illidan->GetMotionMaster()->MoveIdle();
- ((boss_illidan_stormrageAI*)Illidan->AI())->AkamaGUID = m_creature->GetGUID();
- ((boss_illidan_stormrageAI*)Illidan->AI())->EnterPhase(PHASE_TALK_SEQUENCE);
+ CAST_AI(boss_illidan_stormrageAI, Illidan->AI())->AkamaGUID = m_creature->GetGUID();
+ CAST_AI(boss_illidan_stormrageAI, Illidan->AI())->EnterPhase(PHASE_TALK_SEQUENCE);
}
}
@@ -1138,7 +1138,7 @@ struct TRINITY_DLL_DECL npc_akama_illidanAI : public ScriptedAI
else if(Phase == PHASE_TALK)
{
if(GETCRE(Illidan, IllidanGUID))
- ((boss_illidan_stormrageAI*)Illidan->AI())->DeleteFromThreatList(m_creature->GetGUID());
+ CAST_AI(boss_illidan_stormrageAI, Illidan->AI())->DeleteFromThreatList(m_creature->GetGUID());
EnterEvadeMode();
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
WalkCount++;
@@ -1191,7 +1191,7 @@ struct TRINITY_DLL_DECL npc_akama_illidanAI : public ScriptedAI
case 0:
if(GETCRE(Illidan, IllidanGUID))
{
- ((boss_illidan_stormrageAI*)Illidan->AI())->Timer[EVENT_TAUNT] += 30000;
+ CAST_AI(boss_illidan_stormrageAI, Illidan->AI())->Timer[EVENT_TAUNT] += 30000;
Illidan->MonsterYell(SAY_AKAMA_MINION, LANG_UNIVERSAL, 0);
DoPlaySoundToSet(Illidan, SOUND_AKAMA_MINION);
}
@@ -1481,7 +1481,7 @@ struct TRINITY_DLL_DECL boss_maievAI : public ScriptedAI
{
if(GETCRE(Illidan, IllidanGUID))
{
- Unit* target = ((boss_illidan_stormrageAI*)Illidan->AI())->SelectUnit(SELECT_TARGET_RANDOM, 0);
+ Unit* target = CAST_AI(boss_illidan_stormrageAI, Illidan->AI())->SelectUnit(SELECT_TARGET_RANDOM, 0);
if(!target || !m_creature->IsWithinDistInMap(target, 80) || Illidan->IsWithinDistInMap(target, 20))
{
@@ -1560,7 +1560,7 @@ struct TRINITY_DLL_DECL boss_maievAI : public ScriptedAI
m_creature->SetVisibility(VISIBILITY_OFF);
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
if(GETCRE(Illidan, IllidanGUID))
- ((boss_illidan_stormrageAI*)Illidan->AI())->DeleteFromThreatList(m_creature->GetGUID());
+ CAST_AI(boss_illidan_stormrageAI, Illidan->AI())->DeleteFromThreatList(m_creature->GetGUID());
m_creature->AttackStop();
Timer[EVENT_MAIEV_STEALTH] = 60000; //reappear after 1 minute
MaxTimer = 1;
@@ -1577,7 +1577,7 @@ bool GossipSelect_npc_akama_at_illidan(Player *player, Creature *_Creature, uint
if(action == GOSSIP_ACTION_INFO_DEF) // Time to begin the Event
{
player->CLOSE_GOSSIP_MENU();
- ((npc_akama_illidanAI*)_Creature->AI())->EnterPhase(PHASE_CHANNEL);
+ CAST_AI(npc_akama_illidanAI, _Creature->AI())->EnterPhase(PHASE_CHANNEL);
}
return true;
}
@@ -1676,7 +1676,7 @@ bool GOHello_cage_trap(Player* plr, GameObject* go)
cell_lock->Visit(cell_lock, cSearcher, *(plr->GetMap()));
if(trigger)
- ((cage_trap_triggerAI*)trigger->AI())->Active = true;
+ CAST_AI(cage_trap_triggerAI, trigger->AI())->Active = true;
go->SetGoState(GO_STATE_ACTIVE);
return true;
}
@@ -1812,9 +1812,9 @@ void boss_illidan_stormrageAI::Reset()
Akama->Respawn();
else
{
- ((npc_akama_illidanAI*)Akama->AI())->EnterEvadeMode();
+ CAST_AI(npc_akama_illidanAI, Akama->AI())->EnterEvadeMode();
Akama->GetMotionMaster()->MoveTargetedHome();
- ((npc_akama_illidanAI*)Akama->AI())->Reset();
+ CAST_AI(npc_akama_illidanAI, Akama->AI())->Reset();
}
}
AkamaGUID = 0;
@@ -1877,7 +1877,7 @@ void boss_illidan_stormrageAI::JustSummoned(Creature* summon)
summon->SetVisibility(VISIBILITY_OFF); // Leave her invisible until she has to talk
summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
MaievGUID = summon->GetGUID();
- ((boss_maievAI*)summon->AI())->GetIllidanGUID(m_creature->GetGUID());
+ CAST_AI(boss_maievAI, summon->AI())->GetIllidanGUID(m_creature->GetGUID());
summon->AI()->DoAction(PHASE_TALK_SEQUENCE);
}break;
case FLAME_OF_AZZINOTH:
@@ -1907,7 +1907,7 @@ void boss_illidan_stormrageAI::HandleTalkSequence()
{
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE + UNIT_FLAG_NOT_SELECTABLE);
m_creature->AddThreat(Akama, 100.0f);
- ((npc_akama_illidanAI*)Akama->AI())->EnterPhase(PHASE_FIGHT_ILLIDAN);
+ CAST_AI(npc_akama_illidanAI, Akama->AI())->EnterPhase(PHASE_FIGHT_ILLIDAN);
EnterPhase(PHASE_NORMAL);
}
break;
@@ -2026,7 +2026,7 @@ void boss_illidan_stormrageAI::SummonFlamesOfAzzinoth()
Flame->setFaction(m_creature->getFaction()); // Just in case the database has it as a different faction
Flame->SetMeleeDamageSchool(SPELL_SCHOOL_FIRE);
FlameGUID[i] = Flame->GetGUID(); // Record GUID in order to check if they're dead later on to move to the next phase
- ((flame_of_azzinothAI*)Flame->AI())->SetGlaiveGUID(GlaiveGUID[i]);
+ CAST_AI(flame_of_azzinothAI, Flame->AI())->SetGlaiveGUID(GlaiveGUID[i]);
Glaive->CastSpell(Flame, SPELL_AZZINOTH_CHANNEL, false); // Glaives do some random Beam type channel on it.
}
}
diff --git a/src/bindings/scripts/scripts/zone/black_temple/boss_reliquary_of_souls.cpp b/src/bindings/scripts/scripts/zone/black_temple/boss_reliquary_of_souls.cpp
index 6bd777405ea..d3d64cf6596 100644
--- a/src/bindings/scripts/scripts/zone/black_temple/boss_reliquary_of_souls.cpp
+++ b/src/bindings/scripts/scripts/zone/black_temple/boss_reliquary_of_souls.cpp
@@ -178,7 +178,7 @@ struct TRINITY_DLL_DECL boss_reliquary_of_soulsAI : public ScriptedAI
if(!Soul) return false;
if(Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0))
{
- ((npc_enslaved_soulAI*)Soul->AI())->ReliquaryGUID = m_creature->GetGUID();
+ CAST_AI(npc_enslaved_soulAI, Soul->AI())->ReliquaryGUID = m_creature->GetGUID();
Soul->AI()->AttackStart(target);
}else EnterEvadeMode();
return true;
@@ -629,7 +629,7 @@ void npc_enslaved_soulAI::JustDied(Unit *killer)
{
Creature* Reliquary = (Unit::GetCreature((*m_creature), ReliquaryGUID));
if(Reliquary)
- ((boss_reliquary_of_soulsAI*)Reliquary->AI())->SoulDeathCount++;
+ CAST_AI(boss_reliquary_of_soulsAI, Reliquary->AI())->SoulDeathCount++;
}
DoCast(m_creature, SPELL_SOUL_RELEASE, true);
}
diff --git a/src/bindings/scripts/scripts/zone/black_temple/boss_shade_of_akama.cpp b/src/bindings/scripts/scripts/zone/black_temple/boss_shade_of_akama.cpp
index ec876e4c7ac..e4dcd3f0a9c 100644
--- a/src/bindings/scripts/scripts/zone/black_temple/boss_shade_of_akama.cpp
+++ b/src/bindings/scripts/scripts/zone/black_temple/boss_shade_of_akama.cpp
@@ -309,7 +309,7 @@ struct TRINITY_DLL_DECL boss_shade_of_akamaAI : public ScriptedAI
Creature* Sorcerer = m_creature->SummonCreature(CREATURE_SORCERER, X, Y, Z_SPAWN, 0, TEMPSUMMON_DEAD_DESPAWN, 0);
if(Sorcerer)
{
- ((mob_ashtongue_sorcererAI*)Sorcerer->AI())->ShadeGUID = m_creature->GetGUID();
+ CAST_AI(mob_ashtongue_sorcererAI, Sorcerer->AI())->ShadeGUID = m_creature->GetGUID();
Sorcerer->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
Sorcerer->GetMotionMaster()->MovePoint(0, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ());
Sorcerer->SetUInt64Value(UNIT_FIELD_TARGET, m_creature->GetGUID());
@@ -354,7 +354,7 @@ struct TRINITY_DLL_DECL boss_shade_of_akamaAI : public ScriptedAI
{
for(std::list<Creature*>::iterator itr = ChannelerList.begin(); itr != ChannelerList.end(); ++itr)
{
- ((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());
debug_log("TSCR: Shade of Akama Grid Search found channeler %u. Adding to list", (*itr)->GetGUID());
}
@@ -489,7 +489,7 @@ void mob_ashtongue_channelerAI::JustDied(Unit* killer)
{
Creature* Shade = (Unit::GetCreature((*m_creature), ShadeGUID));
if(Shade && Shade->isAlive())
- ((boss_shade_of_akamaAI*)Shade->AI())->IncrementDeathCount();
+ CAST_AI(boss_shade_of_akamaAI, Shade->AI())->IncrementDeathCount();
else error_log("SD2 ERROR: Channeler dead but unable to increment DeathCount for Shade of Akama.");
}
@@ -497,7 +497,7 @@ void mob_ashtongue_sorcererAI::JustDied(Unit* killer)
{
Creature* Shade = (Unit::GetCreature((*m_creature), ShadeGUID));
if(Shade && Shade->isAlive())
- ((boss_shade_of_akamaAI*)Shade->AI())->IncrementDeathCount(m_creature->GetGUID());
+ CAST_AI(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.");
}
@@ -572,8 +572,8 @@ struct TRINITY_DLL_DECL npc_akamaAI : public ScriptedAI
pInstance->SetData(DATA_SHADEOFAKAMAEVENT, IN_PROGRESS);
// Prevent players from trying to restart event
m_creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
- ((boss_shade_of_akamaAI*)Shade->AI())->SetAkamaGUID(m_creature->GetGUID());
- ((boss_shade_of_akamaAI*)Shade->AI())->SetSelectableChannelers();
+ CAST_AI(boss_shade_of_akamaAI, Shade->AI())->SetAkamaGUID(m_creature->GetGUID());
+ CAST_AI(boss_shade_of_akamaAI, Shade->AI())->SetSelectableChannelers();
Shade->AddThreat(m_creature, 1000000.0f);
m_creature->CombatStart(Shade);
Shade->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE);
@@ -621,7 +621,7 @@ struct TRINITY_DLL_DECL npc_akamaAI : public ScriptedAI
HasYelledOnce = false;
Creature* Shade = Unit::GetCreature((*m_creature), ShadeGUID);
if(Shade && Shade->isAlive())
- ((boss_shade_of_akamaAI*)Shade->AI())->HasKilledAkama = true;
+ CAST_AI(boss_shade_of_akamaAI, Shade->AI())->HasKilledAkama = true;
}
void UpdateAI(const uint32 diff)
@@ -640,7 +640,7 @@ struct TRINITY_DLL_DECL npc_akamaAI : public ScriptedAI
Creature* Shade = (Unit::GetCreature((*m_creature), ShadeGUID));
if(Shade && Shade->isAlive())
{
- if(((boss_shade_of_akamaAI*)Shade->AI())->IsBanished)
+ if(CAST_AI(boss_shade_of_akamaAI, Shade->AI())->IsBanished)
{
if(CastSoulRetrieveTimer < diff)
{
@@ -816,7 +816,7 @@ bool GossipSelect_npc_akama(Player *player, Creature *_Creature, uint32 sender,
if (action == GOSSIP_ACTION_INFO_DEF + 1) //Fight time
{
player->CLOSE_GOSSIP_MENU();
- ((npc_akamaAI*)_Creature->AI())->BeginEvent(player);
+ CAST_AI(npc_akamaAI, _Creature->AI())->BeginEvent(player);
}
return true;
diff --git a/src/bindings/scripts/scripts/zone/black_temple/boss_teron_gorefiend.cpp b/src/bindings/scripts/scripts/zone/black_temple/boss_teron_gorefiend.cpp
index 615c0084d11..a20594166c7 100644
--- a/src/bindings/scripts/scripts/zone/black_temple/boss_teron_gorefiend.cpp
+++ b/src/bindings/scripts/scripts/zone/black_temple/boss_teron_gorefiend.cpp
@@ -352,7 +352,7 @@ struct TRINITY_DLL_DECL boss_teron_gorefiendAI : public ScriptedAI
{
Construct->CastSpell(Construct, SPELL_PASSIVE_SHADOWFORM, true);
SetThreatList(Construct); // Use same function as Doom Blossom to set Threat List.
- ((mob_shadowy_constructAI*)Construct->AI())->GhostGUID = GhostGUID;
+ CAST_AI(mob_shadowy_constructAI, Construct->AI())->GhostGUID = GhostGUID;
Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 1);
if(!target) // someone's trying to solo.
target = m_creature->getVictim();
@@ -430,7 +430,7 @@ struct TRINITY_DLL_DECL boss_teron_gorefiendAI : public ScriptedAI
DoomBlossom->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
DoomBlossom->setFaction(m_creature->getFaction());
DoomBlossom->AddThreat(target, 1.0f);
- ((mob_doom_blossomAI*)DoomBlossom->AI())->SetTeronGUID(m_creature->GetGUID());
+ CAST_AI(mob_doom_blossomAI, DoomBlossom->AI())->SetTeronGUID(m_creature->GetGUID());
target->CombatStart(DoomBlossom);
SetThreatList(DoomBlossom);
SummonDoomBlossomTimer = 35000;
diff --git a/src/bindings/scripts/scripts/zone/black_temple/boss_warlord_najentus.cpp b/src/bindings/scripts/scripts/zone/black_temple/boss_warlord_najentus.cpp
index ee3cc90661a..183e2c4317f 100644
--- a/src/bindings/scripts/scripts/zone/black_temple/boss_warlord_najentus.cpp
+++ b/src/bindings/scripts/scripts/zone/black_temple/boss_warlord_najentus.cpp
@@ -197,7 +197,7 @@ bool GOHello_go_najentus_spine(Player *player, GameObject* _GO)
{
if(ScriptedInstance* pInstance = (ScriptedInstance*)_GO->GetInstanceData())
if(Creature* Najentus = Unit::GetCreature(*_GO, pInstance->GetData64(DATA_HIGHWARLORDNAJENTUS)))
- if(((boss_najentusAI*)Najentus->AI())->RemoveImpalingSpine())
+ if(CAST_AI(boss_najentusAI, Najentus->AI())->RemoveImpalingSpine())
{
player->CastSpell(player, SPELL_CREATE_NAJENTUS_SPINE, true);
_GO->SetLootState(GO_NOT_READY);
diff --git a/src/bindings/scripts/scripts/zone/black_temple/illidari_council.cpp b/src/bindings/scripts/scripts/zone/black_temple/illidari_council.cpp
index 7331e0490ec..dd4a75cfdc2 100644
--- a/src/bindings/scripts/scripts/zone/black_temple/illidari_council.cpp
+++ b/src/bindings/scripts/scripts/zone/black_temple/illidari_council.cpp
@@ -261,8 +261,8 @@ struct TRINITY_DLL_DECL mob_illidari_councilAI : public ScriptedAI
// Start the event for the Voice Trigger
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())->EventStarted = true;
+ CAST_AI(mob_blood_elf_council_voice_triggerAI, VoiceTrigger->AI())->LoadCouncilGUIDs();
+ CAST_AI(mob_blood_elf_council_voice_triggerAI, VoiceTrigger->AI())->EventStarted = true;
}
for(uint8 i = 0; i < 4; ++i)
@@ -366,7 +366,7 @@ struct TRINITY_DLL_DECL boss_illidari_councilAI : public ScriptedAI
{
Creature* Controller = (Unit::GetCreature(*m_creature, pInstance->GetData64(DATA_ILLIDARICOUNCIL)));
if(Controller)
- ((mob_illidari_councilAI*)Controller->AI())->StartEvent(who);
+ CAST_AI(mob_illidari_councilAI, Controller->AI())->StartEvent(who);
}
else
{
diff --git a/src/bindings/scripts/scripts/zone/blackrock_depths/blackrock_depths.cpp b/src/bindings/scripts/scripts/zone/blackrock_depths/blackrock_depths.cpp
index 7e493f54e0b..61465508cab 100644
--- a/src/bindings/scripts/scripts/zone/blackrock_depths/blackrock_depths.cpp
+++ b/src/bindings/scripts/scripts/zone/blackrock_depths/blackrock_depths.cpp
@@ -594,7 +594,7 @@ bool GossipSelect_npc_dughal_stormwing(Player *player, Creature *_Creature, uint
if (action == GOSSIP_ACTION_INFO_DEF + 1)
{
player->CLOSE_GOSSIP_MENU();
- ((npc_escortAI*)(_Creature->AI()))->Start(false, false, true, player->GetGUID());
+ CAST_AI(npc_escortAI, (_Creature->AI()))->Start(false, false, true, player->GetGUID());
_Creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
pInstance->SetData(DATA_QUEST_JAIL_BREAK,ENCOUNTER_STATE_IN_PROGRESS);
}
@@ -751,7 +751,7 @@ bool QuestAccept_npc_marshal_windsor(Player *player, Creature *creature, Quest c
{PlayerStart = player;
if( pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED )
{
- ((npc_escortAI*)(creature->AI()))->Start(true, true, false, player->GetGUID());
+ CAST_AI(npc_escortAI, (creature->AI()))->Start(true, true, false, player->GetGUID());
pInstance->SetData(DATA_QUEST_JAIL_BREAK,ENCOUNTER_STATE_IN_PROGRESS);
creature->setFaction(11);
}
@@ -1059,7 +1059,7 @@ bool GossipSelect_npc_tobias_seecher(Player *player, Creature *_Creature, uint32
if (action == GOSSIP_ACTION_INFO_DEF + 1)
{
player->CLOSE_GOSSIP_MENU();
- ((npc_escortAI*)(_Creature->AI()))->Start(false, false, true, player->GetGUID());
+ CAST_AI(npc_escortAI, (_Creature->AI()))->Start(false, false, true, player->GetGUID());
_Creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
pInstance->SetData(DATA_TOBIAS,ENCOUNTER_STATE_IN_PROGRESS);
}
@@ -1197,7 +1197,7 @@ bool ChooseReward_npc_rocknot(Player *player, Creature *_Creature, const Quest *
{
DoScriptText(SAY_GOT_BEER, _Creature);
_Creature->CastSpell(_Creature,SPELL_DRUNKEN_RAGE,false);
- ((npc_escortAI*)(_Creature->AI()))->Start(false, false, false);
+ CAST_AI(npc_escortAI, (_Creature->AI()))->Start(false, false, false);
}
}
diff --git a/src/bindings/scripts/scripts/zone/blackwing_lair/boss_vaelastrasz.cpp b/src/bindings/scripts/scripts/zone/blackwing_lair/boss_vaelastrasz.cpp
index b11ac370804..0fe4a7473e6 100644
--- a/src/bindings/scripts/scripts/zone/blackwing_lair/boss_vaelastrasz.cpp
+++ b/src/bindings/scripts/scripts/zone/blackwing_lair/boss_vaelastrasz.cpp
@@ -223,7 +223,7 @@ void SendDefaultMenu_boss_vael(Player *player, Creature *_Creature, uint32 actio
if (action == GOSSIP_ACTION_INFO_DEF + 1) //Fight time
{
player->CLOSE_GOSSIP_MENU();
- ((boss_vaelAI*)_Creature->AI())->BeginSpeach((Unit*)player);
+ CAST_AI(boss_vaelAI, _Creature->AI())->BeginSpeach((Unit*)player);
}
}
diff --git a/src/bindings/scripts/scripts/zone/blackwing_lair/boss_victor_nefarius.cpp b/src/bindings/scripts/scripts/zone/blackwing_lair/boss_victor_nefarius.cpp
index b3aee0035df..4b8a8b6ff23 100644
--- a/src/bindings/scripts/scripts/zone/blackwing_lair/boss_victor_nefarius.cpp
+++ b/src/bindings/scripts/scripts/zone/blackwing_lair/boss_victor_nefarius.cpp
@@ -373,7 +373,7 @@ bool GossipSelect_boss_victor_nefarius(Player *player, Creature *_Creature, uint
case GOSSIP_ACTION_INFO_DEF+3:
player->CLOSE_GOSSIP_MENU();
DoScriptText(SAY_GAMESBEGIN_1, _Creature);
- ((boss_victor_nefariusAI*)_Creature->AI())->BeginEvent(player);
+ CAST_AI(boss_victor_nefariusAI, _Creature->AI())->BeginEvent(player);
break;
}
return true;
diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_archimonde.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_archimonde.cpp
index 75c234190a7..0e2dd277454 100644
--- a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_archimonde.cpp
+++ b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_archimonde.cpp
@@ -530,7 +530,7 @@ struct TRINITY_DLL_DECL boss_archimondeAI : public hyjal_trashAI
if (Wisp)
{
Wisp->AI()->AttackStart(m_creature);
- ((mob_ancient_wispAI*)Wisp->AI())->ArchimondeGUID = m_creature->GetGUID();
+ CAST_AI(mob_ancient_wispAI, Wisp->AI())->ArchimondeGUID = m_creature->GetGUID();
}
SummonWispTimer = 1500;
++WispCount;
diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.cpp
index 12b2255b72c..33b484f9bdf 100644
--- a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.cpp
+++ b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.cpp
@@ -462,7 +462,7 @@ void hyjalAI::SummonCreature(uint32 entry, float Base[4][3])
{//summon at tower
pCreature = m_creature->SummonCreature(entry, SpawnPointSpecial[SPAWN_NEAR_TOWER][0]+irand(-20,20), SpawnPointSpecial[SPAWN_NEAR_TOWER][1]+irand(-20,20), SpawnPointSpecial[SPAWN_NEAR_TOWER][2]+irand(-10,10), 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 120000);
if(pCreature)
- ((hyjal_trashAI*)pCreature->AI())->useFlyPath = true;
+ CAST_AI(hyjal_trashAI, pCreature->AI())->useFlyPath = true;
}else{//summon at gate
pCreature = m_creature->SummonCreature(entry, SpawnPointSpecial[SPAWN_GARG_GATE][0]+irand(-10,10), SpawnPointSpecial[SPAWN_GARG_GATE][1]+irand(-10,10), SpawnPointSpecial[SPAWN_GARG_GATE][2]+irand(-10,10), 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 120000);
}
@@ -474,7 +474,7 @@ void hyjalAI::SummonCreature(uint32 entry, float Base[4][3])
}else{
pCreature = m_creature->SummonCreature(entry, SpawnPointSpecial[SPAWN_NEAR_TOWER][0], SpawnPointSpecial[SPAWN_NEAR_TOWER][1],SpawnPointSpecial[SPAWN_NEAR_TOWER][2], 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 120000);
if(pCreature)
- ((hyjal_trashAI*)pCreature->AI())->useFlyPath = true;
+ CAST_AI(hyjal_trashAI, pCreature->AI())->useFlyPath = true;
}
break;
case 17908: //GIANT_INFERNAL
@@ -510,7 +510,7 @@ void hyjalAI::SummonCreature(uint32 entry, float Base[4][3])
case ANETHERON:
case KAZROGAL:
case AZGALOR:
- ((hyjal_trashAI*)pCreature->AI())->IsEvent = true;
+ CAST_AI(hyjal_trashAI, pCreature->AI())->IsEvent = true;
break;
}
if(pInstance)
@@ -682,7 +682,7 @@ void hyjalAI::Retreat()
if(JainaDummy)
{
JainaDummy->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
- ((hyjalAI*)JainaDummy->AI())->IsDummy = true;
+ CAST_AI(hyjalAI, JainaDummy->AI())->IsDummy = true;
DummyGuid = JainaDummy->GetGUID();
}
AddWaypoint(0,JainaDummySpawn[1][0],JainaDummySpawn[1][1],JainaDummySpawn[1][2]);
@@ -1000,8 +1000,8 @@ void hyjalAI::WaypointReached(uint32 i)
Unit* Dummy = Unit::GetUnit((*m_creature),DummyGuid);
if(Dummy)
{
- ((hyjalAI*)CAST_CRE(Dummy)->AI())->DoMassTeleport = true;
- ((hyjalAI*)CAST_CRE(Dummy)->AI())->MassTeleportTimer = 20000;
+ CAST_AI(hyjalAI, CAST_CRE(Dummy)->AI())->DoMassTeleport = true;
+ CAST_AI(hyjalAI, CAST_CRE(Dummy)->AI())->MassTeleportTimer = 20000;
Dummy->CastSpell(m_creature,SPELL_MASS_TELEPORT,false);
}
}
@@ -1100,9 +1100,9 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff)
Creature* pUnit = m_creature->SummonCreature(GHOUL, AllianceBase[r][0]+irand(-15,15), AllianceBase[r][1]+irand(-15,15), AllianceBase[r][2], 0, TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000);
if(pUnit)
{
- ((hyjal_trashAI*)pUnit->AI())->faction = Faction;
- ((hyjal_trashAI*)pUnit->AI())->IsOverrun = true;
- ((hyjal_trashAI*)pUnit->AI())->OverrunType = i;
+ CAST_AI(hyjal_trashAI, pUnit->AI())->faction = Faction;
+ CAST_AI(hyjal_trashAI, pUnit->AI())->IsOverrun = true;
+ CAST_AI(hyjal_trashAI, pUnit->AI())->OverrunType = i;
pUnit->setActive(true);
}
}
@@ -1112,9 +1112,9 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff)
Creature* pUnit = m_creature->SummonCreature(ABOMINATION, AllianceBase[r][0]+irand(-15,15), AllianceBase[r][1]+irand(-15,15), AllianceBase[r][2], 0, TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000);
if(pUnit)
{
- ((hyjal_trashAI*)pUnit->AI())->faction = Faction;
- ((hyjal_trashAI*)pUnit->AI())->IsOverrun = true;
- ((hyjal_trashAI*)pUnit->AI())->OverrunType = i;
+ CAST_AI(hyjal_trashAI, pUnit->AI())->faction = Faction;
+ CAST_AI(hyjal_trashAI, pUnit->AI())->IsOverrun = true;
+ CAST_AI(hyjal_trashAI, pUnit->AI())->OverrunType = i;
pUnit->setActive(true);
}
}
@@ -1124,9 +1124,9 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff)
if(pUnit)
{
pUnit->SetHomePosition(AllianceOverrunGargPos[i][0], AllianceOverrunGargPos[i][1], AllianceOverrunGargPos[i][2], AllianceOverrunGargPos[i][3]);
- ((hyjal_trashAI*)pUnit->AI())->faction = Faction;
- ((hyjal_trashAI*)pUnit->AI())->IsOverrun = true;
- ((hyjal_trashAI*)pUnit->AI())->OverrunType = i;
+ CAST_AI(hyjal_trashAI, pUnit->AI())->faction = Faction;
+ CAST_AI(hyjal_trashAI, pUnit->AI())->IsOverrun = true;
+ CAST_AI(hyjal_trashAI, pUnit->AI())->OverrunType = i;
pUnit->setActive(true);
}
}
@@ -1141,9 +1141,9 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff)
if(pUnit)
{
pUnit->SetHomePosition(InfernalSPWP[i][0], InfernalSPWP[i][1], InfernalSPWP[i][2], InfernalSPWP[i][3]);
- ((hyjal_trashAI*)pUnit->AI())->faction = Faction;
- ((hyjal_trashAI*)pUnit->AI())->IsOverrun = true;
- ((hyjal_trashAI*)pUnit->AI())->OverrunType = i;
+ CAST_AI(hyjal_trashAI, pUnit->AI())->faction = Faction;
+ CAST_AI(hyjal_trashAI, pUnit->AI())->IsOverrun = true;
+ CAST_AI(hyjal_trashAI, pUnit->AI())->OverrunType = i;
pUnit->setActive(true);
}
}
@@ -1153,9 +1153,9 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff)
Creature* pUnit = m_creature->SummonCreature(GHOUL, HordeBase[r][0]+irand(-15,15), HordeBase[r][1]+irand(-15,15), HordeBase[r][2], 0, TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000);
if(pUnit)
{
- ((hyjal_trashAI*)pUnit->AI())->faction = Faction;
- ((hyjal_trashAI*)pUnit->AI())->IsOverrun = true;
- ((hyjal_trashAI*)pUnit->AI())->OverrunType = i;
+ CAST_AI(hyjal_trashAI, pUnit->AI())->faction = Faction;
+ CAST_AI(hyjal_trashAI, pUnit->AI())->IsOverrun = true;
+ CAST_AI(hyjal_trashAI, pUnit->AI())->OverrunType = i;
pUnit->setActive(true);
}
}
@@ -1165,9 +1165,9 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff)
Creature* pUnit = m_creature->SummonCreature(ABOMINATION, HordeBase[r][0]+irand(-15,15), HordeBase[r][1]+irand(-15,15), HordeBase[r][2], 0, TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000);
if(pUnit)
{
- ((hyjal_trashAI*)pUnit->AI())->faction = Faction;
- ((hyjal_trashAI*)pUnit->AI())->IsOverrun = true;
- ((hyjal_trashAI*)pUnit->AI())->OverrunType = i;
+ CAST_AI(hyjal_trashAI, pUnit->AI())->faction = Faction;
+ CAST_AI(hyjal_trashAI, pUnit->AI())->IsOverrun = true;
+ CAST_AI(hyjal_trashAI, pUnit->AI())->OverrunType = i;
pUnit->setActive(true);
}
}
diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjal_trash.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjal_trash.cpp
index 7bfcac6f5c3..afe26079795 100644
--- a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjal_trash.cpp
+++ b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjal_trash.cpp
@@ -1147,7 +1147,7 @@ struct mob_frost_wyrmAI : public hyjal_trashAI
hyjal_trashAI::UpdateAI(diff);
if(IsEvent || IsOverrun)
{
- ((hyjal_trashAI*)m_creature->AI())->SetCanMelee(false);
+ CAST_AI(hyjal_trashAI, m_creature->AI())->SetCanMelee(false);
npc_escortAI::UpdateAI(diff);
}
if (IsEvent)
@@ -1259,7 +1259,7 @@ struct mob_gargoyleAI : public hyjal_trashAI
hyjal_trashAI::UpdateAI(diff);
if(IsEvent || IsOverrun)
{
- ((hyjal_trashAI*)m_creature->AI())->SetCanMelee(false);
+ CAST_AI(hyjal_trashAI, m_creature->AI())->SetCanMelee(false);
npc_escortAI::UpdateAI(diff);
}
if (IsEvent)
diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/old_hillsbrad/old_hillsbrad.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/old_hillsbrad/old_hillsbrad.cpp
index 146d9e1922b..6c7c5544c79 100644
--- a/src/bindings/scripts/scripts/zone/caverns_of_time/old_hillsbrad/old_hillsbrad.cpp
+++ b/src/bindings/scripts/scripts/zone/caverns_of_time/old_hillsbrad/old_hillsbrad.cpp
@@ -335,7 +335,7 @@ struct TRINITY_DLL_DECL npc_thrall_old_hillsbradAI : public npc_escortAI
if (uint64 TarethaGUID = pInstance->GetData64(DATA_TARETHA))
{
if (Creature* Taretha = (Unit::GetCreature(*m_creature, TarethaGUID)))
- ((npc_escortAI*)(Taretha->AI()))->Start(false, false, true, PlayerGUID);
+ CAST_AI(npc_escortAI, (Taretha->AI()))->Start(false, false, true, PlayerGUID);
}
//kill credit creature for quest
@@ -536,10 +536,10 @@ bool GossipSelect_npc_thrall_old_hillsbrad(Player *player, Creature *_Creature,
DoScriptText(SAY_TH_START_EVENT_PART1, _Creature);
- ((npc_escortAI*)(_Creature->AI()))->Start(true, true, true, player->GetGUID());
- ((npc_escortAI*)(_Creature->AI()))->SetMaxPlayerDistance(100.0f);//not really needed, because it will not despawn if player is too far
- ((npc_escortAI*)(_Creature->AI()))->SetDespawnAtEnd(false);
- ((npc_escortAI*)(_Creature->AI()))->SetDespawnAtFar(false);
+ CAST_AI(npc_escortAI, (_Creature->AI()))->Start(true, true, true, player->GetGUID());
+ CAST_AI(npc_escortAI, (_Creature->AI()))->SetMaxPlayerDistance(100.0f);//not really needed, because it will not despawn if player is too far
+ CAST_AI(npc_escortAI, (_Creature->AI()))->SetDespawnAtEnd(false);
+ CAST_AI(npc_escortAI, (_Creature->AI()))->SetDespawnAtFar(false);
break;
case GOSSIP_ACTION_INFO_DEF+2:
@@ -555,14 +555,14 @@ bool GossipSelect_npc_thrall_old_hillsbrad(Player *player, Creature *_Creature,
DoScriptText(SAY_TH_START_EVENT_PART2, _Creature);
- ((npc_thrall_old_hillsbradAI*)_Creature->AI())->StartWP();
+ CAST_AI(npc_thrall_old_hillsbradAI, _Creature->AI())->StartWP();
break;
case GOSSIP_ACTION_INFO_DEF+3:
player->CLOSE_GOSSIP_MENU();
if(pInstance)
pInstance->SetData(TYPE_THRALL_PART3,IN_PROGRESS);
- ((npc_thrall_old_hillsbradAI*)_Creature->AI())->StartWP();
+ CAST_AI(npc_thrall_old_hillsbradAI, _Creature->AI())->StartWP();
break;
}
return true;
@@ -649,7 +649,7 @@ bool GossipSelect_npc_taretha(Player *player, Creature *_Creature, uint32 sender
{
Creature* Thrall = (Unit::GetCreature((*_Creature), ThrallGUID));
if(Thrall)
- ((npc_thrall_old_hillsbradAI*)Thrall->AI())->StartWP();
+ CAST_AI(npc_thrall_old_hillsbradAI, Thrall->AI())->StartWP();
}
}
}
diff --git a/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_fathomlord_karathress.cpp b/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_fathomlord_karathress.cpp
index e41557b95ea..6f37d68e062 100644
--- a/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_fathomlord_karathress.cpp
+++ b/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_fathomlord_karathress.cpp
@@ -349,8 +349,8 @@ struct TRINITY_DLL_DECL boss_fathomguard_sharkkisAI : public ScriptedAI
Karathress = (Unit::GetCreature((*m_creature), pInstance->GetData64(DATA_KARATHRESS)));
if (Karathress)
- ((boss_fathomlord_karathressAI*)Karathress->AI())->EventSharkkisDeath();
- ((boss_fathomlord_karathressAI*)Karathress->AI())->EventSharkkisDeath();
+ CAST_AI(boss_fathomlord_karathressAI, Karathress->AI())->EventSharkkisDeath();
+ CAST_AI(boss_fathomlord_karathressAI, Karathress->AI())->EventSharkkisDeath();
}
}
@@ -479,7 +479,7 @@ struct TRINITY_DLL_DECL boss_fathomguard_tidalvessAI : public ScriptedAI
if (Karathress)
if(!m_creature->isAlive() && Karathress)
- ((boss_fathomlord_karathressAI*)Karathress->AI())->EventTidalvessDeath();
+ CAST_AI(boss_fathomlord_karathressAI, Karathress->AI())->EventTidalvessDeath();
}
}
@@ -594,7 +594,7 @@ struct TRINITY_DLL_DECL boss_fathomguard_caribdisAI : public ScriptedAI
if (Karathress)
if(!m_creature->isAlive() && Karathress)
- ((boss_fathomlord_karathressAI*)Karathress->AI())->EventCaribdisDeath();
+ CAST_AI(boss_fathomlord_karathressAI, Karathress->AI())->EventCaribdisDeath();
}
}
diff --git a/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_lady_vashj.cpp b/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_lady_vashj.cpp
index 5d13f2e5eba..a732cb788b1 100644
--- a/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_lady_vashj.cpp
+++ b/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_lady_vashj.cpp
@@ -590,7 +590,7 @@ struct TRINITY_DLL_DECL mob_enchanted_elementalAI : public ScriptedAI
uint32 move;
uint32 phase;
float x, y, z;
- Unit *Vashj;
+ Creature *Vashj;
void Reset()
{
@@ -619,7 +619,7 @@ struct TRINITY_DLL_DECL mob_enchanted_elementalAI : public ScriptedAI
}
}
if (pInstance)
- Vashj = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_LADYVASHJ));
+ Vashj = Unit::GetCreature((*m_creature), pInstance->GetData64(DATA_LADYVASHJ));
}
void EnterCombat(Unit *who) { return; }
@@ -672,7 +672,7 @@ struct TRINITY_DLL_DECL mob_enchanted_elementalAI : public ScriptedAI
m_creature->DealDamage(m_creature, m_creature->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
}
}
- if(((boss_lady_vashjAI*)CAST_CRE(Vashj)->AI())->InCombat == false || ((boss_lady_vashjAI*)CAST_CRE(Vashj)->AI())->Phase != 2 || Vashj->isDead())
+ if(CAST_AI(boss_lady_vashjAI, Vashj->AI())->InCombat == false || CAST_AI(boss_lady_vashjAI, Vashj->AI())->Phase != 2 || Vashj->isDead())
{
//call Unsummon()
m_creature->DealDamage(m_creature, m_creature->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
@@ -710,7 +710,7 @@ struct TRINITY_DLL_DECL mob_tainted_elementalAI : public ScriptedAI
Vashj = (Unit::GetCreature((*m_creature), pInstance->GetData64(DATA_LADYVASHJ)));
if(Vashj)
- ((boss_lady_vashjAI*)Vashj->AI())->EventTaintedElementalDeath();
+ CAST_AI(boss_lady_vashjAI, Vashj->AI())->EventTaintedElementalDeath();
}
}
@@ -827,7 +827,7 @@ struct TRINITY_DLL_DECL mob_toxic_sporebatAI : public ScriptedAI
//check if vashj is death
Unit *Vashj = NULL;
Vashj = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_LADYVASHJ));
- if(!Vashj || (Vashj && !Vashj->isAlive()) || (Vashj && ((boss_lady_vashjAI*)CAST_CRE(Vashj)->AI())->Phase != 3))
+ if(!Vashj || (Vashj && !Vashj->isAlive()) || (Vashj && CAST_AI(boss_lady_vashjAI, CAST_CRE(Vashj)->AI())->Phase != 3))
{
//remove
m_creature->setDeathState(DEAD);
@@ -938,7 +938,7 @@ bool ItemUse_item_tainted_core(Player *player, Item* _Item, SpellCastTargets con
Creature *Vashj = NULL;
Vashj = (Unit::GetCreature((*player), pInstance->GetData64(DATA_LADYVASHJ)));
- if(Vashj && ((boss_lady_vashjAI*)Vashj->AI())->Phase == 2)
+ if(Vashj && CAST_AI(boss_lady_vashjAI, Vashj->AI())->Phase == 2)
{
if(targets.getGOTarget() && targets.getGOTarget()->GetTypeId()==TYPEID_GAMEOBJECT)
{
@@ -974,7 +974,7 @@ bool ItemUse_item_tainted_core(Player *player, Item* _Item, SpellCastTargets con
//get and remove channel
Unit *Channel = NULL;
- Channel = Unit::GetUnit((*Vashj), ((boss_lady_vashjAI*)Vashj->AI())->ShieldGeneratorChannel[channel_identifier]);
+ Channel = Unit::GetCreature(*Vashj, CAST_AI(boss_lady_vashjAI, Vashj->AI())->ShieldGeneratorChannel[channel_identifier]);
if(Channel)
{
//call Unsummon()
diff --git a/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_leotheras_the_blind.cpp b/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_leotheras_the_blind.cpp
index 8b9421dfd4c..92ebfc75998 100644
--- a/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_leotheras_the_blind.cpp
+++ b/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_leotheras_the_blind.cpp
@@ -664,7 +664,7 @@ struct TRINITY_DLL_DECL mob_greyheart_spellbinderAI : public ScriptedAI
pInstance->SetData64(DATA_LEOTHERAS_EVENT_STARTER, 0);
Creature *leotheras = (Creature *)Unit::GetUnit(*m_creature, leotherasGUID);
if(leotheras && leotheras->isAlive())
- ((boss_leotheras_the_blindAI*)leotheras->AI())->CheckChannelers(false);
+ CAST_AI(boss_leotheras_the_blindAI, leotheras->AI())->CheckChannelers(false);
}
}
diff --git a/src/bindings/scripts/scripts/zone/coilfang_resevoir/steam_vault/boss_warlord_kalithresh.cpp b/src/bindings/scripts/scripts/zone/coilfang_resevoir/steam_vault/boss_warlord_kalithresh.cpp
index fb8a00865ed..a2dbeafdde4 100644
--- a/src/bindings/scripts/scripts/zone/coilfang_resevoir/steam_vault/boss_warlord_kalithresh.cpp
+++ b/src/bindings/scripts/scripts/zone/coilfang_resevoir/steam_vault/boss_warlord_kalithresh.cpp
@@ -182,7 +182,7 @@ struct TRINITY_DLL_DECL boss_warlord_kalithreshAI : public ScriptedAI
{
DoScriptText(SAY_REGEN, m_creature);
DoCast(m_creature,SPELL_WARLORDS_RAGE);
- ((mob_naga_distillerAI*)distiller->AI())->StartRageGen(m_creature);
+ CAST_AI(mob_naga_distillerAI, distiller->AI())->StartRageGen(m_creature);
}
Rage_Timer = 3000+rand()%15000;
}else Rage_Timer -= diff;
diff --git a/src/bindings/scripts/scripts/zone/eastern_plaguelands/the_scarlet_enclave.cpp b/src/bindings/scripts/scripts/zone/eastern_plaguelands/the_scarlet_enclave.cpp
index 99fb2adab3d..b950fade6c9 100644
--- a/src/bindings/scripts/scripts/zone/eastern_plaguelands/the_scarlet_enclave.cpp
+++ b/src/bindings/scripts/scripts/zone/eastern_plaguelands/the_scarlet_enclave.cpp
@@ -284,7 +284,7 @@ void npc_unworthy_initiateAI::UpdateAI(const uint32 diff)
if(go_prison)
go_prison->ResetDoorOrButton();
- ((npc_unworthy_initiate_anchorAI*)trigger->AI())->SetTarget(m_creature->GetGUID());
+ CAST_AI(npc_unworthy_initiate_anchorAI, trigger->AI())->SetTarget(m_creature->GetGUID());
trigger->CastSpell(m_creature,SPELL_SOUL_PRISON_CHAIN,true);
anchor = trigger->GetGUID();
}
@@ -367,12 +367,12 @@ bool GOHello_go_acherus_soul_prison(Player *player, GameObject* _GO)
Unit* prison_anchor = finder->FindNearestCreature(29521, 15);
if(!prison_anchor) return false;
- uint64 owner = ((npc_unworthy_initiate_anchorAI*)CAST_CRE(prison_anchor)->AI())->GetTarget();
+ uint64 owner = CAST_AI(npc_unworthy_initiate_anchorAI, CAST_CRE(prison_anchor)->AI())->GetTarget();
Creature* prisoner = Creature::GetCreature((*player),owner);
if(prisoner)
{
- ((npc_unworthy_initiateAI*)(prisoner->AI()))->EventStart(CAST_CRE(prison_anchor),player);
+ CAST_AI(npc_unworthy_initiateAI, (prisoner->AI()))->EventStart(CAST_CRE(prison_anchor),player);
}
return false;
diff --git a/src/bindings/scripts/scripts/zone/eversong_woods/eversong_woods.cpp b/src/bindings/scripts/scripts/zone/eversong_woods/eversong_woods.cpp
index a10a9a353fb..aaded603f80 100644
--- a/src/bindings/scripts/scripts/zone/eversong_woods/eversong_woods.cpp
+++ b/src/bindings/scripts/scripts/zone/eversong_woods/eversong_woods.cpp
@@ -111,7 +111,7 @@ bool GossipSelect_npc_prospector_anvilward(Player *player, Creature *_Creature,
break;
case GOSSIP_ACTION_INFO_DEF+2:
player->CLOSE_GOSSIP_MENU();
- ((npc_escortAI*)(_Creature->AI()))->Start(true, true, false, player->GetGUID());
+ CAST_AI(npc_escortAI, (_Creature->AI()))->Start(true, true, false, player->GetGUID());
break;
}
return true;
@@ -343,7 +343,7 @@ struct TRINITY_DLL_DECL master_kelerun_bloodmournAI : public ScriptedAI
Creature* paladinSpawn;
paladinSpawn = (Unit::GetCreature((*m_creature), paladinGuid[paladinPhase]));
if ( paladinSpawn ) {
- ((npc_secondTrialAI*)paladinSpawn->AI())->Activate(m_creature->GetGUID());
+ CAST_AI(npc_secondTrialAI, paladinSpawn->AI())->Activate(m_creature->GetGUID());
switch(paladinPhase) {
case 0:
@@ -405,7 +405,7 @@ bool GossipHello_master_kelerun_bloodmourn(Player *player, Creature *_Creature)
// Escort quests or any other event-driven quests. If player in party, all players that can accept this quest will receive confirmation box to accept quest.
// !not sure if this really works!
- if ( ((master_kelerun_bloodmournAI*)_Creature->AI())->questPhase == 0 ) {
+ if ( CAST_AI(master_kelerun_bloodmournAI, _Creature->AI())->questPhase == 0 ) {
player->PrepareQuestMenu(_Creature->GetGUID());
player->SendPreparedQuest(_Creature->GetGUID());
}
@@ -418,7 +418,7 @@ bool QuestAccept_master_kelerun_bloodmourn(Player *player, Creature *creature, Q
{
// One Player exclusive quest, wait for user go activation
if(quest->GetQuestId() == QUEST_SECOND_TRIAL )
- ((master_kelerun_bloodmournAI*)creature->AI())->questPhase = 1;
+ CAST_AI(master_kelerun_bloodmournAI, creature->AI())->questPhase = 1;
return true;
}
@@ -444,7 +444,7 @@ void npc_secondTrialAI::JustDied(Unit* Killer) {
Summoner = (Unit::GetCreature((*m_creature), summonerGuid));
if ( Summoner )
- ((master_kelerun_bloodmournAI*)Summoner->AI())->SecondTrialKill();
+ CAST_AI(master_kelerun_bloodmournAI, Summoner->AI())->SecondTrialKill();
// last kill quest complete for group
if ( m_creature->GetEntry() == CHAMPION_SUNSTRIKER ) {
@@ -514,7 +514,7 @@ bool GOHello_go_second_trial(Player *player, GameObject* _GO)
cell_lock->Visit(cell_lock, grid_unit_searcher, *(_GO->GetMap()));
if ( event_controller )
- ((master_kelerun_bloodmournAI*)event_controller->AI())->StartEvent();
+ CAST_AI(master_kelerun_bloodmournAI, event_controller->AI())->StartEvent();
return true;
}
@@ -594,8 +594,8 @@ bool QuestAccept_npc_apprentice_mirveda(Player* player, Creature* creature, Ques
{
if (quest->GetQuestId() == QUEST_UNEXPECTED_RESULT)
{
- ((npc_apprentice_mirvedaAI*)creature->AI())->Summon = true;
- ((npc_apprentice_mirvedaAI*)creature->AI())->PlayerGUID = player->GetGUID();
+ CAST_AI(npc_apprentice_mirvedaAI, creature->AI())->Summon = true;
+ CAST_AI(npc_apprentice_mirvedaAI, creature->AI())->PlayerGUID = player->GetGUID();
}
return true;
}
diff --git a/src/bindings/scripts/scripts/zone/feralas/feralas.cpp b/src/bindings/scripts/scripts/zone/feralas/feralas.cpp
index 7064e366f0b..be57b8c8d88 100644
--- a/src/bindings/scripts/scripts/zone/feralas/feralas.cpp
+++ b/src/bindings/scripts/scripts/zone/feralas/feralas.cpp
@@ -190,7 +190,7 @@ bool QuestAccept_npc_oox22fe(Player* pPlayer, Creature* pCreature, const Quest*
if (pPlayer->GetTeam() == HORDE)
pCreature->setFaction(FACTION_ESCORTEE_H);
- ((npc_escortAI*)(pCreature->AI()))->Start(true, true, false, pPlayer->GetGUID());
+ CAST_AI(npc_escortAI, (pCreature->AI()))->Start(true, true, false, pPlayer->GetGUID());
}
return true;
diff --git a/src/bindings/scripts/scripts/zone/ghostlands/ghostlands.cpp b/src/bindings/scripts/scripts/zone/ghostlands/ghostlands.cpp
index c8c107d95f7..9d4e81ca241 100644
--- a/src/bindings/scripts/scripts/zone/ghostlands/ghostlands.cpp
+++ b/src/bindings/scripts/scripts/zone/ghostlands/ghostlands.cpp
@@ -247,7 +247,7 @@ bool QuestAccept_npc_ranger_lilatha(Player* player, Creature* creature, Quest co
if (quest->GetQuestId() == QUEST_ESCAPE_FROM_THE_CATACOMBS)
{
creature->setFaction(113);
- ((npc_escortAI*)(creature->AI()))->Start(true, true, false, player->GetGUID());
+ CAST_AI(npc_escortAI, (creature->AI()))->Start(true, true, false, player->GetGUID());
}
return true;
}
diff --git a/src/bindings/scripts/scripts/zone/gruuls_lair/boss_high_king_maulgar.cpp b/src/bindings/scripts/scripts/zone/gruuls_lair/boss_high_king_maulgar.cpp
index 71ab145ff8e..19c7a148a93 100644
--- a/src/bindings/scripts/scripts/zone/gruuls_lair/boss_high_king_maulgar.cpp
+++ b/src/bindings/scripts/scripts/zone/gruuls_lair/boss_high_king_maulgar.cpp
@@ -341,7 +341,7 @@ struct TRINITY_DLL_DECL boss_olm_the_summonerAI : public ScriptedAI
Maulgar = (Unit::GetCreature((*m_creature), pInstance->GetData64(DATA_MAULGAR)));
if(Maulgar)
- ((boss_high_king_maulgarAI*)Maulgar->AI())->AddDeath();
+ CAST_AI(boss_high_king_maulgarAI, Maulgar->AI())->AddDeath();
if(CheckAllBossDied(pInstance, m_creature))
pInstance->SetData(DATA_MAULGAREVENT, DONE);
@@ -445,7 +445,7 @@ struct TRINITY_DLL_DECL boss_kiggler_the_crazedAI : public ScriptedAI
Maulgar = (Unit::GetCreature((*m_creature), pInstance->GetData64(DATA_MAULGAR)));
if(Maulgar)
- ((boss_high_king_maulgarAI*)Maulgar->AI())->AddDeath();
+ CAST_AI(boss_high_king_maulgarAI, Maulgar->AI())->AddDeath();
if(CheckAllBossDied(pInstance, m_creature))
pInstance->SetData(DATA_MAULGAREVENT, DONE);
@@ -553,7 +553,7 @@ struct TRINITY_DLL_DECL boss_blindeye_the_seerAI : public ScriptedAI
Maulgar = (Unit::GetCreature((*m_creature), pInstance->GetData64(DATA_MAULGAR)));
if(Maulgar)
- ((boss_high_king_maulgarAI*)Maulgar->AI())->AddDeath();
+ CAST_AI(boss_high_king_maulgarAI, Maulgar->AI())->AddDeath();
if(CheckAllBossDied(pInstance, m_creature))
pInstance->SetData(DATA_MAULGAREVENT, DONE);
@@ -651,7 +651,7 @@ struct TRINITY_DLL_DECL boss_krosh_firehandAI : public ScriptedAI
Maulgar = (Unit::GetCreature((*m_creature), pInstance->GetData64(DATA_MAULGAR)));
if(Maulgar)
- ((boss_high_king_maulgarAI*)Maulgar->AI())->AddDeath();
+ CAST_AI(boss_high_king_maulgarAI, Maulgar->AI())->AddDeath();
if(CheckAllBossDied(pInstance, m_creature))
pInstance->SetData(DATA_MAULGAREVENT, DONE);
diff --git a/src/bindings/scripts/scripts/zone/hellfire_citadel/blood_furnace/boss_kelidan_the_breaker.cpp b/src/bindings/scripts/scripts/zone/hellfire_citadel/blood_furnace/boss_kelidan_the_breaker.cpp
index f274693d10e..cc44edd7e72 100644
--- a/src/bindings/scripts/scripts/zone/hellfire_citadel/blood_furnace/boss_kelidan_the_breaker.cpp
+++ b/src/bindings/scripts/scripts/zone/hellfire_citadel/blood_furnace/boss_kelidan_the_breaker.cpp
@@ -292,7 +292,7 @@ struct TRINITY_DLL_DECL mob_shadowmoon_channelerAI : public ScriptedAI
void EnterCombat(Unit* who)
{
if(Creature *Kelidan = me->FindNearestCreature(ENTRY_KELIDAN, 100))
- ((boss_kelidan_the_breakerAI*)Kelidan->AI())->ChannelerEngaged(who);
+ CAST_AI(boss_kelidan_the_breakerAI, Kelidan->AI())->ChannelerEngaged(who);
if (m_creature->IsNonMeleeSpellCasted(false))
m_creature->InterruptNonMeleeSpells(true);
DoStartMovement(who);
@@ -301,7 +301,7 @@ struct TRINITY_DLL_DECL mob_shadowmoon_channelerAI : public ScriptedAI
void JustDied(Unit* Killer)
{
if(Creature *Kelidan = me->FindNearestCreature(ENTRY_KELIDAN, 100))
- ((boss_kelidan_the_breakerAI*)Kelidan->AI())->ChannelerDied(Killer);
+ CAST_AI(boss_kelidan_the_breakerAI, Kelidan->AI())->ChannelerDied(Killer);
}
void UpdateAI(const uint32 diff)
@@ -313,7 +313,7 @@ struct TRINITY_DLL_DECL mob_shadowmoon_channelerAI : public ScriptedAI
if (!m_creature->IsNonMeleeSpellCasted(false))
if(Creature *Kelidan = me->FindNearestCreature(ENTRY_KELIDAN, 100))
{
- uint64 channeler = ((boss_kelidan_the_breakerAI*)Kelidan->AI())->GetChanneled(m_creature);
+ uint64 channeler = CAST_AI(boss_kelidan_the_breakerAI, Kelidan->AI())->GetChanneled(m_creature);
if(Unit *channeled = Unit::GetUnit(*m_creature, channeler))
DoCast(channeled,SPELL_CHANNELING);
}
diff --git a/src/bindings/scripts/scripts/zone/hellfire_citadel/magtheridons_lair/boss_magtheridon.cpp b/src/bindings/scripts/scripts/zone/hellfire_citadel/magtheridons_lair/boss_magtheridon.cpp
index 96956790019..d61ca485dce 100644
--- a/src/bindings/scripts/scripts/zone/hellfire_citadel/magtheridons_lair/boss_magtheridon.cpp
+++ b/src/bindings/scripts/scripts/zone/hellfire_citadel/magtheridons_lair/boss_magtheridon.cpp
@@ -368,7 +368,7 @@ struct TRINITY_DLL_DECL boss_magtheridonAI : public ScriptedAI
Creature *summon = m_creature->SummonCreature(MOB_ABYSSAL, x, y, z, 0, TEMPSUMMON_CORPSE_DESPAWN, 0);
if(summon)
{
- ((mob_abyssalAI*)summon->AI())->SetTrigger(2);
+ CAST_AI(mob_abyssalAI, summon->AI())->SetTrigger(2);
m_creature->CastSpell(summon, SPELL_BLAZE_TARGET, true);
summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
}
@@ -398,7 +398,7 @@ struct TRINITY_DLL_DECL boss_magtheridonAI : public ScriptedAI
float x, y, z;
target->GetPosition(x, y, z);
Creature *summon = m_creature->SummonCreature(MOB_ABYSSAL, x, y, z, 0, TEMPSUMMON_CORPSE_DESPAWN, 0);
- if(summon) ((mob_abyssalAI*)summon->AI())->SetTrigger(1);
+ if(summon) CAST_AI(mob_abyssalAI, summon->AI())->SetTrigger(1);
}
Debris_Timer = 10000;
}else Debris_Timer -= diff;
@@ -516,7 +516,7 @@ bool GOHello_go_Manticron_Cube(Player *player, GameObject* _GO)
player->InterruptNonMeleeSpells(false);
player->CastSpell(player, SPELL_SHADOW_GRASP, true);
player->CastSpell(player, SPELL_SHADOW_GRASP_VISUAL, false);
- ((boss_magtheridonAI*)Magtheridon->AI())->SetClicker(_GO->GetGUID(), player->GetGUID());
+ CAST_AI(boss_magtheridonAI, Magtheridon->AI())->SetClicker(_GO->GetGUID(), player->GetGUID());
return true;
}
diff --git a/src/bindings/scripts/scripts/zone/hellfire_citadel/shattered_halls/boss_nethekurse.cpp b/src/bindings/scripts/scripts/zone/hellfire_citadel/shattered_halls/boss_nethekurse.cpp
index 2506d2a56aa..940f5d8742b 100644
--- a/src/bindings/scripts/scripts/zone/hellfire_citadel/shattered_halls/boss_nethekurse.cpp
+++ b/src/bindings/scripts/scripts/zone/hellfire_citadel/shattered_halls/boss_nethekurse.cpp
@@ -330,7 +330,7 @@ struct TRINITY_DLL_DECL mob_fel_orc_convertAI : public ScriptedAI
Creature *pKurse = Unit::GetCreature(*m_creature,pInstance->GetData64(DATA_NETHEKURSE));
if (pKurse && m_creature->GetDistance(pKurse) < 45.0f)
{
- ((boss_grand_warlock_nethekurseAI*)pKurse->AI())->DoYellForPeonAggro();
+ CAST_AI(boss_grand_warlock_nethekurseAI, pKurse->AI())->DoYellForPeonAggro();
if (pInstance->GetData(TYPE_NETHEKURSE) == IN_PROGRESS )
return;
@@ -350,7 +350,7 @@ struct TRINITY_DLL_DECL mob_fel_orc_convertAI : public ScriptedAI
{
Creature *pKurse = Unit::GetCreature(*m_creature,pInstance->GetData64(DATA_NETHEKURSE));
if (pKurse)
- ((boss_grand_warlock_nethekurseAI*)pKurse->AI())->DoYellForPeonDeath();
+ CAST_AI(boss_grand_warlock_nethekurseAI, pKurse->AI())->DoYellForPeonDeath();
}
}
}
diff --git a/src/bindings/scripts/scripts/zone/hellfire_citadel/shattered_halls/boss_warbringer_omrogg.cpp b/src/bindings/scripts/scripts/zone/hellfire_citadel/shattered_halls/boss_warbringer_omrogg.cpp
index cf4bee0a68f..3274c8dbe62 100644
--- a/src/bindings/scripts/scripts/zone/hellfire_citadel/shattered_halls/boss_warbringer_omrogg.cpp
+++ b/src/bindings/scripts/scripts/zone/hellfire_citadel/shattered_halls/boss_warbringer_omrogg.cpp
@@ -274,7 +274,7 @@ struct TRINITY_DLL_DECL boss_warbringer_omroggAI : public ScriptedAI
DoScriptText(YELL_DIE_L, Left);
- ((mob_omrogg_headsAI*)CAST_CRE(Right)->AI())->DoDeathYell();
+ CAST_AI(mob_omrogg_headsAI, CAST_CRE(Right)->AI())->DoDeathYell();
}
if (pInstance)
diff --git a/src/bindings/scripts/scripts/zone/hellfire_peninsula/hellfire_peninsula.cpp b/src/bindings/scripts/scripts/zone/hellfire_peninsula/hellfire_peninsula.cpp
index 7ef47058489..a32112ed709 100644
--- a/src/bindings/scripts/scripts/zone/hellfire_peninsula/hellfire_peninsula.cpp
+++ b/src/bindings/scripts/scripts/zone/hellfire_peninsula/hellfire_peninsula.cpp
@@ -233,7 +233,7 @@ bool QuestAccept_npc_wounded_blood_elf(Player* player, Creature* creature, Quest
{
if (quest->GetQuestId() == QUEST_ROAD_TO_FALCON_WATCH)
{
- ((npc_escortAI*)(creature->AI()))->Start(true, true, false, player->GetGUID());
+ CAST_AI(npc_escortAI, (creature->AI()))->Start(true, true, false, player->GetGUID());
// Change faction so mobs attack
creature->setFaction(775);
}
diff --git a/src/bindings/scripts/scripts/zone/karazhan/boss_midnight.cpp b/src/bindings/scripts/scripts/zone/karazhan/boss_midnight.cpp
index d60e057c296..08df637eb04 100644
--- a/src/bindings/scripts/scripts/zone/karazhan/boss_midnight.cpp
+++ b/src/bindings/scripts/scripts/zone/karazhan/boss_midnight.cpp
@@ -284,7 +284,7 @@ struct TRINITY_DLL_DECL boss_attumenAI : public ScriptedAI
Creature *pMidnight = Unit::GetCreature(*m_creature, Midnight);
if(pMidnight && pMidnight->GetTypeId() == TYPEID_UNIT)
{
- ((boss_midnightAI*)(pMidnight->AI()))->Mount(m_creature);
+ CAST_AI(boss_midnightAI, (pMidnight->AI()))->Mount(m_creature);
m_creature->SetHealth(pMidnight->GetHealth());
DoResetThreat();
}
@@ -303,7 +303,7 @@ struct TRINITY_DLL_DECL boss_attumenAI : public ScriptedAI
void boss_midnightAI::SetMidnight(Creature *pAttumen, uint64 value)
{
- ((boss_attumenAI*)pAttumen->AI())->Midnight = value;
+ CAST_AI(boss_attumenAI, pAttumen->AI())->Midnight = value;
}
CreatureAI* GetAI_boss_attumen(Creature *_Creature)
diff --git a/src/bindings/scripts/scripts/zone/karazhan/boss_moroes.cpp b/src/bindings/scripts/scripts/zone/karazhan/boss_moroes.cpp
index f00b3650e9f..a051410e267 100644
--- a/src/bindings/scripts/scripts/zone/karazhan/boss_moroes.cpp
+++ b/src/bindings/scripts/scripts/zone/karazhan/boss_moroes.cpp
@@ -360,7 +360,7 @@ struct TRINITY_DLL_DECL boss_moroes_guestAI : public ScriptedAI
{
for(uint8 i = 0; i < 3; ++i)
{
- uint64 GUID = ((boss_moroesAI*)Moroes->AI())->AddGUID[i];
+ uint64 GUID = CAST_AI(boss_moroesAI, Moroes->AI())->AddGUID[i];
if(GUID && GUID != m_creature->GetGUID())
GuestGUID[i+1] = GUID;
}
diff --git a/src/bindings/scripts/scripts/zone/karazhan/boss_prince_malchezaar.cpp b/src/bindings/scripts/scripts/zone/karazhan/boss_prince_malchezaar.cpp
index 1c574f9e0db..b22f140076c 100644
--- a/src/bindings/scripts/scripts/zone/karazhan/boss_prince_malchezaar.cpp
+++ b/src/bindings/scripts/scripts/zone/karazhan/boss_prince_malchezaar.cpp
@@ -380,8 +380,8 @@ struct TRINITY_DLL_DECL boss_malchezaarAI : public ScriptedAI
Infernal->SetUInt32Value(UNIT_FIELD_DISPLAYID, INFERNAL_MODEL_INVISIBLE);
Infernal->setFaction(m_creature->getFaction());
if(point)
- ((netherspite_infernalAI*)Infernal->AI())->point=point;
- ((netherspite_infernalAI*)Infernal->AI())->malchezaar=m_creature->GetGUID();
+ CAST_AI(netherspite_infernalAI, Infernal->AI())->point=point;
+ CAST_AI(netherspite_infernalAI, Infernal->AI())->malchezaar=m_creature->GetGUID();
infernals.push_back(Infernal->GetGUID());
DoCast(Infernal, SPELL_INFERNAL_RELAY);
@@ -621,7 +621,7 @@ void netherspite_infernalAI::Cleanup()
Unit *pMalchezaar = Unit::GetUnit(*m_creature, malchezaar);
if(pMalchezaar && pMalchezaar->isAlive())
- ((boss_malchezaarAI*)CAST_CRE(pMalchezaar)->AI())->Cleanup(m_creature, point);
+ CAST_AI(boss_malchezaarAI, CAST_CRE(pMalchezaar)->AI())->Cleanup(m_creature, point);
}
CreatureAI* GetAI_netherspite_infernal(Creature *_Creature)
diff --git a/src/bindings/scripts/scripts/zone/karazhan/boss_terestian_illhoof.cpp b/src/bindings/scripts/scripts/zone/karazhan/boss_terestian_illhoof.cpp
index a77f8d052b1..eb708815510 100644
--- a/src/bindings/scripts/scripts/zone/karazhan/boss_terestian_illhoof.cpp
+++ b/src/bindings/scripts/scripts/zone/karazhan/boss_terestian_illhoof.cpp
@@ -297,7 +297,7 @@ struct TRINITY_DLL_DECL boss_terestianAI : public ScriptedAI
Creature* Chains = m_creature->SummonCreature(CREATURE_DEMONCHAINS, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 21000);
if(Chains)
{
- ((mob_demon_chainAI*)Chains->AI())->SacrificeGUID = target->GetGUID();
+ CAST_AI(mob_demon_chainAI, Chains->AI())->SacrificeGUID = target->GetGUID();
Chains->CastSpell(Chains, SPELL_DEMON_CHAINS, true);
switch(rand()%2)
{
diff --git a/src/bindings/scripts/scripts/zone/karazhan/bosses_opera.cpp b/src/bindings/scripts/scripts/zone/karazhan/bosses_opera.cpp
index 67dd35b46a0..8dd429faf39 100644
--- a/src/bindings/scripts/scripts/zone/karazhan/bosses_opera.cpp
+++ b/src/bindings/scripts/scripts/zone/karazhan/bosses_opera.cpp
@@ -220,7 +220,7 @@ struct TRINITY_DLL_DECL mob_titoAI : public ScriptedAI
Creature* Dorothee = (Unit::GetCreature((*m_creature), DorotheeGUID));
if(Dorothee && Dorothee->isAlive())
{
- ((boss_dorotheeAI*)Dorothee->AI())->TitoDied = true;
+ CAST_AI(boss_dorotheeAI, Dorothee->AI())->TitoDied = true;
DoScriptText(SAY_DOROTHEE_TITO_DEATH, Dorothee);
}
}
@@ -247,7 +247,7 @@ void boss_dorotheeAI::SummonTito()
if(Tito)
{
DoScriptText(SAY_DOROTHEE_SUMMON, m_creature);
- ((mob_titoAI*)Tito->AI())->DorotheeGUID = m_creature->GetGUID();
+ CAST_AI(mob_titoAI, Tito->AI())->DorotheeGUID = m_creature->GetGUID();
Tito->AI()->AttackStart(m_creature->getVictim());
SummonedTito = true;
TitoDied = false;
@@ -1174,8 +1174,8 @@ void boss_julianneAI::DamageTaken(Unit* done_by, uint32 &damage)
{
PretendToDie(m_creature);
IsFakingDeath = true;
- ((boss_romuloAI*)Romulo->AI())->ResurrectTimer = 10000;
- ((boss_romuloAI*)Romulo->AI())->JulianneDead = true;
+ CAST_AI(boss_romuloAI, Romulo->AI())->ResurrectTimer = 10000;
+ CAST_AI(boss_romuloAI, Romulo->AI())->JulianneDead = true;
damage = 0;
return;
}
@@ -1199,8 +1199,8 @@ void boss_romuloAI::DamageTaken(Unit* done_by, uint32 &damage)
if (Creature* Julianne = (Unit::GetCreature((*m_creature), JulianneGUID)))
{
- ((boss_julianneAI*)Julianne->AI())->RomuloDead = true;
- ((boss_julianneAI*)Julianne->AI())->ResurrectSelfTimer = 10000;
+ CAST_AI(boss_julianneAI, Julianne->AI())->RomuloDead = true;
+ CAST_AI(boss_julianneAI, Julianne->AI())->ResurrectSelfTimer = 10000;
}
damage = 0;
@@ -1227,8 +1227,8 @@ void boss_romuloAI::DamageTaken(Unit* done_by, uint32 &damage)
{
PretendToDie(m_creature);
IsFakingDeath = true;
- ((boss_julianneAI*)Julianne->AI())->ResurrectTimer = 10000;
- ((boss_julianneAI*)Julianne->AI())->RomuloDead = true;
+ CAST_AI(boss_julianneAI, Julianne->AI())->ResurrectTimer = 10000;
+ CAST_AI(boss_julianneAI, Julianne->AI())->RomuloDead = true;
damage = 0;
return;
}
@@ -1279,8 +1279,8 @@ void boss_julianneAI::UpdateAI(const uint32 diff)
if(Romulo)
{
RomuloGUID = Romulo->GetGUID();
- ((boss_romuloAI*)Romulo->AI())->JulianneGUID = m_creature->GetGUID();
- ((boss_romuloAI*)Romulo->AI())->Phase = PHASE_ROMULO;
+ CAST_AI(boss_romuloAI, Romulo->AI())->JulianneGUID = m_creature->GetGUID();
+ CAST_AI(boss_romuloAI, Romulo->AI())->Phase = PHASE_ROMULO;
Romulo->setFaction(16);
if(m_creature->getVictim())
@@ -1317,11 +1317,11 @@ void boss_julianneAI::UpdateAI(const uint32 diff)
if(ResurrectTimer < diff)
{
Creature* Romulo = (Unit::GetCreature((*m_creature), RomuloGUID));
- if(Romulo && ((boss_romuloAI*)Romulo->AI())->IsFakingDeath)
+ if(Romulo && CAST_AI(boss_romuloAI, Romulo->AI())->IsFakingDeath)
{
DoScriptText(SAY_JULIANNE_RESURRECT, m_creature);
Resurrect(Romulo);
- ((boss_romuloAI*)Romulo->AI())->IsFakingDeath = false;
+ CAST_AI(boss_romuloAI, Romulo->AI())->IsFakingDeath = false;
RomuloDead = false;
ResurrectTimer = 10000;
}
@@ -1371,11 +1371,11 @@ void boss_romuloAI::UpdateAI(const uint32 diff)
if(ResurrectTimer < diff)
{
Creature* Julianne = (Unit::GetCreature((*m_creature), JulianneGUID));
- if(Julianne && ((boss_julianneAI*)Julianne->AI())->IsFakingDeath)
+ if(Julianne && CAST_AI(boss_julianneAI, Julianne->AI())->IsFakingDeath)
{
DoScriptText(SAY_ROMULO_RESURRECT, m_creature);
Resurrect(Julianne);
- ((boss_julianneAI*)Julianne->AI())->IsFakingDeath = false;
+ CAST_AI(boss_julianneAI, Julianne->AI())->IsFakingDeath = false;
JulianneDead = false;
ResurrectTimer = 10000;
}
diff --git a/src/bindings/scripts/scripts/zone/karazhan/karazhan.cpp b/src/bindings/scripts/scripts/zone/karazhan/karazhan.cpp
index ae456703dfd..35eb18fce4b 100644
--- a/src/bindings/scripts/scripts/zone/karazhan/karazhan.cpp
+++ b/src/bindings/scripts/scripts/zone/karazhan/karazhan.cpp
@@ -390,7 +390,7 @@ bool GossipHello_npc_barnes(Player* player, Creature* _Creature)
player->ADD_GOSSIP_ITEM(5, OZ_GM_GOSSIP3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5);
}
- if(!((npc_barnesAI*)_Creature->AI())->RaidWiped)
+ if(!CAST_AI(npc_barnesAI, _Creature->AI())->RaidWiped)
player->SEND_GOSSIP_MENU(8970, _Creature->GetGUID());
else
player->SEND_GOSSIP_MENU(8975, _Creature->GetGUID());
@@ -409,21 +409,21 @@ bool GossipSelect_npc_barnes(Player *player, Creature *_Creature, uint32 sender,
break;
case GOSSIP_ACTION_INFO_DEF+2:
player->CLOSE_GOSSIP_MENU();
- ((npc_barnesAI*)_Creature->AI())->StartEvent();
+ CAST_AI(npc_barnesAI, _Creature->AI())->StartEvent();
break;
case GOSSIP_ACTION_INFO_DEF+3:
player->CLOSE_GOSSIP_MENU();
- ((npc_barnesAI*)_Creature->AI())->Event = EVENT_OZ;
+ CAST_AI(npc_barnesAI, _Creature->AI())->Event = EVENT_OZ;
outstring_log("TSCR: player (GUID %i) manually set Opera event to EVENT_OZ",player->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+4:
player->CLOSE_GOSSIP_MENU();
- ((npc_barnesAI*)_Creature->AI())->Event = EVENT_HOOD;
+ CAST_AI(npc_barnesAI, _Creature->AI())->Event = EVENT_HOOD;
outstring_log("TSCR: player (GUID %i) manually set Opera event to EVENT_HOOD",player->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+5:
player->CLOSE_GOSSIP_MENU();
- ((npc_barnesAI*)_Creature->AI())->Event = EVENT_RAJ;
+ CAST_AI(npc_barnesAI, _Creature->AI())->Event = EVENT_RAJ;
outstring_log("TSCR: player (GUID %i) manually set Opera event to EVENT_RAJ",player->GetGUID());
break;
}
diff --git a/src/bindings/scripts/scripts/zone/magisters_terrace/boss_priestess_delrissa.cpp b/src/bindings/scripts/scripts/zone/magisters_terrace/boss_priestess_delrissa.cpp
index ead9e36eed6..473efb698e4 100644
--- a/src/bindings/scripts/scripts/zone/magisters_terrace/boss_priestess_delrissa.cpp
+++ b/src/bindings/scripts/scripts/zone/magisters_terrace/boss_priestess_delrissa.cpp
@@ -392,7 +392,7 @@ struct TRINITY_DLL_DECL boss_priestess_guestAI : public ScriptedAI
{
pInstance->SetData(DATA_DELRISSA_DEATH_COUNT, 1);
- ((boss_priestess_delrissaAI*)Delrissa->AI())->KilledLackey();
+ CAST_AI(boss_priestess_delrissaAI, Delrissa->AI())->KilledLackey();
if (!Delrissa->isAlive() && pInstance->GetData(DATA_DELRISSA_DEATH_COUNT) > 3)
Delrissa->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
@@ -423,7 +423,7 @@ struct TRINITY_DLL_DECL boss_priestess_guestAI : public ScriptedAI
Creature* Delrissa = (Unit::GetCreature(*m_creature, pInstance->GetData64(DATA_DELRISSA)));
if (Delrissa)
{
- Group = ((boss_priestess_delrissaAI*)Delrissa->AI())->Adds;
+ Group = CAST_AI(boss_priestess_delrissaAI, Delrissa->AI())->Adds;
Add* dAdd = new Add(Delrissa->GetEntry(), Delrissa->GetGUID());
Group.push_back(dAdd);
}
@@ -649,13 +649,13 @@ struct TRINITY_DLL_DECL boss_ellris_duskhallowAI : public boss_priestess_guestAI
/*void mob_fizzleAI::JustDied(Unit* killer)
{
if(Creature* Ellris = (Unit::GetCreature(*m_creature, EllrisGUID)))
- ((boss_ellris_duskhallowAI*)Ellris->AI())->ImpGUID = 0;
+ CAST_AI(boss_ellris_duskhallowAI, Ellris->AI())->ImpGUID = 0;
}
void mob_fizzleAI::KilledUnit(Unit* victim)
{
if(Creature* Ellris = (Unit::GetCreature(*m_creature, EllrisGUID)))
- ((boss_ellris_duskhallowAI*)Ellris->AI())->KilledUnit(victim);
+ CAST_AI(boss_ellris_duskhallowAI, Ellris->AI())->KilledUnit(victim);
}*/
#define SPELL_KNOCKDOWN 11428
@@ -984,7 +984,7 @@ struct TRINITY_DLL_DECL boss_garaxxasAI : public boss_priestess_guestAI
Creature* Sliver = m_creature->SummonCreature(CREATURE_SLIVER, 0, 0, 0, 0, TEMPSUMMON_CORPSE_DESPAWN, 0);
if (Sliver)
{
- //((mob_sliverAI*)Sliver->AI())->GaraxxasGUID = m_creature->GetGUID();
+ //CAST_AI(mob_sliverAI, Sliver->AI())->GaraxxasGUID = m_creature->GetGUID();
//SliverGUID = Sliver->GetGUID();
HasSummonedSliver = true;
}
@@ -1043,13 +1043,13 @@ struct TRINITY_DLL_DECL boss_garaxxasAI : public boss_priestess_guestAI
/*void mob_sliverAI::JustDied(Unit* killer)
{
if(Creature* Garaxxas = (Unit::GetCreature(*m_creature, GaraxxasGUID)))
- ((boss_garaxxasAI*)Garaxxas->AI())->SliverGUID = 0;
+ CAST_AI(boss_garaxxasAI, Garaxxas->AI())->SliverGUID = 0;
}
void mob_sliverAI::KilledUnit(Unit* victim)
{
if(Creature* Garaxxas = (Unit::GetCreature(*m_creature, GaraxxasGUID)))
- ((boss_garaxxasAI*)Garaxxas->AI())->KilledUnit(victim);
+ CAST_AI(boss_garaxxasAI, Garaxxas->AI())->KilledUnit(victim);
}*/
#define SPELL_WINDFURY_TOTEM 27621
diff --git a/src/bindings/scripts/scripts/zone/magisters_terrace/boss_selin_fireheart.cpp b/src/bindings/scripts/scripts/zone/magisters_terrace/boss_selin_fireheart.cpp
index 75e78c1b0fb..918c27bb9df 100644
--- a/src/bindings/scripts/scripts/zone/magisters_terrace/boss_selin_fireheart.cpp
+++ b/src/bindings/scripts/scripts/zone/magisters_terrace/boss_selin_fireheart.cpp
@@ -345,12 +345,12 @@ struct TRINITY_DLL_DECL mob_fel_crystalAI : public ScriptedAI
Creature* Selin = (Unit::GetCreature(*m_creature, pInstance->GetData64(DATA_SELIN)));
if (Selin && Selin->isAlive())
{
- if (((boss_selin_fireheartAI*)Selin->AI())->CrystalGUID == m_creature->GetGUID())
+ if(CAST_AI(boss_selin_fireheartAI, Selin->AI())->CrystalGUID == m_creature->GetGUID())
{
// Set this to false if we are the creature that Selin is draining so his AI flows properly
- ((boss_selin_fireheartAI*)Selin->AI())->DrainingCrystal = false;
- ((boss_selin_fireheartAI*)Selin->AI())->IsDraining = false;
- ((boss_selin_fireheartAI*)Selin->AI())->EmpowerTimer = 10000;
+ CAST_AI(boss_selin_fireheartAI, Selin->AI())->DrainingCrystal = false;
+ CAST_AI(boss_selin_fireheartAI, Selin->AI())->IsDraining = false;
+ CAST_AI(boss_selin_fireheartAI, Selin->AI())->EmpowerTimer = 10000;
if (Selin->getVictim())
{
Selin->AI()->AttackStart(Selin->getVictim());
diff --git a/src/bindings/scripts/scripts/zone/moonglade/moonglade.cpp b/src/bindings/scripts/scripts/zone/moonglade/moonglade.cpp
index 86274a6aed4..f849f52419b 100644
--- a/src/bindings/scripts/scripts/zone/moonglade/moonglade.cpp
+++ b/src/bindings/scripts/scripts/zone/moonglade/moonglade.cpp
@@ -523,7 +523,7 @@ bool QuestAccept_npc_clintar_dreamwalker(Player *player, Creature *creature, Que
{
Creature *clintar_spirit = creature->SummonCreature(CLINTAR_SPIRIT, CLINTAR_SPIRIT_SUMMON_X, CLINTAR_SPIRIT_SUMMON_Y, CLINTAR_SPIRIT_SUMMON_Z, CLINTAR_SPIRIT_SUMMON_O, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 100000);
if(clintar_spirit)
- ((npc_clintar_spiritAI*)clintar_spirit->AI())->StartEvent(player);
+ CAST_AI(npc_clintar_spiritAI, clintar_spirit->AI())->StartEvent(player);
}
return true;
}
diff --git a/src/bindings/scripts/scripts/zone/netherstorm/netherstorm.cpp b/src/bindings/scripts/scripts/zone/netherstorm/netherstorm.cpp
index b1aa21d032f..c8c7651dbe1 100644
--- a/src/bindings/scripts/scripts/zone/netherstorm/netherstorm.cpp
+++ b/src/bindings/scripts/scripts/zone/netherstorm/netherstorm.cpp
@@ -324,8 +324,8 @@ bool GOHello_go_manaforge_control_console(Player *player, GameObject* _GO)
if( manaforge )
{
- ((npc_manaforge_control_consoleAI*)manaforge->AI())->someplayer = player->GetGUID();
- ((npc_manaforge_control_consoleAI*)manaforge->AI())->goConsole = _GO->GetGUID();
+ CAST_AI(npc_manaforge_control_consoleAI, manaforge->AI())->someplayer = player->GetGUID();
+ CAST_AI(npc_manaforge_control_consoleAI, manaforge->AI())->goConsole = _GO->GetGUID();
_GO->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);
}
return true;
@@ -660,7 +660,7 @@ bool AreaTrigger_at_commander_dawnforge(Player *player, AreaTriggerEntry *at)
if (!Dawnforge)
return false;
- if (((npc_commander_dawnforgeAI*)Dawnforge->AI())->CanStartEvent(player))
+ if(CAST_AI(npc_commander_dawnforgeAI, Dawnforge->AI())->CanStartEvent(player))
return true;
}
return false;
@@ -917,7 +917,7 @@ bool QuestAccept_npc_bessy(Player* player, Creature* creature, Quest const* ques
{
creature->setFaction(113);
creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
- ((npc_escortAI*)(creature->AI()))->Start(true, true, false, player->GetGUID());
+ CAST_AI(npc_escortAI, (creature->AI()))->Start(true, true, false, player->GetGUID());
}
return true;
}
diff --git a/src/bindings/scripts/scripts/zone/orgrimmar/orgrimmar.cpp b/src/bindings/scripts/scripts/zone/orgrimmar/orgrimmar.cpp
index f2e0602389b..5a9d17db745 100644
--- a/src/bindings/scripts/scripts/zone/orgrimmar/orgrimmar.cpp
+++ b/src/bindings/scripts/scripts/zone/orgrimmar/orgrimmar.cpp
@@ -137,8 +137,8 @@ bool QuestAccept_npc_shenthul(Player* player, Creature* creature, Quest const* q
{
if( quest->GetQuestId() == QUEST_2460 )
{
- ((npc_shenthulAI*)creature->AI())->CanTalk = true;
- ((npc_shenthulAI*)creature->AI())->playerGUID = player->GetGUID();
+ CAST_AI(npc_shenthulAI, creature->AI())->CanTalk = true;
+ CAST_AI(npc_shenthulAI, creature->AI())->playerGUID = player->GetGUID();
}
return true;
}
diff --git a/src/bindings/scripts/scripts/zone/razorfen_kraul/razorfen_kraul.cpp b/src/bindings/scripts/scripts/zone/razorfen_kraul/razorfen_kraul.cpp
index cf9eb2acd67..8680218e992 100644
--- a/src/bindings/scripts/scripts/zone/razorfen_kraul/razorfen_kraul.cpp
+++ b/src/bindings/scripts/scripts/zone/razorfen_kraul/razorfen_kraul.cpp
@@ -129,7 +129,7 @@ bool QuestAccept_npc_willix(Player* player, Creature* creature, Quest const* que
{
if (quest->GetQuestId() == QUEST_WILLIX_THE_IMPORTER)
{
- ((npc_escortAI*)(creature->AI()))->Start(true, true, false, player->GetGUID());
+ CAST_AI(npc_escortAI, (creature->AI()))->Start(true, true, false, player->GetGUID());
DoScriptText(SAY_READY, creature, player);
creature->setFaction(113);
}
diff --git a/src/bindings/scripts/scripts/zone/scarlet_monastery/boss_headless_horseman.cpp b/src/bindings/scripts/scripts/zone/scarlet_monastery/boss_headless_horseman.cpp
index 0546bc4db95..8e6b25229a7 100644
--- a/src/bindings/scripts/scripts/zone/scarlet_monastery/boss_headless_horseman.cpp
+++ b/src/bindings/scripts/scripts/zone/scarlet_monastery/boss_headless_horseman.cpp
@@ -424,7 +424,7 @@ struct TRINITY_DLL_DECL boss_headless_horsemanAI : public ScriptedAI
case 1: {
Creature *smoke = m_creature->SummonCreature(HELPER,Spawn[1].x,Spawn[1].y,Spawn[1].z,0,TEMPSUMMON_TIMED_DESPAWN,20000);
if(smoke)
- ((mob_wisp_invisAI*)smoke->AI())->SetType(3);
+ CAST_AI(mob_wisp_invisAI, smoke->AI())->SetType(3);
DoCast(m_creature,SPELL_RHYME_BIG);
break;}
case 6:
@@ -469,7 +469,7 @@ struct TRINITY_DLL_DECL boss_headless_horsemanAI : public ScriptedAI
else { //maybe possible when player dies from conflagration
Creature *Head = Unit::GetCreature((*m_creature), headGUID);
if (Head)
- ((mob_headAI*)Head->AI())->SaySound(SAY_PLAYER_DEATH);
+ CAST_AI(mob_headAI, Head->AI())->SaySound(SAY_PLAYER_DEATH);
}
}
}
@@ -522,7 +522,7 @@ struct TRINITY_DLL_DECL boss_headless_horsemanAI : public ScriptedAI
flame->CastSpell(flame,SPELL_BODY_FLAME,false);
Creature *wisp = DoSpawnCreature(WISP_INVIS,0,0,0,0,TEMPSUMMON_TIMED_DESPAWN,60000);
if(wisp)
- ((mob_wisp_invisAI*)wisp->AI())->SetType(4);
+ CAST_AI(mob_wisp_invisAI, wisp->AI())->SetType(4);
if(pInstance)
pInstance->SetData(DATA_HORSEMAN_EVENT, DONE);
}
@@ -628,7 +628,7 @@ struct TRINITY_DLL_DECL boss_headless_horsemanAI : public ScriptedAI
{
Creature *flame = m_creature->SummonCreature(HELPER,Spawn[0].x,Spawn[0].y,Spawn[0].z,0,TEMPSUMMON_TIMED_DESPAWN,17000);
if(flame)
- ((mob_wisp_invisAI*)flame->AI())->SetType(2);
+ CAST_AI(mob_wisp_invisAI, flame->AI())->SetType(2);
burned = true;
}else burn -= diff;
break;
@@ -679,8 +679,8 @@ struct TRINITY_DLL_DECL boss_headless_horsemanAI : public ScriptedAI
Creature* Head = Unit::GetCreature((*m_creature), headGUID);
if (Head && Head->isAlive())
{
- ((mob_headAI*)Head->AI())->Phase = Phase;
- ((mob_headAI*)Head->AI())->Disappear();
+ CAST_AI(mob_headAI, Head->AI())->Phase = Phase;
+ CAST_AI(mob_headAI, Head->AI())->Disappear();
}
return;
}
@@ -718,7 +718,7 @@ void mob_headAI::Disappear()
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
m_creature->GetMotionMaster()->MoveIdle();
- ((boss_headless_horsemanAI*)body->AI())->returned = true;
+ CAST_AI(boss_headless_horsemanAI, body->AI())->returned = true;
}
}
}
@@ -741,7 +741,7 @@ struct TRINITY_DLL_DECL mob_pulsing_pumpkinAI : public ScriptedAI
{
debuff->SetDisplayId(m_creature->GetDisplayId());
debuff->CastSpell(debuff,SPELL_PUMPKIN_AURA_GREEN,false);
- ((mob_wisp_invisAI*)debuff->AI())->SetType(1);
+ CAST_AI(mob_wisp_invisAI, debuff->AI())->SetType(1);
debuffGUID = debuff->GetGUID();
}
sprouted = false;
@@ -807,8 +807,8 @@ bool GOHello_go_loosely_turned_soil(Player *plr, GameObject* soil)
Creature *horseman = soil->SummonCreature(HH_MOUNTED,FlightPoint[20].x,FlightPoint[20].y,FlightPoint[20].z,0,TEMPSUMMON_MANUAL_DESPAWN,0);
if(horseman)
{
- ((boss_headless_horsemanAI*)horseman->AI())->playerGUID = plr->GetGUID();
- ((boss_headless_horsemanAI*)horseman->AI())->FlyMode();
+ CAST_AI(boss_headless_horsemanAI, horseman->AI())->playerGUID = plr->GetGUID();
+ CAST_AI(boss_headless_horsemanAI, horseman->AI())->FlyMode();
}
//}
return true;
diff --git a/src/bindings/scripts/scripts/zone/shadowfang_keep/shadowfang_keep.cpp b/src/bindings/scripts/scripts/zone/shadowfang_keep/shadowfang_keep.cpp
index 22eae9ba7d5..672a0ce4f41 100644
--- a/src/bindings/scripts/scripts/zone/shadowfang_keep/shadowfang_keep.cpp
+++ b/src/bindings/scripts/scripts/zone/shadowfang_keep/shadowfang_keep.cpp
@@ -126,7 +126,7 @@ bool GossipSelect_npc_shadowfang_prisoner(Player* pPlayer, Creature* pCreature,
if (uiAction == GOSSIP_ACTION_INFO_DEF+1)
{
pPlayer->CLOSE_GOSSIP_MENU();
- ((npc_escortAI*)(pCreature->AI()))->Start(false, true, false);
+ CAST_AI(npc_escortAI, (pCreature->AI()))->Start(false, true, false);
}
return true;
}
diff --git a/src/bindings/scripts/scripts/zone/shadowmoon_valley/shadowmoon_valley.cpp b/src/bindings/scripts/scripts/zone/shadowmoon_valley/shadowmoon_valley.cpp
index a7f6bb37fa4..bff993e856f 100644
--- a/src/bindings/scripts/scripts/zone/shadowmoon_valley/shadowmoon_valley.cpp
+++ b/src/bindings/scripts/scripts/zone/shadowmoon_valley/shadowmoon_valley.cpp
@@ -832,8 +832,8 @@ bool QuestAccept_npc_overlord_morghor(Player *player, Creature *_Creature, const
{
if(_Quest->GetQuestId() == QUEST_LORD_ILLIDAN_STORMRAGE)
{
- ((npc_overlord_morghorAI*)_Creature->AI())->PlayerGUID = player->GetGUID();
- ((npc_overlord_morghorAI*)_Creature->AI())->StartEvent();
+ CAST_AI(npc_overlord_morghorAI, _Creature->AI())->PlayerGUID = player->GetGUID();
+ CAST_AI(npc_overlord_morghorAI, _Creature->AI())->StartEvent();
return true;
}
return false;
@@ -1047,7 +1047,7 @@ bool QuestAccept_npc_earthmender_wilda(Player* player, Creature* creature, Quest
if (quest->GetQuestId() == QUEST_ESCAPE_FROM_COILSKAR_CISTERN)
{
creature->setFaction(113);
- ((npc_escortAI*)(creature->AI()))->Start(true, true, false, player->GetGUID());
+ CAST_AI(npc_escortAI, (creature->AI()))->Start(true, true, false, player->GetGUID());
}
return true;
}
@@ -1490,14 +1490,14 @@ struct TRINITY_DLL_DECL npc_lord_illidan_stormrageAI : public ScriptedAI
Spawn->GetMotionMaster()->MovePoint(0,x, y, z);
}
}
- ((mob_illidari_spawnAI*)Spawn->AI())->LordIllidanGUID = m_creature->GetGUID();
+ CAST_AI(mob_illidari_spawnAI, Spawn->AI())->LordIllidanGUID = m_creature->GetGUID();
}
if(WavesInfo[WaveCount].CreatureId == 22076) // Torloth
{
- ((mob_torloth_the_magnificentAI*)Spawn->AI())->LordIllidanGUID = m_creature->GetGUID();
+ CAST_AI(mob_torloth_the_magnificentAI, Spawn->AI())->LordIllidanGUID = m_creature->GetGUID();
if(PlayerGUID)
- ((mob_torloth_the_magnificentAI*)Spawn->AI())->AggroTargetGUID = PlayerGUID;
+ CAST_AI(mob_torloth_the_magnificentAI, Spawn->AI())->AggroTargetGUID = PlayerGUID;
}
}
}
@@ -1605,7 +1605,7 @@ void mob_illidari_spawnAI::JustDied(Unit *slayer)
m_creature->RemoveCorpse();
if(Creature* LordIllidan = (Unit::GetCreature(*m_creature, LordIllidanGUID)))
if(LordIllidan)
- ((npc_lord_illidan_stormrageAI*)LordIllidan->AI())->LiveCounter();
+ CAST_AI(npc_lord_illidan_stormrageAI, LordIllidan->AI())->LiveCounter();
}
/*#####
@@ -1616,13 +1616,13 @@ bool GOQuestAccept_GO_crystal_prison(Player* plr, GameObject* go, Quest const* q
{
if(quest->GetQuestId() == QUEST_BATTLE_OF_THE_CRIMSON_WATCH )
{
- Unit* Illidan = plr->FindNearestCreature(22083, 50);
+ Creature* Illidan = plr->FindNearestCreature(22083, 50);
- if(Illidan && !(((npc_lord_illidan_stormrageAI*)CAST_CRE(Illidan)->AI())->EventStarted))
+ if(Illidan && !CAST_AI(npc_lord_illidan_stormrageAI, Illidan->AI())->EventStarted)
{
- ((npc_lord_illidan_stormrageAI*)CAST_CRE(Illidan)->AI())->PlayerGUID = plr->GetGUID();
- ((npc_lord_illidan_stormrageAI*)CAST_CRE(Illidan)->AI())->LiveCount = 0;
- ((npc_lord_illidan_stormrageAI*)CAST_CRE(Illidan)->AI())->EventStarted=true;
+ CAST_AI(npc_lord_illidan_stormrageAI, Illidan->AI())->PlayerGUID = plr->GetGUID();
+ CAST_AI(npc_lord_illidan_stormrageAI, Illidan->AI())->LiveCount = 0;
+ CAST_AI(npc_lord_illidan_stormrageAI, Illidan->AI())->EventStarted=true;
}
}
return true;
diff --git a/src/bindings/scripts/scripts/zone/shattrath/shattrath_city.cpp b/src/bindings/scripts/scripts/zone/shattrath/shattrath_city.cpp
index d21b2b79cb4..236ef85f85c 100644
--- a/src/bindings/scripts/scripts/zone/shattrath/shattrath_city.cpp
+++ b/src/bindings/scripts/scripts/zone/shattrath/shattrath_city.cpp
@@ -525,8 +525,8 @@ bool GossipSelect_npc_dirty_larry(Player *player, Creature *creature, uint32 sen
{
if (action == GOSSIP_ACTION_INFO_DEF+1)
{
- ((npc_dirty_larryAI*)creature->AI())->Event = true;
- ((npc_dirty_larryAI*)creature->AI())->PlayerGUID = player->GetGUID();
+ CAST_AI(npc_dirty_larryAI, creature->AI())->Event = true;
+ CAST_AI(npc_dirty_larryAI, creature->AI())->PlayerGUID = player->GetGUID();
player->CLOSE_GOSSIP_MENU();
}
diff --git a/src/bindings/scripts/scripts/zone/silverpine_forest/silverpine_forest.cpp b/src/bindings/scripts/scripts/zone/silverpine_forest/silverpine_forest.cpp
index 16c2e98a7cd..ed96d3a1768 100644
--- a/src/bindings/scripts/scripts/zone/silverpine_forest/silverpine_forest.cpp
+++ b/src/bindings/scripts/scripts/zone/silverpine_forest/silverpine_forest.cpp
@@ -81,7 +81,7 @@ bool GossipSelect_npc_astor_hadren(Player *player, Creature *_Creature, uint32 s
player->CLOSE_GOSSIP_MENU();
_Creature->setFaction(21);
if(player)
- ((npc_astor_hadrenAI*)_Creature->AI())->AttackStart(player);
+ CAST_AI(npc_astor_hadrenAI, _Creature->AI())->AttackStart(player);
break;
}
return true;
@@ -171,7 +171,7 @@ bool QuestAccept_npc_deathstalker_erland(Player* player, Creature* creature, Que
if (quest->GetQuestId() == QUEST_ESCORTING)
{
DoScriptText(SAY_QUESTACCEPT, creature, player);
- ((npc_escortAI*)(creature->AI()))->Start(true, true, false, player->GetGUID());
+ CAST_AI(npc_escortAI, (creature->AI()))->Start(true, true, false, player->GetGUID());
}
return true;
diff --git a/src/bindings/scripts/scripts/zone/stonetalon_mountains/stonetalon_mountains.cpp b/src/bindings/scripts/scripts/zone/stonetalon_mountains/stonetalon_mountains.cpp
index 92234808573..e8f234c0e0b 100644
--- a/src/bindings/scripts/scripts/zone/stonetalon_mountains/stonetalon_mountains.cpp
+++ b/src/bindings/scripts/scripts/zone/stonetalon_mountains/stonetalon_mountains.cpp
@@ -145,7 +145,7 @@ bool QuestAccept_npc_kaya_flathoof(Player* player, Creature* creature, Quest con
{
if (quest->GetQuestId() == QUEST_PK)
{
- ((npc_escortAI*)(creature->AI()))->Start(true, true, false, player->GetGUID());
+ CAST_AI(npc_escortAI, (creature->AI()))->Start(true, true, false, player->GetGUID());
DoScriptText(SAY_START, creature);
creature->setFaction(113);
creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2);
diff --git a/src/bindings/scripts/scripts/zone/stormwind/stormwind_city.cpp b/src/bindings/scripts/scripts/zone/stormwind/stormwind_city.cpp
index b9ea06a6402..36f09218093 100644
--- a/src/bindings/scripts/scripts/zone/stormwind/stormwind_city.cpp
+++ b/src/bindings/scripts/scripts/zone/stormwind/stormwind_city.cpp
@@ -109,8 +109,8 @@ bool QuestAccept_npc_bartleby(Player *player, Creature *_Creature, Quest const *
if(_Quest->GetQuestId() == 1640)
{
_Creature->setFaction(168);
- ((npc_bartlebyAI*)_Creature->AI())->PlayerGUID = player->GetGUID();
- ((npc_bartlebyAI*)_Creature->AI())->AttackStart(player);
+ CAST_AI(npc_bartlebyAI, _Creature->AI())->PlayerGUID = player->GetGUID();
+ CAST_AI(npc_bartlebyAI, _Creature->AI())->AttackStart(player);
}
return true;
}
@@ -159,7 +159,7 @@ bool QuestAccept_npc_dashel_stonefist(Player *player, Creature *_Creature, Quest
if(_Quest->GetQuestId() == 1447)
{
_Creature->setFaction(168);
- ((npc_dashel_stonefistAI*)_Creature->AI())->AttackStart(player);
+ CAST_AI(npc_dashel_stonefistAI, _Creature->AI())->AttackStart(player);
}
return true;
}
diff --git a/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_kalecgos.cpp b/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_kalecgos.cpp
index 13d7f591c76..9a2852487fa 100644
--- a/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_kalecgos.cpp
+++ b/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_kalecgos.cpp
@@ -318,8 +318,8 @@ struct TRINITY_DLL_DECL boss_sathrovarrAI : public ScriptedAI
TeleportAllPlayersBack();
if(Unit *Kalecgos = Unit::GetUnit(*m_creature, KalecgosGUID))
{
- ((boss_kalecgosAI*)CAST_CRE(Kalecgos)->AI())->TalkTimer = 1;
- ((boss_kalecgosAI*)CAST_CRE(Kalecgos)->AI())->isFriendly = false;
+ CAST_AI(boss_kalecgosAI, CAST_CRE(Kalecgos)->AI())->TalkTimer = 1;
+ CAST_AI(boss_kalecgosAI, CAST_CRE(Kalecgos)->AI())->isFriendly = false;
}
EnterEvadeMode();
return;
@@ -338,8 +338,8 @@ struct TRINITY_DLL_DECL boss_sathrovarrAI : public ScriptedAI
TeleportAllPlayersBack();
if(Unit *Kalecgos = Unit::GetUnit(*m_creature, KalecgosGUID))
{
- ((boss_kalecgosAI*)CAST_CRE(Kalecgos)->AI())->TalkTimer = 1;
- ((boss_kalecgosAI*)CAST_CRE(Kalecgos)->AI())->isFriendly = true;
+ CAST_AI(boss_kalecgosAI, CAST_CRE(Kalecgos)->AI())->TalkTimer = 1;
+ CAST_AI(boss_kalecgosAI, CAST_CRE(Kalecgos)->AI())->isFriendly = true;
}
if(pInstance)
@@ -371,7 +371,7 @@ struct TRINITY_DLL_DECL boss_sathrovarrAI : public ScriptedAI
if(Kalecgos)
{
Kalecgos->CastSpell(Kalecgos, SPELL_ENRAGE, true);
- ((boss_kalecgosAI*)CAST_CRE(Kalecgos)->AI())->isEnraged = true;
+ CAST_AI(boss_kalecgosAI, CAST_CRE(Kalecgos)->AI())->isEnraged = true;
}
DoCast(m_creature, SPELL_ENRAGE, true);
isEnraged = true;
@@ -381,7 +381,7 @@ struct TRINITY_DLL_DECL boss_sathrovarrAI : public ScriptedAI
{
if(Unit *Kalecgos = Unit::GetUnit(*m_creature, KalecgosGUID))
{
- if(((boss_kalecgosAI*)CAST_CRE(Kalecgos)->AI())->isBanished)
+ if(CAST_AI(boss_kalecgosAI, CAST_CRE(Kalecgos)->AI())->isBanished)
{
m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
return;
@@ -570,7 +570,7 @@ void boss_kalecgosAI::UpdateAI(const uint32 diff)
if(Sath)
{
Sath->CastSpell(Sath, SPELL_ENRAGE, true);
- ((boss_sathrovarrAI*)CAST_CRE(Sath)->AI())->isEnraged = true;
+ CAST_AI(boss_sathrovarrAI, CAST_CRE(Sath)->AI())->isEnraged = true;
}
DoCast(m_creature, SPELL_ENRAGE, true);
isEnraged = true;
@@ -580,7 +580,7 @@ void boss_kalecgosAI::UpdateAI(const uint32 diff)
{
if(Unit *Sath = Unit::GetUnit(*m_creature, SathGUID))
{
- if(((boss_sathrovarrAI*)CAST_CRE(Sath)->AI())->isBanished)
+ if(CAST_AI(boss_sathrovarrAI, CAST_CRE(Sath)->AI())->isBanished)
{
Sath->DealDamage(Sath, Sath->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
return;
diff --git a/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_kiljaeden.cpp b/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_kiljaeden.cpp
index d971d3b5385..c06720665dc 100644
--- a/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_kiljaeden.cpp
+++ b/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_kiljaeden.cpp
@@ -518,7 +518,7 @@ struct TRINITY_DLL_DECL boss_kiljaedenAI : public Scripted_NoMovementAI
if(pInstance){
Creature* Control = CAST_CRE(Unit::GetUnit(*m_creature, pInstance->GetData64(DATA_KILJAEDEN_CONTROLLER)));
if(Control)
- ((Scripted_NoMovementAI*)Control->AI())->Reset();
+ CAST_AI(Scripted_NoMovementAI, Control->AI())->Reset();
}
}
@@ -647,8 +647,8 @@ struct TRINITY_DLL_DECL boss_kiljaedenAI : public Scripted_NoMovementAI
break;
case TIMER_ORBS_EMPOWER: //Phase 3
if(Phase == PHASE_SACRIFICE){
- if(Kalec)((boss_kalecgos_kjAI*)Kalec->AI())->EmpowerOrb(true);
- }else if(Kalec)((boss_kalecgos_kjAI*)Kalec->AI())->EmpowerOrb(false);
+ if(Kalec)CAST_AI(boss_kalecgos_kjAI, Kalec->AI())->EmpowerOrb(true);
+ }else if(Kalec)CAST_AI(boss_kalecgos_kjAI, Kalec->AI())->EmpowerOrb(false);
Timer[TIMER_ORBS_EMPOWER]= (Phase == PHASE_SACRIFICE) ? 45000 : 35000;
OrbActivated = true;
TimerIsDeactiveted[TIMER_ORBS_EMPOWER] = true;
@@ -747,7 +747,7 @@ struct TRINITY_DLL_DECL mob_kiljaeden_controllerAI : public Scripted_NoMovementA
void Reset(){
Phase = PHASE_DECEIVERS;
- if(KalecKJ)((boss_kalecgos_kjAI*)KalecKJ->AI())->ResetOrbs();
+ if(KalecKJ)CAST_AI(boss_kalecgos_kjAI, KalecKJ->AI())->ResetOrbs();
DeceiverDeathCount = 0;
SummonedDeceivers = false;
KiljaedenDeath = false;
@@ -767,7 +767,7 @@ struct TRINITY_DLL_DECL mob_kiljaeden_controllerAI : public Scripted_NoMovementA
break;
case CREATURE_KILJAEDEN:
summoned->CastSpell(summoned, SPELL_REBIRTH, false);
- ((boss_kiljaedenAI*)summoned->AI())->Phase=PHASE_NORMAL;
+ CAST_AI(boss_kiljaedenAI, summoned->AI())->Phase=PHASE_NORMAL;
summoned->AddThreat(m_creature->getVictim(), 1.0f);
break;
}
@@ -848,7 +848,7 @@ struct TRINITY_DLL_DECL mob_hand_of_the_deceiverAI : public ScriptedAI
Creature* Control = CAST_CRE(Unit::GetUnit(*m_creature, pInstance->GetData64(DATA_KILJAEDEN_CONTROLLER)));
if(Control)
- ((mob_kiljaeden_controllerAI*)Control->AI())->DeceiverDeathCount++;
+ CAST_AI(mob_kiljaeden_controllerAI, Control->AI())->DeceiverDeathCount++;
}
void UpdateAI(const uint32 diff){
diff --git a/src/bindings/scripts/scripts/zone/tanaris/tanaris.cpp b/src/bindings/scripts/scripts/zone/tanaris/tanaris.cpp
index f89640bbfd6..cefca8902d3 100644
--- a/src/bindings/scripts/scripts/zone/tanaris/tanaris.cpp
+++ b/src/bindings/scripts/scripts/zone/tanaris/tanaris.cpp
@@ -435,7 +435,7 @@ bool QuestAccept_npc_OOX17(Player* player, Creature* creature, Quest const* ques
creature->SetUInt32Value(UNIT_FIELD_BYTES_1,0);
creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2);
DoScriptText(SAY_CHICKEN_ACC, creature);
- ((npc_escortAI*)(creature->AI()))->Start(true, true, false, player->GetGUID());
+ CAST_AI(npc_escortAI, (creature->AI()))->Start(true, true, false, player->GetGUID());
}
return true;
diff --git a/src/bindings/scripts/scripts/zone/teldrassil/teldrassil.cpp b/src/bindings/scripts/scripts/zone/teldrassil/teldrassil.cpp
index 846b3a008f6..fb376795119 100644
--- a/src/bindings/scripts/scripts/zone/teldrassil/teldrassil.cpp
+++ b/src/bindings/scripts/scripts/zone/teldrassil/teldrassil.cpp
@@ -175,7 +175,7 @@ CreatureAI* GetAI_npc_mist(Creature* pCreature)
bool QuestAccept_npc_mist(Player* pPlayer, Creature* pCreature, Quest const* pQuest)
{
if (pQuest->GetQuestId() == QUEST_MIST)
- ((npc_mistAI*)(pCreature->AI()))->DoStart(pPlayer->GetGUID());
+ CAST_AI(npc_mistAI, (pCreature->AI()))->DoStart(pPlayer->GetGUID());
return true;
}
diff --git a/src/bindings/scripts/scripts/zone/tempest_keep/botanica/boss_warp_splinter.cpp b/src/bindings/scripts/scripts/zone/tempest_keep/botanica/boss_warp_splinter.cpp
index 4dd70cb7d20..9ee41dec903 100644
--- a/src/bindings/scripts/scripts/zone/tempest_keep/botanica/boss_warp_splinter.cpp
+++ b/src/bindings/scripts/scripts/zone/tempest_keep/botanica/boss_warp_splinter.cpp
@@ -160,7 +160,7 @@ struct TRINITY_DLL_DECL boss_warp_splinterAI : public ScriptedAI
float O = - m_creature->GetAngle(X,Y);
if(Creature *pTreant = m_creature->SummonCreature(CREATURE_TREANT,treant_pos[i][0],treant_pos[i][1],treant_pos[i][2],O,TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN,25000))
- ((mob_treantAI*)pTreant->AI())->WarpGuid = m_creature->GetGUID();
+ CAST_AI(mob_treantAI, pTreant->AI())->WarpGuid = m_creature->GetGUID();
}
switch(rand()%2)
{
diff --git a/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_cthun.cpp b/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_cthun.cpp
index e3c10237635..6ba434f3de2 100644
--- a/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_cthun.cpp
+++ b/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_cthun.cpp
@@ -190,7 +190,7 @@ struct TRINITY_DLL_DECL eye_of_cthunAI : public Scripted_NoMovementAI
void SpawnEyeTentacle(float x, float y)
{
Creature* Spawned;
- Spawned = (Creature*)m_creature->SummonCreature(MOB_EYE_TENTACLE,m_creature->GetPositionX()+x,m_creature->GetPositionY()+y,m_creature->GetPositionZ(),0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,500);
+ Spawned = me->SummonCreature(MOB_EYE_TENTACLE,m_creature->GetPositionX()+x,m_creature->GetPositionY()+y,m_creature->GetPositionZ(),0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,500);
if (Spawned)
{
Unit* target;
@@ -244,7 +244,7 @@ struct TRINITY_DLL_DECL eye_of_cthunAI : public Scripted_NoMovementAI
Creature* Spawned = NULL;
//Spawn claw tentacle on the random target
- Spawned = (Creature*)m_creature->SummonCreature(MOB_CLAW_TENTACLE,target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(),0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,500);
+ Spawned = me->SummonCreature(MOB_CLAW_TENTACLE,target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(),0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,500);
if (Spawned)
Spawned->AI()->AttackStart(target);
@@ -506,7 +506,7 @@ struct TRINITY_DLL_DECL cthunAI : public Scripted_NoMovementAI
void SpawnEyeTentacle(float x, float y)
{
Creature* Spawned;
- Spawned = (Creature*)m_creature->SummonCreature(MOB_EYE_TENTACLE,m_creature->GetPositionX()+x,m_creature->GetPositionY()+y,m_creature->GetPositionZ(),0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,500);
+ Spawned = me->SummonCreature(MOB_EYE_TENTACLE,m_creature->GetPositionX()+x,m_creature->GetPositionY()+y,m_creature->GetPositionZ(),0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,500);
if (Spawned)
{
Unit* target;
@@ -629,20 +629,20 @@ struct TRINITY_DLL_DECL cthunAI : public Scripted_NoMovementAI
Creature* Spawned;
//Spawn flesh tentacle
- Spawned = (Creature*)m_creature->SummonCreature(MOB_FLESH_TENTACLE, TENTACLE_POS1_X, TENTACLE_POS1_Y, TENTACLE_POS1_Z, TENTACLE_POS1_O, TEMPSUMMON_CORPSE_DESPAWN, 0);
+ Spawned = me->SummonCreature(MOB_FLESH_TENTACLE, TENTACLE_POS1_X, TENTACLE_POS1_Y, TENTACLE_POS1_Z, TENTACLE_POS1_O, TEMPSUMMON_CORPSE_DESPAWN, 0);
if (!Spawned)
FleshTentaclesKilled++;
else
- ((flesh_tentacleAI*)(Spawned->AI()))->SpawnedByCthun(m_creature->GetGUID());
+ CAST_AI(flesh_tentacleAI, (Spawned->AI()))->SpawnedByCthun(m_creature->GetGUID());
//Spawn flesh tentacle
- Spawned = (Creature*)m_creature->SummonCreature(MOB_FLESH_TENTACLE, TENTACLE_POS2_X, TENTACLE_POS2_Y, TENTACLE_POS2_Z, TENTACLE_POS2_O, TEMPSUMMON_CORPSE_DESPAWN, 0);
+ Spawned = me->SummonCreature(MOB_FLESH_TENTACLE, TENTACLE_POS2_X, TENTACLE_POS2_Y, TENTACLE_POS2_Z, TENTACLE_POS2_O, TEMPSUMMON_CORPSE_DESPAWN, 0);
if (!Spawned)
FleshTentaclesKilled++;
else
- ((flesh_tentacleAI*)(Spawned->AI()))->SpawnedByCthun(m_creature->GetGUID());
+ CAST_AI(flesh_tentacleAI, (Spawned->AI()))->SpawnedByCthun(m_creature->GetGUID());
PhaseTimer = 0;
}else PhaseTimer -= diff;
@@ -775,7 +775,7 @@ struct TRINITY_DLL_DECL cthunAI : public Scripted_NoMovementAI
Creature* Spawned = NULL;
//Spawn claw tentacle on the random target
- Spawned = (Creature*)m_creature->SummonCreature(MOB_GIANT_CLAW_TENTACLE,target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(),0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,500);
+ Spawned = me->SummonCreature(MOB_GIANT_CLAW_TENTACLE,target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(),0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,500);
if (Spawned)
Spawned->AI()->AttackStart(target);
@@ -796,7 +796,7 @@ struct TRINITY_DLL_DECL cthunAI : public Scripted_NoMovementAI
Creature* Spawned = NULL;
//Spawn claw tentacle on the random target
- Spawned = (Creature*)m_creature->SummonCreature(MOB_GIANT_EYE_TENTACLE,target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(),0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,500);
+ Spawned = me->SummonCreature(MOB_GIANT_EYE_TENTACLE,target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(),0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,500);
if (Spawned)
Spawned->AI()->AttackStart(target);
@@ -844,20 +844,20 @@ struct TRINITY_DLL_DECL cthunAI : public Scripted_NoMovementAI
Creature* Spawned;
//Spawn flesh tentacle
- Spawned = (Creature*)m_creature->SummonCreature(MOB_FLESH_TENTACLE, TENTACLE_POS1_X, TENTACLE_POS1_Y, TENTACLE_POS1_Z, TENTACLE_POS1_O, TEMPSUMMON_CORPSE_DESPAWN, 0);
+ Spawned = me->SummonCreature(MOB_FLESH_TENTACLE, TENTACLE_POS1_X, TENTACLE_POS1_Y, TENTACLE_POS1_Z, TENTACLE_POS1_O, TEMPSUMMON_CORPSE_DESPAWN, 0);
if (!Spawned)
FleshTentaclesKilled++;
else
- ((flesh_tentacleAI*)(Spawned->AI()))->SpawnedByCthun(m_creature->GetGUID());
+ CAST_AI(flesh_tentacleAI, (Spawned->AI()))->SpawnedByCthun(m_creature->GetGUID());
//Spawn flesh tentacle
- Spawned = (Creature*)m_creature->SummonCreature(MOB_FLESH_TENTACLE, TENTACLE_POS2_X, TENTACLE_POS2_Y, TENTACLE_POS2_Z, TENTACLE_POS2_O, TEMPSUMMON_CORPSE_DESPAWN, 0);
+ Spawned = me->SummonCreature(MOB_FLESH_TENTACLE, TENTACLE_POS2_X, TENTACLE_POS2_Y, TENTACLE_POS2_Z, TENTACLE_POS2_O, TEMPSUMMON_CORPSE_DESPAWN, 0);
if (!Spawned)
FleshTentaclesKilled++;
else
- ((flesh_tentacleAI*)(Spawned->AI()))->SpawnedByCthun(m_creature->GetGUID());
+ CAST_AI(flesh_tentacleAI, (Spawned->AI()))->SpawnedByCthun(m_creature->GetGUID());
PhaseTimer = 0;
}else PhaseTimer -= diff;
@@ -1258,7 +1258,7 @@ void flesh_tentacleAI::JustDied(Unit* killer)
Creature* Cthun = Unit::GetCreature(*m_creature, Parent);
if (Cthun)
- ((cthunAI*)(Cthun->AI()))->FleshTentcleKilled();
+ CAST_AI(cthunAI, (Cthun->AI()))->FleshTentcleKilled();
else error_log("TSCR: flesh_tentacle: No Cthun");
}
diff --git a/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_skeram.cpp b/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_skeram.cpp
index a8168615a5e..a354a10a184 100644
--- a/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_skeram.cpp
+++ b/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_skeram.cpp
@@ -283,7 +283,7 @@ struct TRINITY_DLL_DECL boss_skeramAI : public ScriptedAI
Image1->SetHealth(m_creature->GetHealth() / 5);
if (target)
Image1->AI()->AttackStart(target);
- ((boss_skeramAI*)Image1->AI())->IsImage = true;
+ CAST_AI(boss_skeramAI, Image1->AI())->IsImage = true;
}
Image2 = m_creature->SummonCreature(15263,i2->x, i2->y, i2->z, i2->r, TEMPSUMMON_CORPSE_DESPAWN, 30000);
@@ -293,7 +293,7 @@ struct TRINITY_DLL_DECL boss_skeramAI : public ScriptedAI
Image2->SetHealth(m_creature->GetHealth() / 5);
if (target)
Image2->AI()->AttackStart(target);
- ((boss_skeramAI*)Image2->AI())->IsImage = true;
+ CAST_AI(boss_skeramAI, Image2->AI())->IsImage = true;
}
Invisible = true;
}
diff --git a/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_twinemperors.cpp b/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_twinemperors.cpp
index ea06d60daa7..e3785c3a473 100644
--- a/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_twinemperors.cpp
+++ b/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_twinemperors.cpp
@@ -230,7 +230,7 @@ struct TRINITY_DLL_DECL boss_twinemperorsAI : public ScriptedAI
thismap->CreatureRelocation(m_creature, other_x, other_y, other_z, other_o);
SetAfterTeleport();
- ((boss_twinemperorsAI*) pOtherBoss->AI())->SetAfterTeleport();
+ CAST_AI(boss_twinemperorsAI, pOtherBoss->AI())->SetAfterTeleport();
}
}
diff --git a/src/bindings/scripts/scripts/zone/terokkar_forest/terokkar_forest.cpp b/src/bindings/scripts/scripts/zone/terokkar_forest/terokkar_forest.cpp
index bced060c063..6170ba35b90 100644
--- a/src/bindings/scripts/scripts/zone/terokkar_forest/terokkar_forest.cpp
+++ b/src/bindings/scripts/scripts/zone/terokkar_forest/terokkar_forest.cpp
@@ -322,7 +322,7 @@ bool GossipSelect_npc_floon(Player *player, Creature *_Creature, uint32 sender,
player->CLOSE_GOSSIP_MENU();
_Creature->setFaction(FACTION_HOSTILE_FL);
DoScriptText(SAY_FLOON_ATTACK, _Creature, player);
- ((npc_floonAI*)_Creature->AI())->AttackStart(player);
+ CAST_AI(npc_floonAI, _Creature->AI())->AttackStart(player);
}
return true;
}
@@ -413,7 +413,7 @@ bool QuestAccept_npc_isla_starmane(Player* player, Creature* creature, Quest con
{
if (quest->GetQuestId() == QUEST_EFTW_H || quest->GetQuestId() == QUEST_EFTW_A)
{
- ((npc_escortAI*)(creature->AI()))->Start(true, true, false, player->GetGUID());
+ CAST_AI(npc_escortAI, (creature->AI()))->Start(true, true, false, player->GetGUID());
creature->setFaction(113);
}
return true;
diff --git a/src/bindings/scripts/scripts/zone/thousand_needles/thousand_needles.cpp b/src/bindings/scripts/scripts/zone/thousand_needles/thousand_needles.cpp
index 4af016c3456..7406d259db1 100644
--- a/src/bindings/scripts/scripts/zone/thousand_needles/thousand_needles.cpp
+++ b/src/bindings/scripts/scripts/zone/thousand_needles/thousand_needles.cpp
@@ -101,7 +101,7 @@ bool QuestAccept_npc_swiftmountain(Player* player, Creature* creature, Quest con
{
if (quest->GetQuestId() == QUEST_HOMEWARD_BOUND)
{
- ((npc_escortAI*)(creature->AI()))->Start(true, true, false, player->GetGUID());
+ CAST_AI(npc_escortAI, (creature->AI()))->Start(true, true, false, player->GetGUID());
DoScriptText(SAY_READY, creature, player);
creature->setFaction(113);
}
diff --git a/src/bindings/scripts/scripts/zone/tirisfal_glades/tirisfal_glades.cpp b/src/bindings/scripts/scripts/zone/tirisfal_glades/tirisfal_glades.cpp
index 92576ba998e..fb558dc31a3 100644
--- a/src/bindings/scripts/scripts/zone/tirisfal_glades/tirisfal_glades.cpp
+++ b/src/bindings/scripts/scripts/zone/tirisfal_glades/tirisfal_glades.cpp
@@ -75,7 +75,7 @@ bool QuestAccept_npc_calvin_montague(Player* player, Creature* creature, Quest c
{
creature->setFaction(FACTION_HOSTILE);
creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2);
- ((npc_calvin_montagueAI*)creature->AI())->AttackStart(player);
+ CAST_AI(npc_calvin_montagueAI, creature->AI())->AttackStart(player);
}
return true;
}
diff --git a/src/bindings/scripts/scripts/zone/undercity/undercity.cpp b/src/bindings/scripts/scripts/zone/undercity/undercity.cpp
index b4e12f60ead..482165b0b55 100644
--- a/src/bindings/scripts/scripts/zone/undercity/undercity.cpp
+++ b/src/bindings/scripts/scripts/zone/undercity/undercity.cpp
@@ -134,8 +134,8 @@ bool ChooseReward_npc_lady_sylvanas_windrunner(Player *player, Creature *_Creatu
{
if( _Quest->GetQuestId() == 9180 )
{
- ((npc_lady_sylvanas_windrunnerAI*)_Creature->AI())->LamentEvent = true;
- ((npc_lady_sylvanas_windrunnerAI*)_Creature->AI())->DoPlaySoundToSet(_Creature,SOUND_CREDIT);
+ CAST_AI(npc_lady_sylvanas_windrunnerAI, _Creature->AI())->LamentEvent = true;
+ CAST_AI(npc_lady_sylvanas_windrunnerAI, _Creature->AI())->DoPlaySoundToSet(_Creature,SOUND_CREDIT);
_Creature->CastSpell(_Creature,SPELL_SYLVANAS_CAST,false);
for( uint8 i = 0; i < 4; ++i)
diff --git a/src/bindings/scripts/scripts/zone/ungoro_crater/ungoro_crater.cpp b/src/bindings/scripts/scripts/zone/ungoro_crater/ungoro_crater.cpp
index f8f87e5bc13..f8e7976f541 100644
--- a/src/bindings/scripts/scripts/zone/ungoro_crater/ungoro_crater.cpp
+++ b/src/bindings/scripts/scripts/zone/ungoro_crater/ungoro_crater.cpp
@@ -124,7 +124,7 @@ bool QuestAccept_npc_ame(Player* player, Creature* creature, Quest const* quest)
{
if (quest->GetQuestId() == QUEST_CHASING_AME)
{
- ((npc_escortAI*)(creature->AI()))->Start(false, true, false, player->GetGUID());
+ CAST_AI(npc_escortAI, (creature->AI()))->Start(false, true, false, player->GetGUID());
DoScriptText(SAY_READY, creature, player);
creature->SetUInt32Value(UNIT_FIELD_BYTES_1,0);
// Change faction so mobs attack
diff --git a/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/boss_ingvar_the_plunderer.cpp b/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/boss_ingvar_the_plunderer.cpp
index f164e473148..9e9eb94413e 100644
--- a/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/boss_ingvar_the_plunderer.cpp
+++ b/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/boss_ingvar_the_plunderer.cpp
@@ -365,7 +365,7 @@ struct TRINITY_DLL_DECL mob_annhylde_the_callerAI : public ScriptedAI
ingvar->SetUInt32Value(UNIT_FIELD_DISPLAYID, MODEL_INGVAR_UNDEAD); // Visual Hack - when he dies he becomes human model -> wrong
Creature* c_ingvar = (Creature*)ingvar;
- ((boss_ingvar_the_plundererAI*)(c_ingvar->AI()))->StartZombiePhase();
+ CAST_AI(boss_ingvar_the_plundererAI, (c_ingvar->AI()))->StartZombiePhase();
m_creature->GetMotionMaster()->MovePoint(2,x+1,y,z+30);
Resurect_Phase++;
diff --git a/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/boss_keleseth.cpp b/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/boss_keleseth.cpp
index 3ba7d16dd41..aebeb3d9c5f 100644
--- a/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/boss_keleseth.cpp
+++ b/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/boss_keleseth.cpp
@@ -193,7 +193,7 @@ struct TRINITY_DLL_DECL boss_kelesethAI : public ScriptedAI
Creature* Chains = m_creature->SummonCreature(CREATURE_FROSTTOMB, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 20000);
if(Chains)
{
- ((mob_frost_tombAI*)Chains->AI())->SetPrisoner(target);
+ CAST_AI(mob_frost_tombAI, Chains->AI())->SetPrisoner(target);
Chains->CastSpell(target, SPELL_FROST_TOMB, true);
DoScriptText(SAY_FROST_TOMB, m_creature);
diff --git a/src/bindings/scripts/scripts/zone/westfall/westfall.cpp b/src/bindings/scripts/scripts/zone/westfall/westfall.cpp
index 13ddc85458e..f9e04a5186f 100644
--- a/src/bindings/scripts/scripts/zone/westfall/westfall.cpp
+++ b/src/bindings/scripts/scripts/zone/westfall/westfall.cpp
@@ -165,7 +165,7 @@ bool QuestAccept_npc_daphne_stilwell(Player* pPlayer, Creature* pCreature, const
if (pQuest->GetQuestId() == QUEST_TOME_VALOR)
{
DoScriptText(SAY_DS_START, pCreature);
- ((npc_escortAI*)(pCreature->AI()))->Start(true, true, true, pPlayer->GetGUID());
+ CAST_AI(npc_escortAI, (pCreature->AI()))->Start(true, true, true, pPlayer->GetGUID());
}
return true;
@@ -251,7 +251,7 @@ bool QuestAccept_npc_defias_traitor(Player* player, Creature* creature, Quest co
{
if (quest->GetQuestId() == QUEST_DEFIAS_BROTHERHOOD)
{
- ((npc_escortAI*)(creature->AI()))->Start(true, true, true, player->GetGUID());
+ CAST_AI(npc_escortAI, (creature->AI()))->Start(true, true, true, player->GetGUID());
DoScriptText(SAY_START, creature, player);
}
diff --git a/src/bindings/scripts/scripts/zone/zangarmarsh/zangarmarsh.cpp b/src/bindings/scripts/scripts/zone/zangarmarsh/zangarmarsh.cpp
index 5377c6f20d7..a4f2f32b250 100644
--- a/src/bindings/scripts/scripts/zone/zangarmarsh/zangarmarsh.cpp
+++ b/src/bindings/scripts/scripts/zone/zangarmarsh/zangarmarsh.cpp
@@ -333,7 +333,7 @@ bool QuestAccept_npc_kayra_longmane(Player* player, Creature* creature, Quest co
{
if (quest->GetQuestId() == QUEST_EFU)
{
- ((npc_escortAI*)(creature->AI()))->Start(true, true, false, player->GetGUID());
+ CAST_AI(npc_escortAI, (creature->AI()))->Start(true, true, false, player->GetGUID());
creature->setFaction(113);
}
return true;
diff --git a/src/bindings/scripts/scripts/zone/zulaman/zulaman.cpp b/src/bindings/scripts/scripts/zone/zulaman/zulaman.cpp
index 8bc21dbba1d..e888abe7b24 100644
--- a/src/bindings/scripts/scripts/zone/zulaman/zulaman.cpp
+++ b/src/bindings/scripts/scripts/zone/zulaman/zulaman.cpp
@@ -158,8 +158,8 @@ bool GossipSelect_npc_zulaman_hostage(Player* player, Creature* _Creature, uint3
/*Creature* summon = _Creature->SummonCreature(HostageInfo[progress], x-2, y, z, 0, TEMPSUMMON_DEAD_DESPAWN, 0);
if(summon)
{
- ((npc_zulaman_hostageAI*)summon->AI())->PlayerGUID = player->GetGUID();
- ((npc_zulaman_hostageAI*)summon->AI())->IsLoot = true;
+ CAST_AI(npc_zulaman_hostageAI, summon->AI())->PlayerGUID = player->GetGUID();
+ CAST_AI(npc_zulaman_hostageAI, summon->AI())->IsLoot = true;
summon->SetDisplayId(10056);
summon->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
summon->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
diff --git a/src/bindings/scripts/scripts/zone/zulfarrak/zulfarrak.cpp b/src/bindings/scripts/scripts/zone/zulfarrak/zulfarrak.cpp
index bdc5c264c51..8eeaed543ed 100644
--- a/src/bindings/scripts/scripts/zone/zulfarrak/zulfarrak.cpp
+++ b/src/bindings/scripts/scripts/zone/zulfarrak/zulfarrak.cpp
@@ -121,7 +121,7 @@ bool GossipSelect_npc_sergeant_bly(Player *player, Creature *_Creature, uint32 s
{
player->CLOSE_GOSSIP_MENU();
_Creature->setFaction(FACTION_HOSTILE);
- ((npc_sergeant_blyAI*)_Creature->AI())->AttackStart(player);
+ CAST_AI(npc_sergeant_blyAI, _Creature->AI())->AttackStart(player);
}
return true;
}