aboutsummaryrefslogtreecommitdiff
path: root/src/game/PetHandler.cpp
diff options
context:
space:
mode:
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);