refactor(Scripts/Kalimdor): Spell Scripts registry macros (#19185)

* zone_dustwallow_marsh spell:spell_ooze_zap

* zone_dustwallow_marsh spell:spell_ooze_zap_channel_end

* zone_dustwallow_marsh spell:spell_energize_aoe

* zone_feralas spell:spell_gordunni_trap

* zone_durotar aura:spell_mount_check_aura

* zone_durotar spell:spell_voljin_war_drums

* zone_durotar spell:spell_voodoo

* boss_salramm aura:spell_boss_salramm_steal_flesh_aura

* instance_zulfarrak spell:spell_zulfarrak_summon_zulfarrak_zombies

* instance_zulfarrak spell:spell_zulfarrak_unlocking
This commit is contained in:
Jelle Meeus
2024-06-26 22:26:35 +02:00
committed by GitHub
parent b259ec6df7
commit a9c93cc94e
6 changed files with 210 additions and 312 deletions
@@ -0,0 +1,3 @@
--
UPDATE `spell_script_names` SET `ScriptName`='spell_mount_check_aura' WHERE `spell_id`=75420;
UPDATE `spell_script_names` SET `ScriptName`='spell_boss_salramm_steal_flesh_aura' WHERE `spell_id`=52708;
@@ -161,14 +161,14 @@ public:
};
};
class spell_boss_salramm_steal_flesh : public SpellScriptLoader
class spell_boss_salramm_steal_flesh_aura : public AuraScript
{
public:
spell_boss_salramm_steal_flesh() : SpellScriptLoader("spell_boss_salramm_steal_flesh") { }
PrepareAuraScript(spell_boss_salramm_steal_flesh_aura);
class spell_boss_salramm_steal_flesh_AuraScript : public AuraScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareAuraScript(spell_boss_salramm_steal_flesh_AuraScript);
return ValidateSpellInfo({ SPELL_STEAL_FLESH_CASTER, SPELL_STEAL_FLESH_TARGET });
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
@@ -183,19 +183,13 @@ public:
void Register() override
{
AfterEffectRemove += AuraEffectRemoveFn(spell_boss_salramm_steal_flesh_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_boss_salramm_steal_flesh_AuraScript();
AfterEffectRemove += AuraEffectRemoveFn(spell_boss_salramm_steal_flesh_aura::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
void AddSC_boss_salramm()
{
new boss_salramm();
new spell_boss_salramm_steal_flesh();
RegisterSpellScript(spell_boss_salramm_steal_flesh_aura);
}
@@ -457,14 +457,9 @@ public:
};
// 10247 - Summon Zul'Farrak Zombies
class spell_zulfarrak_summon_zulfarrak_zombies : public SpellScriptLoader
class spell_zulfarrak_summon_zulfarrak_zombies : public SpellScript
{
public:
spell_zulfarrak_summon_zulfarrak_zombies() : SpellScriptLoader("spell_zulfarrak_summon_zulfarrak_zombies") { }
class spell_zulfarrak_summon_zulfarrak_zombies_SpellScript : public SpellScript
{
PrepareSpellScript(spell_zulfarrak_summon_zulfarrak_zombies_SpellScript);
PrepareSpellScript(spell_zulfarrak_summon_zulfarrak_zombies);
void HandleSummon(SpellEffIndex effIndex)
{
@@ -485,26 +480,15 @@ public:
void Register() override
{
OnEffectHit += SpellEffectFn(spell_zulfarrak_summon_zulfarrak_zombies_SpellScript::HandleSummon, EFFECT_0, SPELL_EFFECT_SUMMON);
OnEffectHit += SpellEffectFn(spell_zulfarrak_summon_zulfarrak_zombies_SpellScript::HandleSummon, EFFECT_1, SPELL_EFFECT_SUMMON);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_zulfarrak_summon_zulfarrak_zombies_SpellScript;
OnEffectHit += SpellEffectFn(spell_zulfarrak_summon_zulfarrak_zombies::HandleSummon, EFFECT_0, SPELL_EFFECT_SUMMON);
OnEffectHit += SpellEffectFn(spell_zulfarrak_summon_zulfarrak_zombies::HandleSummon, EFFECT_1, SPELL_EFFECT_SUMMON);
}
};
// 10738 - Unlocking
class spell_zulfarrak_unlocking : public SpellScriptLoader
class spell_zulfarrak_unlocking : public SpellScript
{
public:
spell_zulfarrak_unlocking() : SpellScriptLoader("spell_zulfarrak_unlocking") { }
class spell_zulfarrak_unlocking_SpellScript : public SpellScript
{
PrepareSpellScript(spell_zulfarrak_unlocking_SpellScript);
PrepareSpellScript(spell_zulfarrak_unlocking);
void HandleOpenLock(SpellEffIndex /*effIndex*/)
{
@@ -523,20 +507,14 @@ public:
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_zulfarrak_unlocking_SpellScript::HandleOpenLock, EFFECT_0, SPELL_EFFECT_OPEN_LOCK);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_zulfarrak_unlocking_SpellScript();
OnEffectHitTarget += SpellEffectFn(spell_zulfarrak_unlocking::HandleOpenLock, EFFECT_0, SPELL_EFFECT_OPEN_LOCK);
}
};
void AddSC_instance_zulfarrak()
{
new instance_zulfarrak();
new spell_zulfarrak_summon_zulfarrak_zombies();
new spell_zulfarrak_unlocking();
RegisterSpellScript(spell_zulfarrak_summon_zulfarrak_zombies);
RegisterSpellScript(spell_zulfarrak_unlocking);
}
+12 -45
View File
@@ -361,14 +361,9 @@ public:
typedef npc_troll_volunteer::npc_troll_volunteerAI VolunteerAI;
class spell_mount_check : public SpellScriptLoader
class spell_mount_check_aura : public AuraScript
{
public:
spell_mount_check() : SpellScriptLoader("spell_mount_check") { }
class spell_mount_check_AuraScript : public AuraScript
{
PrepareAuraScript(spell_mount_check_AuraScript)
PrepareAuraScript(spell_mount_check_aura);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
@@ -397,24 +392,13 @@ public:
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_mount_check_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_mount_check_AuraScript();
OnEffectPeriodic += AuraEffectPeriodicFn(spell_mount_check_aura::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
class spell_voljin_war_drums : public SpellScriptLoader
class spell_voljin_war_drums : public SpellScript
{
public:
spell_voljin_war_drums() : SpellScriptLoader("spell_voljin_war_drums") { }
class spell_voljin_war_drums_SpellScript : public SpellScript
{
PrepareSpellScript(spell_voljin_war_drums_SpellScript)
PrepareSpellScript(spell_voljin_war_drums);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
@@ -438,13 +422,7 @@ public:
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_voljin_war_drums_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_voljin_war_drums_SpellScript();
OnEffectHitTarget += SpellEffectFn(spell_voljin_war_drums::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
@@ -460,14 +438,9 @@ enum VoodooSpells
};
// 17009
class spell_voodoo : public SpellScriptLoader
class spell_voodoo : public SpellScript
{
public:
spell_voodoo() : SpellScriptLoader("spell_voodoo") { }
class spell_voodoo_SpellScript : public SpellScript
{
PrepareSpellScript(spell_voodoo_SpellScript)
PrepareSpellScript(spell_voodoo);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
@@ -492,13 +465,7 @@ public:
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_voodoo_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_voodoo_SpellScript();
OnEffectHitTarget += SpellEffectFn(spell_voodoo::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
@@ -507,8 +474,8 @@ void AddSC_durotar()
new npc_tiger_matriarch_credit();
new npc_tiger_matriarch();
new npc_troll_volunteer();
new spell_mount_check();
new spell_voljin_war_drums();
new spell_voodoo();
RegisterSpellScript(spell_mount_check_aura);
RegisterSpellScript(spell_voljin_war_drums);
RegisterSpellScript(spell_voodoo);
}
@@ -30,14 +30,9 @@ enum SpellScripts
SPELL_ENERGIZED = 42492,
};
class spell_ooze_zap : public SpellScriptLoader
class spell_ooze_zap : public SpellScript
{
public:
spell_ooze_zap() : SpellScriptLoader("spell_ooze_zap") { }
class spell_ooze_zap_SpellScript : public SpellScript
{
PrepareSpellScript(spell_ooze_zap_SpellScript);
PrepareSpellScript(spell_ooze_zap);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
@@ -64,25 +59,14 @@ public:
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_ooze_zap_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
OnCheckCast += SpellCheckCastFn(spell_ooze_zap_SpellScript::CheckRequirement);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_ooze_zap_SpellScript();
OnEffectHitTarget += SpellEffectFn(spell_ooze_zap::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
OnCheckCast += SpellCheckCastFn(spell_ooze_zap::CheckRequirement);
}
};
class spell_ooze_zap_channel_end : public SpellScriptLoader
class spell_ooze_zap_channel_end : public SpellScript
{
public:
spell_ooze_zap_channel_end() : SpellScriptLoader("spell_ooze_zap_channel_end") { }
class spell_ooze_zap_channel_end_SpellScript : public SpellScript
{
PrepareSpellScript(spell_ooze_zap_channel_end_SpellScript);
PrepareSpellScript(spell_ooze_zap_channel_end);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
@@ -99,24 +83,13 @@ public:
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_ooze_zap_channel_end_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_ooze_zap_channel_end_SpellScript();
OnEffectHitTarget += SpellEffectFn(spell_ooze_zap_channel_end::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
class spell_energize_aoe : public SpellScriptLoader
class spell_energize_aoe : public SpellScript
{
public:
spell_energize_aoe() : SpellScriptLoader("spell_energize_aoe") { }
class spell_energize_aoe_SpellScript : public SpellScript
{
PrepareSpellScript(spell_energize_aoe_SpellScript);
PrepareSpellScript(spell_energize_aoe);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
@@ -143,22 +116,16 @@ public:
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_energize_aoe_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_energize_aoe_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY);
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_energize_aoe_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENTRY);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_energize_aoe_SpellScript();
OnEffectHitTarget += SpellEffectFn(spell_energize_aoe::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_energize_aoe::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY);
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_energize_aoe::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENTRY);
}
};
void AddSC_dustwallow_marsh()
{
new spell_ooze_zap();
new spell_ooze_zap_channel_end();
new spell_energize_aoe();
RegisterSpellScript(spell_ooze_zap);
RegisterSpellScript(spell_ooze_zap_channel_end);
RegisterSpellScript(spell_energize_aoe);
}
+4 -15
View File
@@ -33,14 +33,9 @@ enum GordunniTrap
GO_GORDUNNI_DIRT_MOUND = 144064,
};
class spell_gordunni_trap : public SpellScriptLoader
class spell_gordunni_trap : public SpellScript
{
public:
spell_gordunni_trap() : SpellScriptLoader("spell_gordunni_trap") { }
class spell_gordunni_trap_SpellScript : public SpellScript
{
PrepareSpellScript(spell_gordunni_trap_SpellScript);
PrepareSpellScript(spell_gordunni_trap);
void HandleDummy()
{
@@ -54,18 +49,12 @@ public:
void Register() override
{
OnCast += SpellCastFn(spell_gordunni_trap_SpellScript::HandleDummy);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_gordunni_trap_SpellScript();
OnCast += SpellCastFn(spell_gordunni_trap::HandleDummy);
}
};
void AddSC_feralas()
{
new spell_gordunni_trap();
RegisterSpellScript(spell_gordunni_trap);
}