mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 10:37:03 +00:00
[10688] New version of patch for send real diff from last update.
In new version last update time stopred for specific Cell that store all world objects placed in it. All objects of Cell updated (or not updated) in same time. Original version provided by ciphercom.
This commit is contained in:
parent
464908f453
commit
e219ee99bb
36 changed files with 183 additions and 151 deletions
|
|
@ -291,7 +291,7 @@ Unit::~Unit()
|
|||
MANGOS_ASSERT(m_deletedHolders.size() == 0);
|
||||
}
|
||||
|
||||
void Unit::Update( uint32 p_time )
|
||||
void Unit::Update(uint32 update_diff, uint32 tick_diff)
|
||||
{
|
||||
if(!IsInWorld())
|
||||
return;
|
||||
|
|
@ -306,21 +306,21 @@ void Unit::Update( uint32 p_time )
|
|||
// WARNING! Order of execution here is important, do not change.
|
||||
// Spells must be processed with event system BEFORE they go to _UpdateSpells.
|
||||
// Or else we may have some SPELL_STATE_FINISHED spells stalled in pointers, that is bad.
|
||||
m_Events.Update( p_time );
|
||||
_UpdateSpells( p_time );
|
||||
m_Events.Update(update_diff);
|
||||
_UpdateSpells(update_diff);
|
||||
|
||||
CleanupDeletedAuras();
|
||||
|
||||
if (m_lastManaUseTimer)
|
||||
{
|
||||
if (p_time >= m_lastManaUseTimer)
|
||||
if (update_diff >= m_lastManaUseTimer)
|
||||
m_lastManaUseTimer = 0;
|
||||
else
|
||||
m_lastManaUseTimer -= p_time;
|
||||
m_lastManaUseTimer -= update_diff;
|
||||
}
|
||||
|
||||
if (CanHaveThreatList())
|
||||
getThreatManager().UpdateForClient(p_time);
|
||||
getThreatManager().UpdateForClient(update_diff);
|
||||
|
||||
// update combat timer only for players and pets
|
||||
if (isInCombat() && (GetTypeId() == TYPEID_PLAYER || ((Creature*)this)->IsPet() || ((Creature*)this)->isCharmed()))
|
||||
|
|
@ -331,26 +331,24 @@ void Unit::Update( uint32 p_time )
|
|||
if (m_HostileRefManager.isEmpty())
|
||||
{
|
||||
// m_CombatTimer set at aura start and it will be freeze until aura removing
|
||||
if (m_CombatTimer <= p_time)
|
||||
if (m_CombatTimer <= update_diff)
|
||||
CombatStop();
|
||||
else
|
||||
m_CombatTimer -= p_time;
|
||||
m_CombatTimer -= update_diff;
|
||||
}
|
||||
}
|
||||
|
||||
if (uint32 base_att = getAttackTimer(BASE_ATTACK))
|
||||
{
|
||||
setAttackTimer(BASE_ATTACK, (p_time >= base_att ? 0 : base_att - p_time) );
|
||||
}
|
||||
setAttackTimer(BASE_ATTACK, (update_diff >= base_att ? 0 : base_att - update_diff) );
|
||||
|
||||
// update abilities available only for fraction of time
|
||||
UpdateReactives( p_time );
|
||||
UpdateReactives(update_diff);
|
||||
|
||||
ModifyAuraState(AURA_STATE_HEALTHLESS_20_PERCENT, GetHealth() < GetMaxHealth()*0.20f);
|
||||
ModifyAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, GetHealth() < GetMaxHealth()*0.35f);
|
||||
ModifyAuraState(AURA_STATE_HEALTH_ABOVE_75_PERCENT, GetHealth() > GetMaxHealth()*0.75f);
|
||||
|
||||
i_motionMaster.UpdateMotion(p_time);
|
||||
i_motionMaster.UpdateMotion(tick_diff); // movegens expected non freeze time diff
|
||||
}
|
||||
|
||||
bool Unit::haveOffhandWeapon() const
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue