mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[10564] Not allow charmed by player creatures have threat list.
Original patch provided by zergtmn.
This commit is contained in:
parent
f9fcf5e055
commit
be07edb8a1
2 changed files with 12 additions and 6 deletions
|
|
@ -8372,23 +8372,29 @@ void Unit::setDeathState(DeathState s)
|
||||||
bool Unit::CanHaveThreatList() const
|
bool Unit::CanHaveThreatList() const
|
||||||
{
|
{
|
||||||
// only creatures can have threat list
|
// only creatures can have threat list
|
||||||
if( GetTypeId() != TYPEID_UNIT )
|
if (GetTypeId() != TYPEID_UNIT)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// only alive units can have threat list
|
// only alive units can have threat list
|
||||||
if( !isAlive() )
|
if (!isAlive())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
Creature const* creature = ((Creature const*)this);
|
||||||
|
|
||||||
// totems can not have threat list
|
// totems can not have threat list
|
||||||
if( ((Creature*)this)->isTotem() )
|
if (creature->isTotem())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// vehicles can not have threat list
|
// vehicles can not have threat list
|
||||||
if( ((Creature*)this)->isVehicle() )
|
if (creature->isVehicle())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// pets can not have a threat list, unless they are controlled by a creature
|
// 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 false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "10563"
|
#define REVISION_NR "10564"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue