Core/Commands: Add .debug guidlimits <optional map id> chat command

Add .debug guidlimits <optional map id> chat command to show the highest low guid counter for Creature and GameObject, useful when reaching Respawn.GuidWarnLevel

(cherry picked from commit 7421ccaf7e)
This commit is contained in:
jackpoz
2019-07-13 18:15:39 +02:00
committed by Shauren
parent 1e84edde39
commit e7b94603f2
3 changed files with 47 additions and 0 deletions

View File

@@ -122,6 +122,7 @@ public:
{ "wsexpression" , rbac::RBAC_PERM_COMMAND_DEBUG, false, &HandleDebugWSExpressionCommand, "" },
{ "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, "" },
};
static std::vector<ChatCommand> commandTable =
{
@@ -1723,6 +1724,39 @@ public:
return true;
}
static bool HandleDebugGuidLimitsCommand(ChatHandler* handler, CommandArgs* args)
{
auto mapId = args->TryConsume<uint32>();
if (mapId)
{
sMapMgr->DoForAllMapsWithMapId(mapId.get(),
[handler](Map* map) -> void
{
HandleDebugGuidLimitsMap(handler, map);
}
);
}
else
{
sMapMgr->DoForAllMaps(
[handler](Map* map) -> void
{
HandleDebugGuidLimitsMap(handler, map);
}
);
}
handler->PSendSysMessage("Guid Warn Level: %u", sWorld->getIntConfig(CONFIG_RESPAWN_GUIDWARNLEVEL));
handler->PSendSysMessage("Guid Alert Level: %u", sWorld->getIntConfig(CONFIG_RESPAWN_GUIDALERTLEVEL));
return true;
}
static void HandleDebugGuidLimitsMap(ChatHandler* handler, Map* map)
{
handler->PSendSysMessage("Map Id: %u Name: '%s' Instance Id: %u Highest Guid Creature: " UI64FMTD " GameObject: " UI64FMTD,
map->GetId(), map->GetMapName(), map->GetInstanceId(), uint64(map->GenerateLowGuid<HighGuid::Creature>()), uint64(map->GetMaxLowGuid<HighGuid::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.");