Core/Warden: Add .debug warden force, allowing you to force specific warden checks to be sent

This commit is contained in:
Treeston
2020-08-19 00:25:44 +02:00
committed by GitHub
parent 24a494398f
commit f04f4e91ff
9 changed files with 70 additions and 7 deletions

View File

@@ -43,6 +43,7 @@ EndScriptData */
#include "RBAC.h"
#include "SpellMgr.h"
#include "Transport.h"
#include "Warden.h"
#include "World.h"
#include <fstream>
#include <limits>
@@ -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<ChatCommand> debugWardenCommandTable =
{
{ "force", rbac::RBAC_PERM_COMMAND_DEBUG, true, &HandleDebugWardenForce, "" }
};
static std::vector<ChatCommand> 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<ChatCommand> commandTable =
{
@@ -1725,6 +1731,23 @@ public:
return true;
}
static bool HandleDebugWardenForce(ChatHandler* handler, std::vector<uint16> 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<uint32> mapId)
{
if (mapId)