From 38cb6ace25f9a7ebaf3e35089484f2761d648f70 Mon Sep 17 00:00:00 2001 From: Paul <60552737+demetrzz@users.noreply.github.com> Date: Tue, 15 Jul 2025 10:05:56 +0300 Subject: [PATCH] fix(Core/Spells): Fixed explosive shot ammo consumption (#21501) Co-authored-by: pavel_k Co-authored-by: Jelle Meeus --- .../rev_1752529849711771043.sql | 3 +++ src/server/game/Spells/Spell.cpp | 2 +- src/server/scripts/Spells/spell_hunter.cpp | 22 +++++++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 data/sql/updates/pending_db_world/rev_1752529849711771043.sql diff --git a/data/sql/updates/pending_db_world/rev_1752529849711771043.sql b/data/sql/updates/pending_db_world/rev_1752529849711771043.sql new file mode 100644 index 000000000..22f93567c --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1752529849711771043.sql @@ -0,0 +1,3 @@ +-- +DELETE FROM `spell_script_names` WHERE `spell_id` = -53301 AND `ScriptName` = 'spell_hun_explosive_shot'; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES (-53301, 'spell_hun_explosive_shot'); diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 6985ed536..383010b11 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -5405,7 +5405,7 @@ void Spell::TakePower() void Spell::TakeAmmo() { - if (m_attackType == RANGED_ATTACK && m_caster->IsPlayer()) + if (m_attackType == RANGED_ATTACK && m_caster->IsPlayer() && !m_spellInfo->HasAttribute(SPELL_ATTR6_DO_NOT_CONSUME_RESOURCES)) { Item* pItem = m_caster->ToPlayer()->GetWeaponForAttack(RANGED_ATTACK); diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp index 0f4013298..9a375c846 100644 --- a/src/server/scripts/Spells/spell_hunter.cpp +++ b/src/server/scripts/Spells/spell_hunter.cpp @@ -1347,6 +1347,27 @@ class spell_hun_target_self_and_pet : public SpellScript } }; +// -53301 - Explosive Shot +class spell_hun_explosive_shot : public SpellScript +{ + PrepareSpellScript(spell_hun_explosive_shot); + + void HandleFinish() + { + // Handling of explosive shot initial cast without LnL proc + if (!GetCaster() || !GetCaster()->IsPlayer()) + return; + + if (!GetCaster()->HasAura(SPELL_LOCK_AND_LOAD_TRIGGER)) + GetSpell()->TakeAmmo(); + } + + void Register() override + { + AfterCast += SpellCastFn(spell_hun_explosive_shot::HandleFinish); + } +}; + void AddSC_hunter_spell_scripts() { RegisterSpellScript(spell_hun_check_pet_los); @@ -1378,4 +1399,5 @@ void AddSC_hunter_spell_scripts() RegisterSpellScript(spell_hun_intimidation); RegisterSpellScript(spell_hun_bestial_wrath); RegisterSpellScript(spell_hun_target_self_and_pet); + RegisterSpellScript(spell_hun_explosive_shot); }