mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 19:37:03 +00:00
[10526] Implement server side global cooldown check.
Signed-off-by: VladimirMangos <vladimir@getmangos.com> Also pet/controlled unit global cooldown code replaced by new placed in charmInfo structure. Thanks to nos4r2zod for testing and gcd range check implement.
This commit is contained in:
parent
cb03e5a376
commit
3a8ad26a5e
12 changed files with 142 additions and 26 deletions
|
|
@ -65,6 +65,9 @@ float baseMoveSpeed[MAX_MOVE_TYPE] =
|
|||
3.14f // MOVE_PITCH_RATE
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Methods of class MovementInfo
|
||||
|
||||
void MovementInfo::Read(ByteBuffer &data)
|
||||
{
|
||||
data >> moveFlags;
|
||||
|
|
@ -155,6 +158,28 @@ void MovementInfo::Write(ByteBuffer &data) const
|
|||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Methods of class GlobalCooldownMgr
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
void GlobalCooldownMgr::AddGlobalCooldown(SpellEntry const* spellInfo, uint32 gcd)
|
||||
{
|
||||
m_GlobalCooldowns[spellInfo->StartRecoveryCategory] = GlobalCooldown(gcd, getMSTime());
|
||||
}
|
||||
|
||||
void GlobalCooldownMgr::CancelGlobalCooldown(SpellEntry const* spellInfo)
|
||||
{
|
||||
m_GlobalCooldowns[spellInfo->StartRecoveryCategory].duration = 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Methods of class Unit
|
||||
|
||||
Unit::Unit()
|
||||
: WorldObject(), i_motionMaster(this), m_ThreatManager(this), m_HostileRefManager(this)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue