mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-18 00:18:43 +01:00
Core/Scripts: Removed CAST_CRE define
This commit is contained in:
@@ -24,7 +24,6 @@
|
||||
#include "CreatureAIImpl.h"
|
||||
#include "InstanceScript.h"
|
||||
|
||||
#define CAST_CRE(a) (dynamic_cast<Creature*>(a))
|
||||
#define CAST_AI(a, b) (dynamic_cast<a*>(b))
|
||||
|
||||
class InstanceScript;
|
||||
|
||||
@@ -569,7 +569,8 @@ public:
|
||||
return;
|
||||
|
||||
if (Unit* summon = me->ToTempSummon()->GetSummoner())
|
||||
CAST_CRE(summon)->AI()->SetData(2, 1);
|
||||
if (Creature* creature = summon->ToCreature())
|
||||
creature->AI()->SetData(2, 1);
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 /*diff*/)
|
||||
@@ -586,8 +587,8 @@ public:
|
||||
return;
|
||||
|
||||
if (Unit* summoner = me->ToTempSummon()->GetSummoner())
|
||||
if (Creature* summonerCre = summoner->ToCreature())
|
||||
summonerCre->AI()->SetData(2, 2);
|
||||
if (Creature* creature = summoner->ToCreature())
|
||||
creature->AI()->SetData(2, 2);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -145,9 +145,9 @@ public:
|
||||
|
||||
void KilledUnit(Unit* who)
|
||||
{
|
||||
Unit* pMalchezaar = Unit::GetUnit(*me, malchezaar);
|
||||
if (pMalchezaar)
|
||||
CAST_CRE(pMalchezaar)->AI()->KilledUnit(who);
|
||||
if (Unit* unit = Unit::GetUnit(*me, malchezaar))
|
||||
if (Creature* creature = unit->ToCreature())
|
||||
creature->AI()->KilledUnit(who);
|
||||
}
|
||||
|
||||
void SpellHit(Unit* /*who*/, const SpellInfo* spell)
|
||||
|
||||
@@ -274,9 +274,9 @@ class boss_hexlord_malacrass : public CreatureScript
|
||||
|
||||
for (uint8 i = 0; i < 4; ++i)
|
||||
{
|
||||
Unit* Temp = Unit::GetUnit(*me, AddGUID[i]);
|
||||
if (Temp && Temp->isAlive())
|
||||
CAST_CRE(Temp)->AI()->AttackStart(me->getVictim());
|
||||
Creature* creature = Unit::GetCreature(*me, AddGUID[i]);
|
||||
if (creature && creature->isAlive())
|
||||
creature->AI()->AttackStart(me->getVictim());
|
||||
else
|
||||
{
|
||||
EnterEvadeMode();
|
||||
|
||||
@@ -960,12 +960,12 @@ void hyjalAI::WaypointReached(uint32 waypointId)
|
||||
DoCast(me, SPELL_MASS_TELEPORT, false);
|
||||
if (me->GetEntry() == THRALL && DummyGuid)
|
||||
{
|
||||
Unit* Dummy = Unit::GetUnit(*me, DummyGuid);
|
||||
if (Dummy)
|
||||
if (Creature* creature = Unit::GetCreature(*me, DummyGuid))
|
||||
{
|
||||
CAST_AI(hyjalAI, CAST_CRE(Dummy)->AI())->DoMassTeleport = true;
|
||||
CAST_AI(hyjalAI, CAST_CRE(Dummy)->AI())->MassTeleportTimer = 20000;
|
||||
Dummy->CastSpell(me, SPELL_MASS_TELEPORT, false);
|
||||
hyjalAI* ai = CAST_AI(hyjalAI, creature->AI());
|
||||
ai->DoMassTeleport = true;
|
||||
ai->MassTeleportTimer = 20000;
|
||||
creature->CastSpell(me, SPELL_MASS_TELEPORT, false);
|
||||
}
|
||||
}
|
||||
//do some talking
|
||||
|
||||
@@ -191,7 +191,7 @@ hyjal_trashAI::hyjal_trashAI(Creature* creature) : npc_escortAI(creature)
|
||||
|
||||
void hyjal_trashAI::DamageTaken(Unit* done_by, uint32 &damage)
|
||||
{
|
||||
if (done_by->GetTypeId() == TYPEID_PLAYER || (done_by->GetTypeId() == TYPEID_UNIT && CAST_CRE(done_by)->isPet()))
|
||||
if (done_by->GetTypeId() == TYPEID_PLAYER || done_by->isPet())
|
||||
{
|
||||
damageTaken += damage;
|
||||
if (instance)
|
||||
|
||||
@@ -204,7 +204,7 @@ protected:
|
||||
/// Will be called when a dialogue step was done
|
||||
virtual void JustDidDialogueStep(int32 /*entry*/) {}
|
||||
/// Will be called to get a speaker, MUST be implemented if not used in instances
|
||||
virtual Creature* GetSpeakerByEntry(uint32 /*entry*/) { return NULL; }
|
||||
virtual Creature* GetSpeakerByEntry(int32 /*entry*/) { return NULL; }
|
||||
|
||||
private:
|
||||
void DoNextDialogueStep()
|
||||
|
||||
@@ -113,7 +113,7 @@ public:
|
||||
{
|
||||
Unit* dalronn = Unit::GetUnit(*me, instance->GetData64(DATA_DALRONN));
|
||||
if (dalronn && dalronn->isDead())
|
||||
CAST_CRE(dalronn)->Respawn();
|
||||
dalronn->ToCreature()->Respawn();
|
||||
|
||||
instance->SetData(DATA_SKARVALD_DALRONN_EVENT, NOT_STARTED);
|
||||
}
|
||||
@@ -280,7 +280,7 @@ public:
|
||||
{
|
||||
Unit* skarvald = Unit::GetUnit(*me, instance->GetData64(DATA_SKARVALD));
|
||||
if (skarvald && skarvald->isDead())
|
||||
CAST_CRE(skarvald)->Respawn();
|
||||
skarvald->ToCreature()->Respawn();
|
||||
|
||||
instance->SetData(DATA_SKARVALD_DALRONN_EVENT, NOT_STARTED);
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ public:
|
||||
if (owner->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
owner->CastSpell(owner, 46231, true);
|
||||
CAST_CRE(who)->DespawnOrUnsummon();
|
||||
who->ToCreature()->DespawnOrUnsummon();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1263,7 +1263,7 @@ public:
|
||||
|
||||
if (me->isSummon())
|
||||
if (Unit* summoner = me->ToTempSummon()->GetSummoner())
|
||||
CAST_AI(npc_thassarian::npc_thassarianAI, CAST_CRE(summoner)->AI())->arthasInPosition = true;
|
||||
CAST_AI(npc_thassarian::npc_thassarianAI, summoner->ToCreature()->AI())->arthasInPosition = true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1295,7 +1295,7 @@ public:
|
||||
me->CastSpell(me, SPELL_STUN, true);
|
||||
if (me->isSummon())
|
||||
if (Unit* summoner = me->ToTempSummon()->GetSummoner())
|
||||
CAST_AI(npc_thassarian::npc_thassarianAI, CAST_CRE(summoner)->AI())->arlosInPosition = true;
|
||||
CAST_AI(npc_thassarian::npc_thassarianAI, summoner->ToCreature()->AI())->arlosInPosition = true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1352,7 +1352,7 @@ public:
|
||||
|
||||
if (me->isSummon())
|
||||
if (Unit* summoner = me->ToTempSummon()->GetSummoner())
|
||||
CAST_AI(npc_thassarian::npc_thassarianAI, CAST_CRE(summoner)->AI())->talbotInPosition = true;
|
||||
CAST_AI(npc_thassarian::npc_thassarianAI, summoner->ToCreature()->AI())->talbotInPosition = true;
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 uiDiff)
|
||||
|
||||
@@ -2264,7 +2264,7 @@ public:
|
||||
if (CheckTimer <= diff)
|
||||
{
|
||||
GETUNIT(Illidan, IllidanGUID);
|
||||
if (!Illidan || CAST_CRE(Illidan)->IsInEvadeMode())
|
||||
if (!Illidan || Illidan->ToCreature()->IsInEvadeMode())
|
||||
{
|
||||
me->SetVisible(false);
|
||||
me->setDeathState(JUST_DIED);
|
||||
|
||||
@@ -305,7 +305,7 @@ public:
|
||||
{
|
||||
Unit* member = Unit::GetUnit(*me, Council[i]);
|
||||
if (member && member->isAlive())
|
||||
CAST_CRE(member)->AI()->AttackStart(target);
|
||||
member->ToCreature()->AI()->AttackStart(target);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -542,27 +542,31 @@ public:
|
||||
if (Spitfire_Timer <= diff)
|
||||
{
|
||||
DoCast(me, SPELL_SPITFIRE_TOTEM);
|
||||
Unit* SpitfireTotem = Unit::GetUnit(*me, CREATURE_SPITFIRE_TOTEM);
|
||||
if (SpitfireTotem)
|
||||
{
|
||||
CAST_CRE(SpitfireTotem)->AI()->AttackStart(me->getVictim());
|
||||
}
|
||||
if (Unit* SpitfireTotem = Unit::GetUnit(*me, CREATURE_SPITFIRE_TOTEM))
|
||||
SpitfireTotem->ToCreature()->AI()->AttackStart(me->getVictim());
|
||||
|
||||
Spitfire_Timer = 60000;
|
||||
} else Spitfire_Timer -= diff;
|
||||
}
|
||||
else
|
||||
Spitfire_Timer -= diff;
|
||||
|
||||
//PoisonCleansing_Timer
|
||||
if (PoisonCleansing_Timer <= diff)
|
||||
{
|
||||
DoCast(me, SPELL_POISON_CLEANSING_TOTEM);
|
||||
PoisonCleansing_Timer = 30000;
|
||||
} else PoisonCleansing_Timer -= diff;
|
||||
}
|
||||
else
|
||||
PoisonCleansing_Timer -= diff;
|
||||
|
||||
//Earthbind_Timer
|
||||
if (Earthbind_Timer <= diff)
|
||||
{
|
||||
DoCast(me, SPELL_EARTHBIND_TOTEM);
|
||||
Earthbind_Timer = 45000;
|
||||
} else Earthbind_Timer -= diff;
|
||||
}
|
||||
else
|
||||
Earthbind_Timer -= diff;
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
@@ -665,17 +669,19 @@ public:
|
||||
{
|
||||
//DoCast(me, SPELL_SUMMON_CYCLONE); // Doesn't work
|
||||
Cyclone_Timer = 30000+rand()%10000;
|
||||
Creature* Cyclone = me->SummonCreature(CREATURE_CYCLONE, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), float(rand()%5), TEMPSUMMON_TIMED_DESPAWN, 15000);
|
||||
if (Cyclone)
|
||||
|
||||
if (Creature* Cyclone = me->SummonCreature(CREATURE_CYCLONE, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), float(rand()%5), TEMPSUMMON_TIMED_DESPAWN, 15000))
|
||||
{
|
||||
CAST_CRE(Cyclone)->SetObjectScale(3.0f);
|
||||
Cyclone->ToCreature()->SetObjectScale(3.0f);
|
||||
Cyclone->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
|
||||
Cyclone->setFaction(me->getFaction());
|
||||
Cyclone->CastSpell(Cyclone, SPELL_CYCLONE_CYCLONE, true);
|
||||
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
|
||||
Cyclone->AI()->AttackStart(target);
|
||||
}
|
||||
} else Cyclone_Timer -= diff;
|
||||
}
|
||||
else
|
||||
Cyclone_Timer -= diff;
|
||||
|
||||
//Heal_Timer
|
||||
if (Heal_Timer <= diff)
|
||||
@@ -684,14 +690,14 @@ public:
|
||||
Unit* unit = NULL;
|
||||
|
||||
while (unit == NULL || !unit->isAlive())
|
||||
{
|
||||
unit = selectAdvisorUnit();
|
||||
}
|
||||
|
||||
if (unit && unit->isAlive())
|
||||
DoCast(unit, SPELL_HEAL);
|
||||
Heal_Timer = 60000;
|
||||
} else Heal_Timer -= diff;
|
||||
}
|
||||
else
|
||||
Heal_Timer -= diff;
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
@@ -786,7 +786,7 @@ public:
|
||||
{
|
||||
// check if vashj is death
|
||||
Unit* Vashj = Unit::GetUnit(*me, instance->GetData64(DATA_LADYVASHJ));
|
||||
if (!Vashj || (Vashj && !Vashj->isAlive()) || (Vashj && CAST_AI(boss_lady_vashj::boss_lady_vashjAI, CAST_CRE(Vashj)->AI())->Phase != 3))
|
||||
if (!Vashj || !Vashj->isAlive() || CAST_AI(boss_lady_vashj::boss_lady_vashjAI, Vashj->ToCreature()->AI())->Phase != 3)
|
||||
{
|
||||
// remove
|
||||
me->setDeathState(DEAD);
|
||||
@@ -796,7 +796,9 @@ public:
|
||||
}
|
||||
|
||||
CheckTimer = 1000;
|
||||
} else CheckTimer -= diff;
|
||||
}
|
||||
else
|
||||
CheckTimer -= diff;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -306,7 +306,7 @@ class boss_warbringer_omrogg : public CreatureScript
|
||||
|
||||
pLeftHead->AI()->Talk(YELL_DIE_L);
|
||||
|
||||
CAST_AI(mob_omrogg_heads::mob_omrogg_headsAI, CAST_CRE(pRightHead)->AI())->DoDeathYell();
|
||||
CAST_AI(mob_omrogg_heads::mob_omrogg_headsAI, pRightHead->ToCreature()->AI())->DoDeathYell();
|
||||
|
||||
if (instance)
|
||||
instance->SetData(TYPE_OMROGG, DONE);
|
||||
|
||||
@@ -167,9 +167,9 @@ class boss_warchief_kargath_bladefist : public CreatureScript
|
||||
Unit* temp = Unit::GetUnit(*me, *itr);
|
||||
if (temp && temp->isAlive())
|
||||
{
|
||||
(*temp).GetMotionMaster()->Clear(true);
|
||||
temp->GetMotionMaster()->Clear(true);
|
||||
me->DealDamage(temp, temp->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
|
||||
CAST_CRE(temp)->RemoveCorpse();
|
||||
temp->ToCreature()->RemoveCorpse();
|
||||
}
|
||||
}
|
||||
adds.clear();
|
||||
@@ -179,9 +179,9 @@ class boss_warchief_kargath_bladefist : public CreatureScript
|
||||
Unit* temp = Unit::GetUnit(*me, *itr);
|
||||
if (temp && temp->isAlive())
|
||||
{
|
||||
(*temp).GetMotionMaster()->Clear(true);
|
||||
temp->GetMotionMaster()->Clear(true);
|
||||
me->DealDamage(temp, temp->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
|
||||
CAST_CRE(temp)->RemoveCorpse();
|
||||
temp->ToCreature()->RemoveCorpse();
|
||||
}
|
||||
}
|
||||
assassins.clear();
|
||||
|
||||
@@ -474,17 +474,16 @@ public:
|
||||
|
||||
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
|
||||
me->setFaction(1194);
|
||||
Unit* Creepjack = me->FindNearestCreature(NPC_CREEPJACK, 20);
|
||||
if (Creepjack)
|
||||
if (Unit* Creepjack = me->FindNearestCreature(NPC_CREEPJACK, 20))
|
||||
{
|
||||
CAST_CRE(Creepjack)->AI()->EnterEvadeMode();
|
||||
Creepjack->ToCreature()->AI()->EnterEvadeMode();
|
||||
Creepjack->setFaction(1194);
|
||||
Creepjack->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
|
||||
}
|
||||
Unit* Malone = me->FindNearestCreature(NPC_MALONE, 20);
|
||||
if (Malone)
|
||||
|
||||
if (Unit* Malone = me->FindNearestCreature(NPC_MALONE, 20))
|
||||
{
|
||||
CAST_CRE(Malone)->AI()->EnterEvadeMode();
|
||||
Malone->ToCreature()->AI()->EnterEvadeMode();
|
||||
Malone->setFaction(1194);
|
||||
Malone->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
|
||||
}
|
||||
@@ -558,18 +557,17 @@ public:
|
||||
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
|
||||
me->RemoveAllAuras();
|
||||
|
||||
Unit* Creepjack = me->FindNearestCreature(NPC_CREEPJACK, 20);
|
||||
if (Creepjack)
|
||||
if (Unit* Creepjack = me->FindNearestCreature(NPC_CREEPJACK, 20))
|
||||
{
|
||||
CAST_CRE(Creepjack)->AI()->EnterEvadeMode();
|
||||
Creepjack->ToCreature()->AI()->EnterEvadeMode();
|
||||
Creepjack->setFaction(1194);
|
||||
Creepjack->GetMotionMaster()->MoveTargetedHome();
|
||||
Creepjack->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
|
||||
}
|
||||
Unit* Malone = me->FindNearestCreature(NPC_MALONE, 20);
|
||||
if (Malone)
|
||||
|
||||
if (Unit* Malone = me->FindNearestCreature(NPC_MALONE, 20))
|
||||
{
|
||||
CAST_CRE(Malone)->AI()->EnterEvadeMode();
|
||||
Malone->ToCreature()->AI()->EnterEvadeMode();
|
||||
Malone->setFaction(1194);
|
||||
Malone->GetMotionMaster()->MoveTargetedHome();
|
||||
Malone->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
|
||||
|
||||
Reference in New Issue
Block a user