mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-20 09:17:36 +01:00
*Use canattack to check if canattack in pethandler and combathandler
--HG-- branch : trunk
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user