refactor(Scripts/UtgardeKeep): Upgrade scripts to new register method (#20795)
This commit is contained in:
@@ -99,19 +99,9 @@ enum eEvents
|
|||||||
EVENT_AXE_PICKUP,
|
EVENT_AXE_PICKUP,
|
||||||
};
|
};
|
||||||
|
|
||||||
class boss_ingvar_the_plunderer : public CreatureScript
|
struct boss_ingvar_the_plunderer : public ScriptedAI
|
||||||
{
|
{
|
||||||
public:
|
boss_ingvar_the_plunderer(Creature* c) : ScriptedAI(c), summons(me)
|
||||||
boss_ingvar_the_plunderer() : CreatureScript("boss_ingvar_the_plunderer") { }
|
|
||||||
|
|
||||||
CreatureAI* GetAI(Creature* pCreature) const override
|
|
||||||
{
|
|
||||||
return GetUtgardeKeepAI<boss_ingvar_the_plundererAI>(pCreature);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct boss_ingvar_the_plundererAI : public ScriptedAI
|
|
||||||
{
|
|
||||||
boss_ingvar_the_plundererAI(Creature* c) : ScriptedAI(c), summons(me)
|
|
||||||
{
|
{
|
||||||
pInstance = c->GetInstanceScript();
|
pInstance = c->GetInstanceScript();
|
||||||
}
|
}
|
||||||
@@ -327,7 +317,7 @@ public:
|
|||||||
events.Repeat(15s, 20s);
|
events.Repeat(15s, 20s);
|
||||||
break;
|
break;
|
||||||
case EVENT_SPELL_CLEAVE_OR_WOE_STRIKE:
|
case EVENT_SPELL_CLEAVE_OR_WOE_STRIKE:
|
||||||
if (me->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID) == 0 )
|
if (me->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID) == 0)
|
||||||
{
|
{
|
||||||
events.Repeat(3s);
|
events.Repeat(3s);
|
||||||
break;
|
break;
|
||||||
@@ -339,7 +329,7 @@ public:
|
|||||||
events.Repeat(3s, 7s);
|
events.Repeat(3s, 7s);
|
||||||
break;
|
break;
|
||||||
case EVENT_SPELL_SMASH:
|
case EVENT_SPELL_SMASH:
|
||||||
if (me->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID) == 0 )
|
if (me->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID) == 0)
|
||||||
{
|
{
|
||||||
events.Repeat(3s);
|
events.Repeat(3s);
|
||||||
break;
|
break;
|
||||||
@@ -388,10 +378,9 @@ public:
|
|||||||
if (!me->HasUnitFlag(UNIT_FLAG_NOT_SELECTABLE))
|
if (!me->HasUnitFlag(UNIT_FLAG_NOT_SELECTABLE))
|
||||||
DoMeleeAttackIfReady();
|
DoMeleeAttackIfReady();
|
||||||
}
|
}
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void AddSC_boss_ingvar_the_plunderer()
|
void AddSC_boss_ingvar_the_plunderer()
|
||||||
{
|
{
|
||||||
new boss_ingvar_the_plunderer();
|
RegisterUtgardeKeepCreatureAI(boss_ingvar_the_plunderer);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,19 +58,9 @@ enum eEvents
|
|||||||
EVENT_SUMMON_SKELETONS,
|
EVENT_SUMMON_SKELETONS,
|
||||||
};
|
};
|
||||||
|
|
||||||
class npc_frost_tomb : public CreatureScript
|
struct npc_frost_tomb : public NullCreatureAI
|
||||||
{
|
{
|
||||||
public:
|
npc_frost_tomb(Creature* c) : NullCreatureAI(c)
|
||||||
npc_frost_tomb() : CreatureScript("npc_frost_tomb") { }
|
|
||||||
|
|
||||||
CreatureAI* GetAI(Creature* pCreature) const override
|
|
||||||
{
|
|
||||||
return GetUtgardeKeepAI<npc_frost_tombAI>(pCreature);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct npc_frost_tombAI : public NullCreatureAI
|
|
||||||
{
|
|
||||||
npc_frost_tombAI(Creature* c) : NullCreatureAI(c)
|
|
||||||
{
|
{
|
||||||
if (TempSummon* t = c->ToTempSummon())
|
if (TempSummon* t = c->ToTempSummon())
|
||||||
if (Unit* s = t->GetSummonerUnit())
|
if (Unit* s = t->GetSummonerUnit())
|
||||||
@@ -112,22 +102,11 @@ public:
|
|||||||
me->KillSelf();
|
me->KillSelf();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class boss_keleseth : public CreatureScript
|
struct boss_keleseth : public ScriptedAI
|
||||||
{
|
{
|
||||||
public:
|
boss_keleseth(Creature* c) : ScriptedAI(c)
|
||||||
boss_keleseth() : CreatureScript("boss_keleseth") { }
|
|
||||||
|
|
||||||
CreatureAI* GetAI(Creature* pCreature) const override
|
|
||||||
{
|
|
||||||
return GetUtgardeKeepAI<boss_kelesethAI>(pCreature);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct boss_kelesethAI : public ScriptedAI
|
|
||||||
{
|
|
||||||
boss_kelesethAI(Creature* c) : ScriptedAI(c)
|
|
||||||
{
|
{
|
||||||
pInstance = c->GetInstanceScript();
|
pInstance = c->GetInstanceScript();
|
||||||
}
|
}
|
||||||
@@ -227,7 +206,6 @@ public:
|
|||||||
|
|
||||||
DoMeleeAttackIfReady();
|
DoMeleeAttackIfReady();
|
||||||
}
|
}
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum eSkeletonEnum
|
enum eSkeletonEnum
|
||||||
@@ -242,19 +220,9 @@ enum eSkeletonEnum
|
|||||||
EVENT_RESURRECT_2,
|
EVENT_RESURRECT_2,
|
||||||
};
|
};
|
||||||
|
|
||||||
class npc_vrykul_skeleton : public CreatureScript
|
struct npc_vrykul_skeleton : public ScriptedAI
|
||||||
{
|
{
|
||||||
public:
|
npc_vrykul_skeleton(Creature* c) : ScriptedAI(c)
|
||||||
npc_vrykul_skeleton() : CreatureScript("npc_vrykul_skeleton") { }
|
|
||||||
|
|
||||||
CreatureAI* GetAI(Creature* pCreature) const override
|
|
||||||
{
|
|
||||||
return GetUtgardeKeepAI<npc_vrykul_skeletonAI>(pCreature);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct npc_vrykul_skeletonAI : public ScriptedAI
|
|
||||||
{
|
|
||||||
npc_vrykul_skeletonAI(Creature* c) : ScriptedAI(c)
|
|
||||||
{
|
{
|
||||||
pInstance = c->GetInstanceScript();
|
pInstance = c->GetInstanceScript();
|
||||||
}
|
}
|
||||||
@@ -292,7 +260,7 @@ public:
|
|||||||
|
|
||||||
void UpdateAI(uint32 diff) override
|
void UpdateAI(uint32 diff) override
|
||||||
{
|
{
|
||||||
if (pInstance && pInstance->GetData(DATA_KELESETH) != IN_PROGRESS )
|
if (pInstance && pInstance->GetData(DATA_KELESETH) != IN_PROGRESS)
|
||||||
{
|
{
|
||||||
if (me->IsAlive())
|
if (me->IsAlive())
|
||||||
me->KillSelf();
|
me->KillSelf();
|
||||||
@@ -340,7 +308,6 @@ public:
|
|||||||
if (!me->HasUnitFlag(UNIT_FLAG_NON_ATTACKABLE))
|
if (!me->HasUnitFlag(UNIT_FLAG_NON_ATTACKABLE))
|
||||||
DoMeleeAttackIfReady();
|
DoMeleeAttackIfReady();
|
||||||
}
|
}
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class spell_frost_tomb_aura : public AuraScript
|
class spell_frost_tomb_aura : public AuraScript
|
||||||
@@ -368,8 +335,8 @@ class spell_frost_tomb_aura : public AuraScript
|
|||||||
|
|
||||||
void AddSC_boss_keleseth()
|
void AddSC_boss_keleseth()
|
||||||
{
|
{
|
||||||
new boss_keleseth();
|
RegisterUtgardeKeepCreatureAI(boss_keleseth);
|
||||||
new npc_frost_tomb();
|
RegisterUtgardeKeepCreatureAI(npc_frost_tomb);
|
||||||
new npc_vrykul_skeleton();
|
RegisterUtgardeKeepCreatureAI(npc_vrykul_skeleton);
|
||||||
RegisterSpellScript(spell_frost_tomb_aura);
|
RegisterSpellScript(spell_frost_tomb_aura);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,19 +66,9 @@ enum eEvents
|
|||||||
EVENT_MATE_DIED
|
EVENT_MATE_DIED
|
||||||
};
|
};
|
||||||
|
|
||||||
class boss_skarvald_the_constructor : public CreatureScript
|
struct boss_skarvald_the_constructor : public ScriptedAI
|
||||||
{
|
{
|
||||||
public:
|
boss_skarvald_the_constructor(Creature* c) : ScriptedAI(c)
|
||||||
boss_skarvald_the_constructor() : CreatureScript("boss_skarvald_the_constructor") { }
|
|
||||||
|
|
||||||
CreatureAI* GetAI(Creature* pCreature) const override
|
|
||||||
{
|
|
||||||
return GetUtgardeKeepAI<boss_skarvald_the_constructorAI>(pCreature);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct boss_skarvald_the_constructorAI : public ScriptedAI
|
|
||||||
{
|
|
||||||
boss_skarvald_the_constructorAI(Creature* c) : ScriptedAI(c)
|
|
||||||
{
|
{
|
||||||
pInstance = c->GetInstanceScript();
|
pInstance = c->GetInstanceScript();
|
||||||
}
|
}
|
||||||
@@ -226,22 +216,11 @@ public:
|
|||||||
}
|
}
|
||||||
DoMeleeAttackIfReady();
|
DoMeleeAttackIfReady();
|
||||||
}
|
}
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class boss_dalronn_the_controller : public CreatureScript
|
struct boss_dalronn_the_controller : public ScriptedAI
|
||||||
{
|
|
||||||
public:
|
|
||||||
boss_dalronn_the_controller() : CreatureScript("boss_dalronn_the_controller") { }
|
|
||||||
|
|
||||||
CreatureAI* GetAI(Creature* pCreature) const override
|
|
||||||
{
|
{
|
||||||
return GetUtgardeKeepAI<boss_dalronn_the_controllerAI>(pCreature);
|
boss_dalronn_the_controller(Creature* c) : ScriptedAI(c), summons(me)
|
||||||
}
|
|
||||||
|
|
||||||
struct boss_dalronn_the_controllerAI : public ScriptedAI
|
|
||||||
{
|
|
||||||
boss_dalronn_the_controllerAI(Creature* c) : ScriptedAI(c), summons(me)
|
|
||||||
{
|
{
|
||||||
pInstance = c->GetInstanceScript();
|
pInstance = c->GetInstanceScript();
|
||||||
}
|
}
|
||||||
@@ -397,10 +376,9 @@ public:
|
|||||||
DoMeleeAttackIfReady();
|
DoMeleeAttackIfReady();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
void AddSC_boss_skarvald_dalronn()
|
void AddSC_boss_skarvald_dalronn()
|
||||||
{
|
{
|
||||||
new boss_skarvald_the_constructor();
|
RegisterUtgardeKeepCreatureAI(boss_skarvald_the_constructor);
|
||||||
new boss_dalronn_the_controller();
|
RegisterUtgardeKeepCreatureAI(boss_dalronn_the_controller);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,19 +23,9 @@
|
|||||||
#include "SpellScriptLoader.h"
|
#include "SpellScriptLoader.h"
|
||||||
#include "Vehicle.h"
|
#include "Vehicle.h"
|
||||||
|
|
||||||
class npc_dragonflayer_forge_master : public CreatureScript
|
struct npc_dragonflayer_forge_master : public ScriptedAI
|
||||||
{
|
{
|
||||||
public:
|
npc_dragonflayer_forge_master(Creature* c) : ScriptedAI(c)
|
||||||
npc_dragonflayer_forge_master() : CreatureScript("npc_dragonflayer_forge_master") { }
|
|
||||||
|
|
||||||
CreatureAI* GetAI(Creature* pCreature) const override
|
|
||||||
{
|
|
||||||
return GetUtgardeKeepAI<npc_dragonflayer_forge_masterAI>(pCreature);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct npc_dragonflayer_forge_masterAI : public ScriptedAI
|
|
||||||
{
|
|
||||||
npc_dragonflayer_forge_masterAI(Creature* c) : ScriptedAI(c)
|
|
||||||
{
|
{
|
||||||
pInstance = c->GetInstanceScript();
|
pInstance = c->GetInstanceScript();
|
||||||
|
|
||||||
@@ -88,7 +78,6 @@ public:
|
|||||||
}
|
}
|
||||||
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE);
|
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE);
|
||||||
}
|
}
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum EnslavedProtoDrake
|
enum EnslavedProtoDrake
|
||||||
@@ -111,14 +100,9 @@ enum EnslavedProtoDrake
|
|||||||
|
|
||||||
const Position protodrakeCheckPos = {206.24f, -190.28f, 200.11f, 0.f};
|
const Position protodrakeCheckPos = {206.24f, -190.28f, 200.11f, 0.f};
|
||||||
|
|
||||||
class npc_enslaved_proto_drake : public CreatureScript
|
struct npc_enslaved_proto_drake : public ScriptedAI
|
||||||
{
|
{
|
||||||
public:
|
npc_enslaved_proto_drake(Creature* creature) : ScriptedAI(creature)
|
||||||
npc_enslaved_proto_drake() : CreatureScript("npc_enslaved_proto_drake") { }
|
|
||||||
|
|
||||||
struct npc_enslaved_proto_drakeAI : public ScriptedAI
|
|
||||||
{
|
|
||||||
npc_enslaved_proto_drakeAI(Creature* creature) : ScriptedAI(creature)
|
|
||||||
{
|
{
|
||||||
_setData = false;
|
_setData = false;
|
||||||
}
|
}
|
||||||
@@ -193,15 +177,9 @@ public:
|
|||||||
DoMeleeAttackIfReady();
|
DoMeleeAttackIfReady();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool _setData;
|
bool _setData;
|
||||||
EventMap _events;
|
EventMap _events;
|
||||||
};
|
|
||||||
|
|
||||||
CreatureAI* GetAI(Creature* creature) const override
|
|
||||||
{
|
|
||||||
return GetUtgardeKeepAI<npc_enslaved_proto_drakeAI>(creature);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum TickingTimeBomb
|
enum TickingTimeBomb
|
||||||
@@ -234,8 +212,8 @@ class spell_ticking_time_bomb_aura : public AuraScript
|
|||||||
|
|
||||||
void AddSC_utgarde_keep()
|
void AddSC_utgarde_keep()
|
||||||
{
|
{
|
||||||
new npc_dragonflayer_forge_master();
|
RegisterUtgardeKeepCreatureAI(npc_dragonflayer_forge_master);
|
||||||
new npc_enslaved_proto_drake();
|
RegisterUtgardeKeepCreatureAI(npc_enslaved_proto_drake);
|
||||||
|
|
||||||
RegisterSpellScript(spell_ticking_time_bomb_aura);
|
RegisterSpellScript(spell_ticking_time_bomb_aura);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,4 +83,6 @@ inline AI* GetUtgardeKeepAI(T* obj)
|
|||||||
return GetInstanceAI<AI>(obj, UtgardeKeepScriptName);
|
return GetInstanceAI<AI>(obj, UtgardeKeepScriptName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define RegisterUtgardeKeepCreatureAI(ai_name) RegisterCreatureAIWithFactory(ai_name, GetUtgardeKeepAI)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user