From 15d4deebd31a99b7fb0100471b3ebbce954c6195 Mon Sep 17 00:00:00 2001 From: Salanto Date: Mon, 12 Apr 2021 00:20:10 +0200 Subject: [PATCH] At least make the intro message work --- include/aoclient.h | 29 +++++++++++++++++++++++++++++ src/commands.cpp | 14 ++++++++++++++ src/packets.cpp | 5 +++++ src/testimony_recorder.cpp | 6 ++++-- 4 files changed, 52 insertions(+), 2 deletions(-) diff --git a/include/aoclient.h b/include/aoclient.h index f27ac35..c5dae80 100644 --- a/include/aoclient.h +++ b/include/aoclient.h @@ -1303,6 +1303,34 @@ class AOClient : public QObject { * @iscommand */ void cmdNoteCardClear(int argc, QStringList argv); + + /** + * @brief [Insert description here] + * + * @details [Insert explanation here] + */ + void cmdExamine(int argc, QStringList argv); + + /** + * @brief [Insert description here] + * + * @details [Insert explanation here] + */ + void cmdTestify(int argc, QStringList argv); + + /** + * @brief [Insert description here] + * + * @details [Insert explanation here] + */ + void cmdUpdateStatement(int argc, QStringList argv); + + /** + * @brief [Insert description here] + * + * @details [Insert explanation here] + */ + void cmdDeleteStatement(int argc, QStringList argv); // Messaging/Client @@ -1622,6 +1650,7 @@ class AOClient : public QObject { {"judgelog", {ACLFlags.value("CM"), 0, &AOClient::cmdJudgeLog}}, {"allow_blankposting", {ACLFlags.value("MODCHAT"), 0, &AOClient::cmdAllow_Blankposting}}, {"baninfo", {ACLFlags.value("BAN"), 1, &AOClient::cmdBanInfo}}, + {"examine", {ACLFlags.value("CM"), 0, &AOClient::cmdExamine}}, }; /** diff --git a/src/commands.cpp b/src/commands.cpp index fd65f09..b8470f3 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -1356,6 +1356,20 @@ void AOClient::cmdBanInfo(int argc, QStringList argv) sendServerMessage(ban_info.join("\n")); } +void AOClient::cmdExamine(int argc, QStringList argv) +{ + AreaData* area = server->areas[current_area]; + if (area->test_rec == AreaData::TestimonyRecording::RECORDING) { + sendServerMessage("Examination already in progress."); + } + else { + clearTestimony(); + area->statement = 0; + area->test_rec = AreaData::TestimonyRecording::RECORDING; + sendServerMessage("Started testimony recording."); + } +} + QStringList AOClient::buildAreaList(int area_idx) { QStringList entries; diff --git a/src/packets.cpp b/src/packets.cpp index 2c5acb7..ff1c8a1 100644 --- a/src/packets.cpp +++ b/src/packets.cpp @@ -630,6 +630,11 @@ AOPacket AOClient::validateIcPacket(AOPacket packet) //Testimony playback if (area->test_rec == AreaData::TestimonyRecording::RECORDING || area->test_rec == AreaData::TestimonyRecording::ADD) { + if (area->statement == 0) { + args[4] = "~~--== " + args[4] + " ==--"; + args[14] = "5"; + server->broadcast(AOPacket("RT",{"testimony1"}), current_area); + } addStatement(args); } else if (area->test_rec == AreaData::TestimonyRecording::UPDATE) { diff --git a/src/testimony_recorder.cpp b/src/testimony_recorder.cpp index b1db0bd..826819c 100644 --- a/src/testimony_recorder.cpp +++ b/src/testimony_recorder.cpp @@ -23,10 +23,12 @@ void AOClient::addStatement(QStringList packet) { AreaData* area = server->areas[current_area]; int c_statement = area->statement; - packet[13] = 1; + packet[14] = 1; if (area->test_rec == AreaData::TestimonyRecording::RECORDING) { - if (area->testimony.isEmpty() && c_statement <= 50) { //Make this configurable once Mangos ConfigManager changes get merged + if (c_statement <= 50) { //Make this configurable once Mangos ConfigManager changes get merged area->testimony.append(packet); + area->statement = c_statement + 1; + return; } else { sendServerMessage("Unable to add more statements. The maximum amount of statements has been reached.");