refactor(Scripts/EasternKingdoms): spell scripts use registry macros (#20399)

This commit is contained in:
Jelle Meeus
2024-11-01 20:54:41 +01:00
committed by GitHub
parent bbbcaac77c
commit 7410175a08
9 changed files with 308 additions and 433 deletions
@@ -710,44 +710,33 @@ private:
InstanceScript* instance;
};
class spell_threatening_gaze : public SpellScriptLoader
class spell_threatening_gaze_aura : public AuraScript
{
public:
spell_threatening_gaze() : SpellScriptLoader("spell_threatening_gaze") { }
PrepareAuraScript(spell_threatening_gaze_aura);
class spell_threatening_gaze_AuraScript : public AuraScript
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
PrepareAuraScript(spell_threatening_gaze_AuraScript);
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
{
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
if (Unit* target = GetTarget())
{
if (Unit* target = GetTarget())
if (Unit* caster = GetCaster())
{
if (Unit* caster = GetCaster())
if (Creature* cCaster = caster->ToCreature())
{
if (Creature* cCaster = caster->ToCreature())
if (cCaster->IsAIEnabled)
{
if (cCaster->IsAIEnabled)
{
cCaster->AI()->SetGUID(target->GetGUID(), ACTION_CHARGE);
}
cCaster->AI()->SetGUID(target->GetGUID(), ACTION_CHARGE);
}
}
}
}
}
}
void Register() override
{
OnEffectRemove += AuraEffectRemoveFn(spell_threatening_gaze_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
void Register() override
{
return new spell_threatening_gaze_AuraScript();
OnEffectRemove += AuraEffectRemoveFn(spell_threatening_gaze_aura::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
@@ -798,7 +787,7 @@ void AddSC_boss_mandokir()
new npc_ohgan();
RegisterZulGurubCreatureAI(npc_chained_spirit);
RegisterZulGurubCreatureAI(npc_vilebranch_speaker);
new spell_threatening_gaze();
RegisterSpellScript(spell_threatening_gaze_aura);
RegisterSpellScript(spell_mandokir_charge);
RegisterSpellScript(spell_threatening_gaze_charge);
}