From 7b7c91283498ed71f84ce24b046bd7750349e98a Mon Sep 17 00:00:00 2001 From: Wyk3d Date: Mon, 22 Dec 2008 01:22:09 +0200 Subject: [PATCH] [6928] Corrected the handling of evade and threat for creature summoned pets. Should fix some of the setVisibility crashes. --- src/game/MotionMaster.cpp | 11 ++++++++++- src/game/Unit.cpp | 8 ++++++-- src/shared/revision_nr.h | 2 +- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/game/MotionMaster.cpp b/src/game/MotionMaster.cpp index 2dc42cd4d..23beef949 100644 --- a/src/game/MotionMaster.cpp +++ b/src/game/MotionMaster.cpp @@ -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(*target,PET_FOLLOW_DIST,PET_FOLLOW_ANGLE)); + } } else { diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 86a0e29af..829555c2e 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -9047,8 +9047,12 @@ bool Unit::CanHaveThreatList() const if( !isAlive() ) return false; - // pets and totems can not have threat list - if( ((Creature*)this)->isPet() || ((Creature*)this)->isTotem() ) + // totems can not have threat list + if( ((Creature*)this)->isTotem() ) + 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; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index fcbcb4319..1a4a6befc 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "6927" + #define REVISION_NR "6928" #endif // __REVISION_NR_H__ -- 2.11.4.GIT