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

#include "CharmInfo.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 
)
411{
412 m_GlobalCooldowns[spellInfo->StartRecoveryCategory] = GlobalCooldown(gcd, GameTime::GetGameTimeMS().count());
413}
Milliseconds GetGameTimeMS()
Definition: GameTime.cpp:43
Definition: CharmInfo.h:69
GlobalCooldownList m_GlobalCooldowns
Definition: CharmInfo.h:89

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

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

◆ CancelGlobalCooldown()

void GlobalCooldownMgr::CancelGlobalCooldown ( SpellInfo const *  spellInfo)
416{
417 m_GlobalCooldowns[spellInfo->StartRecoveryCategory].duration = 0;
418}

References m_GlobalCooldowns, and SpellInfo::StartRecoveryCategory.

Referenced by Spell::CancelGlobalCooldown().

◆ HasGlobalCooldown()

bool GlobalCooldownMgr::HasGlobalCooldown ( SpellInfo const *  spellInfo) const
405{
406 GlobalCooldownList::const_iterator itr = m_GlobalCooldowns.find(spellInfo->StartRecoveryCategory);
407 return itr != m_GlobalCooldowns.end() && itr->second.duration && getMSTimeDiff(itr->second.cast_time, GameTime::GetGameTimeMS().count()) < itr->second.duration;
408}
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