From 452dd95e39bbdd364b33358ba691fcde746005b5 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Thu, 9 Jun 2022 20:50:52 -0400 Subject: [PATCH] Scripts/Commands: Improve ".debug objectcount" Port From (https://github.com/TrinityCore/TrinityCore/commit/4e3d23188e02d2c79f09460590d0f43a5f81a982) --- Source/Game/Chat/Commands/DebugCommands.cs | 2 +- Source/Game/Maps/Map.cs | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Source/Game/Chat/Commands/DebugCommands.cs b/Source/Game/Chat/Commands/DebugCommands.cs index 54ca0a939..3405c9138 100644 --- a/Source/Game/Chat/Commands/DebugCommands.cs +++ b/Source/Game/Chat/Commands/DebugCommands.cs @@ -733,7 +733,7 @@ namespace Game.Chat { void HandleDebugObjectCountMap(Map map) { - handler.SendSysMessage($"Map Id: {map.GetId()} Name: '{map.GetMapName()}' Instance Id: {map.GetInstanceId()} Creatures: {map.GetObjectsStore().OfType().Count()} GameObjects: {map.GetObjectsStore().OfType().Count()}"); + handler.SendSysMessage($"Map Id: {map.GetId()} Name: '{map.GetMapName()}' Instance Id: {map.GetInstanceId()} Creatures: {map.GetObjectsStore().OfType().Count()} GameObjects: {map.GetObjectsStore().OfType().Count()} SetActive Objects: {map.GetActiveNonPlayersCount()}"); Dictionary creatureIds = new(); foreach (var p in map.GetObjectsStore()) diff --git a/Source/Game/Maps/Map.cs b/Source/Game/Maps/Map.cs index 3124ceedc..f4d27cac7 100644 --- a/Source/Game/Maps/Map.cs +++ b/Source/Game/Maps/Map.cs @@ -3865,6 +3865,11 @@ namespace Game.Maps return m_activePlayers; } + public int GetActiveNonPlayersCount() + { + return m_activeNonPlayers.Count; + } + public Dictionary GetObjectsStore() { return _objectsStore; } public MultiMap GetCreatureBySpawnIdStore() { return _creatureBySpawnIdStore; }