mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-24 19:06:49 +01:00
Core/Player: fixed periodic drinking and eating emote
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user