From b9188738dcf300d494c90c69502f488c9f1dcb5c Mon Sep 17 00:00:00 2001 From: Ovahlord Date: Sun, 1 Dec 2019 22:54:39 +0100 Subject: [PATCH] Core/Spells: updated T.N.T aurascript to new model and added missing proc entry --- .../custom/custom_2019_12_01_02_world.sql | 3 ++ src/server/scripts/Spells/spell_hunter.cpp | 53 ++++++++----------- 2 files changed, 24 insertions(+), 32 deletions(-) create mode 100644 sql/updates/world/custom/custom_2019_12_01_02_world.sql diff --git a/sql/updates/world/custom/custom_2019_12_01_02_world.sql b/sql/updates/world/custom/custom_2019_12_01_02_world.sql new file mode 100644 index 0000000000..50b88d37e9 --- /dev/null +++ b/sql/updates/world/custom/custom_2019_12_01_02_world.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_proc` WHERE `SpellId`= -56333; +INSERT INTO `spell_proc` (`SpellId`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `ProcFlags`, `SpellTypeMask`, `SpellPhaseMask`, `HitMask`, `Cooldown`, `Chance`) VALUES +(-56333, 9, 0, 0x08000000, 0x00020000 | 0x00004000, 0x00040000, 1, 2, 0, 0, 100); diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp index d640c17e88..3c7b963854 100644 --- a/src/server/scripts/Spells/spell_hunter.cpp +++ b/src/server/scripts/Spells/spell_hunter.cpp @@ -1241,42 +1241,31 @@ class spell_hun_thrill_of_the_hunt : public SpellScriptLoader }; // -56333 - T.N.T. -class spell_hun_tnt : public SpellScriptLoader +class spell_hun_tnt : public AuraScript { - public: - spell_hun_tnt() : SpellScriptLoader("spell_hun_tnt") { } + PrepareAuraScript(spell_hun_tnt); - class spell_hun_tnt_AuraScript : public AuraScript - { - PrepareAuraScript(spell_hun_tnt_AuraScript); + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_HUNTER_LOCK_AND_LOAD }); + } - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_HUNTER_LOCK_AND_LOAD }); - } + bool CheckProc(ProcEventInfo& /*eventInfo*/) + { + return roll_chance_i(GetEffect(EFFECT_0)->GetAmount()); + } - bool CheckProc(ProcEventInfo& /*eventInfo*/) - { - return roll_chance_i(GetEffect(EFFECT_0)->GetAmount()); - } + void HandleEffectProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/) + { + PreventDefaultAction(); + GetTarget()->CastSpell(GetTarget(), SPELL_HUNTER_LOCK_AND_LOAD, true, nullptr, aurEff); + } - void HandleEffectProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/) - { - PreventDefaultAction(); - GetTarget()->CastSpell(GetTarget(), SPELL_HUNTER_LOCK_AND_LOAD, true, nullptr, aurEff); - } - - void Register() override - { - DoCheckProc += AuraCheckProcFn(spell_hun_tnt_AuraScript::CheckProc); - OnEffectProc += AuraEffectProcFn(spell_hun_tnt_AuraScript::HandleEffectProc, EFFECT_0, SPELL_AURA_DUMMY); - } - }; - - AuraScript* GetAuraScript() const override - { - return new spell_hun_tnt_AuraScript(); - } + void Register() override + { + DoCheckProc += AuraCheckProcFn(spell_hun_tnt::CheckProc); + OnEffectProc += AuraEffectProcFn(spell_hun_tnt::HandleEffectProc, EFFECT_0, SPELL_AURA_DUMMY); + } }; // 76659 - Wild Quiver @@ -1724,7 +1713,7 @@ void AddSC_hunter_spell_scripts() new spell_hun_tame_beast(); new spell_hun_target_only_pet_and_owner(); new spell_hun_thrill_of_the_hunt(); - new spell_hun_tnt(); + RegisterAuraScript(spell_hun_tnt); RegisterAuraScript(spell_hun_trap_launcher); new spell_hun_wild_quiver(); }