*Allow pets to cast devour magic on both friends and enemies.

--HG--
branch : trunk
This commit is contained in:
megamage committed 2008-12-10 15:14:49 -06:00
1 parent 4182df058c
commit bcb39b263d
5 files changed
+61 -26

No files matched your search

+21 -1
View File
@@ -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;
}