Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 34 additions & 12 deletions src/server/game/Entities/Object/Object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1681,19 +1681,19 @@ float WorldObject::GetGridActivationRange() const
if (ToPlayer())
{
if (ToPlayer()->GetCinematicMgr().IsOnCinematic())
{
return DEFAULT_VISIBILITY_INSTANCE;
}
return IsInWintergrasp() ? VISIBILITY_DIST_WINTERGRASP : GetMap()->GetVisibilityRange();

if (IsInDalaran())
return VISIBILITY_DIST_DALARAN;
else if (IsInWintergrasp())
return VISIBILITY_DIST_WINTERGRASP;
else
return GetMap()->GetVisibilityRange();
Comment on lines +1686 to +1691
}
else if (ToCreature())
{
return ToCreature()->m_SightDistance;
}
else if (((IsGameObject() && ToGameObject()->IsTransport()) || IsDynamicObject()) && isActiveObject())
{
return GetMap()->GetVisibilityRange();
}

return 0.0f;
}
Expand All @@ -1704,15 +1704,24 @@ float WorldObject::GetVisibilityRange() const
return GetVisibilityOverrideDistance();
else if (IsGameObject())
{
if (IsInWintergrasp())
if (IsInDalaran())
return VISIBILITY_DIST_DALARAN;
else if (IsInWintergrasp())
return VISIBILITY_DIST_WINTERGRASP;
else if (IsVisibilityOverridden())
return GetVisibilityOverrideDistance();
else
return GetMap()->GetVisibilityRange();
}
else
return IsInWintergrasp() ? VISIBILITY_DIST_WINTERGRASP : GetMap()->GetVisibilityRange();
{
if (IsInDalaran())
return VISIBILITY_DIST_DALARAN;
else if (IsInWintergrasp())
return VISIBILITY_DIST_WINTERGRASP;
else
return GetMap()->GetVisibilityRange();
}
}

float WorldObject::GetSightRange(WorldObject const* target) const
Expand All @@ -1727,7 +1736,9 @@ float WorldObject::GetSightRange(WorldObject const* target) const
return target->GetVisibilityOverrideDistance();
else if (target->IsGameObject())
{
if (IsInWintergrasp() && target->IsInWintergrasp())
if (IsInDalaran() && target->IsInDalaran())
return VISIBILITY_DIST_DALARAN;
else if (IsInWintergrasp() && target->IsInWintergrasp())
return VISIBILITY_DIST_WINTERGRASP;
else if (target->IsVisibilityOverridden())
return target->GetVisibilityOverrideDistance();
Expand All @@ -1737,9 +1748,20 @@ float WorldObject::GetSightRange(WorldObject const* target) const
return GetMap()->GetVisibilityRange();
}

return IsInWintergrasp() && target->IsInWintergrasp() ? VISIBILITY_DIST_WINTERGRASP : GetMap()->GetVisibilityRange();
if (IsInDalaran() && target->IsInDalaran())
return VISIBILITY_DIST_DALARAN;
else if (IsInWintergrasp() && target->IsInWintergrasp())
return VISIBILITY_DIST_WINTERGRASP;
else
return GetMap()->GetVisibilityRange();
}
return IsInWintergrasp() ? VISIBILITY_DIST_WINTERGRASP : GetMap()->GetVisibilityRange();

if (IsInDalaran())
return VISIBILITY_DIST_DALARAN;
else if (IsInWintergrasp())
return VISIBILITY_DIST_WINTERGRASP;
else
return GetMap()->GetVisibilityRange();
}
else if (ToCreature())
return ToCreature()->m_SightDistance;
Expand Down
5 changes: 5 additions & 0 deletions src/server/game/Entities/Object/Object.h
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,11 @@ class WorldObject : public Object, public WorldLocation
return GetMapId() == MAP_NORTHREND && GetPositionX() > 3733.33331f && GetPositionX() < 5866.66663f && GetPositionY() > 1599.99999f && GetPositionY() < 4799.99997f;
}

[[nodiscard]] bool IsInDalaran() const
{
return GetMapId() == MAP_NORTHREND && GetZoneId() == AREA_DALARAN;
}

uint32 LastUsedScriptID;

// Transports
Expand Down
1 change: 1 addition & 0 deletions src/server/game/Entities/Object/ObjectDefines.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#define DEFAULT_VISIBILITY_DISTANCE 100.0f // default visible distance, 100 yards on continents
#define DEFAULT_VISIBILITY_INSTANCE 170.0f // default visible distance in instances, 170 yards
#define VISIBILITY_DIST_WINTERGRASP 175.0f
#define VISIBILITY_DIST_DALARAN 84.0f // visible distance in dalaran due to the city's dense/compact layout
#define DEFAULT_VISIBILITY_BGARENAS 250.0f // default visible distance in BG/Arenas, roughly 250 yards

#define DEFAULT_WORLD_OBJECT_SIZE 0.388999998569489f // player size, also currently used (correctly?) for any non Unit world objects
Expand Down
Loading