mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
Merge branch 'master' into 303
Conflicts: src/game/Corpse.cpp src/game/DynamicObject.cpp src/game/GameObject.cpp src/game/Object.h src/game/Unit.cpp src/game/Unit.h
This commit is contained in:
commit
af1e1d7794
13 changed files with 34 additions and 27 deletions
|
|
@ -8547,7 +8547,7 @@ int32 Unit::ModifyPower(Powers power, int32 dVal)
|
|||
return gain;
|
||||
}
|
||||
|
||||
bool Unit::isVisibleForOrDetect(Unit const* u, bool detect, bool inVisibleList, bool is2dDistance) const
|
||||
bool Unit::isVisibleForOrDetect(Unit const* u, bool detect, bool inVisibleList, bool is3dDistance) const
|
||||
{
|
||||
if(!u)
|
||||
return false;
|
||||
|
|
@ -8598,27 +8598,25 @@ bool Unit::isVisibleForOrDetect(Unit const* u, bool detect, bool inVisibleList,
|
|||
if(u->isInFlight()) // what see player in flight
|
||||
{
|
||||
// use object grey distance for all (only see objects any way)
|
||||
if(is2dDistance)
|
||||
if (!IsWithinDistInMap(u,World::GetMaxVisibleDistanceInFlight()+(inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f), is3dDistance))
|
||||
{
|
||||
if (!IsWithinDistInMap2d(u,World::GetMaxVisibleDistanceInFlight()+(inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f)))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!IsWithinDistInMap(u,World::GetMaxVisibleDistanceInFlight()+(inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f)))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if(!isAlive()) // distance for show body
|
||||
{
|
||||
if(is2dDistance)
|
||||
if (!IsWithinDistInMap(u,World::GetMaxVisibleDistanceForObject()+(inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f), is3dDistance))
|
||||
{
|
||||
if (!IsWithinDistInMap2d(u,World::GetMaxVisibleDistanceForObject()+(inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f)))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!IsWithinDistInMap(u,World::GetMaxVisibleDistanceForObject()+(inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f)))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -8627,28 +8625,26 @@ bool Unit::isVisibleForOrDetect(Unit const* u, bool detect, bool inVisibleList,
|
|||
if(u->GetTypeId()==TYPEID_PLAYER)
|
||||
{
|
||||
// Players far than max visible distance for player or not in our map are not visible too
|
||||
if(is2dDistance)
|
||||
if (!at_same_transport && !IsWithinDistInMap(u,World::GetMaxVisibleDistanceForPlayer()+(inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f), is3dDistance))
|
||||
{
|
||||
if (!at_same_transport && !IsWithinDistInMap2d(u,World::GetMaxVisibleDistanceForPlayer()+(inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f)))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!at_same_transport && !IsWithinDistInMap(u,World::GetMaxVisibleDistanceForPlayer()+(inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f)))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Units far than max visible distance for creature or not in our map are not visible too
|
||||
if(is2dDistance)
|
||||
if (!IsWithinDistInMap(u,World::GetMaxVisibleDistanceForCreature()+(inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f), is3dDistance))
|
||||
{
|
||||
if (!IsWithinDistInMap2d(u,World::GetMaxVisibleDistanceForCreature()+(inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f)))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!IsWithinDistInMap(u,World::GetMaxVisibleDistanceForCreature()+(inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f)))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -8656,28 +8652,26 @@ bool Unit::isVisibleForOrDetect(Unit const* u, bool detect, bool inVisibleList,
|
|||
else if(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(is2dDistance)
|
||||
if (!IsWithinDistInMap(u,World::GetMaxVisibleDistanceForPlayer()+(inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f), is3dDistance))
|
||||
{
|
||||
if (!IsWithinDistInMap2d(u,World::GetMaxVisibleDistanceForPlayer()+(inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f)))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!IsWithinDistInMap(u,World::GetMaxVisibleDistanceForPlayer()+(inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f)))
|
||||
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(is2dDistance)
|
||||
if (!IsWithinDistInMap(u,World::GetMaxVisibleDistanceForCreature()+(inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f), is3dDistance))
|
||||
{
|
||||
if (!IsWithinDistInMap2d(u,World::GetMaxVisibleDistanceForCreature()+(inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f)))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!IsWithinDistInMap(u,World::GetMaxVisibleDistanceForCreature()+(inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f)))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -9492,7 +9486,7 @@ Unit* Unit::GetUnit(WorldObject& object, uint64 guid)
|
|||
|
||||
bool Unit::isVisibleForInState( Player const* u, bool inVisibleList ) const
|
||||
{
|
||||
return isVisibleForOrDetect(u, false, inVisibleList, true);
|
||||
return isVisibleForOrDetect(u, false, inVisibleList, false);
|
||||
}
|
||||
|
||||
uint32 Unit::GetCreatureType() const
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue