Scripts/Commands: Add .debug modifiertree command

This commit is contained in:
Shauren
2026-03-10 14:07:31 +01:00
parent e88ca89aaa
commit 36f8497aec
2 changed files with 27 additions and 2 deletions

View File

@@ -0,0 +1,5 @@
DELETE FROM `command` WHERE `name` IN ('debug modifiertree','debug playercondition','debug wsexpression');
INSERT INTO `command` (`name`, `help`) VALUES
('debug modifiertree', 'Syntax: .debug modifiertree #modifierTreeId\r\n\r\nChecks if ModifierTree #modifierTreeId conditions are met for targeted player.'),
('debug playercondition', 'Syntax: .debug playercondition #playerConditionId\r\n\r\nChecks if PlayerCondition #playerConditionId condition is met for targeted player.'),
('debug wsexpression', 'Syntax: .debug wsexpression #worldStateExpressionId\r\n\r\nChecks if WorldStateExpression #worldStateExpressionId condition is met on current map.');

View File

@@ -120,6 +120,7 @@ public:
{ "neargraveyard", HandleDebugNearGraveyard, rbac::RBAC_PERM_COMMAND_DEBUG, Console::No },
{ "instancespawn", HandleDebugInstanceSpawns, rbac::RBAC_PERM_COMMAND_DEBUG, Console::No },
{ "conversation", HandleDebugConversationCommand, rbac::RBAC_PERM_COMMAND_DEBUG, Console::No },
{ "modifiertree", HandleDebugModifierTreeCommand, rbac::RBAC_PERM_COMMAND_DEBUG, Console::No },
{ "wsexpression", HandleDebugWSExpressionCommand, rbac::RBAC_PERM_COMMAND_DEBUG, Console::No },
{ "playercondition", HandleDebugPlayerConditionCommand, rbac::RBAC_PERM_COMMAND_DEBUG, Console::No },
{ "pvp warmode", HandleDebugWarModeBalanceCommand, rbac::RBAC_PERM_COMMAND_DEBUG, Console::Yes },
@@ -1589,6 +1590,25 @@ public:
return Conversation::CreateConversation(conversationEntry, target, *target, target->GetGUID()) != nullptr;
}
static bool HandleDebugModifierTreeCommand(ChatHandler* handler, uint32 modifierTreeId)
{
Player* target = handler->getSelectedPlayerOrSelf();
if (!target)
{
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
handler->SetSentErrorMessage(true);
return false;
}
if (target->ModifierTreeSatisfied(modifierTreeId))
handler->PSendSysMessage("ModifierTree %u met", modifierTreeId);
else
handler->PSendSysMessage("ModifierTree %u not met", modifierTreeId);
return true;
}
static bool HandleDebugWSExpressionCommand(ChatHandler* handler, uint32 expressionId)
{
Player* target = handler->getSelectedPlayerOrSelf();
@@ -1605,9 +1625,9 @@ public:
return false;
if (ConditionMgr::IsMeetingWorldStateExpression(target->GetMap(), wsExpressionEntry))
handler->PSendSysMessage("Expression %u meet", expressionId);
handler->PSendSysMessage("WorldStateExpression %u met", expressionId);
else
handler->PSendSysMessage("Expression %u not meet", expressionId);
handler->PSendSysMessage("WorldStateExpression %u not met", expressionId);
return true;
}