From 26998d36bb5ab5703bd445d169eaeea8f519ca3d Mon Sep 17 00:00:00 2001 From: GMKyle Date: Tue, 5 Nov 2019 01:53:32 -0500 Subject: [PATCH] fix(Core/Spell): Eye of Gruul healing discount spell (#1913) --- .../rev_1559162254925218831.sql | 5 ++ src/server/scripts/Spells/spell_item.cpp | 70 ++++++++++++++++++- src/server/scripts/Spells/spell_paladin.cpp | 38 ---------- 3 files changed, 74 insertions(+), 39 deletions(-) create mode 100644 data/sql/updates/pending_db_world/rev_1559162254925218831.sql diff --git a/data/sql/updates/pending_db_world/rev_1559162254925218831.sql b/data/sql/updates/pending_db_world/rev_1559162254925218831.sql new file mode 100644 index 000000000..7204d0d5f --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1559162254925218831.sql @@ -0,0 +1,5 @@ +INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1559162254925218831'); + +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_pal_item_healing_discount' AND `spell_id`=37705; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(37705, 'spell_item_eye_of_gruul_healing_discount'); diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index 7f057d03a..8f326fcd4 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -1429,6 +1429,74 @@ class spell_item_direbrew_remote : public SpellScriptLoader } }; +enum EyeOfGruul +{ + SPELL_DRUID_ITEM_HEALING_TRANCE = 37721, + SPELL_PALADIN_ITEM_HEALING_TRANCE = 37723, + SPELL_PRIEST_ITEM_HEALING_TRANCE = 37706, + SPELL_SHAMAN_ITEM_HEALING_TRANCE = 37722 +}; + +// 37705 - Healing Discount +class spell_item_eye_of_gruul_healing_discount : public SpellScriptLoader +{ + public: + spell_item_eye_of_gruul_healing_discount() : SpellScriptLoader("spell_item_eye_of_gruul_healing_discount") { } + + class spell_item_eye_of_gruul_healing_discount_AuraScript : public AuraScript + { + PrepareAuraScript(spell_item_eye_of_gruul_healing_discount_AuraScript); + + bool Validate(SpellInfo const* /*spellInfo*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_DRUID_ITEM_HEALING_TRANCE) + || !sSpellMgr->GetSpellInfo(SPELL_PALADIN_ITEM_HEALING_TRANCE) + || !sSpellMgr->GetSpellInfo(SPELL_PRIEST_ITEM_HEALING_TRANCE) + || !sSpellMgr->GetSpellInfo(SPELL_SHAMAN_ITEM_HEALING_TRANCE)) + return false; + return true; + } + + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/) + { + PreventDefaultAction(); + if (Unit* unitTarget = GetTarget()) + { + uint32 spell_id = 0; + switch (unitTarget->getClass()) + { + case CLASS_DRUID: + spell_id = SPELL_DRUID_ITEM_HEALING_TRANCE; + break; + case CLASS_PALADIN: + spell_id = SPELL_PALADIN_ITEM_HEALING_TRANCE; + break; + case CLASS_PRIEST: + spell_id = SPELL_PRIEST_ITEM_HEALING_TRANCE; + break; + case CLASS_SHAMAN: + spell_id = SPELL_SHAMAN_ITEM_HEALING_TRANCE; + break; + default: + return; // ignore for non-healing classes + } + + unitTarget->CastSpell(unitTarget, spell_id, true, NULL, aurEff); + } + } + + void Register() + { + OnEffectProc += AuraEffectProcFn(spell_item_eye_of_gruul_healing_discount_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_item_eye_of_gruul_healing_discount_AuraScript(); + } +}; + enum eArgentKnight { SPELL_SUMMON_ARGENT_KNIGHT_ALLIANCE = 54296 @@ -1472,7 +1540,6 @@ class spell_item_summon_argent_knight : public SpellScriptLoader } }; - // Theirs // Generic script for handling item dummy effects which trigger another spell. class spell_item_trigger_spell : public SpellScriptLoader @@ -4046,6 +4113,7 @@ void AddSC_item_spell_scripts() new spell_item_summon_or_dismiss(); new spell_item_draenic_pale_ale(); new spell_item_direbrew_remote(); + new spell_item_eye_of_gruul_healing_discount(); new spell_item_summon_argent_knight(); // Theirs diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp index d39c42804..19cd23c67 100644 --- a/src/server/scripts/Spells/spell_paladin.cpp +++ b/src/server/scripts/Spells/spell_paladin.cpp @@ -45,8 +45,6 @@ enum PaladinSpells SPELL_PALADIN_HAND_OF_SACRIFICE = 6940, SPELL_PALADIN_DIVINE_SACRIFICE = 64205, - SPELL_PALADIN_ITEM_HEALING_TRANCE = 37706, - SPELL_PALADIN_JUDGEMENT_DAMAGE = 54158, SPELL_PALADIN_JUDGEMENT_OF_JUSTICE = 20184, SPELL_PALADIN_JUDGEMENT_OF_LIGHT = 20185, @@ -1007,41 +1005,6 @@ class spell_pal_holy_shock : public SpellScriptLoader } }; -// 37705 - Healing Discount -class spell_pal_item_healing_discount : public SpellScriptLoader -{ - public: - spell_pal_item_healing_discount() : SpellScriptLoader("spell_pal_item_healing_discount") { } - - class spell_pal_item_healing_discount_AuraScript : public AuraScript - { - PrepareAuraScript(spell_pal_item_healing_discount_AuraScript); - - bool Validate(SpellInfo const* /*spellInfo*/) - { - if (!sSpellMgr->GetSpellInfo(SPELL_PALADIN_ITEM_HEALING_TRANCE)) - return false; - return true; - } - - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/) - { - PreventDefaultAction(); - GetTarget()->CastSpell(GetTarget(), SPELL_PALADIN_ITEM_HEALING_TRANCE, true, NULL, aurEff); - } - - void Register() - { - OnEffectProc += AuraEffectProcFn(spell_pal_item_healing_discount_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL); - } - }; - - AuraScript* GetAuraScript() const - { - return new spell_pal_item_healing_discount_AuraScript(); - } -}; - // 53407 - Judgement of Justice // 20271 - Judgement of Light // 53408 - Judgement of Wisdom @@ -1355,7 +1318,6 @@ void AddSC_paladin_spell_scripts() new spell_pal_hand_of_sacrifice(); new spell_pal_hand_of_salvation(); new spell_pal_holy_shock(); - new spell_pal_item_healing_discount(); new spell_pal_judgement("spell_pal_judgement_of_justice", SPELL_PALADIN_JUDGEMENT_OF_JUSTICE); new spell_pal_judgement("spell_pal_judgement_of_light", SPELL_PALADIN_JUDGEMENT_OF_LIGHT); new spell_pal_judgement("spell_pal_judgement_of_wisdom", SPELL_PALADIN_JUDGEMENT_OF_WISDOM);