Core/Player: fixed periodic drinking and eating emote

This commit is contained in:
Ovalord
2018-01-20 01:18:13 +01:00
parent 2deecabc17
commit a1482cb9f6
3 changed files with 43 additions and 0 deletions

View File

@@ -334,6 +334,7 @@ Player::Player(WorldSession* session): Unit(true), _archaeology(this)
m_regenTimerCount = 0;
m_holyPowerRegenTimerCount = 0;
m_focusRegenTimerCount = 0;
m_foodEmoteTimerCount = 0;
m_weaponChangeTimer = 0;
m_zoneUpdateId = uint32(-1);
@@ -2200,6 +2201,8 @@ void Player::RegenerateAll()
if (getClass() == CLASS_HUNTER)
m_focusRegenTimerCount += m_regenTimer;
m_foodEmoteTimerCount += m_regenTimer;
Regenerate(POWER_ENERGY);
Regenerate(POWER_MANA);
Regenerate(POWER_FOCUS);
@@ -2249,6 +2252,39 @@ 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<Aura*> auraList;
AuraEffectList const& ModRegenAuras = GetAuraEffectsByType(SPELL_AURA_MOD_REGEN);
AuraEffectList const& ModPowerRegenAuras = GetAuraEffectsByType(SPELL_AURA_MOD_POWER_REGEN);
for (auto itr = ModRegenAuras.begin(); itr != ModRegenAuras.end(); ++itr)
auraList.emplace_back((*itr)->GetBase());
for (auto itr = ModPowerRegenAuras.begin(); itr != ModPowerRegenAuras.end(); ++itr)
auraList.emplace_back((*itr)->GetBase());
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)->HasEffectType(SPELL_AURA_MOD_REGEN) && (*itr)->GetSpellInfo()->AuraInterruptFlags & AURA_INTERRUPT_FLAG_NOT_SEATED)
{
SendPlaySpellVisualKit(SPELL_VISUAL_KIT_FOOD, 0, 0);
break;
}
else if ((*itr)->HasEffectType(SPELL_AURA_MOD_POWER_REGEN) && (*itr)->GetSpellInfo()->AuraInterruptFlags & AURA_INTERRUPT_FLAG_NOT_SEATED)
{
SendPlaySpellVisualKit(SPELL_VISUAL_KIT_DRINK, 0, 0);
break;
}
}
m_foodEmoteTimerCount -= 5000;
}
}
void Player::Regenerate(Powers power)

View File

@@ -2595,6 +2595,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
uint32 m_regenTimerCount;
uint32 m_holyPowerRegenTimerCount;
uint32 m_focusRegenTimerCount;
uint32 m_foodEmoteTimerCount;
float m_powerFraction[MAX_POWERS_PER_CLASS];
uint32 m_contestedPvPTimer;

View File

@@ -311,6 +311,12 @@ enum SpellCategory
SPELL_CATEGORY_DRINK = 59
};
enum SpellVisualKit
{
SPELL_VISUAL_KIT_FOOD = 406,
SPELL_VISUAL_KIT_DRINK = 438
};
const uint32 ItemQualityColors[MAX_ITEM_QUALITY] =
{
0xff9d9d9d, //GREY