mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-27 23:56:25 +00:00
fix(Scripts/Items): Noblegarden Chocolate instantly giving Well Fed buff (#22150)
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
--
|
||||
DELETE FROM `spell_linked_spell` WHERE `spell_trigger`=-61874 AND `spell_effect`=24870;
|
||||
DELETE FROM `spell_script_names` WHERE `spell_id`=61874 AND `ScriptName`='spell_item_noblegarden_chocolate';
|
||||
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES (61874, 'spell_item_noblegarden_chocolate');
|
||||
@@ -21,7 +21,8 @@
|
||||
|
||||
enum eNoblegarden
|
||||
{
|
||||
SPELL_NOBLEGARDEN_BUNNY = 61734
|
||||
SPELL_NOBLEGARDEN_BUNNY = 61734,
|
||||
SPELL_WELL_FED = 24870,
|
||||
};
|
||||
|
||||
// 61712 Summon Noblegarden Bunny Controller
|
||||
@@ -55,7 +56,46 @@ class spell_summon_noblegarden_bunny_controller : public SpellScript
|
||||
}
|
||||
};
|
||||
|
||||
// 61874 - Food (Noblegarden Chocolate, item 44791)
|
||||
class spell_item_noblegarden_chocolate : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_item_noblegarden_chocolate);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
return ValidateSpellInfo({ SPELL_WELL_FED });
|
||||
}
|
||||
|
||||
bool Load() override
|
||||
{
|
||||
_buffGiven = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandlePeriodic(AuraEffect const* /*aurEff*/)
|
||||
{
|
||||
if (Unit* caster = GetCaster())
|
||||
{
|
||||
uint32 duration = static_cast<uint32>(GetDuration());
|
||||
if (duration <= 14000 && !_buffGiven)
|
||||
{
|
||||
_buffGiven = true;
|
||||
caster->CastSpell(caster, SPELL_WELL_FED, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectPeriodic += AuraEffectPeriodicFn(spell_item_noblegarden_chocolate::HandlePeriodic, EFFECT_0, SPELL_AURA_OBS_MOD_HEALTH);
|
||||
}
|
||||
|
||||
private:
|
||||
bool _buffGiven;
|
||||
};
|
||||
|
||||
void AddSC_event_noblegarden_scripts()
|
||||
{
|
||||
RegisterSpellScript(spell_summon_noblegarden_bunny_controller);
|
||||
RegisterSpellScript(spell_item_noblegarden_chocolate);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user