diff --git a/Source/Framework/Constants/Spells/SpellConst.cs b/Source/Framework/Constants/Spells/SpellConst.cs index ea0ecc125..c0c4ed8e7 100644 --- a/Source/Framework/Constants/Spells/SpellConst.cs +++ b/Source/Framework/Constants/Spells/SpellConst.cs @@ -34,6 +34,9 @@ namespace Framework.Constants public const float TrajectoryMissileSize = 3.0f; public const int MaxPowersPerSpell = 4; + + public const uint VisualKitFood = 406; + public const uint VisualKitDrink = 438; } diff --git a/Source/Game/Entities/Player/Player.Fields.cs b/Source/Game/Entities/Player/Player.Fields.cs index 337589d34..957c94532 100644 --- a/Source/Game/Entities/Player/Player.Fields.cs +++ b/Source/Game/Entities/Player/Player.Fields.cs @@ -157,6 +157,7 @@ namespace Game.Entities byte m_swingErrorMsg; uint m_combatExitTime; uint m_regenTimerCount; + uint m_foodEmoteTimerCount; uint m_weaponChangeTimer; //Quest diff --git a/Source/Game/Entities/Player/Player.cs b/Source/Game/Entities/Player/Player.cs index 0dc683af4..ae1b2e426 100644 --- a/Source/Game/Entities/Player/Player.cs +++ b/Source/Game/Entities/Player/Player.cs @@ -3647,6 +3647,7 @@ namespace Game.Entities void RegenerateAll() { m_regenTimerCount += RegenTimer; + m_foodEmoteTimerCount += RegenTimer; for (PowerType power = PowerType.Mana; power < PowerType.Max; power++)// = power + 1) if (power != PowerType.Runes) @@ -3683,6 +3684,32 @@ namespace Game.Entities } RegenTimer = 0; + + // Handles the emotes for drinking and eating. + // According to sniffs there is a background timer going on that repeats independed from the time window where the aura applies. + // That's why we dont need to reset the timer on apply. In sniffs I have seen that the first call for the spell visual is totally random, then after + // 5 seconds over and over again which confirms my theory that we have a independed timer. + if (m_foodEmoteTimerCount >= 5000) + { + List auraList = GetAuraEffectsByType(AuraType.ModRegen); + auraList.AddRange(GetAuraEffectsByType(AuraType.ModPowerRegen)); + + foreach (var auraEffect in auraList) + { + // Food emote comes above drinking emote if we have to decide (mage regen food for example) + if (auraEffect.GetBase().HasEffectType(AuraType.ModRegen) && auraEffect.GetSpellInfo().HasAuraInterruptFlag(SpellAuraInterruptFlags.Standing)) + { + SendPlaySpellVisualKit(SpellConst.VisualKitFood, 0, 0); + break; + } + else if (auraEffect.GetBase().HasEffectType(AuraType.ModPowerRegen) && auraEffect.GetSpellInfo().HasAuraInterruptFlag(SpellAuraInterruptFlags.Standing)) + { + SendPlaySpellVisualKit(SpellConst.VisualKitDrink, 0, 0); + break; + } + } + m_foodEmoteTimerCount -= 5000; + } } void Regenerate(PowerType power) {