From bcb39b263d65a52c7b21f372d92668a0504f8475 Mon Sep 17 00:00:00 2001 From: megamage Date: Wed, 10 Dec 2008 15:14:49 -0600 Subject: *Allow pets to cast devour magic on both friends and enemies. --HG-- branch : trunk --- src/game/Unit.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'src/game/Unit.cpp') diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 51fb5262855..ec3f687f0e6 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -8303,7 +8303,7 @@ Unit *Unit::GetCharmer() const return NULL; } -Player* Unit::GetCharmerOrOwnerPlayerOrPlayerItself() +Player* Unit::GetCharmerOrOwnerPlayerOrPlayerItself() const { uint64 guid = GetCharmerOrOwnerGUID(); if(IS_PLAYER_GUID(guid)) @@ -12834,4 +12834,24 @@ void Unit::SetConfused(bool apply) if(GetTypeId() == TYPEID_PLAYER) ((Player*)this)->SetClientControl(this, !apply); +} + +bool Unit::IsInPartyWith(Unit const *unit) const +{ + const Player *p1 = GetCharmerOrOwnerPlayerOrPlayerItself(); + const Player *p2 = unit->GetCharmerOrOwnerPlayerOrPlayerItself(); + if(p1 && p2) + return p1->IsInSameGroupWith(p2); + else + return false; +} + +bool Unit::IsInRaidWith(Unit const *unit) const +{ + const Player *p1 = GetCharmerOrOwnerPlayerOrPlayerItself(); + const Player *p2 = unit->GetCharmerOrOwnerPlayerOrPlayerItself(); + if(p1 && p2) + return p1->IsInSameRaidWith(p2); + else + return false; } \ No newline at end of file -- cgit v1.2.3