From d9f4ba5e1d4cc762ed766eb3afd7975385933fcf Mon Sep 17 00:00:00 2001 From: Andrew <47818697+Nyeriah@users.noreply.github.com> Date: Fri, 5 Jul 2024 06:32:33 -0300 Subject: [PATCH] =?UTF-8?q?fix(Scripts/Item):=20Fix=20Fel=20Mana=20Potion?= =?UTF-8?q?=20not=20benefiting=20from=20Alchemist'=E2=80=A6=20(#19281)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix(Scripts/Item): Fix Fel Mana Potion not benefiting from Alchemist's Stone --- .../rev_1720136214539685800.sql | 4 +++ src/server/scripts/Spells/spell_item.cpp | 33 +++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 data/sql/updates/pending_db_world/rev_1720136214539685800.sql diff --git a/data/sql/updates/pending_db_world/rev_1720136214539685800.sql b/data/sql/updates/pending_db_world/rev_1720136214539685800.sql new file mode 100644 index 000000000..bbdea5293 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1720136214539685800.sql @@ -0,0 +1,4 @@ +-- +DELETE FROM `spell_script_names` WHERE `spell_id` = 38929; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(38929, 'spell_item_fel_mana_potion'); diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index 654d14a63..9eb2652ab 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -3990,6 +3990,38 @@ class spell_item_eye_of_grillok_aura : public AuraScript } }; +enum FelManaPotion +{ + SPELL_FEL_MANA_POTION = 38929, + SPELL_ALCHEMIST_STONE = 17619, + SPELL_ALCHEMIST_STONE_ENERGIZE = 21400 +}; + +class spell_item_fel_mana_potion : public AuraScript +{ + PrepareAuraScript(spell_item_fel_mana_potion) + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_ALCHEMIST_STONE, SPELL_ALCHEMIST_STONE_ENERGIZE }); + } + + void OnPeriodic(AuraEffect const* aurEff) + { + if (Unit* caster = GetCaster()) + if (caster->HasAura(SPELL_ALCHEMIST_STONE)) + { + uint32 val = GetSpellInfo()->Effects[EFFECT_0].BasePoints * 0.4f; + caster->CastCustomSpell(SPELL_ALCHEMIST_STONE_ENERGIZE, SPELLVALUE_BASE_POINT0, val, caster, true); + } + } + + void Register() override + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_item_fel_mana_potion::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_ENERGIZE); + } +}; + void AddSC_item_spell_scripts() { RegisterSpellScript(spell_item_massive_seaforium_charge); @@ -4112,5 +4144,6 @@ void AddSC_item_spell_scripts() RegisterSpellScript(spell_item_venomhide_feed); RegisterSpellScript(spell_item_scroll_of_retribution); RegisterSpellAndAuraScriptPair(spell_item_eye_of_grillok, spell_item_eye_of_grillok_aura); + RegisterSpellScript(spell_item_fel_mana_potion); }