refactor(Scripts/Events): convert hallows_end to new system (#9610)

This commit is contained in:
Kitzunu
2021-12-14 19:41:36 +01:00
committed by GitHub
parent 658a7c2b56
commit 695f8350af
+58 -228
View File
@@ -49,14 +49,9 @@ enum eTrickSpells
SPELL_TRICK_BUFF = 24753, SPELL_TRICK_BUFF = 24753,
}; };
class spell_hallows_end_trick : public SpellScriptLoader class spell_hallows_end_trick : public SpellScript
{ {
public: PrepareSpellScript(spell_hallows_end_trick);
spell_hallows_end_trick() : SpellScriptLoader("spell_hallows_end_trick") {}
class spell_hallows_end_trick_SpellScript : public SpellScript
{
PrepareSpellScript(spell_hallows_end_trick_SpellScript);
void HandleScript(SpellEffIndex /*effIndex*/) void HandleScript(SpellEffIndex /*effIndex*/)
{ {
@@ -97,27 +92,16 @@ public:
void Register() override void Register() override
{ {
OnEffectHitTarget += SpellEffectFn(spell_hallows_end_trick_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); OnEffectHitTarget += SpellEffectFn(spell_hallows_end_trick::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
} }
}; };
SpellScript* GetSpellScript() const override class spell_hallows_end_put_costume : public SpellScript
{
return new spell_hallows_end_trick_SpellScript();
}
};
class spell_hallows_end_put_costume : public SpellScriptLoader
{ {
public: public:
spell_hallows_end_put_costume(const char* name, uint32 maleSpell, uint32 femaleSpell) : SpellScriptLoader(name), _maleSpell(maleSpell), _femaleSpell(femaleSpell) {} spell_hallows_end_put_costume(uint32 maleSpell, uint32 femaleSpell) : _maleSpell(maleSpell), _femaleSpell(femaleSpell) { }
class spell_hallows_end_put_costume_SpellScript : public SpellScript PrepareSpellScript(spell_hallows_end_put_costume);
{
public:
spell_hallows_end_put_costume_SpellScript(uint32 maleSpell, uint32 femaleSpell) : _maleSpell(maleSpell), _femaleSpell(femaleSpell) { }
PrepareSpellScript(spell_hallows_end_put_costume_SpellScript);
void HandleScript(SpellEffIndex /*effIndex*/) void HandleScript(SpellEffIndex /*effIndex*/)
{ {
@@ -127,17 +111,7 @@ public:
void Register() override void Register() override
{ {
OnEffectHitTarget += SpellEffectFn(spell_hallows_end_put_costume_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); OnEffectHitTarget += SpellEffectFn(spell_hallows_end_put_costume::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
private:
uint32 _maleSpell;
uint32 _femaleSpell;
};
SpellScript* GetSpellScript() const override
{
return new spell_hallows_end_put_costume_SpellScript(_maleSpell, _femaleSpell);
} }
private: private:
@@ -153,14 +127,9 @@ enum eTrickOrTreatSpells
SPELL_TRICKED_OR_TREATED = 24755 SPELL_TRICKED_OR_TREATED = 24755
}; };
class spell_hallows_end_trick_or_treat : public SpellScriptLoader class spell_hallows_end_trick_or_treat : public SpellScript
{ {
public: PrepareSpellScript(spell_hallows_end_trick_or_treat);
spell_hallows_end_trick_or_treat() : SpellScriptLoader("spell_hallows_end_trick_or_treat") {}
class spell_hallows_end_trick_or_treat_SpellScript : public SpellScript
{
PrepareSpellScript(spell_hallows_end_trick_or_treat_SpellScript);
void HandleScript(SpellEffIndex /*effIndex*/) void HandleScript(SpellEffIndex /*effIndex*/)
{ {
@@ -173,13 +142,7 @@ public:
void Register() override void Register() override
{ {
OnEffectHitTarget += SpellEffectFn(spell_hallows_end_trick_or_treat_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); OnEffectHitTarget += SpellEffectFn(spell_hallows_end_trick_or_treat::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_hallows_end_trick_or_treat_SpellScript();
} }
}; };
@@ -191,14 +154,9 @@ enum eHallowsEndCandy
SPELL_HALLOWS_END_CANDY_4 = 24927, SPELL_HALLOWS_END_CANDY_4 = 24927,
}; };
class spell_hallows_end_candy : public SpellScriptLoader class spell_hallows_end_candy : public SpellScript
{ {
public: PrepareSpellScript(spell_hallows_end_candy);
spell_hallows_end_candy() : SpellScriptLoader("spell_hallows_end_candy") {}
class spell_hallows_end_candy_SpellScript : public SpellScript
{
PrepareSpellScript(spell_hallows_end_candy_SpellScript);
void HandleDummy(SpellEffIndex /*effIndex*/) void HandleDummy(SpellEffIndex /*effIndex*/)
{ {
@@ -211,13 +169,7 @@ public:
void Register() override void Register() override
{ {
OnEffectHitTarget += SpellEffectFn(spell_hallows_end_candy_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); OnEffectHitTarget += SpellEffectFn(spell_hallows_end_candy::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_hallows_end_candy_SpellScript();
} }
}; };
@@ -226,14 +178,9 @@ enum trickyTreat
SPELL_UPSET_TUMMY = 42966, SPELL_UPSET_TUMMY = 42966,
}; };
class spell_hallows_end_tricky_treat : public SpellScriptLoader class spell_hallows_end_tricky_treat : public SpellScript
{ {
public: PrepareSpellScript(spell_hallows_end_tricky_treat);
spell_hallows_end_tricky_treat() : SpellScriptLoader("spell_hallows_end_tricky_treat") {}
class spell_hallows_end_tricky_treat_SpellScript : public SpellScript
{
PrepareSpellScript(spell_hallows_end_tricky_treat_SpellScript);
void HandleScript(SpellEffIndex /*effIndex*/) void HandleScript(SpellEffIndex /*effIndex*/)
{ {
@@ -246,13 +193,7 @@ public:
void Register() override void Register() override
{ {
OnEffectHitTarget += SpellEffectFn(spell_hallows_end_tricky_treat_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); OnEffectHitTarget += SpellEffectFn(spell_hallows_end_tricky_treat::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_hallows_end_tricky_treat_SpellScript();
} }
}; };
@@ -300,14 +241,9 @@ enum costumedOrphan
TALK_SHADE_DEATH = 6, TALK_SHADE_DEATH = 6,
}; };
class spell_hallows_end_bucket_lands : public SpellScriptLoader class spell_hallows_end_bucket_lands : public SpellScript
{ {
public: PrepareSpellScript(spell_hallows_end_bucket_lands);
spell_hallows_end_bucket_lands() : SpellScriptLoader("spell_hallows_end_bucket_lands") {}
class spell_hallows_end_bucket_lands_SpellScript : public SpellScript
{
PrepareSpellScript(spell_hallows_end_bucket_lands_SpellScript);
bool handled; bool handled;
bool Load() override { handled = false; return true; } bool Load() override { handled = false; return true; }
@@ -325,24 +261,13 @@ public:
void Register() override void Register() override
{ {
OnEffectHitTarget += SpellEffectFn(spell_hallows_end_bucket_lands_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); OnEffectHitTarget += SpellEffectFn(spell_hallows_end_bucket_lands::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
} }
}; };
SpellScript* GetSpellScript() const override class spell_hallows_end_base_fire : public AuraScript
{ {
return new spell_hallows_end_bucket_lands_SpellScript(); PrepareAuraScript(spell_hallows_end_base_fire);
}
};
class spell_hallows_end_base_fire : public SpellScriptLoader
{
public:
spell_hallows_end_base_fire() : SpellScriptLoader("spell_hallows_end_base_fire") { }
class spell_hallows_end_base_fire_AuraScript : public AuraScript
{
PrepareAuraScript(spell_hallows_end_base_fire_AuraScript);
void CalcPeriodic(AuraEffect const* /*aurEff*/, bool& /*isPeriodic*/, int32& amplitude) void CalcPeriodic(AuraEffect const* /*aurEff*/, bool& /*isPeriodic*/, int32& amplitude)
{ {
@@ -385,28 +310,15 @@ public:
void Register() override void Register() override
{ {
DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_hallows_end_base_fire_AuraScript::CalcPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_hallows_end_base_fire::CalcPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_hallows_end_base_fire_AuraScript::HandleEffectPeriodicUpdate, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_hallows_end_base_fire::HandleEffectPeriodicUpdate, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
OnEffectApply += AuraEffectApplyFn(spell_hallows_end_base_fire_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL); OnEffectApply += AuraEffectApplyFn(spell_hallows_end_base_fire::HandleEffectApply, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL);
} }
}; };
AuraScript* GetAuraScript() const override struct npc_costumed_orphan_matron : public ScriptedAI
{ {
return new spell_hallows_end_base_fire_AuraScript(); npc_costumed_orphan_matron(Creature* c) : ScriptedAI(c) { }
}
};
class npc_costumed_orphan_matron : public CreatureScript
{
public:
npc_costumed_orphan_matron() : CreatureScript("npc_costumed_orphan_matron") { }
struct npc_costumed_orphan_matronAI : public ScriptedAI
{
npc_costumed_orphan_matronAI(Creature* c) : ScriptedAI(c)
{
}
uint32 eventStarted; uint32 eventStarted;
bool allowQuest; bool allowQuest;
@@ -508,7 +420,7 @@ public:
} }
}; };
bool OnGossipHello(Player* player, Creature* creature) override bool OnGossipHello(Player* player, Creature* creature)
{ {
QuestRelationBounds pObjectQR = sObjectMgr->GetCreatureQuestRelationBounds(creature->GetEntry()); QuestRelationBounds pObjectQR = sObjectMgr->GetCreatureQuestRelationBounds(creature->GetEntry());
QuestRelationBounds pObjectQIR = sObjectMgr->GetCreatureQuestInvolvedRelationBounds(creature->GetEntry()); QuestRelationBounds pObjectQIR = sObjectMgr->GetCreatureQuestInvolvedRelationBounds(creature->GetEntry());
@@ -560,7 +472,7 @@ public:
return true; return true;
} }
bool OnQuestAccept(Player* /*player*/, Creature* creature, Quest const* quest) override bool OnQuestAccept(Player* /*player*/, Creature* creature, Quest const* quest)
{ {
if ((quest->GetQuestId() == QUEST_LET_THE_FIRES_COME_A || quest->GetQuestId() == QUEST_LET_THE_FIRES_COME_H) && !creature->AI()->GetData(DATA_ALLOW_START)) if ((quest->GetQuestId() == QUEST_LET_THE_FIRES_COME_A || quest->GetQuestId() == QUEST_LET_THE_FIRES_COME_H) && !creature->AI()->GetData(DATA_ALLOW_START))
creature->AI()->DoAction(ACTION_START_EVENT); creature->AI()->DoAction(ACTION_START_EVENT);
@@ -568,22 +480,9 @@ public:
return true; return true;
} }
CreatureAI* GetAI(Creature* pCreature) const override struct npc_soh_fire_trigger : public NullCreatureAI
{ {
return new npc_costumed_orphan_matronAI (pCreature); npc_soh_fire_trigger(Creature* creature) : NullCreatureAI(creature) { }
}
};
class npc_soh_fire_trigger : public CreatureScript
{
public:
npc_soh_fire_trigger() : CreatureScript("npc_soh_fire_trigger") { }
struct npc_soh_fire_triggerAI : public NullCreatureAI
{
npc_soh_fire_triggerAI(Creature* creature) : NullCreatureAI(creature)
{
}
void Reset() override void Reset() override
{ {
@@ -645,20 +544,9 @@ public:
} }
}; };
CreatureAI* GetAI(Creature* creature) const override struct npc_hallows_end_soh : public ScriptedAI
{ {
return new npc_soh_fire_triggerAI(creature); npc_hallows_end_soh(Creature* creature) : ScriptedAI(creature)
}
};
class npc_hallows_end_soh : public CreatureScript
{
public:
npc_hallows_end_soh() : CreatureScript("npc_hallows_end_soh") { }
struct npc_hallows_end_sohAI : public ScriptedAI
{
npc_hallows_end_sohAI(Creature* creature) : ScriptedAI(creature)
{ {
pos = 0; pos = 0;
counter = 0; counter = 0;
@@ -971,22 +859,9 @@ public:
} }
}; };
CreatureAI* GetAI(Creature* creature) const override struct npc_hallows_end_train_fire : public NullCreatureAI
{ {
return new npc_hallows_end_sohAI(creature); npc_hallows_end_train_fire(Creature* creature) : NullCreatureAI(creature) { }
}
};
class npc_hallows_end_train_fire : public CreatureScript
{
public:
npc_hallows_end_train_fire() : CreatureScript("npc_hallows_end_train_fire") { }
struct npc_hallows_end_train_fireAI : public NullCreatureAI
{
npc_hallows_end_train_fireAI(Creature* creature) : NullCreatureAI(creature)
{
}
uint32 timer; uint32 timer;
void Reset() override void Reset() override
@@ -1020,12 +895,6 @@ public:
} }
}; };
CreatureAI* GetAI(Creature* creature) const override
{
return new npc_hallows_end_train_fireAI(creature);
}
};
/////////////////////////////////////// ///////////////////////////////////////
////// HEADLESS HORSEMAN EVENT ////// HEADLESS HORSEMAN EVENT
/////////////////////////////////////// ///////////////////////////////////////
@@ -1086,16 +955,9 @@ enum hhSounds
SOUND_DEATH = 11964, SOUND_DEATH = 11964,
}; };
class boss_headless_horseman : public CreatureScript struct boss_headless_horseman : public ScriptedAI
{ {
public: boss_headless_horseman(Creature* creature) : ScriptedAI(creature), summons(me) { }
boss_headless_horseman() : CreatureScript("boss_headless_horseman") { }
struct boss_headless_horsemanAI : public ScriptedAI
{
boss_headless_horsemanAI(Creature* creature) : ScriptedAI(creature), summons(me)
{
}
EventMap events; EventMap events;
SummonList summons; SummonList summons;
@@ -1353,22 +1215,9 @@ public:
} }
}; };
CreatureAI* GetAI(Creature* creature) const override struct boss_headless_horseman_head : public ScriptedAI
{ {
return new boss_headless_horsemanAI(creature); boss_headless_horseman_head(Creature* creature) : ScriptedAI(creature) { }
}
};
class boss_headless_horseman_head : public CreatureScript
{
public:
boss_headless_horseman_head() : CreatureScript("boss_headless_horseman_head") { }
struct boss_headless_horseman_headAI : public ScriptedAI
{
boss_headless_horseman_headAI(Creature* creature) : ScriptedAI(creature)
{
}
uint8 pct; uint8 pct;
uint32 timer; uint32 timer;
@@ -1484,22 +1333,9 @@ public:
} }
}; };
CreatureAI* GetAI(Creature* creature) const override struct boss_headless_horseman_pumpkin : public ScriptedAI
{ {
return new boss_headless_horseman_headAI(creature); boss_headless_horseman_pumpkin(Creature* creature) : ScriptedAI(creature) { }
}
};
class boss_headless_horseman_pumpkin : public CreatureScript
{
public:
boss_headless_horseman_pumpkin() : CreatureScript("boss_headless_horseman_pumpkin") { }
struct boss_headless_horseman_pumpkinAI : public ScriptedAI
{
boss_headless_horseman_pumpkinAI(Creature* creature) : ScriptedAI(creature)
{
}
uint32 timer; uint32 timer;
@@ -1540,12 +1376,6 @@ public:
} }
}; };
CreatureAI* GetAI(Creature* creature) const override
{
return new boss_headless_horseman_pumpkinAI(creature);
}
};
class go_loosely_turned_soil : public GameObjectScript class go_loosely_turned_soil : public GameObjectScript
{ {
public: public:
@@ -1587,28 +1417,28 @@ public:
void AddSC_event_hallows_end_scripts() void AddSC_event_hallows_end_scripts()
{ {
// Spells // Spells
new spell_hallows_end_trick(); RegisterSpellScript(spell_hallows_end_trick);
new spell_hallows_end_trick_or_treat(); RegisterSpellScript(spell_hallows_end_trick_or_treat);
new spell_hallows_end_candy(); RegisterSpellScript(spell_hallows_end_candy);
new spell_hallows_end_tricky_treat(); RegisterSpellScript(spell_hallows_end_tricky_treat);
new spell_hallows_end_put_costume("spell_hallows_end_pirate_costume", SPELL_PIRATE_COSTUME_MALE, SPELL_PIRATE_COSTUME_FEMALE); RegisterSpellScriptWithArgs(spell_hallows_end_put_costume, "spell_hallows_end_pirate_costume", SPELL_PIRATE_COSTUME_MALE, SPELL_PIRATE_COSTUME_FEMALE);
new spell_hallows_end_put_costume("spell_hallows_end_leper_costume", SPELL_LEPER_GNOME_COSTUME_MALE, SPELL_LEPER_GNOME_COSTUME_FEMALE); RegisterSpellScriptWithArgs(spell_hallows_end_put_costume, "spell_hallows_end_leper_costume", SPELL_LEPER_GNOME_COSTUME_MALE, SPELL_LEPER_GNOME_COSTUME_FEMALE);
new spell_hallows_end_put_costume("spell_hallows_end_ghost_costume", SPELL_GHOST_COSTUME_MALE, SPELL_GHOST_COSTUME_FEMALE); RegisterSpellScriptWithArgs(spell_hallows_end_put_costume, "spell_hallows_end_ghost_costume", SPELL_GHOST_COSTUME_MALE, SPELL_GHOST_COSTUME_FEMALE);
new spell_hallows_end_put_costume("spell_hallows_end_ninja_costume", SPELL_NINJA_COSTUME_MALE, SPELL_NINJA_COSTUME_FEMALE); RegisterSpellScriptWithArgs(spell_hallows_end_put_costume, "spell_hallows_end_ninja_costume", SPELL_NINJA_COSTUME_MALE, SPELL_NINJA_COSTUME_FEMALE);
RegisterSpellScript(spell_hallows_end_base_fire);
RegisterSpellScript(spell_hallows_end_bucket_lands);
// Quests // Quests
new npc_hallows_end_train_fire(); RegisterCreatureAI(npc_hallows_end_train_fire);
// Event // creatures
new npc_costumed_orphan_matron(); RegisterCreatureAI(npc_costumed_orphan_matron);
new npc_soh_fire_trigger(); RegisterCreatureAI(npc_soh_fire_trigger);
new npc_hallows_end_soh(); RegisterCreatureAI(npc_hallows_end_soh);
new spell_hallows_end_base_fire();
new spell_hallows_end_bucket_lands();
// Headless Horseman // Headless Horseman
new go_loosely_turned_soil(); new go_loosely_turned_soil();
new boss_headless_horseman(); RegisterCreatureAI(boss_headless_horseman);
new boss_headless_horseman_head(); RegisterCreatureAI(boss_headless_horseman_head);
new boss_headless_horseman_pumpkin(); RegisterCreatureAI(boss_headless_horseman_pumpkin);
} }