From f332defa52201de2a811d04bbb32947593eab41b Mon Sep 17 00:00:00 2001 From: Wiso <61384316+WisoAltred@users.noreply.github.com> Date: Tue, 4 Feb 2025 18:28:26 +0200 Subject: [PATCH] Allow = and >[number] testimony traversal options. (#393) * Allow = and >[number] testimony traversal options. Automatically loops back to 1 if the user inputs a value over the statement size. Could instead deny sending that message entirely with an OOC error. * Adjust reg exp to capture <[Number], remove duplicate reg check --- src/packet/packet_ms.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/packet/packet_ms.cpp b/src/packet/packet_ms.cpp index 9097e2a..4586e7d 100644 --- a/src/packet/packet_ms.cpp +++ b/src/packet/packet_ms.cpp @@ -434,6 +434,15 @@ AOPacket *PacketMS::validateIcPacket(AOClient &client) const client.sendServerMessage("First statement reached."); } } + if (l_args[4] == "=") { + auto l_statement = area->jumpToStatement(area->statement()); + l_args = l_statement.first; + l_progress = l_statement.second; + client.m_pos = l_args[5]; + + client.sendServerMessageArea(client_name + " repeated the current statement."); + } + QRegularExpressionMatch match = isTestimonyJumpCommand(client.decodeMessage(l_args[4])); // Get rid of that pesky encoding, then do the fun part if (match.hasMatch()) { client.m_pos = "wit"; @@ -473,6 +482,8 @@ QRegularExpressionMatch PacketMS::isTestimonyJumpCommand(QString message) const // even if it hurts my heart // // and my grey matter - QRegularExpression jump("(?>)(?[0,1,2,3,4,5,6,7,8,9]+)"); + // + // get well soon + QRegularExpression jump("(?>|<)(?\\d+)"); return jump.match(message); }