diff options
author | Sorikoff <46191832+Sorikoff@users.noreply.github.com> | 2019-06-21 17:21:49 +0000 |
---|---|---|
committer | Giacomo Pozzoni <giacomopoz@gmail.com> | 2019-06-21 19:21:49 +0200 |
commit | a4cd4d8b872bcbd9e28e9ae76f5220b30494a996 (patch) | |
tree | 22a25f3e72ff8386b6fa8b88e6edeb04f14077c8 | |
parent | fc92bd358c83ce0ea6f7c41e124641f41e91858c (diff) |
Scripts/Spells: Migrate Lightwell to Script (#23455)
* Scripts/Spells: Migrate Lightwell to Script
* Add newline to SQL file
* Misc
* Rename 9999_99_99_99_world.sql to 2019_06_21_01_world.sql
-rw-r--r-- | sql/updates/world/3.3.5/2019_06_21_01_world.sql | 3 | ||||
-rw-r--r-- | src/server/game/Spells/SpellEffects.cpp | 30 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_priest.cpp | 55 |
3 files changed, 58 insertions, 30 deletions
diff --git a/sql/updates/world/3.3.5/2019_06_21_01_world.sql b/sql/updates/world/3.3.5/2019_06_21_01_world.sql new file mode 100644 index 00000000000..f531b7639aa --- /dev/null +++ b/sql/updates/world/3.3.5/2019_06_21_01_world.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_script_names` WHERE `ScriptName` IN ('spell_pri_lightwell'); +INSERT INTO `spell_script_names` VALUES +(60123,'spell_pri_lightwell'); diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index a5b16142c89..2bd0d6ea8c8 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -3714,36 +3714,6 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) } return; } - case 60123: // Lightwell - { - if (m_caster->GetTypeId() != TYPEID_UNIT || !m_caster->ToCreature()->IsSummon()) - return; - - uint32 spell_heal; - - switch (m_caster->GetEntry()) - { - case 31897: spell_heal = 7001; break; - case 31896: spell_heal = 27873; break; - case 31895: spell_heal = 27874; break; - case 31894: spell_heal = 28276; break; - case 31893: spell_heal = 48084; break; - case 31883: spell_heal = 48085; break; - default: - TC_LOG_ERROR("spells", "Unknown Lightwell spell caster %u.", m_caster->GetEntry()); - return; - } - - // proc a spellcast - if (Aura* chargesAura = m_caster->ToCreature()->GetAura(59907)) - { - m_caster->CastSpell(unitTarget, spell_heal, m_caster->ToCreature()->ToTempSummon()->GetSummonerGUID()); - if (chargesAura->ModCharges(-1)) - m_caster->ToCreature()->ToTempSummon()->UnSummon(); - } - - return; - } case 45668: // Ultra-Advanced Proto-Typical Shortening Blaster { if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT) diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp index 4b0547e6d3b..9a2062a475d 100644 --- a/src/server/scripts/Spells/spell_priest.cpp +++ b/src/server/scripts/Spells/spell_priest.cpp @@ -27,6 +27,7 @@ #include "SpellAuraEffects.h" #include "SpellMgr.h" #include "SpellScript.h" +#include "TemporarySummon.h" enum PriestSpells { @@ -38,6 +39,7 @@ enum PriestSpells SPELL_PRIEST_GLYPH_OF_PRAYER_OF_HEALING_HEAL = 56161, SPELL_PRIEST_GUARDIAN_SPIRIT_HEAL = 48153, SPELL_PRIEST_ITEM_EFFICIENCY = 37595, + SPELL_PRIEST_LIGHTWELL_CHARGES = 59907, SPELL_PRIEST_MANA_LEECH_PROC = 34650, SPELL_PRIEST_PENANCE_R1 = 47540, SPELL_PRIEST_PENANCE_R1_DAMAGE = 47758, @@ -70,6 +72,16 @@ enum PriestSpellIcons PRIEST_ICON_ID_PAIN_AND_SUFFERING = 2874, }; +enum Mics +{ + PRIEST_LIGHTWELL_NPC_1 = 31897, + PRIEST_LIGHTWELL_NPC_2 = 31896, + PRIEST_LIGHTWELL_NPC_3 = 31895, + PRIEST_LIGHTWELL_NPC_4 = 31894, + PRIEST_LIGHTWELL_NPC_5 = 31893, + PRIEST_LIGHTWELL_NPC_6 = 31883 +}; + class PowerCheck { public: @@ -678,6 +690,48 @@ class spell_pri_item_t6_trinket : public SpellScriptLoader } }; +// 60123 - Lightwell +class spell_pri_lightwell : public SpellScript +{ + PrepareSpellScript(spell_pri_lightwell); + + bool Load() override + { + return GetCaster()->GetTypeId() == TYPEID_UNIT; + } + + void HandleScriptEffect(SpellEffIndex /* effIndex */) + { + Creature* caster = GetCaster()->ToCreature(); + if (!caster || !caster->IsSummon()) + return; + + uint32 lightwellRenew = 0; + switch (caster->GetEntry()) + { + case PRIEST_LIGHTWELL_NPC_1: lightwellRenew = 7001; break; + case PRIEST_LIGHTWELL_NPC_2: lightwellRenew = 27873; break; + case PRIEST_LIGHTWELL_NPC_3: lightwellRenew = 27874; break; + case PRIEST_LIGHTWELL_NPC_4: lightwellRenew = 28276; break; + case PRIEST_LIGHTWELL_NPC_5: lightwellRenew = 48084; break; + case PRIEST_LIGHTWELL_NPC_6: lightwellRenew = 48085; break; + } + + // proc a spellcast + if (Aura* chargesAura = caster->GetAura(SPELL_PRIEST_LIGHTWELL_CHARGES)) + { + caster->CastSpell(GetHitUnit(), lightwellRenew, caster->ToTempSummon()->GetSummonerGUID()); + if (chargesAura->ModCharges(-1)) + caster->ToTempSummon()->UnSummon(); + } + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_pri_lightwell::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } +}; + // -7001 - Lightwell Renew class spell_pri_lightwell_renew : public SpellScriptLoader { @@ -1467,6 +1521,7 @@ void AddSC_priest_spell_scripts() new spell_pri_imp_shadowform(); new spell_pri_improved_spirit_tap(); new spell_pri_item_t6_trinket(); + RegisterSpellScript(spell_pri_lightwell); new spell_pri_lightwell_renew(); new spell_pri_mana_leech(); new spell_pri_mind_sear(); |