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,
};
class spell_hallows_end_trick : public SpellScriptLoader
class spell_hallows_end_trick : public SpellScript
{
public:
spell_hallows_end_trick() : SpellScriptLoader("spell_hallows_end_trick") {}
class spell_hallows_end_trick_SpellScript : public SpellScript
{
PrepareSpellScript(spell_hallows_end_trick_SpellScript);
PrepareSpellScript(spell_hallows_end_trick);
void HandleScript(SpellEffIndex /*effIndex*/)
{
@@ -97,27 +92,16 @@ public:
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
{
return new spell_hallows_end_trick_SpellScript();
}
};
class spell_hallows_end_put_costume : public SpellScriptLoader
class spell_hallows_end_put_costume : public SpellScript
{
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
{
public:
spell_hallows_end_put_costume_SpellScript(uint32 maleSpell, uint32 femaleSpell) : _maleSpell(maleSpell), _femaleSpell(femaleSpell) { }
PrepareSpellScript(spell_hallows_end_put_costume_SpellScript);
PrepareSpellScript(spell_hallows_end_put_costume);
void HandleScript(SpellEffIndex /*effIndex*/)
{
@@ -127,17 +111,7 @@ public:
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_hallows_end_put_costume_SpellScript::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);
OnEffectHitTarget += SpellEffectFn(spell_hallows_end_put_costume::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
private:
@@ -153,14 +127,9 @@ enum eTrickOrTreatSpells
SPELL_TRICKED_OR_TREATED = 24755
};
class spell_hallows_end_trick_or_treat : public SpellScriptLoader
class spell_hallows_end_trick_or_treat : public SpellScript
{
public:
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);
PrepareSpellScript(spell_hallows_end_trick_or_treat);
void HandleScript(SpellEffIndex /*effIndex*/)
{
@@ -173,13 +142,7 @@ public:
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_hallows_end_trick_or_treat_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_hallows_end_trick_or_treat_SpellScript();
OnEffectHitTarget += SpellEffectFn(spell_hallows_end_trick_or_treat::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
@@ -191,14 +154,9 @@ enum eHallowsEndCandy
SPELL_HALLOWS_END_CANDY_4 = 24927,
};
class spell_hallows_end_candy : public SpellScriptLoader
class spell_hallows_end_candy : public SpellScript
{
public:
spell_hallows_end_candy() : SpellScriptLoader("spell_hallows_end_candy") {}
class spell_hallows_end_candy_SpellScript : public SpellScript
{
PrepareSpellScript(spell_hallows_end_candy_SpellScript);
PrepareSpellScript(spell_hallows_end_candy);
void HandleDummy(SpellEffIndex /*effIndex*/)
{
@@ -211,13 +169,7 @@ public:
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_hallows_end_candy_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_hallows_end_candy_SpellScript();
OnEffectHitTarget += SpellEffectFn(spell_hallows_end_candy::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
@@ -226,14 +178,9 @@ enum trickyTreat
SPELL_UPSET_TUMMY = 42966,
};
class spell_hallows_end_tricky_treat : public SpellScriptLoader
class spell_hallows_end_tricky_treat : public SpellScript
{
public:
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);
PrepareSpellScript(spell_hallows_end_tricky_treat);
void HandleScript(SpellEffIndex /*effIndex*/)
{
@@ -246,13 +193,7 @@ public:
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_hallows_end_tricky_treat_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_hallows_end_tricky_treat_SpellScript();
OnEffectHitTarget += SpellEffectFn(spell_hallows_end_tricky_treat::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
@@ -300,14 +241,9 @@ enum costumedOrphan
TALK_SHADE_DEATH = 6,
};
class spell_hallows_end_bucket_lands : public SpellScriptLoader
class spell_hallows_end_bucket_lands : public SpellScript
{
public:
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);
PrepareSpellScript(spell_hallows_end_bucket_lands);
bool handled;
bool Load() override { handled = false; return true; }
@@ -325,24 +261,13 @@ public:
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();
}
};
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);
PrepareAuraScript(spell_hallows_end_base_fire);
void CalcPeriodic(AuraEffect const* /*aurEff*/, bool& /*isPeriodic*/, int32& amplitude)
{
@@ -385,28 +310,15 @@ public:
void Register() override
{
DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_hallows_end_base_fire_AuraScript::CalcPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_hallows_end_base_fire_AuraScript::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);
DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_hallows_end_base_fire::CalcPeriodic, 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::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();
}
};
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)
{
}
npc_costumed_orphan_matron(Creature* c) : ScriptedAI(c) { }
uint32 eventStarted;
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 pObjectQIR = sObjectMgr->GetCreatureQuestInvolvedRelationBounds(creature->GetEntry());
@@ -560,7 +472,7 @@ public:
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))
creature->AI()->DoAction(ACTION_START_EVENT);
@@ -568,22 +480,9 @@ public:
return true;
}
CreatureAI* GetAI(Creature* pCreature) const override
struct npc_soh_fire_trigger : public NullCreatureAI
{
return new npc_costumed_orphan_matronAI (pCreature);
}
};
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)
{
}
npc_soh_fire_trigger(Creature* creature) : NullCreatureAI(creature) { }
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);
}
};
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)
npc_hallows_end_soh(Creature* creature) : ScriptedAI(creature)
{
pos = 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);
}
};
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)
{
}
npc_hallows_end_train_fire(Creature* creature) : NullCreatureAI(creature) { }
uint32 timer;
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
///////////////////////////////////////
@@ -1086,16 +955,9 @@ enum hhSounds
SOUND_DEATH = 11964,
};
class boss_headless_horseman : public CreatureScript
struct boss_headless_horseman : public ScriptedAI
{
public:
boss_headless_horseman() : CreatureScript("boss_headless_horseman") { }
struct boss_headless_horsemanAI : public ScriptedAI
{
boss_headless_horsemanAI(Creature* creature) : ScriptedAI(creature), summons(me)
{
}
boss_headless_horseman(Creature* creature) : ScriptedAI(creature), summons(me) { }
EventMap events;
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);
}
};
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)
{
}
boss_headless_horseman_head(Creature* creature) : ScriptedAI(creature) { }
uint8 pct;
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);
}
};
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)
{
}
boss_headless_horseman_pumpkin(Creature* creature) : ScriptedAI(creature) { }
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
{
public:
@@ -1587,28 +1417,28 @@ public:
void AddSC_event_hallows_end_scripts()
{
// Spells
new spell_hallows_end_trick();
new spell_hallows_end_trick_or_treat();
new spell_hallows_end_candy();
new spell_hallows_end_tricky_treat();
new 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);
new 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);
RegisterSpellScript(spell_hallows_end_trick);
RegisterSpellScript(spell_hallows_end_trick_or_treat);
RegisterSpellScript(spell_hallows_end_candy);
RegisterSpellScript(spell_hallows_end_tricky_treat);
RegisterSpellScriptWithArgs(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_leper_costume", SPELL_LEPER_GNOME_COSTUME_MALE, SPELL_LEPER_GNOME_COSTUME_FEMALE);
RegisterSpellScriptWithArgs(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_ninja_costume", SPELL_NINJA_COSTUME_MALE, SPELL_NINJA_COSTUME_FEMALE);
RegisterSpellScript(spell_hallows_end_base_fire);
RegisterSpellScript(spell_hallows_end_bucket_lands);
// Quests
new npc_hallows_end_train_fire();
RegisterCreatureAI(npc_hallows_end_train_fire);
// Event
new npc_costumed_orphan_matron();
new npc_soh_fire_trigger();
new npc_hallows_end_soh();
new spell_hallows_end_base_fire();
new spell_hallows_end_bucket_lands();
// creatures
RegisterCreatureAI(npc_costumed_orphan_matron);
RegisterCreatureAI(npc_soh_fire_trigger);
RegisterCreatureAI(npc_hallows_end_soh);
// Headless Horseman
new go_loosely_turned_soil();
new boss_headless_horseman();
new boss_headless_horseman_head();
new boss_headless_horseman_pumpkin();
RegisterCreatureAI(boss_headless_horseman);
RegisterCreatureAI(boss_headless_horseman_head);
RegisterCreatureAI(boss_headless_horseman_pumpkin);
}