*Use m_mover to check if can detect target.
--HG-- branch : trunk
This commit is contained in:
+8
-13
@@ -18540,7 +18540,7 @@ void Player::ReportedAfkBy(Player* reporter)
|
||||
bool Player::canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList, bool is3dDistance) const
|
||||
{
|
||||
// Always can see self
|
||||
if (u == this)
|
||||
if (m_mover == this)
|
||||
return true;
|
||||
|
||||
// phased visibility (both must phased in same way)
|
||||
@@ -18572,38 +18572,33 @@ bool Player::canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList, bool
|
||||
if(!u->IsVisibleInGridForPlayer(this))
|
||||
return false;
|
||||
|
||||
// If the player is currently channeling vision, update visibility from the target unit's location
|
||||
const WorldObject* target = m_seer;
|
||||
//if (!target || !HasFarsightVision()) // Vision needs to be on the farsight target
|
||||
// target = this;
|
||||
|
||||
// different visible distance checks
|
||||
if(isInFlight()) // what see player in flight
|
||||
{
|
||||
if (!target->IsWithinDistInMap(u,World::GetMaxVisibleDistanceInFlight()+(inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f), is3dDistance))
|
||||
if (!m_seer->IsWithinDistInMap(u,World::GetMaxVisibleDistanceInFlight()+(inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f), is3dDistance))
|
||||
return false;
|
||||
}
|
||||
else if(!u->isAlive()) // distance for show body
|
||||
{
|
||||
if (!target->IsWithinDistInMap(u,World::GetMaxVisibleDistanceForObject()+(inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f), is3dDistance))
|
||||
if (!m_seer->IsWithinDistInMap(u,World::GetMaxVisibleDistanceForObject()+(inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f), is3dDistance))
|
||||
return false;
|
||||
}
|
||||
else if(u->GetTypeId()==TYPEID_PLAYER) // distance for show player
|
||||
{
|
||||
// Players far than max visible distance for player or not in our map are not visible too
|
||||
if (!at_same_transport && !target->IsWithinDistInMap(u,World::GetMaxVisibleDistanceForPlayer()+(inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f), is3dDistance))
|
||||
if (!at_same_transport && !m_seer->IsWithinDistInMap(u,World::GetMaxVisibleDistanceForPlayer()+(inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f), is3dDistance))
|
||||
return false;
|
||||
}
|
||||
else if(u->GetCharmerOrOwnerGUID()) // distance for show pet/charmed
|
||||
{
|
||||
// Pet/charmed far than max visible distance for player or not in our map are not visible too
|
||||
if (!target->IsWithinDistInMap(u,World::GetMaxVisibleDistanceForPlayer()+(inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f), is3dDistance))
|
||||
if (!m_seer->IsWithinDistInMap(u,World::GetMaxVisibleDistanceForPlayer()+(inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f), is3dDistance))
|
||||
return false;
|
||||
}
|
||||
else // distance for show creature
|
||||
{
|
||||
// Units far than max visible distance for creature or not in our map are not visible too
|
||||
if (!target->IsWithinDistInMap(u
|
||||
if (!m_seer->IsWithinDistInMap(u
|
||||
, u->isActiveObject() ? (MAX_VISIBILITY_DISTANCE - (inVisibleList ? 0.0f : World::GetVisibleUnitGreyDistance()))
|
||||
: (World::GetMaxVisibleDistanceForCreature() + (inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f))
|
||||
, is3dDistance))
|
||||
@@ -18624,7 +18619,7 @@ bool Player::canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList, bool
|
||||
}
|
||||
|
||||
// player see other player with stealth/invisibility only if he in same group or raid or same team (raid/team case dependent from conf setting)
|
||||
if((m_invisibilityMask || u->m_invisibilityMask) && !canDetectInvisibilityOf(u))
|
||||
if((m_mover->m_invisibilityMask || u->m_invisibilityMask) && !m_mover->canDetectInvisibilityOf(u))
|
||||
if(!(u->GetTypeId()==TYPEID_PLAYER && !IsHostileTo(u) && IsGroupVisibleFor(((Player*)u))))
|
||||
return false;
|
||||
|
||||
@@ -18638,7 +18633,7 @@ bool Player::canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList, bool
|
||||
detect = false;
|
||||
if(m_DetectInvTimer < 300 || !HaveAtClient(u))
|
||||
if(!(u->GetTypeId()==TYPEID_PLAYER && !IsHostileTo(u) && IsGroupVisibleFor(((Player*)u))))
|
||||
if(!detect || !canDetectStealthOf(u, GetDistance(u)))
|
||||
if(!detect || !m_mover->canDetectStealthOf(u, GetDistance(u)))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user