[svn] Fixed pets stopping attack after pressing the attack button multiple times.

--HG--
branch : trunk
This commit is contained in:
gvcoman
2008-11-07 18:46:25 -06:00
parent 3c7ae2b226
commit 9d6d9efa65
2 changed files with 7 additions and 4 deletions
+4 -1
View File
@@ -65,9 +65,12 @@ void PetAI::MoveInLineOfSight(Unit *u)
void PetAI::AttackStart(Unit *u) void PetAI::AttackStart(Unit *u)
{ {
if( inCombat || !u || (i_pet.isPet() && ((Pet&)i_pet).getPetType() == MINI_PET) ) if( !u || (i_pet.isPet() && ((Pet&)i_pet).getPetType() == MINI_PET) )
return; return;
if (inCombat && i_pet.getVictim() && u != i_pet.getVictim())
i_pet.AttackStop();
if(i_pet.Attack(u,true)) if(i_pet.Attack(u,true))
{ {
i_pet.clearUnitState(UNIT_STAT_FOLLOW); i_pet.clearUnitState(UNIT_STAT_FOLLOW);
+3 -3
View File
@@ -104,9 +104,6 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data )
if( GetPlayer()->IsFriendlyTo(TargetUnit)) if( GetPlayer()->IsFriendlyTo(TargetUnit))
return; return;
if(pet->getVictim())
pet->AttackStop();
if(pet->GetTypeId() != TYPEID_PLAYER) if(pet->GetTypeId() != TYPEID_PLAYER)
{ {
if (((Creature*)pet)->AI()) if (((Creature*)pet)->AI())
@@ -123,6 +120,9 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data )
} }
else // charmed player else // charmed player
{ {
if(pet->getVictim() && pet->getVictim() != TargetUnit)
pet->AttackStop();
pet->Attack(TargetUnit,true); pet->Attack(TargetUnit,true);
pet->SendPetAIReaction(guid1); pet->SendPetAIReaction(guid1);
} }