aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjackpoz <giacomopoz@gmail.com>2019-07-13 18:15:39 +0200
committerShauren <shauren.trinity@gmail.com>2021-12-16 00:53:58 +0100
commite7b94603f256386eae8a9724c830d37593c0f0e1 (patch)
treec9c2cc2f85dfdab782e1c5349186e8744ccca9c0 /src
parent1e84edde3946ce001168e03468668789c735ed37 (diff)
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 7421ccaf7eb134f549ad3734a815397216d020ed)
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Maps/Map.h7
-rw-r--r--src/server/scripts/Commands/cs_debug.cpp34
2 files changed, 41 insertions, 0 deletions
diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h
index b678a82ff71..8e579b9c1c4 100644
--- a/src/server/game/Maps/Map.h
+++ b/src/server/game/Maps/Map.h
@@ -568,6 +568,13 @@ class TC_GAME_API Map : public GridRefManager<NGridType>
return GetGuidSequenceGenerator<high>().Generate();
}
+ template<HighGuid high>
+ inline ObjectGuid::LowType GetMaxLowGuid()
+ {
+ static_assert(ObjectGuidTraits<high>::SequenceSource.HasFlag(ObjectGuidSequenceSource::Map), "Only map specific guid can be retrieved in Map context");
+ return GetGuidSequenceGenerator<high>().GetNextAfterMaxUsed();
+ }
+
void AddUpdateObject(Object* obj)
{
_updateObjects.insert(obj);
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<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.");