From 6260107fb35b2d1608457ddc5789e347fa663fa1 Mon Sep 17 00:00:00 2001 From: Grz3s Date: Wed, 4 Dec 2024 22:58:15 +0100 Subject: [PATCH] Icecrown: Spell 58203 Scripted target corrected Closes https://github.com/cmangos/mangos-wotlk/pull/579 --- sql/scriptdev2/spell.sql | 1 + .../scripts/northrend/icecrown.cpp | 24 +++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/sql/scriptdev2/spell.sql b/sql/scriptdev2/spell.sql index c29d95cd8b8..0c86f4b299b 100644 --- a/sql/scriptdev2/spell.sql +++ b/sql/scriptdev2/spell.sql @@ -913,6 +913,7 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES (57667,'spell_frozen_siegebolt'), (57669,'spell_replenishment'), (57853,'spell_master_summoners_staff'), +(58203,'spell_iron_chain'), (58418,'spell_portal_to_capital_city'), (58420,'spell_portal_to_capital_city'), (58524,'spell_control_eidolon_watcher'), diff --git a/src/game/AI/ScriptDevAI/scripts/northrend/icecrown.cpp b/src/game/AI/ScriptDevAI/scripts/northrend/icecrown.cpp index 16957af8dc9..9f43cc3c200 100644 --- a/src/game/AI/ScriptDevAI/scripts/northrend/icecrown.cpp +++ b/src/game/AI/ScriptDevAI/scripts/northrend/icecrown.cpp @@ -1317,6 +1317,29 @@ struct ControlEidolonWatcher : public SpellScript } }; +// 58203 - Iron Chain +struct IronChain : public SpellScript, public AuraScript +{ + SpellCastResult OnCheckCast(Spell* spell, bool /*strict*/) const override + { + Unit* target = spell->m_targets.getUnitTarget(); + if (!target || target->GetEntry() != 31075) + return SPELL_FAILED_BAD_TARGETS; + + return SPELL_CAST_OK; + } + void OnApply(Aura* aura, bool apply) const override + { + Unit* caster = aura->GetCaster(); + if (!caster || !aura->GetTarget()->IsCreature()) + return; + if (!apply) + return; + + aura->GetTarget()->GetMotionMaster()->MoveFollow(caster, 2.0f, M_PI_F, true); + } +}; + void AddSC_icecrown() { Script* pNewScript = new Script; @@ -1378,4 +1401,5 @@ void AddSC_icecrown() RegisterSpellScript("spell_burning_skeleton"); RegisterSpellScript("spell_refurbished_demolisher"); RegisterSpellScript("spell_control_eidolon_watcher"); + RegisterSpellScript("spell_iron_chain"); }