mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-19 03:45:43 +00:00
feat(Core/Player): implement Spell Queue (#20797)
This commit is contained in:
@@ -400,6 +400,22 @@ bool GlobalCooldownMgr::HasGlobalCooldown(SpellInfo const* spellInfo) const
|
||||
return itr != m_GlobalCooldowns.end() && itr->second.duration && getMSTimeDiff(itr->second.cast_time, GameTime::GetGameTimeMS().count()) < itr->second.duration;
|
||||
}
|
||||
|
||||
uint32 GlobalCooldownMgr::GetGlobalCooldown(SpellInfo const* spellInfo) const
|
||||
{
|
||||
if (!spellInfo)
|
||||
return 0;
|
||||
|
||||
auto itr = m_GlobalCooldowns.find(spellInfo->StartRecoveryCategory);
|
||||
if (itr == m_GlobalCooldowns.end() || itr->second.duration == 0)
|
||||
return 0;
|
||||
|
||||
uint32 start = itr->second.cast_time;
|
||||
uint32 delay = itr->second.duration;
|
||||
uint32 now = getMSTime();
|
||||
|
||||
return (start + delay > now) ? (start + delay) - now : 0;
|
||||
}
|
||||
|
||||
void GlobalCooldownMgr::AddGlobalCooldown(SpellInfo const* spellInfo, uint32 gcd)
|
||||
{
|
||||
m_GlobalCooldowns[spellInfo->StartRecoveryCategory] = GlobalCooldown(gcd, GameTime::GetGameTimeMS().count());
|
||||
|
||||
Reference in New Issue
Block a user