Added checking global cooldown for pet autocast spells.

Added checking global cooldown for pet spell casting triggered by master.
Optimized PetAI::UpdateAI:
 - Removed obsolete victim_guid as combat check.
 - Stop pet combat when pet die in JustDied(Unit*) method.
 - Optimized autospells selection and casting.

Signed-off-by: ApoC <apoc@nymfe.net>
This commit is contained in:
ApoC 2008-10-27 22:36:42 +01:00 committed by tomrus88
parent ca6e456da1
commit 8bea43063e
4 changed files with 106 additions and 104 deletions

View file

@ -164,6 +164,9 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data )
else
unit_target = NULL;
if (((Creature*)pet)->GetGlobalCooldown() > 0)
return;
// do not cast unknown spells
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellid );
if(!spellInfo)
@ -612,6 +615,9 @@ void WorldSession::HandlePetCastSpellOpcode( WorldPacket& recvPacket )
return;
}
if (pet->GetGlobalCooldown() > 0)
return;
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellid);
if(!spellInfo)
{