mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-29 16:43:47 +00:00
refactor(Scripts/EasternKingdoms): spell scripts use registry macros (#20399)
This commit is contained in:
@@ -246,86 +246,64 @@ public:
|
||||
};
|
||||
};
|
||||
|
||||
class spell_scholomance_fixate : public SpellScriptLoader
|
||||
class spell_scholomance_fixate_aura : public AuraScript
|
||||
{
|
||||
public:
|
||||
spell_scholomance_fixate() : SpellScriptLoader("spell_scholomance_fixate") { }
|
||||
PrepareAuraScript(spell_scholomance_fixate_aura);
|
||||
|
||||
class spell_scholomance_fixate_AuraScript : public AuraScript
|
||||
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
PrepareAuraScript(spell_scholomance_fixate_AuraScript);
|
||||
Unit* target = GetTarget();
|
||||
if (Unit* caster = GetCaster())
|
||||
caster->TauntApply(target);
|
||||
}
|
||||
|
||||
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
if (Unit* caster = GetCaster())
|
||||
caster->TauntApply(target);
|
||||
}
|
||||
|
||||
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
if (Unit* caster = GetCaster())
|
||||
caster->TauntFadeOut(target);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectApply += AuraEffectApplyFn(spell_scholomance_fixate_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
|
||||
OnEffectRemove += AuraEffectRemoveFn(spell_scholomance_fixate_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
|
||||
}
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const override
|
||||
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
return new spell_scholomance_fixate_AuraScript();
|
||||
Unit* target = GetTarget();
|
||||
if (Unit* caster = GetCaster())
|
||||
caster->TauntFadeOut(target);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectApply += AuraEffectApplyFn(spell_scholomance_fixate_aura::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
|
||||
OnEffectRemove += AuraEffectRemoveFn(spell_scholomance_fixate_aura::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
|
||||
}
|
||||
};
|
||||
|
||||
class spell_scholomance_boon_of_life : public SpellScriptLoader
|
||||
class spell_scholomance_boon_of_life_aura : public AuraScript
|
||||
{
|
||||
public:
|
||||
spell_scholomance_boon_of_life() : SpellScriptLoader("spell_scholomance_boon_of_life") { }
|
||||
PrepareAuraScript(spell_scholomance_boon_of_life_aura);
|
||||
|
||||
class spell_scholomance_boon_of_life_AuraScript : public AuraScript
|
||||
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
PrepareAuraScript(spell_scholomance_boon_of_life_AuraScript);
|
||||
|
||||
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (Unit* caster = GetCaster())
|
||||
if (Unit* target = GetTarget())
|
||||
if (Creature* creature = target->ToCreature())
|
||||
{
|
||||
creature->AI()->AttackStart(caster);
|
||||
creature->AddThreat(caster, 10000.0f);
|
||||
}
|
||||
}
|
||||
|
||||
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (Unit* caster = GetCaster())
|
||||
if (Unit* target = GetTarget())
|
||||
if (Creature* creature = target->ToCreature())
|
||||
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_CANCEL)
|
||||
{
|
||||
creature->AI()->Talk(TALK_RAS_HUMAN);
|
||||
creature->SetDisplayId(MODEL_RAS_HUMAN);
|
||||
creature->SetHealth(target->GetMaxHealth());
|
||||
if (InstanceScript* instance = creature->GetInstanceScript())
|
||||
instance->SetData(DATA_RAS_HUMAN, 1);
|
||||
}
|
||||
}
|
||||
{
|
||||
creature->AI()->AttackStart(caster);
|
||||
creature->AddThreat(caster, 10000.0f);
|
||||
}
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectRemove += AuraEffectRemoveFn(spell_scholomance_boon_of_life_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
|
||||
AfterEffectApply += AuraEffectApplyFn(spell_scholomance_boon_of_life_AuraScript::OnApply, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
|
||||
}
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const override
|
||||
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
return new spell_scholomance_boon_of_life_AuraScript();
|
||||
if (Unit* target = GetTarget())
|
||||
if (Creature* creature = target->ToCreature())
|
||||
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_CANCEL)
|
||||
{
|
||||
creature->AI()->Talk(TALK_RAS_HUMAN);
|
||||
creature->SetDisplayId(MODEL_RAS_HUMAN);
|
||||
creature->SetHealth(target->GetMaxHealth());
|
||||
if (InstanceScript* instance = creature->GetInstanceScript())
|
||||
instance->SetData(DATA_RAS_HUMAN, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectRemove += AuraEffectRemoveFn(spell_scholomance_boon_of_life_aura::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
|
||||
AfterEffectApply += AuraEffectApplyFn(spell_scholomance_boon_of_life_aura::OnApply, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -460,7 +438,7 @@ public:
|
||||
void AddSC_instance_scholomance()
|
||||
{
|
||||
new instance_scholomance();
|
||||
new spell_scholomance_fixate();
|
||||
new spell_scholomance_boon_of_life();
|
||||
RegisterSpellScript(spell_scholomance_fixate_aura);
|
||||
RegisterSpellScript(spell_scholomance_boon_of_life_aura);
|
||||
new npc_scholomance_occultist();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user