Skip to content

Commit 47cc6a7

Browse files
authored
fix(Scripts/Items): Noblegarden Chocolate instantly giving Well Fed buff (#22150)
1 parent e6a29d9 commit 47cc6a7

File tree

2 files changed

+45
-1
lines changed

2 files changed

+45
-1
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
--
2+
DELETE FROM `spell_linked_spell` WHERE `spell_trigger`=-61874 AND `spell_effect`=24870;
3+
DELETE FROM `spell_script_names` WHERE `spell_id`=61874 AND `ScriptName`='spell_item_noblegarden_chocolate';
4+
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES (61874, 'spell_item_noblegarden_chocolate');

src/server/scripts/Events/noblegarden.cpp

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121

2222
enum eNoblegarden
2323
{
24-
SPELL_NOBLEGARDEN_BUNNY = 61734
24+
SPELL_NOBLEGARDEN_BUNNY = 61734,
25+
SPELL_WELL_FED = 24870,
2526
};
2627

2728
// 61712 Summon Noblegarden Bunny Controller
@@ -55,7 +56,46 @@ class spell_summon_noblegarden_bunny_controller : public SpellScript
5556
}
5657
};
5758

59+
// 61874 - Food (Noblegarden Chocolate, item 44791)
60+
class spell_item_noblegarden_chocolate : public AuraScript
61+
{
62+
PrepareAuraScript(spell_item_noblegarden_chocolate);
63+
64+
bool Validate(SpellInfo const* /*spellInfo*/) override
65+
{
66+
return ValidateSpellInfo({ SPELL_WELL_FED });
67+
}
68+
69+
bool Load() override
70+
{
71+
_buffGiven = false;
72+
return true;
73+
}
74+
75+
void HandlePeriodic(AuraEffect const* /*aurEff*/)
76+
{
77+
if (Unit* caster = GetCaster())
78+
{
79+
uint32 duration = static_cast<uint32>(GetDuration());
80+
if (duration <= 14000 && !_buffGiven)
81+
{
82+
_buffGiven = true;
83+
caster->CastSpell(caster, SPELL_WELL_FED, true);
84+
}
85+
}
86+
}
87+
88+
void Register() override
89+
{
90+
OnEffectPeriodic += AuraEffectPeriodicFn(spell_item_noblegarden_chocolate::HandlePeriodic, EFFECT_0, SPELL_AURA_OBS_MOD_HEALTH);
91+
}
92+
93+
private:
94+
bool _buffGiven;
95+
};
96+
5897
void AddSC_event_noblegarden_scripts()
5998
{
6099
RegisterSpellScript(spell_summon_noblegarden_bunny_controller);
100+
RegisterSpellScript(spell_item_noblegarden_chocolate);
61101
}

0 commit comments

Comments
 (0)