mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 10:37:03 +00:00
[10924] Send time diff between Update() calls for object - should help with mob respawn on inactive grids etc. Based on patches by VladimirMangos and cipherCOM. All issues from previous patches should be finally fixed now.
Signed-off-by: Ambal <pogrebniak@gala.net>
This commit is contained in:
parent
72b1d30a1c
commit
b11820593c
39 changed files with 284 additions and 149 deletions
|
|
@ -164,12 +164,12 @@ void MovementInfo::Write(ByteBuffer &data) const
|
|||
bool GlobalCooldownMgr::HasGlobalCooldown(SpellEntry const* spellInfo) const
|
||||
{
|
||||
GlobalCooldownList::const_iterator itr = m_GlobalCooldowns.find(spellInfo->StartRecoveryCategory);
|
||||
return itr != m_GlobalCooldowns.end() && itr->second.duration && getMSTimeDiff(itr->second.cast_time, getMSTime()) < itr->second.duration;
|
||||
return itr != m_GlobalCooldowns.end() && itr->second.duration && WorldTimer::getMSTimeDiff(itr->second.cast_time, WorldTimer::getMSTime()) < itr->second.duration;
|
||||
}
|
||||
|
||||
void GlobalCooldownMgr::AddGlobalCooldown(SpellEntry const* spellInfo, uint32 gcd)
|
||||
{
|
||||
m_GlobalCooldowns[spellInfo->StartRecoveryCategory] = GlobalCooldown(gcd, getMSTime());
|
||||
m_GlobalCooldowns[spellInfo->StartRecoveryCategory] = GlobalCooldown(gcd, WorldTimer::getMSTime());
|
||||
}
|
||||
|
||||
void GlobalCooldownMgr::CancelGlobalCooldown(SpellEntry const* spellInfo)
|
||||
|
|
@ -289,11 +289,11 @@ Unit::~Unit()
|
|||
MANGOS_ASSERT(m_deletedHolders.size() == 0);
|
||||
}
|
||||
|
||||
void Unit::Update( uint32 p_time )
|
||||
void Unit::Update( uint32 update_diff, uint32 p_time )
|
||||
{
|
||||
if(!IsInWorld())
|
||||
return;
|
||||
|
||||
|
||||
/*if(p_time > m_AurasCheck)
|
||||
{
|
||||
m_AurasCheck = 2000;
|
||||
|
|
@ -304,21 +304,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()))
|
||||
|
|
@ -329,20 +329,20 @@ 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);
|
||||
|
|
@ -371,7 +371,7 @@ void Unit::SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, SplineTy
|
|||
data << GetPackGUID();
|
||||
data << uint8(0); // new in 3.1 bool, used to toggle MOVEFLAG2_UNK4 = 0x0040 on client side
|
||||
data << GetPositionX() << GetPositionY() << GetPositionZ();
|
||||
data << uint32(getMSTime());
|
||||
data << uint32(WorldTimer::getMSTime());
|
||||
|
||||
data << uint8(type); // unknown
|
||||
switch(type)
|
||||
|
|
@ -8351,7 +8351,7 @@ void Unit::SetSpeedRate(UnitMoveType mtype, float rate, bool forced)
|
|||
data << GetPackGUID();
|
||||
data << uint32(0); // movement flags
|
||||
data << uint16(0); // unk flags
|
||||
data << uint32(getMSTime());
|
||||
data << uint32(WorldTimer::getMSTime());
|
||||
data << float(GetPositionX());
|
||||
data << float(GetPositionY());
|
||||
data << float(GetPositionZ());
|
||||
|
|
@ -8820,7 +8820,7 @@ DiminishingLevels Unit::GetDiminishing(DiminishingGroup group)
|
|||
return DIMINISHING_LEVEL_1;
|
||||
|
||||
// If last spell was casted more than 15 seconds ago - reset the count.
|
||||
if (i->stack==0 && getMSTimeDiff(i->hitTime,getMSTime()) > 15*IN_MILLISECONDS)
|
||||
if (i->stack==0 && WorldTimer::getMSTimeDiff(i->hitTime,WorldTimer::getMSTime()) > 15*IN_MILLISECONDS)
|
||||
{
|
||||
i->hitCount = DIMINISHING_LEVEL_1;
|
||||
return DIMINISHING_LEVEL_1;
|
||||
|
|
@ -8845,7 +8845,7 @@ void Unit::IncrDiminishing(DiminishingGroup group)
|
|||
i->hitCount += 1;
|
||||
return;
|
||||
}
|
||||
m_Diminishing.push_back(DiminishingReturn(group,getMSTime(),DIMINISHING_LEVEL_2));
|
||||
m_Diminishing.push_back(DiminishingReturn(group,WorldTimer::getMSTime(),DIMINISHING_LEVEL_2));
|
||||
}
|
||||
|
||||
void Unit::ApplyDiminishingToDuration(DiminishingGroup group, int32 &duration,Unit* caster,DiminishingLevels Level, int32 limitduration)
|
||||
|
|
@ -8901,7 +8901,7 @@ void Unit::ApplyDiminishingAura( DiminishingGroup group, bool apply )
|
|||
i->stack -= 1;
|
||||
// Remember time after last aura from group removed
|
||||
if (i->stack == 0)
|
||||
i->hitTime = getMSTime();
|
||||
i->hitTime = WorldTimer::getMSTime();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue