From 0ae93c1c944e11a193801ee9e30320c8ebb80351 Mon Sep 17 00:00:00 2001 From: UltraNix <80540499+UltraNix@users.noreply.github.com> Date: Wed, 7 Sep 2022 02:38:50 +0200 Subject: [PATCH] =?UTF-8?q?fix(Scripts/Item):=20Winter=20Veil=20Disguise?= =?UTF-8?q?=20Kit=20cannot=20be=20used=20during=20pre=E2=80=A6=20(#12883)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ...paration phase. --- .../rev_1661691696095705000.sql | 4 +++ src/server/scripts/Spells/spell_item.cpp | 27 +++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 data/sql/updates/pending_db_world/rev_1661691696095705000.sql diff --git a/data/sql/updates/pending_db_world/rev_1661691696095705000.sql b/data/sql/updates/pending_db_world/rev_1661691696095705000.sql new file mode 100644 index 000000000..5260f4cc3 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1661691696095705000.sql @@ -0,0 +1,4 @@ +-- +DELETE FROM `spell_script_names` WHERE `spell_id`=21848; +INSERT INTO `spell_script_names` VALUES +(21848,'spell_item_snowman'); diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index 3c2984212..9eeaeb14e 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -3676,6 +3676,32 @@ class spell_item_mirrens_drinking_hat : public SpellScript } }; +class spell_item_snowman : public SpellScript +{ + PrepareSpellScript(spell_item_snowman); + + SpellCastResult CheckCast() + { + if (Player* caster = GetCaster()->ToPlayer()) + { + if (Battleground* bg = caster->GetBattleground()) + { + if (bg->GetStatus() == STATUS_WAIT_JOIN) + { + return SPELL_FAILED_NOT_READY; + } + } + } + + return SPELL_CAST_OK; + } + + void Register() override + { + OnCheckCast += SpellCheckCastFn(spell_item_snowman::CheckCast); + } +}; + void AddSC_item_spell_scripts() { RegisterSpellScript(spell_item_massive_seaforium_charge); @@ -3789,4 +3815,5 @@ void AddSC_item_spell_scripts() RegisterSpellScript(spell_item_recall); RegisterSpellScript(spell_item_wraith_scythe_drain_life); RegisterSpellScript(spell_item_mirrens_drinking_hat); + RegisterSpellScript(spell_item_snowman); }