feat(Scripts/Commands): Implement debug zonestats command (#23249)

This commit is contained in:
Andrew
2025-10-16 07:24:23 -03:00
committed by GitHub
parent 46f04b6062
commit eb2c6a445c
4 changed files with 40 additions and 4 deletions

View File

@@ -417,9 +417,7 @@ void Map::UpdatePlayerZoneStats(uint32 oldZone, uint32 newZone)
if (oldZone != MAP_INVALID_ZONE)
{
uint32& oldZoneCount = _zonePlayerCountMap[oldZone];
if (!oldZoneCount)
LOG_ERROR("maps", "A player left zone {} (went to {}) - but there were no players in the zone!", oldZone, newZone);
else
if (oldZoneCount)
--oldZoneCount;
}

View File

@@ -514,6 +514,14 @@ public:
void RemoveWorldObjectFromZoneWideVisibleMap(uint32 zoneId, WorldObject* obj);
ZoneWideVisibleWorldObjectsSet const* GetZoneWideVisibleWorldObjectsForZone(uint32 zoneId) const;
[[nodiscard]] uint32 GetPlayerCountInZone(uint32 zoneId) const
{
if (auto const& it = _zonePlayerCountMap.find(zoneId); it != _zonePlayerCountMap.end())
return it->second;
return 0;
};
private:
template<class T> void InitializeObject(T* obj);