aboutsummaryrefslogtreecommitdiff
path: root/src/game/PetHandler.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2009-04-30 09:58:34 -0500
committermegamage <none@none>2009-04-30 09:58:34 -0500
commitefd58033ea12f3380c2ff78ca1f7f0b6db368754 (patch)
tree89fcffe19d652205a3ce5c9e344c79738789b046 /src/game/PetHandler.cpp
parentb4c6a9842c36f01c2f42059bec88f0af10654074 (diff)
*Use canattack to check if canattack in pethandler and combathandler
--HG-- branch : trunk
Diffstat (limited to 'src/game/PetHandler.cpp')
-rw-r--r--src/game/PetHandler.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/game/PetHandler.cpp b/src/game/PetHandler.cpp
index 6286ba40b74..932eb593ff8 100644
--- a/src/game/PetHandler.cpp
+++ b/src/game/PetHandler.cpp
@@ -105,19 +105,21 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data )
//TODO: Send proper error message to client
return;
}
+
// only place where pet can be player
- pet->clearUnitState(UNIT_STAT_FOLLOW);
Unit *TargetUnit = ObjectAccessor::GetUnit(*_player, guid2);
if(!TargetUnit)
return;
- // not let attack friendly units.
- if(GetPlayer()->IsFriendlyTo(TargetUnit))
+ if(!pet->canAttack(TargetUnit))
return;
+
// Not let attack through obstructions
//if(!pet->IsWithinLOSInMap(TargetUnit))
// return;
+ pet->clearUnitState(UNIT_STAT_FOLLOW);
+
if(pet->GetTypeId() != TYPEID_PLAYER && ((Creature*)pet)->IsAIEnabled)
{
((Creature*)pet)->AI()->AttackStart(TargetUnit);