From 7f4fe2e3ece4f25bb127498210e4a339394d9807 Mon Sep 17 00:00:00 2001 From: UltraNix <80540499+UltraNix@users.noreply.github.com> Date: Mon, 21 Nov 2022 22:59:24 +0100 Subject: [PATCH] =?UTF-8?q?fix(Scripts/Spells):=20Hallow's=20End=20Candy?= =?UTF-8?q?=20punpkin=20treat=20should=20turn=20pla=E2=80=A6=20(#13808)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ...yer into a pirate. --- .../rev_1668360561748791400.sql | 4 +++ src/server/scripts/Events/hallows_end.cpp | 35 +++++++++++++++++-- 2 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 data/sql/updates/pending_db_world/rev_1668360561748791400.sql diff --git a/data/sql/updates/pending_db_world/rev_1668360561748791400.sql b/data/sql/updates/pending_db_world/rev_1668360561748791400.sql new file mode 100644 index 000000000..3994a971c --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1668360561748791400.sql @@ -0,0 +1,4 @@ +-- +DELETE FROM `spell_script_names` WHERE `spell_id`=24926; +INSERT INTO `spell_script_names` VALUES +(24926,'spell_hallows_end_candy_pirate_costume'); diff --git a/src/server/scripts/Events/hallows_end.cpp b/src/server/scripts/Events/hallows_end.cpp index 8dec984ff..c290fa26b 100644 --- a/src/server/scripts/Events/hallows_end.cpp +++ b/src/server/scripts/Events/hallows_end.cpp @@ -156,7 +156,9 @@ enum eHallowsEndCandy SPELL_HALLOWS_END_CANDY_1 = 24924, SPELL_HALLOWS_END_CANDY_2 = 24925, SPELL_HALLOWS_END_CANDY_3 = 24926, - SPELL_HALLOWS_END_CANDY_4 = 24927, + SPELL_HALLOWS_END_CANDY_3_FEMALE = 44742, + SPELL_HALLOWS_END_CANDY_3_MALE = 44743, + SPELL_HALLOWS_END_CANDY_4 = 24927 }; class spell_hallows_end_candy : public SpellScript @@ -168,7 +170,7 @@ class spell_hallows_end_candy : public SpellScript if (Player* target = GetHitPlayer()) { uint32 spellId = SPELL_HALLOWS_END_CANDY_1 + urand(0, 3); - GetCaster()->CastSpell(target, spellId, true, nullptr); + GetCaster()->CastSpell(target, spellId, true); } } @@ -178,6 +180,34 @@ class spell_hallows_end_candy : public SpellScript } }; +class spell_hallows_end_candy_pirate_costume : public AuraScript +{ + PrepareAuraScript(spell_hallows_end_candy_pirate_costume); + + void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Unit* target = GetTarget()) + { + target->CastSpell(target, target->getGender() == GENDER_MALE ? SPELL_HALLOWS_END_CANDY_3_MALE : SPELL_HALLOWS_END_CANDY_3_FEMALE, true); + } + } + + void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Unit* target = GetTarget()) + { + target->RemoveAurasDueToSpell(SPELL_HALLOWS_END_CANDY_3_MALE); + target->RemoveAurasDueToSpell(SPELL_HALLOWS_END_CANDY_3_FEMALE); + } + } + + void Register() override + { + OnEffectApply += AuraEffectApplyFn(spell_hallows_end_candy_pirate_costume::HandleEffectApply, EFFECT_0, SPELL_AURA_MOD_INCREASE_SWIM_SPEED, AURA_EFFECT_HANDLE_REAL); + OnEffectRemove += AuraEffectRemoveFn(spell_hallows_end_candy_pirate_costume::HandleEffectRemove, EFFECT_0, SPELL_AURA_MOD_INCREASE_SWIM_SPEED, AURA_EFFECT_HANDLE_REAL); + } +}; + enum trickyTreat { SPELL_UPSET_TUMMY = 42966, @@ -1426,6 +1456,7 @@ void AddSC_event_hallows_end_scripts() RegisterSpellScript(spell_hallows_end_trick); RegisterSpellScript(spell_hallows_end_trick_or_treat); RegisterSpellScript(spell_hallows_end_candy); + RegisterSpellScript(spell_hallows_end_candy_pirate_costume); RegisterSpellScript(spell_hallows_end_tricky_treat); RegisterSpellScriptWithArgs(spell_hallows_end_put_costume, "spell_hallows_end_pirate_costume", SPELL_PIRATE_COSTUME_MALE, SPELL_PIRATE_COSTUME_FEMALE); RegisterSpellScriptWithArgs(spell_hallows_end_put_costume, "spell_hallows_end_leper_costume", SPELL_LEPER_GNOME_COSTUME_MALE, SPELL_LEPER_GNOME_COSTUME_FEMALE);