[6928] Corrected the handling of evade and threat for creature summoned pets. Should fix some of the setVisibility crashes.

This commit is contained in:
Wyk3d 2008-12-22 01:22:09 +02:00 committed by tomrus88
parent 1884889f04
commit ed4efc317c
3 changed files with 21 additions and 4 deletions

View file

@ -150,8 +150,17 @@ MotionMaster::MoveTargetedHome()
}
else if(i_owner->GetTypeId()==TYPEID_UNIT && ((Creature*)i_owner)->GetCharmerOrOwnerGUID())
{
sLog.outError("Pet or controlled creature (Entry: %u GUID: %u) attempt targeted home",
DEBUG_LOG("Pet or controlled creature (Entry: %u GUID: %u) targeting home",
i_owner->GetEntry(), i_owner->GetGUIDLow() );
Unit *target = ((Creature*)i_owner)->GetCharmerOrOwner();
if(target)
{
i_owner->addUnitState(UNIT_STAT_FOLLOW);
DEBUG_LOG("Following %s (GUID: %u)",
target->GetTypeId()==TYPEID_PLAYER ? "player" : "creature",
target->GetTypeId()==TYPEID_PLAYER ? target->GetGUIDLow() : ((Creature*)target)->GetDBTableGUIDLow() );
Mutate(new TargetedMovementGenerator<Creature>(*target,PET_FOLLOW_DIST,PET_FOLLOW_ANGLE));
}
}
else
{

View file

@ -9094,8 +9094,16 @@ bool Unit::CanHaveThreatList() const
if( !isAlive() )
return false;
// pets and totems can not have threat list
if( ((Creature*)this)->isPet() || ((Creature*)this)->isTotem() || ((Creature*)this)->isVehicle() )
// totems can not have threat list
if( ((Creature*)this)->isTotem() )
return false;
// vehicles can not have threat list
if( ((Creature*)this)->isVehicle() )
return false;
// pets can not have a threat list, unless they are controlled by a creature
if( ((Creature*)this)->isPet() && IS_PLAYER_GUID(((Pet*)this)->GetOwnerGUID()) )
return false;
return true;

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "6927"
#define REVISION_NR "6928"
#endif // __REVISION_NR_H__