mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +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
|
|
@ -134,7 +134,6 @@ m_creatureInfo(NULL), m_splineFlags(SPLINEFLAG_WALKMODE)
|
|||
|
||||
m_CreatureSpellCooldowns.clear();
|
||||
m_CreatureCategoryCooldowns.clear();
|
||||
m_GlobalCooldown = 0;
|
||||
|
||||
m_splineFlags = SPLINEFLAG_WALKMODE;
|
||||
}
|
||||
|
|
@ -407,11 +406,6 @@ uint32 Creature::ChooseDisplayId(const CreatureInfo *cinfo, const CreatureData *
|
|||
|
||||
void Creature::Update(uint32 diff)
|
||||
{
|
||||
if(m_GlobalCooldown <= diff)
|
||||
m_GlobalCooldown = 0;
|
||||
else
|
||||
m_GlobalCooldown -= diff;
|
||||
|
||||
if (m_needNotify)
|
||||
{
|
||||
m_needNotify = false;
|
||||
|
|
@ -2025,8 +2019,6 @@ void Creature::AddCreatureSpellCooldown(uint32 spellid)
|
|||
|
||||
if(spellInfo->Category)
|
||||
_AddCreatureCategoryCooldown(spellInfo->Category, time(NULL));
|
||||
|
||||
m_GlobalCooldown = spellInfo->StartRecoveryTime;
|
||||
}
|
||||
|
||||
bool Creature::HasCategoryCooldown(uint32 spell_id) const
|
||||
|
|
@ -2035,10 +2027,6 @@ bool Creature::HasCategoryCooldown(uint32 spell_id) const
|
|||
if(!spellInfo)
|
||||
return false;
|
||||
|
||||
// check global cooldown if spell affected by it
|
||||
if (spellInfo->StartRecoveryCategory > 0 && m_GlobalCooldown > 0)
|
||||
return true;
|
||||
|
||||
CreatureSpellCooldowns::const_iterator itr = m_CreatureCategoryCooldowns.find(spellInfo->Category);
|
||||
return (itr != m_CreatureCategoryCooldowns.end() && time_t(itr->second + (spellInfo->CategoryRecoveryTime / IN_MILLISECONDS)) > time(NULL));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue