From f04f4e91ff3afbf89f30659b85e8593c3206138e Mon Sep 17 00:00:00 2001 From: Treeston Date: Wed, 19 Aug 2020 00:25:44 +0200 Subject: Core/Warden: Add .debug warden force, allowing you to force specific warden checks to be sent --- src/server/scripts/Commands/cs_debug.cpp | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (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 4b12e66407e..6ce53150238 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -43,6 +43,7 @@ EndScriptData */ #include "RBAC.h" #include "SpellMgr.h" #include "Transport.h" +#include "Warden.h" #include "World.h" #include #include @@ -83,6 +84,10 @@ public: { "memoryleak", rbac::RBAC_PERM_COMMAND_DEBUG_ASAN, true, &HandleDebugMemoryLeak, "" }, { "outofbounds", rbac::RBAC_PERM_COMMAND_DEBUG_ASAN, true, &HandleDebugOutOfBounds, "" }, }; + static std::vector debugWardenCommandTable = + { + { "force", rbac::RBAC_PERM_COMMAND_DEBUG, true, &HandleDebugWardenForce, "" } + }; static std::vector debugCommandTable = { { "setbit", rbac::RBAC_PERM_COMMAND_DEBUG_SETBIT, false, &HandleDebugSet32BitCommand, "" }, @@ -121,7 +126,8 @@ public: { "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, "" } + { "questreset", rbac::RBAC_PERM_COMMAND_DEBUG_QUESTRESET, true, &HandleDebugQuestResetCommand, "" }, + { "warden", rbac::RBAC_PERM_COMMAND_DEBUG, true, nullptr, "", debugWardenCommandTable } }; static std::vector commandTable = { @@ -1725,6 +1731,23 @@ public: return true; } + static bool HandleDebugWardenForce(ChatHandler* handler, std::vector checkIds) + { + if (checkIds.empty()) + return false; + + Warden* const warden = handler->GetSession()->GetWarden(); + if (!warden) + { + handler->SendSysMessage("Warden system is not enabled"); + return true; + } + + size_t const nQueued = warden->DEBUG_ForceSpecificChecks(checkIds); + handler->PSendSysMessage("%zu/%zu checks queued for your Warden, they should be sent over the next few minutes (depending on settings)", nQueued, checkIds.size()); + return true; + } + static bool HandleDebugGuidLimitsCommand(ChatHandler* handler, Optional mapId) { if (mapId) -- cgit v1.2.3