*Use m_mover to check if can detect target.

--HG--
branch : trunk
This commit is contained in:
megamage
2009-03-12 14:41:38 -06:00
parent 771f2699d6
commit f7f6d6558c
+8 -13
View File
@@ -18540,7 +18540,7 @@ void Player::ReportedAfkBy(Player* reporter)
bool Player::canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList, bool is3dDistance) const bool Player::canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList, bool is3dDistance) const
{ {
// Always can see self // Always can see self
if (u == this) if (m_mover == this)
return true; return true;
// phased visibility (both must phased in same way) // 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)) if(!u->IsVisibleInGridForPlayer(this))
return false; 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 // different visible distance checks
if(isInFlight()) // what see player in flight 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; return false;
} }
else if(!u->isAlive()) // distance for show body 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; return false;
} }
else if(u->GetTypeId()==TYPEID_PLAYER) // distance for show player 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 // 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; return false;
} }
else if(u->GetCharmerOrOwnerGUID()) // distance for show pet/charmed 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 // 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; return false;
} }
else // distance for show creature else // distance for show creature
{ {
// Units far than max visible distance for creature or not in our map are not visible too // 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())) , u->isActiveObject() ? (MAX_VISIBILITY_DISTANCE - (inVisibleList ? 0.0f : World::GetVisibleUnitGreyDistance()))
: (World::GetMaxVisibleDistanceForCreature() + (inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f)) : (World::GetMaxVisibleDistanceForCreature() + (inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f))
, is3dDistance)) , 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) // 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)))) if(!(u->GetTypeId()==TYPEID_PLAYER && !IsHostileTo(u) && IsGroupVisibleFor(((Player*)u))))
return false; return false;
@@ -18638,7 +18633,7 @@ bool Player::canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList, bool
detect = false; detect = false;
if(m_DetectInvTimer < 300 || !HaveAtClient(u)) if(m_DetectInvTimer < 300 || !HaveAtClient(u))
if(!(u->GetTypeId()==TYPEID_PLAYER && !IsHostileTo(u) && IsGroupVisibleFor(((Player*)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; return false;
} }