mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-18 11:25:42 +00:00
Fix(Core/Player): fix periodic eating and drinking emotes (#1602)
This commit is contained in:
@@ -709,6 +709,7 @@ Player::Player(WorldSession* session): Unit(true), m_mover(this)
|
||||
|
||||
m_regenTimer = 0;
|
||||
m_regenTimerCount = 0;
|
||||
m_foodEmoteTimerCount = 0;
|
||||
m_weaponChangeTimer = 0;
|
||||
|
||||
m_zoneUpdateId = uint32(-1);
|
||||
@@ -2579,6 +2580,7 @@ void Player::RegenerateAll()
|
||||
// return;
|
||||
|
||||
m_regenTimerCount += m_regenTimer;
|
||||
m_foodEmoteTimerCount += m_regenTimer;
|
||||
|
||||
Regenerate(POWER_ENERGY);
|
||||
|
||||
@@ -2623,6 +2625,37 @@ void Player::RegenerateAll()
|
||||
}
|
||||
|
||||
m_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)
|
||||
{
|
||||
std::vector<AuraEffect*> auraList;
|
||||
AuraEffectList const& ModRegenAuras = GetAuraEffectsByType(SPELL_AURA_MOD_REGEN);
|
||||
AuraEffectList const& ModPowerRegenAuras = GetAuraEffectsByType(SPELL_AURA_MOD_POWER_REGEN);
|
||||
|
||||
auraList.reserve(ModRegenAuras.size() + ModPowerRegenAuras.size());
|
||||
auraList.insert(auraList.end(), ModRegenAuras.begin(), ModRegenAuras.end());
|
||||
auraList.insert(auraList.end(), ModPowerRegenAuras.begin(), ModPowerRegenAuras.end());
|
||||
|
||||
for (auto itr = auraList.begin(); itr != auraList.end(); ++itr)
|
||||
{
|
||||
// Food emote comes above drinking emote if we have to decide (mage regen food for example)
|
||||
if ((*itr)->GetBase()->HasEffectType(SPELL_AURA_MOD_REGEN) && (*itr)->GetSpellInfo()->AuraInterruptFlags & AURA_INTERRUPT_FLAG_NOT_SEATED)
|
||||
{
|
||||
SendPlaySpellVisual(SPELL_VISUAL_KIT_FOOD);
|
||||
break;
|
||||
}
|
||||
else if ((*itr)->GetBase()->HasEffectType(SPELL_AURA_MOD_POWER_REGEN) && (*itr)->GetSpellInfo()->AuraInterruptFlags & AURA_INTERRUPT_FLAG_NOT_SEATED)
|
||||
{
|
||||
SendPlaySpellVisual(SPELL_VISUAL_KIT_DRINK);
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_foodEmoteTimerCount -= 5000;
|
||||
}
|
||||
}
|
||||
|
||||
void Player::Regenerate(Powers power)
|
||||
|
||||
Reference in New Issue
Block a user