Core/Spell Mechanics: introduce global cooldown manager for server-side checks for GCD (ported from mangos)

This commit is contained in:
darkstalker
2011-02-22 17:02:47 +06:00
committed by Azazel
parent 401ec2180f
commit 1646f9d91c
9 changed files with 130 additions and 18 deletions
@@ -295,7 +295,7 @@ void WorldSession::HandlePetActionHelper(Unit *pet, uint64 guid1, uint16 spellid
}
if (spellInfo->StartRecoveryCategory > 0)
if (pet->ToCreature()->GetGlobalCooldown() > 0)
if (pet->GetCharmInfo() && pet->GetCharmInfo()->GetGlobalCooldownMgr().HasGlobalCooldown(spellInfo))
return;
for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
@@ -753,7 +753,7 @@ void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket)
}
if (spellInfo->StartRecoveryCategory > 0) // Check if spell is affected by GCD
if (caster->GetTypeId() == TYPEID_UNIT && caster->ToCreature()->GetGlobalCooldown() > 0)
if (caster->GetTypeId() == TYPEID_UNIT && caster->GetCharmInfo() && caster->GetCharmInfo()->GetGlobalCooldownMgr().HasGlobalCooldown(spellInfo))
{
caster->SendPetCastFail(spellId, SPELL_FAILED_NOT_READY);
return;