diff --git a/Source/Game/Chat/Commands/DebugCommands.cs b/Source/Game/Chat/Commands/DebugCommands.cs index 75cd75012..6c72a6d5f 100644 --- a/Source/Game/Chat/Commands/DebugCommands.cs +++ b/Source/Game/Chat/Commands/DebugCommands.cs @@ -27,6 +27,7 @@ using Game.Networking.Packets; using Game.Spells; using System; using System.Collections.Generic; +using System.Linq; using System.Text; namespace Game.Chat @@ -754,6 +755,22 @@ namespace Game.Chat return true; } + + [Command("objectcount", RBACPermissions.CommandDebug, true)] + static bool HandleDebugObjectCountCommand(CommandHandler handler, uint? mapId) + { + 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()}"); + } + + if (mapId.HasValue) + Global.MapMgr.DoForAllMapsWithMapId(mapId.Value, map => HandleDebugObjectCountMap(map)); + else + Global.MapMgr.DoForAllMaps(map => HandleDebugObjectCountMap(map)); + + return true; + } [Command("phase", RBACPermissions.CommandDebugPhase)] static bool HandleDebugPhaseCommand(CommandHandler handler, StringArguments args)