mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-21 07:22:02 -04:00
Scripts/Commands: Add .debug objectcount <optional map id> chat command
Add .debug objectcount <optional map id> chat command to show the number of Creatures and GameObjects
This commit is contained in:
@@ -120,6 +120,7 @@ public:
|
||||
{ "dummy", rbac::RBAC_PERM_COMMAND_DEBUG_DUMMY, false, &HandleDebugDummyCommand, "" },
|
||||
{ "asan", rbac::RBAC_PERM_COMMAND_DEBUG_ASAN, true, nullptr, "", debugAsanCommandTable },
|
||||
{ "guidlimits", rbac::RBAC_PERM_COMMAND_DEBUG, true, &HandleDebugGuidLimitsCommand, "" },
|
||||
{ "objectcount", rbac::RBAC_PERM_COMMAND_DEBUG, true, &HandleDebugObjectCountCommand, "" },
|
||||
{ "questreset", rbac::RBAC_PERM_COMMAND_DEBUG_QUESTRESET, true, &HandleDebugQuestResetCommand, "" }
|
||||
};
|
||||
static std::vector<ChatCommand> commandTable =
|
||||
@@ -1944,6 +1945,39 @@ public:
|
||||
map->GetId(), map->GetMapName(), map->GetInstanceId(), uint64(map->GetMaxLowGuid<HighGuid::Unit>()), uint64(map->GetMaxLowGuid<HighGuid::GameObject>()));
|
||||
}
|
||||
|
||||
static bool HandleDebugObjectCountCommand(ChatHandler* handler, CommandArgs* args)
|
||||
{
|
||||
auto mapId = args->TryConsume<uint32>();
|
||||
if (mapId)
|
||||
{
|
||||
sMapMgr->DoForAllMapsWithMapId(mapId.get(),
|
||||
[handler](Map* map) -> void
|
||||
{
|
||||
HandleDebugObjectCountMap(handler, map);
|
||||
}
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
sMapMgr->DoForAllMaps(
|
||||
[handler](Map* map) -> void
|
||||
{
|
||||
HandleDebugObjectCountMap(handler, map);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void HandleDebugObjectCountMap(ChatHandler* handler, Map* map)
|
||||
{
|
||||
handler->PSendSysMessage("Map Id: %u Name: '%s' Instance Id: %u Creatures: " UI64FMTD " GameObjects: " UI64FMTD,
|
||||
map->GetId(), map->GetMapName(), map->GetInstanceId(),
|
||||
uint64(map->GetObjectsStore().Size<Creature>()),
|
||||
uint64(map->GetObjectsStore().Size<GameObject>()));
|
||||
}
|
||||
|
||||
static bool HandleDebugDummyCommand(ChatHandler* handler, CommandArgs* /*args*/)
|
||||
{
|
||||
handler->SendSysMessage("This command does nothing right now. Edit your local core (cs_debug.cpp) to make it do whatever you need for testing.");
|
||||
|
||||
Reference in New Issue
Block a user