Scripts/Spells: Move spell_anchor_here to generic because is used by more than one boss (#27641)

This commit is contained in:
Aqua Deus
2022-01-22 14:52:05 +01:00
committed by GitHub
parent c2dd07aa32
commit 0bbdfc6112
3 changed files with 19 additions and 29 deletions

View File

@@ -0,0 +1 @@
UPDATE `spell_script_names` SET `ScriptName` = 'spell_gen_anchor_here' WHERE `ScriptName` = 'spell_sc_anchor_here';

View File

@@ -297,34 +297,6 @@ class spell_force_of_earth : public SpellScriptLoader
}
};
// 45313 - Anchor Here
class spell_sc_anchor_here : public SpellScriptLoader
{
public:
spell_sc_anchor_here() : SpellScriptLoader("spell_sc_anchor_here") { }
class spell_sc_anchor_here_SpellScript : public SpellScript
{
PrepareSpellScript(spell_sc_anchor_here_SpellScript);
void HandleScript(SpellEffIndex /*effIndex*/)
{
if (Creature* creature = GetHitUnit()->ToCreature())
creature->SetHomePosition(creature->GetPositionX(), creature->GetPositionY(), creature->GetPositionZ(), creature->GetOrientation());
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_sc_anchor_here_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_sc_anchor_here_SpellScript();
}
};
// 93167 - Twilight Documents
class spell_sc_twilight_documents : public SpellScriptLoader
{
@@ -429,7 +401,6 @@ void AddSC_stonecore()
{
new npc_sc_millhouse_manastorm();
new spell_force_of_earth();
new spell_sc_anchor_here();
new spell_sc_twilight_documents();
new spell_sc_quake();
new at_sc_corborus_intro();

View File

@@ -4732,6 +4732,23 @@ class spell_summon_battle_pet : public SpellScript
}
};
// 45313 - Anchor Here
class spell_gen_anchor_here : public SpellScript
{
PrepareSpellScript(spell_gen_anchor_here);
void HandleScript(SpellEffIndex /*effIndex*/)
{
if (Creature* creature = GetHitCreature())
creature->SetHomePosition(creature->GetPositionX(), creature->GetPositionY(), creature->GetPositionZ(), creature->GetOrientation());
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_gen_anchor_here::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
void AddSC_generic_spell_scripts()
{
RegisterAuraScript(spell_gen_absorb0_hitlimit1);
@@ -4873,4 +4890,5 @@ void AddSC_generic_spell_scripts()
RegisterSpellScript(spell_defender_of_azeroth_death_gate_selector);
RegisterSpellScript(spell_defender_of_azeroth_speak_with_mograine);
RegisterSpellScript(spell_summon_battle_pet);
RegisterSpellScript(spell_gen_anchor_here);
}