AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
GlobalCooldownMgr Class Reference

#include "Unit.h"

Public Member Functions

 GlobalCooldownMgr ()=default
 
bool HasGlobalCooldown (SpellInfo const *spellInfo) const
 
void AddGlobalCooldown (SpellInfo const *spellInfo, uint32 gcd)
 
void CancelGlobalCooldown (SpellInfo const *spellInfo)
 

Private Attributes

GlobalCooldownList m_GlobalCooldowns
 

Detailed Description

Constructor & Destructor Documentation

◆ GlobalCooldownMgr()

GlobalCooldownMgr::GlobalCooldownMgr ( )
default

Member Function Documentation

◆ AddGlobalCooldown()

void GlobalCooldownMgr::AddGlobalCooldown ( SpellInfo const *  spellInfo,
uint32  gcd 
)
348{
349 m_GlobalCooldowns[spellInfo->StartRecoveryCategory] = GlobalCooldown(gcd, GameTime::GetGameTimeMS().count());
350}
Milliseconds GetGameTimeMS()
Definition: GameTime.cpp:43
Definition: Unit.h:988
GlobalCooldownList m_GlobalCooldowns
Definition: Unit.h:1008

References GameTime::GetGameTimeMS(), m_GlobalCooldowns, and SpellInfo::StartRecoveryCategory.

Referenced by Player::EquipItem(), and Spell::TriggerGlobalCooldown().

◆ CancelGlobalCooldown()

void GlobalCooldownMgr::CancelGlobalCooldown ( SpellInfo const *  spellInfo)
353{
354 m_GlobalCooldowns[spellInfo->StartRecoveryCategory].duration = 0;
355}

References m_GlobalCooldowns, and SpellInfo::StartRecoveryCategory.

Referenced by Spell::CancelGlobalCooldown().

◆ HasGlobalCooldown()

bool GlobalCooldownMgr::HasGlobalCooldown ( SpellInfo const *  spellInfo) const
342{
343 GlobalCooldownList::const_iterator itr = m_GlobalCooldowns.find(spellInfo->StartRecoveryCategory);
344 return itr != m_GlobalCooldowns.end() && itr->second.duration && getMSTimeDiff(itr->second.cast_time, GameTime::GetGameTimeMS().count()) < itr->second.duration;
345}
uint32 getMSTimeDiff(uint32 oldMSTime, uint32 newMSTime)
Definition: Timer.h:110

References GameTime::GetGameTimeMS(), getMSTimeDiff(), m_GlobalCooldowns, and SpellInfo::StartRecoveryCategory.

Referenced by Spell::CheckPetCast(), Spell::HasGlobalCooldown(), and PetAI::UpdateAI().

Member Data Documentation

◆ m_GlobalCooldowns

GlobalCooldownList GlobalCooldownMgr::m_GlobalCooldowns
private