Change visibility of pets or charmed units as well when GM is invisible

Fix by liberate

--HG--
branch : trunk
This commit is contained in:
click
2010-04-21 23:15:29 +02:00
parent 12950d1c16
commit b31d567bfd
+6 -3
View File
@@ -20130,18 +20130,21 @@ bool Player::canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList, bool
return false;
}
if (u->GetVisibility() == VISIBILITY_OFF)
if (Unit* owner = u->GetCharmerOrOwnerOrSelf())
{
if (owner->GetVisibility() == VISIBILITY_OFF)
{
// GMs see any players, not higher GMs and all units
if (isGameMaster())
{
if (u->GetTypeId() == TYPEID_PLAYER)
return u->ToPlayer()->GetSession()->GetSecurity() <= GetSession()->GetSecurity();
if (owner->GetTypeId() == TYPEID_PLAYER)
return owner->ToPlayer()->GetSession()->GetSecurity() <= GetSession()->GetSecurity();
else
return true;
}
return false;
}
}
// GM's can see everyone with invisibilitymask with less or equal security level
if (m_mover->m_invisibilityMask || u->m_invisibilityMask)