From 11f952b3a68ba747b6045c5adc165050407658b6 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Thu, 30 Sep 2010 22:29:21 +0400 Subject: [PATCH] [10564] Not allow charmed by player creatures have threat list. Original patch provided by zergtmn. --- src/game/Unit.cpp | 16 +++++++++++----- src/shared/revision_nr.h | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 1f2064449f4..3448163f153 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -8372,23 +8372,29 @@ void Unit::setDeathState(DeathState s) bool Unit::CanHaveThreatList() const { // only creatures can have threat list - if( GetTypeId() != TYPEID_UNIT ) + if (GetTypeId() != TYPEID_UNIT) return false; // only alive units can have threat list - if( !isAlive() ) + if (!isAlive()) return false; + Creature const* creature = ((Creature const*)this); + // totems can not have threat list - if( ((Creature*)this)->isTotem() ) + if (creature->isTotem()) return false; // vehicles can not have threat list - if( ((Creature*)this)->isVehicle() ) + if (creature->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()) ) + if (creature->isPet() && IS_PLAYER_GUID(((Pet const*)creature)->GetOwnerGUID())) + return false; + + // charmed units can not have a threat list if charmed by player + if (creature->isCharmed() && IS_PLAYER_GUID(creature->GetCharmerGUID())) return false; return true; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index a23e40c8a2d..0a9cd23d20d 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 "10563" + #define REVISION_NR "10564" #endif // __REVISION_NR_H__