From 0d2a56473aaf941000cdbe56fc79929dce33fed1 Mon Sep 17 00:00:00 2001 From: Ovahlord Date: Fri, 28 Jan 2022 22:28:28 +0100 Subject: [PATCH] Scripts/Achievements: fixed "You'll Feel Right as Rain" --- .../world/4.3.4/2022_01_28_00_world.sql | 3 ++ src/server/scripts/Spells/spell_item.cpp | 36 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 sql/updates/world/4.3.4/2022_01_28_00_world.sql diff --git a/sql/updates/world/4.3.4/2022_01_28_00_world.sql b/sql/updates/world/4.3.4/2022_01_28_00_world.sql new file mode 100644 index 00000000000..0a82ca637d3 --- /dev/null +++ b/sql/updates/world/4.3.4/2022_01_28_00_world.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_script_names` WHERE `ScriptName`= 'spell_item_satisfied'; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(87649, 'spell_item_satisfied'); diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index 77fcf4c4acb..fb4d8961631 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -5024,6 +5024,41 @@ class spell_item_world_queller_focus : public AuraScript } }; +enum ChocolateCookie +{ + SPELL_BY_THE_TIME_YOURE_DONE_EATING_YOULL_FEEL_RIGHT_AS_RAIN = 99041 // Serverside spell +}; + +// 87649 - Satisfied +class spell_item_satisfied : public SpellScript +{ + bool Load() override + { + return GetCaster()->IsPlayer(); + } + + void HandleAchievementCriteria() + { + Unit* caster = GetCaster(); + if (!caster) + return; + + if (Aura const* aura = GetHitAura()) + { + if (aura->GetStackAmount() == 91) + { + Player* player = caster->ToPlayer(); + player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, SPELL_BY_THE_TIME_YOURE_DONE_EATING_YOULL_FEEL_RIGHT_AS_RAIN, 1); + } + } + } + + void Register() override + { + AfterHit.Register(&spell_item_satisfied::HandleAchievementCriteria); + } +}; + void AddSC_item_spell_scripts() { // 23074 Arcanite Dragonling @@ -5157,4 +5192,5 @@ void AddSC_item_spell_scripts() RegisterSpellScript(spell_item_battle_trance); RegisterSpellScript(spell_item_world_queller_focus); RegisterSpellScript(spell_item_jom_gabbar); + RegisterSpellScript(spell_item_satisfied); }