From 8806a3efdbf073bba0daf931426176230d5a82ac Mon Sep 17 00:00:00 2001 From: click Date: Wed, 17 Nov 2010 00:05:20 +0100 Subject: [PATCH] Core/Script: Add spellscript for Earthbind totem spell (patch by Socolin) --HG-- branch : trunk --- sql/base/world_database.sql | 1 + .../10462_world_spell_script_names.sql | 1 + src/server/scripts/Spells/spell_shaman.cpp | 46 ++++++++++++++++++- 3 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 sql/updates/10462_world_spell_script_names.sql diff --git a/sql/base/world_database.sql b/sql/base/world_database.sql index 594c34469c..12c58505da 100644 --- a/sql/base/world_database.sql +++ b/sql/base/world_database.sql @@ -26960,6 +26960,7 @@ INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES -- shaman ( 39610, 'spell_sha_mana_tide_totem'), ( -1535, 'spell_sha_fire_nova'), +( 6474, 'spell_sha_earthbind_totem'), -- mage (-11113, 'spell_mage_blast_wave'), ( 11958, 'spell_mage_cold_snap'), diff --git a/sql/updates/10462_world_spell_script_names.sql b/sql/updates/10462_world_spell_script_names.sql new file mode 100644 index 0000000000..e35527f9c5 --- /dev/null +++ b/sql/updates/10462_world_spell_script_names.sql @@ -0,0 +1 @@ +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES (6474, 'spell_sha_earthbind_totem'); diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp index a745514f19..1d88e3f68b 100644 --- a/src/server/scripts/Spells/spell_shaman.cpp +++ b/src/server/scripts/Spells/spell_shaman.cpp @@ -29,7 +29,11 @@ enum ShamanSpells SHAMAN_SPELL_GLYPH_OF_MANA_TIDE = 55441, SHAMAN_SPELL_MANA_TIDE_TOTEM = 39609, SHAMAN_SPELL_FIRE_NOVA_R1 = 1535, - SHAMAN_SPELL_FIRE_NOVA_TRIGGERED_R1 = 8349 + SHAMAN_SPELL_FIRE_NOVA_TRIGGERED_R1 = 8349, + + //For Earthen Power + SHAMAN_TOTEM_SPELL_EARTHBIND_TOTEM = 6474, //Spell casted by totem + SHAMAN_TOTEM_SPELL_EARTHEN_POWER = 59566,//Spell witch remove snare effect }; // 1535 Fire Nova @@ -131,8 +135,48 @@ public: } }; +// 6474 - Earthbind Totem - Fix Talent:Earthen Power +class spell_sha_earthbind_totem : public SpellScriptLoader +{ +public: + spell_sha_earthbind_totem() : SpellScriptLoader("spell_sha_earthbind_totem") { } + + class spell_sha_earthbind_totem_AuraScript : public AuraScript + { + PrepareAuraScript(spell_sha_earthbind_totem_AuraScript); + + bool Validate(SpellEntry const * /*spellEntry*/) + { + if (!sSpellStore.LookupEntry(SHAMAN_TOTEM_SPELL_EARTHBIND_TOTEM)) + return false; + if (!sSpellStore.LookupEntry(SHAMAN_TOTEM_SPELL_EARTHEN_POWER)) + return false; + return true; + } + + void HandleEffectPeriodic(AuraEffect const * aurEff, AuraApplication const * aurApp) + { + if (Unit* target = aurApp->GetTarget()) + if (Unit *caster = aurEff->GetBase()->GetCaster()) + if (AuraEffect* aur = caster->GetDummyAuraEffect(SPELLFAMILY_SHAMAN, 2289, 0)) + if (roll_chance_i(aur->GetBaseAmount())) + target->CastSpell(target, SHAMAN_TOTEM_SPELL_EARTHEN_POWER, true, NULL, aurEff); + } + + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_sha_earthbind_totem_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + } + }; + + AuraScript *GetAuraScript() const + { + return new spell_sha_earthbind_totem_AuraScript(); + } +}; void AddSC_shaman_spell_scripts() { new spell_sha_fire_nova(); new spell_sha_mana_tide_totem(); + new spell_sha_earthbind_totem(); }