Core/Objects: Refactor private object checks into separate function
This commit is contained in:
1 parent
434bc017c2
commit
3ab52418ef
3 files changed
+26
-4
No files matched your search
@@ -1726,20 +1726,36 @@ float WorldObject::GetSightRange(const WorldObject* target) const
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
bool WorldObject::CheckPrivateObjectOwnerVisibility(WorldObject const* seer) const
|
||||
{
|
||||
if (!IsPrivateObject())
|
||||
return true;
|
||||
|
||||
// Owner of this private object
|
||||
if (_privateObjectOwner == seer->GetGUID())
|
||||
return true;
|
||||
|
||||
// Another private object of the same owner
|
||||
if (_privateObjectOwner == seer->GetPrivateObjectOwner())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool WorldObject::CanSeeOrDetect(WorldObject const* obj, bool ignoreStealth, bool distanceCheck, bool checkAlert) const
|
||||
{
|
||||
if (this == obj)
|
||||
return true;
|
||||
|
||||
if (!obj->GetPrivateObjectOwner().IsEmpty())
|
||||
return GetGUID() == obj->GetPrivateObjectOwner() || GetPrivateObjectOwner() == obj->GetPrivateObjectOwner();
|
||||
|
||||
if (obj->IsNeverVisible() || CanNeverSee(obj))
|
||||
return false;
|
||||
|
||||
if (obj->IsAlwaysVisibleFor(this) || CanAlwaysSee(obj))
|
||||
return true;
|
||||
|
||||
if (!obj->CheckPrivateObjectOwnerVisibility(this))
|
||||
return false;
|
||||
|
||||
bool corpseVisibility = false;
|
||||
if (distanceCheck)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user