From 3240d27d6fe9b937086845f5c72f55e1fb1404e1 Mon Sep 17 00:00:00 2001 From: Skjalf <47818697+Nyeriah@users.noreply.github.com> Date: Fri, 12 Nov 2021 11:14:10 -0300 Subject: [PATCH] fix(Scripts/Spells): Holiday food items should give their buff after 10 seconds, not when the eating aura expires (#9132) --- .../rev_1634947992074110300.sql | 7 ++++ src/server/scripts/Spells/spell_generic.cpp | 36 +++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 data/sql/updates/pending_db_world/rev_1634947992074110300.sql diff --git a/data/sql/updates/pending_db_world/rev_1634947992074110300.sql b/data/sql/updates/pending_db_world/rev_1634947992074110300.sql new file mode 100644 index 000000000..19b34a118 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1634947992074110300.sql @@ -0,0 +1,7 @@ +INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1634947992074110300'); + +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` = -24869; + +DELETE FROM `spell_script_names` WHERE `spell_id` = -24869 AND `ScriptName` = 'spell_gen_holiday_buff_food'; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(-24869, 'spell_gen_holiday_buff_food'); diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 092745e1a..1ffa125c9 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -5510,6 +5510,41 @@ public: } }; +enum HolidayFoodBuffEnum +{ + SPELL_WELL_FED = 24870, +}; + +// -24869 - Food +class spell_gen_holiday_buff_food : public SpellScriptLoader +{ +public: + spell_gen_holiday_buff_food() : SpellScriptLoader("spell_gen_holiday_buff_food") {} + + class spell_gen_holiday_buff_food_AuraScript : public AuraScript + { + PrepareAuraScript(spell_gen_holiday_buff_food_AuraScript); + + void TriggerFoodBuff(AuraEffect* aurEff) + { + if (aurEff->GetTickNumber() == 10 && GetUnitOwner()) + { + GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_WELL_FED, TriggerCastFlags(TRIGGERED_IGNORE_AURA_INTERRUPT_FLAGS)); + } + } + + void Register() override + { + OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_gen_holiday_buff_food_AuraScript::TriggerFoodBuff, EFFECT_0, SPELL_AURA_OBS_MOD_HEALTH); + } + }; + + AuraScript* GetAuraScript() const override + { + return new spell_gen_holiday_buff_food_AuraScript(); + } +}; + void AddSC_generic_spell_scripts() { new spell_silithyst(); @@ -5640,4 +5675,5 @@ void AddSC_generic_spell_scripts() new spell_gen_eject_passenger(); new spell_gen_charmed_unit_spell_cooldown(); new spell_contagion_of_rot(); + new spell_gen_holiday_buff_food(); }