diff --git a/data/sql/updates/pending_db_world/rev_1772229530522788254.sql b/data/sql/updates/pending_db_world/rev_1772229530522788254.sql new file mode 100644 index 000000000..8f86ea35d --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1772229530522788254.sql @@ -0,0 +1,3 @@ +-- Add CheckCast script for Kill Command to prevent casting without a pet +DELETE FROM `spell_script_names` WHERE `spell_id` = 34026 AND `ScriptName` = 'spell_hun_kill_command'; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES (34026, 'spell_hun_kill_command'); diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp index fce48f898..9c19518e0 100644 --- a/src/server/scripts/Spells/spell_hunter.cpp +++ b/src/server/scripts/Spells/spell_hunter.cpp @@ -1518,6 +1518,30 @@ class spell_hun_explosive_shot : public SpellScript } }; +// 34026 - Kill Command +class spell_hun_kill_command : public SpellScript +{ + PrepareSpellScript(spell_hun_kill_command); + + SpellCastResult CheckCast() + { + Unit* caster = GetCaster(); + if (!caster || !caster->IsPlayer()) + return SPELL_FAILED_NO_VALID_TARGETS; + + Pet* pet = caster->ToPlayer()->GetPet(); + if (!pet) + return SPELL_FAILED_NO_PET; + + return SPELL_CAST_OK; + } + + void Register() override + { + OnCheckCast += SpellCheckCastFn(spell_hun_kill_command::CheckCast); + } +}; + // 58914 - Kill Command (Pet Aura) class spell_hun_kill_command_pet : public AuraScript { @@ -1704,6 +1728,7 @@ void AddSC_hunter_spell_scripts() RegisterSpellScript(spell_hun_glyph_of_mend_pet); // Proc system scripts RegisterSpellScript(spell_hun_rapid_recuperation); + RegisterSpellScript(spell_hun_kill_command); RegisterSpellScript(spell_hun_kill_command_pet); RegisterSpellScript(spell_hun_piercing_shots); RegisterSpellScript(spell_hun_rapid_recuperation_trigger);