From 5247c2814a990c685bebba2ed0e49fdbd03f8320 Mon Sep 17 00:00:00 2001 From: killerwife Date: Sat, 28 Oct 2023 20:33:58 +0200 Subject: [PATCH] Icecrown: Implement s.56683 and s.56684 --- sql/scriptdev2/spell.sql | 2 + .../scripts/northrend/icecrown.cpp | 51 +++++++++++++++++++ 2 files changed, 53 insertions(+) diff --git a/sql/scriptdev2/spell.sql b/sql/scriptdev2/spell.sql index 3bbe50131ab..bf8fc70e63f 100644 --- a/sql/scriptdev2/spell.sql +++ b/sql/scriptdev2/spell.sql @@ -862,6 +862,8 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES (56265,'spell_vortex_aura'), (56266,'spell_vortex_aura'), (56430,'spell_arcane_bomb'), +(56683,'spell_grab_captured_crusader'), +(56684,'spell_drop_off_captured_crusader'), (57073,'spell_drink'), (57082,'spell_crystal_spikes'), (57083,'spell_crystal_spikes'), diff --git a/src/game/AI/ScriptDevAI/scripts/northrend/icecrown.cpp b/src/game/AI/ScriptDevAI/scripts/northrend/icecrown.cpp index 065007af37c..f63e9cb01c9 100644 --- a/src/game/AI/ScriptDevAI/scripts/northrend/icecrown.cpp +++ b/src/game/AI/ScriptDevAI/scripts/northrend/icecrown.cpp @@ -31,6 +31,7 @@ EndContentData */ #include "AI/ScriptDevAI/include/sc_common.h" #include "AI/ScriptDevAI/base/escort_ai.h" +#include "Entities/Vehicle.h" /*###### ## npc_squad_leader @@ -977,6 +978,54 @@ struct spell_create_lance : public SpellScript } }; +// 56683 - Grab Captured Crusader +struct GrabCapturedCrusader : public SpellScript +{ + SpellCastResult OnCheckCast(Spell* spell, bool /*strict*/) const override + { + if (VehicleInfo* vehicle = spell->GetCaster()->GetVehicleInfo()) + { + if (vehicle->GetPassenger(1) != nullptr) + { + spell->SetParam1(SPELL_FAILED_CUSTOM_ERROR_43); + return SPELL_FAILED_CUSTOM_ERROR; + } + } + return SPELL_CAST_OK; + } + + void OnEffectExecute(Spell* spell, SpellEffectIndex /*effIdx*/) const override + { + if (!spell->GetUnitTarget()) + return; + + spell->GetUnitTarget()->CastSpell(spell->GetCaster(), spell->GetDamage(), TRIGGERED_OLD_TRIGGERED); + } +}; + +// 56684 - Drop Off Captured Crusader +struct DropOffCapturedCrusader : public SpellScript +{ + SpellCastResult OnCheckCast(Spell* spell, bool /*strict*/) const override + { + if (VehicleInfo* vehicle = spell->GetCaster()->GetVehicleInfo()) + { + if (vehicle->GetPassenger(1) == nullptr) + { + spell->SetParam1(SPELL_FAILED_CUSTOM_ERROR_41); + return SPELL_FAILED_CUSTOM_ERROR; + } + } + return SPELL_CAST_OK; + } + + void OnEffectExecute(Spell* spell, SpellEffectIndex /*effIdx*/) const override + { + if (VehicleInfo* vehicle = spell->GetCaster()->GetVehicleInfo()) + vehicle->UnBoard(vehicle->GetPassenger(1), false); + } +}; + void AddSC_icecrown() { Script* pNewScript = new Script; @@ -1009,4 +1058,6 @@ void AddSC_icecrown() pNewScript->RegisterSelf(); RegisterSpellScript("spell_create_lance"); + RegisterSpellScript("spell_grab_captured_crusader"); + RegisterSpellScript("spell_drop_off_captured_crusader"); }