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_regenTimer = 0;
|
||||||
m_regenTimerCount = 0;
|
m_regenTimerCount = 0;
|
||||||
|
m_foodEmoteTimerCount = 0;
|
||||||
m_weaponChangeTimer = 0;
|
m_weaponChangeTimer = 0;
|
||||||
|
|
||||||
m_zoneUpdateId = uint32(-1);
|
m_zoneUpdateId = uint32(-1);
|
||||||
@@ -2579,6 +2580,7 @@ void Player::RegenerateAll()
|
|||||||
// return;
|
// return;
|
||||||
|
|
||||||
m_regenTimerCount += m_regenTimer;
|
m_regenTimerCount += m_regenTimer;
|
||||||
|
m_foodEmoteTimerCount += m_regenTimer;
|
||||||
|
|
||||||
Regenerate(POWER_ENERGY);
|
Regenerate(POWER_ENERGY);
|
||||||
|
|
||||||
@@ -2623,6 +2625,37 @@ void Player::RegenerateAll()
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_regenTimer = 0;
|
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)
|
void Player::Regenerate(Powers power)
|
||||||
|
|||||||
@@ -2631,6 +2631,7 @@ class Player : public Unit, public GridObject<Player>
|
|||||||
|
|
||||||
uint32 m_AreaID;
|
uint32 m_AreaID;
|
||||||
uint32 m_regenTimerCount;
|
uint32 m_regenTimerCount;
|
||||||
|
uint32 m_foodEmoteTimerCount;
|
||||||
float m_powerFraction[MAX_POWERS];
|
float m_powerFraction[MAX_POWERS];
|
||||||
uint32 m_contestedPvPTimer;
|
uint32 m_contestedPvPTimer;
|
||||||
|
|
||||||
|
|||||||
@@ -17508,7 +17508,7 @@ void Unit::SendPlaySpellImpact(uint64 guid, uint32 id)
|
|||||||
WorldPacket data(SMSG_PLAY_SPELL_IMPACT, 8 + 4);
|
WorldPacket data(SMSG_PLAY_SPELL_IMPACT, 8 + 4);
|
||||||
data << uint64(guid); // target
|
data << uint64(guid); // target
|
||||||
data << uint32(id); // SpellVisualKit.dbc index
|
data << uint32(id); // SpellVisualKit.dbc index
|
||||||
SendMessageToSet(&data, false);
|
SendMessageToSet(&data, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Unit::ApplyResilience(Unit const* victim, float* crit, int32* damage, bool isCrit, CombatRating type)
|
void Unit::ApplyResilience(Unit const* victim, float* crit, int32* damage, bool isCrit, CombatRating type)
|
||||||
|
|||||||
@@ -246,6 +246,12 @@ enum SpellCategory
|
|||||||
SPELL_CATEGORY_DRINK = 59,
|
SPELL_CATEGORY_DRINK = 59,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum SpellVisualKit
|
||||||
|
{
|
||||||
|
SPELL_VISUAL_KIT_FOOD = 406,
|
||||||
|
SPELL_VISUAL_KIT_DRINK = 438
|
||||||
|
};
|
||||||
|
|
||||||
const uint32 ItemQualityColors[MAX_ITEM_QUALITY] =
|
const uint32 ItemQualityColors[MAX_ITEM_QUALITY] =
|
||||||
{
|
{
|
||||||
0xff9d9d9d, //GREY
|
0xff9d9d9d, //GREY
|
||||||
|
|||||||
Reference in New Issue
Block a user