Core/Auras: implemented PROC_FLAG_HEARTBEAT and moved food/drink emote mechanic into heartbeat handling

Port From (https://github.com/TrinityCore/TrinityCore/commit/d60b4e5b199d56477010941fc1d3aff9eb7064a2)
This commit is contained in:
Hondacrx
2024-08-19 12:14:22 -04:00
parent 5f616b95f5
commit bf0c457273
5 changed files with 37 additions and 29 deletions
+24
View File
@@ -364,6 +364,8 @@ namespace Game.Spells
// m_casterLevel = cast item level/caster level, caster level should be saved to db, confirmed with sniffs
}
public virtual void Heartbeat() { }
public T GetScript<T>() where T : AuraScript
{
return (T)GetScriptByType(typeof(T));
@@ -2863,6 +2865,28 @@ namespace Game.Spells
_staticApplications[target.GetGUID()] |= effMask;
}
void Heartbeat()
{
base.Heartbeat();
// Periodic food and drink emote animation
HandlePeriodicFoodSpellVisualKit();
}
void HandlePeriodicFoodSpellVisualKit()
{
SpellSpecificType specificType = GetSpellInfo().GetSpellSpecific();
bool food = specificType == SpellSpecificType.Food || specificType == SpellSpecificType.FoodAndDrink;
bool drink = specificType == SpellSpecificType.Drink || specificType == SpellSpecificType.FoodAndDrink;
if (food)
GetUnitOwner().SendPlaySpellVisualKit(SpellConst.VisualKitFood, 0, 0);
if (drink)
GetUnitOwner().SendPlaySpellVisualKit(SpellConst.VisualKitDrink, 0, 0);
}
// Allow Apply Aura Handler to modify and access m_AuraDRGroup
public void SetDiminishGroup(DiminishingGroup group) { m_AuraDRGroup = group; }
public DiminishingGroup GetDiminishGroup() { return m_AuraDRGroup; }