From e7b94603f256386eae8a9724c830d37593c0f0e1 Mon Sep 17 00:00:00 2001 From: jackpoz Date: Sat, 13 Jul 2019 18:15:39 +0200 Subject: Core/Commands: Add .debug guidlimits chat command Add .debug guidlimits chat command to show the highest low guid counter for Creature and GameObject, useful when reaching Respawn.GuidWarnLevel (cherry picked from commit 7421ccaf7eb134f549ad3734a815397216d020ed) --- src/server/scripts/Commands/cs_debug.cpp | 34 ++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'src/server/scripts/Commands') diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index dd0d69e6f03..16819886ff0 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -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 commandTable = { @@ -1723,6 +1724,39 @@ public: return true; } + static bool HandleDebugGuidLimitsCommand(ChatHandler* handler, CommandArgs* args) + { + auto mapId = args->TryConsume(); + 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()), uint64(map->GetMaxLowGuid())); + } + 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."); -- cgit v1.2.3