refactor(Scripts/TempestKeep): Spell Scripts use registry macros (#19123)

* init sql

* instance_the_eye aura:spell_the_eye_countercharge_aura

* instance_the_botanica aura:spell_botanica_call_of_the_falcon_aura

* instance_the_botanica aura:spell_botanica_shift_form_aura

* arcatraz aura:spell_arcatraz_soul_steal_aura
This commit is contained in:
Jelle Meeus
2024-06-22 10:19:43 +02:00
committed by GitHub
parent e83e343aec
commit f65283c35a
4 changed files with 122 additions and 156 deletions

View File

@@ -145,37 +145,26 @@ public:
}
};
class spell_the_eye_countercharge : public SpellScriptLoader
class spell_the_eye_countercharge_aura : public AuraScript
{
public:
spell_the_eye_countercharge() : SpellScriptLoader("spell_the_eye_countercharge") { }
PrepareAuraScript(spell_the_eye_countercharge_aura);
class spell_the_eye_counterchargeScript : public AuraScript
bool PrepareProc(ProcEventInfo& /*eventInfo*/)
{
PrepareAuraScript(spell_the_eye_counterchargeScript);
// xinef: prevent charge drop
PreventDefaultAction();
return true;
}
bool PrepareProc(ProcEventInfo& /*eventInfo*/)
{
// xinef: prevent charge drop
PreventDefaultAction();
return true;
}
void Register() override
{
DoCheckProc += AuraCheckProcFn(spell_the_eye_counterchargeScript::PrepareProc);
}
};
AuraScript* GetAuraScript() const override
void Register() override
{
return new spell_the_eye_counterchargeScript();
DoCheckProc += AuraCheckProcFn(spell_the_eye_countercharge_aura::PrepareProc);
}
};
void AddSC_instance_the_eye()
{
new instance_the_eye();
new spell_the_eye_countercharge();
RegisterSpellScript(spell_the_eye_countercharge_aura);
}

View File

@@ -585,37 +585,31 @@ public:
}
};
class spell_arcatraz_soul_steal : public SpellScriptLoader
class spell_arcatraz_soul_steal_aura : public AuraScript
{
public:
spell_arcatraz_soul_steal() : SpellScriptLoader("spell_arcatraz_soul_steal") { }
PrepareAuraScript(spell_arcatraz_soul_steal_aura);
class spell_arcatraz_soul_steal_AuraScript : public AuraScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareAuraScript(spell_arcatraz_soul_steal_AuraScript)
return ValidateSpellInfo({ SPELL_SOUL_STEAL });
}
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Unit* caster = GetCaster())
caster->CastSpell(caster, SPELL_SOUL_STEAL, true);
}
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Unit* caster = GetCaster())
caster->RemoveAurasDueToSpell(SPELL_SOUL_STEAL);
}
void Register() override
{
OnEffectApply += AuraEffectApplyFn(spell_arcatraz_soul_steal_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE, AURA_EFFECT_HANDLE_REAL);
OnEffectRemove += AuraEffectRemoveFn(spell_arcatraz_soul_steal_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
return new spell_arcatraz_soul_steal_AuraScript();
if (Unit* caster = GetCaster())
caster->CastSpell(caster, SPELL_SOUL_STEAL, true);
}
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Unit* caster = GetCaster())
caster->RemoveAurasDueToSpell(SPELL_SOUL_STEAL);
}
void Register() override
{
OnEffectApply += AuraEffectApplyFn(spell_arcatraz_soul_steal_aura::HandleEffectApply, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE, AURA_EFFECT_HANDLE_REAL);
OnEffectRemove += AuraEffectRemoveFn(spell_arcatraz_soul_steal_aura::HandleEffectRemove, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE, AURA_EFFECT_HANDLE_REAL);
}
};
@@ -624,6 +618,6 @@ void AddSC_arcatraz()
new npc_millhouse_manastorm();
new npc_warden_mellichar();
new spell_arcatraz_soul_steal();
RegisterSpellScript(spell_arcatraz_soul_steal_aura);
}

View File

@@ -42,136 +42,114 @@ public:
}
};
class spell_botanica_call_of_the_falcon : public SpellScriptLoader
class spell_botanica_call_of_the_falcon_aura : public AuraScript
{
public:
spell_botanica_call_of_the_falcon() : SpellScriptLoader("spell_botanica_call_of_the_falcon") { }
PrepareAuraScript(spell_botanica_call_of_the_falcon_aura);
class spell_botanica_call_of_the_falcon_AuraScript : public AuraScript
bool Load() override
{
PrepareAuraScript(spell_botanica_call_of_the_falcon_AuraScript)
bool Load() override
{
_falconSet.clear();
return true;
}
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
std::list<Creature*> creatureList;
GetUnitOwner()->GetCreaturesWithEntryInRange(creatureList, 80.0f, NPC_BLOODFALCON);
for (std::list<Creature*>::const_iterator itr = creatureList.begin(); itr != creatureList.end(); ++itr)
{
(*itr)->TauntApply(GetUnitOwner());
(*itr)->AddThreat(GetUnitOwner(), 10000000.0f);
_falconSet.insert((*itr)->GetGUID());
}
}
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
for (ObjectGuid const& guid : _falconSet)
if (Creature* falcon = ObjectAccessor::GetCreature(*GetUnitOwner(), guid))
{
falcon->TauntFadeOut(GetUnitOwner());
falcon->AddThreat(GetUnitOwner(), -10000000.0f);
}
}
void Register() override
{
OnEffectApply += AuraEffectApplyFn(spell_botanica_call_of_the_falcon_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
OnEffectRemove += AuraEffectRemoveFn(spell_botanica_call_of_the_falcon_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
private:
GuidSet _falconSet;
};
AuraScript* GetAuraScript() const override
{
return new spell_botanica_call_of_the_falcon_AuraScript();
_falconSet.clear();
return true;
}
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
std::list<Creature*> creatureList;
GetUnitOwner()->GetCreaturesWithEntryInRange(creatureList, 80.0f, NPC_BLOODFALCON);
for (std::list<Creature*>::const_iterator itr = creatureList.begin(); itr != creatureList.end(); ++itr)
{
(*itr)->TauntApply(GetUnitOwner());
(*itr)->AddThreat(GetUnitOwner(), 10000000.0f);
_falconSet.insert((*itr)->GetGUID());
}
}
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
for (ObjectGuid const& guid : _falconSet)
if (Creature* falcon = ObjectAccessor::GetCreature(*GetUnitOwner(), guid))
{
falcon->TauntFadeOut(GetUnitOwner());
falcon->AddThreat(GetUnitOwner(), -10000000.0f);
}
}
void Register() override
{
OnEffectApply += AuraEffectApplyFn(spell_botanica_call_of_the_falcon_aura::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
OnEffectRemove += AuraEffectRemoveFn(spell_botanica_call_of_the_falcon_aura::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
private:
GuidSet _falconSet;
};
class spell_botanica_shift_form : public SpellScriptLoader
class spell_botanica_shift_form_aura : public AuraScript
{
public:
spell_botanica_shift_form() : SpellScriptLoader("spell_botanica_shift_form") { }
PrepareAuraScript(spell_botanica_shift_form_aura);
class spell_botanica_shift_form_AuraScript : public AuraScript
bool Load() override
{
PrepareAuraScript(spell_botanica_shift_form_AuraScript);
_lastSchool = 0;
_lastForm = 0;
_swapTime = 0;
return true;
}
bool Load() override
bool CheckProc(ProcEventInfo& eventInfo)
{
if (SpellInfo const* spellInfo = eventInfo.GetSpellInfo())
{
_lastSchool = 0;
_lastForm = 0;
_swapTime = 0;
return true;
}
if ((spellInfo->GetSchoolMask() & _lastSchool) && _swapTime > GameTime::GetGameTime().count())
return false;
bool CheckProc(ProcEventInfo& eventInfo)
{
if (SpellInfo const* spellInfo = eventInfo.GetSpellInfo())
uint32 form = 0;
switch (GetFirstSchoolInMask(spellInfo->GetSchoolMask()))
{
if ((spellInfo->GetSchoolMask() & _lastSchool) && _swapTime > GameTime::GetGameTime().count())
return false;
uint32 form = 0;
switch (GetFirstSchoolInMask(spellInfo->GetSchoolMask()))
{
case SPELL_SCHOOL_FIRE:
form = SPELL_FIRE_FORM;
break;
case SPELL_SCHOOL_FROST:
form = SPELL_FROST_FORM;
break;
case SPELL_SCHOOL_ARCANE:
form = SPELL_ARCANE_FORM;
break;
case SPELL_SCHOOL_SHADOW:
form = SPELL_SHADOW_FORM;
break;
default:
break;
}
if (form)
{
_swapTime = GameTime::GetGameTime().count() + 6;
_lastSchool = spellInfo->GetSchoolMask();
GetUnitOwner()->RemoveAurasDueToSpell(_lastForm);
_lastForm = form;
GetUnitOwner()->CastSpell(GetUnitOwner(), _lastForm, true);
}
case SPELL_SCHOOL_FIRE:
form = SPELL_FIRE_FORM;
break;
case SPELL_SCHOOL_FROST:
form = SPELL_FROST_FORM;
break;
case SPELL_SCHOOL_ARCANE:
form = SPELL_ARCANE_FORM;
break;
case SPELL_SCHOOL_SHADOW:
form = SPELL_SHADOW_FORM;
break;
default:
break;
}
return false;
if (form)
{
_swapTime = GameTime::GetGameTime().count() + 6;
_lastSchool = spellInfo->GetSchoolMask();
GetUnitOwner()->RemoveAurasDueToSpell(_lastForm);
_lastForm = form;
GetUnitOwner()->CastSpell(GetUnitOwner(), _lastForm, true);
}
}
void Register() override
{
DoCheckProc += AuraCheckProcFn(spell_botanica_shift_form_AuraScript::CheckProc);
}
private:
uint32 _lastSchool;
uint32 _lastForm;
uint32 _swapTime;
};
AuraScript* GetAuraScript() const override
{
return new spell_botanica_shift_form_AuraScript();
return false;
}
void Register() override
{
DoCheckProc += AuraCheckProcFn(spell_botanica_shift_form_aura::CheckProc);
}
private:
uint32 _lastSchool;
uint32 _lastForm;
uint32 _swapTime;
};
void AddSC_instance_the_botanica()
{
new instance_the_botanica();
new spell_botanica_call_of_the_falcon();
new spell_botanica_shift_form();
RegisterSpellScript(spell_botanica_call_of_the_falcon_aura);
RegisterSpellScript(spell_botanica_shift_form_aura);
}