diff options
author | SnapperRy <snapperryen@gmail.com> | 2016-10-21 15:55:42 +0200 |
---|---|---|
committer | joschiwald <joschiwald.trinity@gmail.com> | 2017-10-15 16:13:44 +0200 |
commit | 25c784926268568d3060c222d3a3f71097fac27f (patch) | |
tree | ba434d0ec1233ed797244001e18ce1b596a6315b | |
parent | 1283e217268087c8330c8214f8e4efc27d98cf6d (diff) |
Script/Spell: remove cosmetic effect for Water Bucket item at login if it expired after the player logged out.
(cherry picked from commit 16cfd59f5b368fd1d05eeeab3afbacfccf0a6870)
Add forgotten override.
(cherry picked from commit c6f94ba42ec7e66419b636ac09aacc1ee7320a77)
Fix non-PCH build.
(cherry picked from commit 02cea9c0bac2f999b461d3679a32672b6f0ac2da)
-rw-r--r-- | sql/updates/world/master/2017_10_15_07_world_2016_10_21_01_world.sql | 4 | ||||
-rw-r--r-- | src/server/scripts/Events/events_script_loader.cpp | 2 | ||||
-rw-r--r-- | src/server/scripts/Events/hallows_end.cpp | 69 |
3 files changed, 75 insertions, 0 deletions
diff --git a/sql/updates/world/master/2017_10_15_07_world_2016_10_21_01_world.sql b/sql/updates/world/master/2017_10_15_07_world_2016_10_21_01_world.sql new file mode 100644 index 00000000000..3753e8fd9c7 --- /dev/null +++ b/sql/updates/world/master/2017_10_15_07_world_2016_10_21_01_world.sql @@ -0,0 +1,4 @@ +-- +DELETE FROM `spell_script_names` WHERE `spell_id`=42336; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(42336, "spell_hallows_end_has_water_bucket"); diff --git a/src/server/scripts/Events/events_script_loader.cpp b/src/server/scripts/Events/events_script_loader.cpp index 76eb43ee77c..e5ec8d9bdf2 100644 --- a/src/server/scripts/Events/events_script_loader.cpp +++ b/src/server/scripts/Events/events_script_loader.cpp @@ -17,10 +17,12 @@ // This is where scripts' loading functions should be declared: void AddSC_event_childrens_week(); +void AddSC_event_hallows_end(); // The name of this function should match: // void Add${NameOfDirectory}Scripts() void AddEventsScripts() { AddSC_event_childrens_week(); + AddSC_event_hallows_end(); } diff --git a/src/server/scripts/Events/hallows_end.cpp b/src/server/scripts/Events/hallows_end.cpp new file mode 100644 index 00000000000..9036bb742ab --- /dev/null +++ b/src/server/scripts/Events/hallows_end.cpp @@ -0,0 +1,69 @@ +/* +* Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/> +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +* This program is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +* You should have received a copy of the GNU General Public License along +* with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include "Player.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellScript.h" +#include "SpellAuraEffects.h" + +enum HallowsEnd +{ + ITEM_WATER_BUCKET = 32971, + SPELL_HAS_WATER_BUCKET = 42336, +}; + +class spell_hallows_end_has_water_bucket : public SpellScriptLoader +{ +public: + spell_hallows_end_has_water_bucket() : SpellScriptLoader("spell_hallows_end_has_water_bucket") {} + + class spell_hallows_end_has_water_bucket_AuraScript : public AuraScript + { + PrepareAuraScript(spell_hallows_end_has_water_bucket_AuraScript); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + if (!sSpellMgr->GetSpellInfo(SPELL_HAS_WATER_BUCKET)) + return false; + return true; + } + + void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Unit* caster = GetCaster()) + if (caster->GetTypeId() == TYPEID_PLAYER) + if (!caster->ToPlayer()->HasItemCount(ITEM_WATER_BUCKET, 1, false)) + caster->RemoveAurasDueToSpell(SPELL_HAS_WATER_BUCKET); + } + + void Register() override + { + AfterEffectApply += AuraEffectApplyFn(spell_hallows_end_has_water_bucket_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_hallows_end_has_water_bucket_AuraScript(); + } +}; + +void AddSC_event_hallows_end() +{ + new spell_hallows_end_has_water_bucket(); +} |