From c0f3a7f9efaa10283260cbedae6e7c7c9180b524 Mon Sep 17 00:00:00 2001 From: azazel Date: Wed, 18 Aug 2010 12:26:17 +0600 Subject: [PATCH] Core/spells: move 20425 Guarded by the Light spell from Warlock spells to Paladin spells. PS Well, this spell used to be in SPELLFAMILY_WARLOCK case, so it seems it never worked before. And that's why I added it to Warlock spells. --HG-- branch : trunk --- sql/base/world_database.sql | 2 +- sql/updates/9447_world_spell_script_names.sql | 3 + src/server/scripts/Spells/spell_paladin.cpp | 258 ++++++++++-------- src/server/scripts/Spells/spell_warlock.cpp | 36 --- 4 files changed, 152 insertions(+), 147 deletions(-) create mode 100644 sql/updates/9447_world_spell_script_names.sql diff --git a/sql/base/world_database.sql b/sql/base/world_database.sql index d44b6641b0..eb34af2f54 100644 --- a/sql/base/world_database.sql +++ b/sql/base/world_database.sql @@ -14747,6 +14747,7 @@ INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES ( 12975,'spell_warr_last_stand'), -- paladin ( 20425, 'spell_pal_judgement_of_command'), +( 63521, 'spell_pal_guarded_by_the_light'), (-20473, 'spell_pal_holy_shock'), ( 37877, 'spell_pal_blessing_of_faith'), -- hunter @@ -14781,7 +14782,6 @@ INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES ( -6201, 'spell_warl_create_healthstone'), ( 47193, 'spell_warl_demonic_empowerment'), ( 47422, 'spell_warl_everlasting_affliction'), -( 63521, 'spell_warl_guarded_by_the_light'), -- druid ( 54846, 'spell_dru_glyph_of_starfire'); /*!40000 ALTER TABLE `spell_script_names` ENABLE KEYS */; diff --git a/sql/updates/9447_world_spell_script_names.sql b/sql/updates/9447_world_spell_script_names.sql new file mode 100644 index 0000000000..da7930b61c --- /dev/null +++ b/sql/updates/9447_world_spell_script_names.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_script_names` WHERE `spell_id`=20425 AND `ScriptName`='spell_warl_judgement_of_command'; +DELETE FROM `spell_script_names` WHERE `spell_id`=20425 AND `ScriptName`='spell_pal_judgement_of_command'; +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES (20425, 'spell_pal_judgement_of_command'); diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp index 53e8569352..1bac2afe0e 100644 --- a/src/server/scripts/Spells/spell_paladin.cpp +++ b/src/server/scripts/Spells/spell_paladin.cpp @@ -22,9 +22,12 @@ */ #include "ScriptPCH.h" +#include "SpellAuraEffects.h" enum PaladinSpells { + PALADIN_SPELL_DIVINE_PLEA = 54428, + PALADIN_SPELL_HOLY_SHOCK_R1 = 20473, PALADIN_SPELL_HOLY_SHOCK_R1_DAMAGE = 25912, PALADIN_SPELL_HOLY_SHOCK_R1_HEALING = 25914, @@ -37,138 +40,173 @@ enum PaladinSpells class spell_pal_blessing_of_faith : public SpellHandlerScript { - public: - spell_pal_blessing_of_faith() : SpellHandlerScript("spell_pal_blessing_of_faith") { } +public: + spell_pal_blessing_of_faith() : SpellHandlerScript("spell_pal_blessing_of_faith") { } - class spell_pal_blessing_of_faith_SpellScript : public SpellScript + class spell_pal_blessing_of_faith_SpellScript : public SpellScript + { + bool Validate(SpellEntry const *spellEntry) { - bool Validate(SpellEntry const *spellEntry) - { - if (!sSpellStore.LookupEntry(SPELL_BLESSING_OF_LOWER_CITY_DRUID)) - return false; - if (!sSpellStore.LookupEntry(SPELL_BLESSING_OF_LOWER_CITY_PALADIN)) - return false; - if (!sSpellStore.LookupEntry(SPELL_BLESSING_OF_LOWER_CITY_PRIEST)) - return false; - if (!sSpellStore.LookupEntry(SPELL_BLESSING_OF_LOWER_CITY_SHAMAN)) - return false; - return true; - } - - void HandleDummy(SpellEffIndex effIndex) - { - if (Unit *unitTarget = GetHitUnit()) - { - uint32 spell_id = 0; - switch(unitTarget->getClass()) - { - case CLASS_DRUID: spell_id = SPELL_BLESSING_OF_LOWER_CITY_DRUID; break; - case CLASS_PALADIN: spell_id = SPELL_BLESSING_OF_LOWER_CITY_PALADIN; break; - case CLASS_PRIEST: spell_id = SPELL_BLESSING_OF_LOWER_CITY_PRIEST; break; - case CLASS_SHAMAN: spell_id = SPELL_BLESSING_OF_LOWER_CITY_SHAMAN; break; - default: return; // ignore for non-healing classes - } - - GetCaster()->CastSpell(GetCaster(), spell_id, true); - } - } - - void Register() - { - // add dummy effect spell handler to Blessing of Faith - EffectHandlers += EffectHandlerFn(spell_pal_blessing_of_faith_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; - - SpellScript *GetSpellScript() const - { - return new spell_pal_blessing_of_faith_SpellScript(); + if (!sSpellStore.LookupEntry(SPELL_BLESSING_OF_LOWER_CITY_DRUID)) + return false; + if (!sSpellStore.LookupEntry(SPELL_BLESSING_OF_LOWER_CITY_PALADIN)) + return false; + if (!sSpellStore.LookupEntry(SPELL_BLESSING_OF_LOWER_CITY_PRIEST)) + return false; + if (!sSpellStore.LookupEntry(SPELL_BLESSING_OF_LOWER_CITY_SHAMAN)) + return false; + return true; } + + void HandleDummy(SpellEffIndex effIndex) + { + if (Unit *unitTarget = GetHitUnit()) + { + uint32 spell_id = 0; + switch(unitTarget->getClass()) + { + case CLASS_DRUID: spell_id = SPELL_BLESSING_OF_LOWER_CITY_DRUID; break; + case CLASS_PALADIN: spell_id = SPELL_BLESSING_OF_LOWER_CITY_PALADIN; break; + case CLASS_PRIEST: spell_id = SPELL_BLESSING_OF_LOWER_CITY_PRIEST; break; + case CLASS_SHAMAN: spell_id = SPELL_BLESSING_OF_LOWER_CITY_SHAMAN; break; + default: return; // ignore for non-healing classes + } + + GetCaster()->CastSpell(GetCaster(), spell_id, true); + } + } + + void Register() + { + // add dummy effect spell handler to Blessing of Faith + EffectHandlers += EffectHandlerFn(spell_pal_blessing_of_faith_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript *GetSpellScript() const + { + return new spell_pal_blessing_of_faith_SpellScript(); + } +}; + +// 63521 Guarded by The Light +class spell_pal_guarded_by_the_light : public SpellHandlerScript +{ +public: + spell_pal_guarded_by_the_light() : SpellHandlerScript("spell_pal_guarded_by_the_light") { } + + class spell_pal_guarded_by_the_light_SpellScript : public SpellScript + { + bool Validate(SpellEntry const * spellEntry) + { + if (!sSpellStore.LookupEntry(PALADIN_SPELL_DIVINE_PLEA)) + return false; + return true; + } + + void HandleScriptEffect(SpellEffIndex effIndex) + { + // Divine Plea + if (Aura* aura = GetCaster()->GetAura(PALADIN_SPELL_DIVINE_PLEA)) + aura->RefreshDuration(); + } + + void Register() + { + EffectHandlers += EffectHandlerFn(spell_pal_guarded_by_the_light_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_pal_guarded_by_the_light_SpellScript(); + } }; class spell_pal_holy_shock : public SpellHandlerScript { - public: - spell_pal_holy_shock() : SpellHandlerScript("spell_pal_holy_shock") { } +public: + spell_pal_holy_shock() : SpellHandlerScript("spell_pal_holy_shock") { } - class spell_pal_holy_shock_SpellScript : public SpellScript + class spell_pal_holy_shock_SpellScript : public SpellScript + { + bool Validate(SpellEntry const *spellEntry) { - bool Validate(SpellEntry const *spellEntry) - { - if (!sSpellStore.LookupEntry(PALADIN_SPELL_HOLY_SHOCK_R1)) - return false; + if (!sSpellStore.LookupEntry(PALADIN_SPELL_HOLY_SHOCK_R1)) + return false; - // can't use other spell than holy shock due to spell_ranks dependency - if (sSpellMgr.GetFirstSpellInChain(PALADIN_SPELL_HOLY_SHOCK_R1) != sSpellMgr.GetFirstSpellInChain(spellEntry->Id)) - return false; + // can't use other spell than holy shock due to spell_ranks dependency + if (sSpellMgr.GetFirstSpellInChain(PALADIN_SPELL_HOLY_SHOCK_R1) != sSpellMgr.GetFirstSpellInChain(spellEntry->Id)) + return false; - uint8 rank = sSpellMgr.GetSpellRank(spellEntry->Id); - if (!sSpellMgr.GetSpellWithRank(PALADIN_SPELL_HOLY_SHOCK_R1_DAMAGE, rank, true)) - return false; - if (!sSpellMgr.GetSpellWithRank(PALADIN_SPELL_HOLY_SHOCK_R1_HEALING, rank, true)) - return false; + uint8 rank = sSpellMgr.GetSpellRank(spellEntry->Id); + if (!sSpellMgr.GetSpellWithRank(PALADIN_SPELL_HOLY_SHOCK_R1_DAMAGE, rank, true)) + return false; + if (!sSpellMgr.GetSpellWithRank(PALADIN_SPELL_HOLY_SHOCK_R1_HEALING, rank, true)) + return false; - return true; - } - - void HandleDummy(SpellEffIndex effIndex) - { - if (Unit *unitTarget = GetHitUnit()) - { - Unit *caster = GetCaster(); - - uint8 rank = sSpellMgr.GetSpellRank(GetSpellInfo()->Id); - - if (caster->IsFriendlyTo(unitTarget)) - caster->CastSpell(unitTarget, sSpellMgr.GetSpellWithRank(PALADIN_SPELL_HOLY_SHOCK_R1_HEALING, rank), true, 0); - else - caster->CastSpell(unitTarget, sSpellMgr.GetSpellWithRank(PALADIN_SPELL_HOLY_SHOCK_R1_DAMAGE, rank), true, 0); - } - } - - void Register() - { - // add dummy effect spell handler to Holy Shock - EffectHandlers += EffectHandlerFn(spell_pal_holy_shock_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; - - SpellScript *GetSpellScript() const - { - return new spell_pal_holy_shock_SpellScript(); + return true; } + + void HandleDummy(SpellEffIndex effIndex) + { + if (Unit *unitTarget = GetHitUnit()) + { + Unit *caster = GetCaster(); + + uint8 rank = sSpellMgr.GetSpellRank(GetSpellInfo()->Id); + + if (caster->IsFriendlyTo(unitTarget)) + caster->CastSpell(unitTarget, sSpellMgr.GetSpellWithRank(PALADIN_SPELL_HOLY_SHOCK_R1_HEALING, rank), true, 0); + else + caster->CastSpell(unitTarget, sSpellMgr.GetSpellWithRank(PALADIN_SPELL_HOLY_SHOCK_R1_DAMAGE, rank), true, 0); + } + } + + void Register() + { + // add dummy effect spell handler to Holy Shock + EffectHandlers += EffectHandlerFn(spell_pal_holy_shock_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript *GetSpellScript() const + { + return new spell_pal_holy_shock_SpellScript(); + } }; class spell_pal_judgement_of_command : public SpellHandlerScript { - public: - spell_pal_judgement_of_command() : SpellHandlerScript("spell_pal_judgement_of_command") { } +public: + spell_pal_judgement_of_command() : SpellHandlerScript("spell_pal_judgement_of_command") { } - class spell_pal_judgement_of_command_SpellScript : public SpellScript + class spell_pal_judgement_of_command_SpellScript : public SpellScript + { + void HandleDummy(SpellEffIndex effIndex) { - void HandleDummy(SpellEffIndex effIndex) - { - if (Unit *unitTarget = GetHitUnit()) - if (SpellEntry const* spell_proto = sSpellStore.LookupEntry(GetEffectValue())) - GetCaster()->CastSpell(unitTarget, spell_proto, true, NULL); - } - - void Register() - { - // add dummy effect spell handler to Judgement of Command - EffectHandlers += EffectHandlerFn(spell_pal_judgement_of_command_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; - - SpellScript *GetSpellScript() const - { - return new spell_pal_judgement_of_command_SpellScript(); + if (Unit *unitTarget = GetHitUnit()) + if (SpellEntry const* spell_proto = sSpellStore.LookupEntry(GetEffectValue())) + GetCaster()->CastSpell(unitTarget, spell_proto, true, NULL); } + + void Register() + { + // add dummy effect spell handler to Judgement of Command + EffectHandlers += EffectHandlerFn(spell_pal_judgement_of_command_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript *GetSpellScript() const + { + return new spell_pal_judgement_of_command_SpellScript(); + } }; void AddSC_paladin_spell_scripts() { - new spell_pal_blessing_of_faith; - new spell_pal_holy_shock; - new spell_pal_judgement_of_command; + new spell_pal_blessing_of_faith(); + new spell_pal_guarded_by_the_light(); + new spell_pal_holy_shock(); + new spell_pal_judgement_of_command(); } diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp index b330fd0daa..f13c35b3b5 100644 --- a/src/server/scripts/Spells/spell_warlock.cpp +++ b/src/server/scripts/Spells/spell_warlock.cpp @@ -27,7 +27,6 @@ enum WarlockSpells { - WARLOCK_DIVINE_PLEA = 54428, WARLOCK_DEMONIC_EMPOWERMENT_SUCCUBUS = 54435, WARLOCK_DEMONIC_EMPOWERMENT_VOIDWALKER = 54443, WARLOCK_DEMONIC_EMPOWERMENT_FELGUARD = 54508, @@ -134,40 +133,6 @@ public: } }; -// 63521 Guarded by The Light -class spell_warl_guarded_by_the_light : public SpellHandlerScript -{ -public: - spell_warl_guarded_by_the_light() : SpellHandlerScript("spell_warl_guarded_by_the_light") { } - - class spell_warl_guarded_by_the_light_SpellScript : public SpellScript - { - bool Validate(SpellEntry const * spellEntry) - { - if (!sSpellStore.LookupEntry(WARLOCK_DIVINE_PLEA)) - return false; - return true; - } - - void HandleScriptEffect(SpellEffIndex effIndex) - { - // Divine Plea - if (Aura* aura = GetCaster()->GetAura(WARLOCK_DIVINE_PLEA)) - aura->RefreshDuration(); - } - - void Register() - { - EffectHandlers += EffectHandlerFn(spell_warl_guarded_by_the_light_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - } - }; - - SpellScript* GetSpellScript() const - { - return new spell_warl_guarded_by_the_light_SpellScript(); - } -}; - // 6201 Create Healthstone (and ranks) class spell_warl_create_healthstone : public SpellHandlerScript { @@ -238,6 +203,5 @@ void AddSC_warlock_spell_scripts() { new spell_warl_demonic_empowerment(); new spell_warl_everlasting_affliction(); - new spell_warl_guarded_by_the_light(); new spell_warl_create_healthstone(); }