Scripts/Spells: Allow using templated spell script with multiple template arguments in RegisterSpellScriptWithArgs

* Also fixed some script conversion issues
This commit is contained in:
Shauren
2023-07-19 13:44:18 +02:00
parent 5be076b240
commit d949f86e28
5 changed files with 62 additions and 83 deletions
+13 -24
View File
@@ -2200,33 +2200,22 @@ class spell_gen_interrupt : public AuraScript
}
};
class spell_gen_increase_stats_buff : public SpellScriptLoader
class spell_gen_increase_stats_buff : public SpellScript
{
public:
spell_gen_increase_stats_buff(char const* scriptName) : SpellScriptLoader(scriptName) { }
PrepareSpellScript(spell_gen_increase_stats_buff);
class spell_gen_increase_stats_buff_SpellScript : public SpellScript
{
PrepareSpellScript(spell_gen_increase_stats_buff_SpellScript);
void HandleDummy(SpellEffIndex /*effIndex*/)
{
if (GetHitUnit()->IsInRaidWith(GetCaster()))
GetCaster()->CastSpell(GetCaster(), GetEffectValue() + 1, true); // raid buff
else
GetCaster()->CastSpell(GetHitUnit(), GetEffectValue(), true); // single-target buff
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
if (GetHitUnit()->IsInRaidWith(GetCaster()))
GetCaster()->CastSpell(GetCaster(), GetEffectValue() + 1, true); // raid buff
else
GetCaster()->CastSpell(GetHitUnit(), GetEffectValue(), true); // single-target buff
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_gen_increase_stats_buff_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_gen_increase_stats_buff_SpellScript();
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_gen_increase_stats_buff::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
enum GenericLifebloom