From 954744d86af2f6d332d508e649dee20cd3153be8 Mon Sep 17 00:00:00 2001 From: in1tiate Date: Sun, 14 Mar 2021 15:14:44 -0500 Subject: [PATCH 1/2] add /subtheme --- include/aoclient.h | 4 +++- src/commands.cpp | 10 ++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/include/aoclient.h b/include/aoclient.h index 1d663fe..6bd2e77 100644 --- a/include/aoclient.h +++ b/include/aoclient.h @@ -234,6 +234,7 @@ class AOClient : public QObject { void cmdClearDoc(int argc, QStringList argv); void cmdTimer(int argc, QStringList argv); void cmdEvidenceMod(int argc, QStringList argv); + void cmdSubTheme(int argc, QStringList argv); // Messaging/Client void cmdPos(int argc, QStringList argv); void cmdForcePos(int argc, QStringList argv); @@ -315,7 +316,8 @@ class AOClient : public QObject { {"m", {ACLFlags.value("MODCHAT"), 1, &AOClient::cmdM}}, {"gm", {ACLFlags.value("MODCHAT"), 1, &AOClient::cmdGM}}, {"mute", {ACLFlags.value("MUTE"), 1, &AOClient::cmdMute}}, - {"unmute", {ACLFlags.value("MUTE"), 1, &AOClient::cmdUnmute}} + {"unmute", {ACLFlags.value("MUTE"), 1, &AOClient::cmdUnmute}}, + {"subtheme", {ACLFlags.value("CM"), 1, &AOClient::cmdSubTheme}}, }; QString partial_packet; diff --git a/src/commands.cpp b/src/commands.cpp index 033050b..5a3c083 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -971,6 +971,16 @@ void AOClient::cmdUnmute(int argc, QStringList argv) server->getClientByID(uid)->is_muted = false; } +void AOClient::cmdSubTheme(int argc, QStringList argv) +{ + QString subtheme = argv.join(" "); + for (AOClient* client : server->clients) { + if (client->current_area == current_area) + client->sendPacket("ST", {subtheme}); + } + sendServerMessageArea("Subtheme was set to " + subtheme); +} + QStringList AOClient::buildAreaList(int area_idx) { QStringList entries; From 01f81c71074d87cbbb942ccf4fa05e0f1c86ec83 Mon Sep 17 00:00:00 2001 From: in1tiate Date: Sun, 14 Mar 2021 15:16:30 -0500 Subject: [PATCH 2/2] always reload theme on subtheme change --- src/commands.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands.cpp b/src/commands.cpp index 5a3c083..38f4915 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -976,7 +976,7 @@ void AOClient::cmdSubTheme(int argc, QStringList argv) QString subtheme = argv.join(" "); for (AOClient* client : server->clients) { if (client->current_area == current_area) - client->sendPacket("ST", {subtheme}); + client->sendPacket("ST", {subtheme, "1"}); } sendServerMessageArea("Subtheme was set to " + subtheme); }