From 40552b1602d0bbf65c857fc8147841842b9872ac Mon Sep 17 00:00:00 2001 From: Salanto Date: Mon, 19 Apr 2021 00:48:51 +0200 Subject: [PATCH 1/2] Add /a and /s --- include/aoclient.h | 22 +++++++++++++++++++++- src/commands/messaging.cpp | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/include/aoclient.h b/include/aoclient.h index 14c6f84..f469125 100644 --- a/include/aoclient.h +++ b/include/aoclient.h @@ -1488,6 +1488,24 @@ class AOClient : public QObject { void cmdCharSelect(int argc, QStringList argv); + /** + * @brief Sends a message to an area that you a CM in. + * + * @details Usage: /a + * + * @iscommand + */ + void cmdA(int argc, QStringList argv); + + /** + * @brief Send a message to all areas that you are a CM in. + * + * @details Usage: /s + * + * @iscommand + */ + void cmdS(int argc, QStringList argv); + ///@} /** @@ -1936,7 +1954,9 @@ class AOClient : public QObject { {"block_dj", {ACLFlags.value("MUTE"), 1, &AOClient::cmdBlockDj}}, {"unblockdj", {ACLFlags.value("MUTE"), 1, &AOClient::cmdUnBlockDj}}, {"unblock_dj", {ACLFlags.value("MUTE"), 1, &AOClient::cmdUnBlockDj}}, - {"charselect", {ACLFlags.value("NONE"), 0, &AOClient::cmdCharSelect}} + {"charselect", {ACLFlags.value("NONE"), 0, &AOClient::cmdCharSelect}}, + {"a", {ACLFlags.value("NONE"), 2, &AOClient::cmdA}}, + {"s", {ACLFlags.value("NONE"), 0, &AOClient::cmdS}}, }; /** diff --git a/src/commands/messaging.cpp b/src/commands/messaging.cpp index bfc4d81..839844f 100644 --- a/src/commands/messaging.cpp +++ b/src/commands/messaging.cpp @@ -340,3 +340,36 @@ void AOClient::cmdCharSelect(int argc, QStringList argv) target->sendPacket("DONE"); } } + +void AOClient::cmdA(int argc, QStringList argv) +{ + bool ok; + int area_id = argv[0].toInt(&ok); + if (!ok) { + sendServerMessage("This does not look like a valid AreaID."); + return; + } + + AreaData* area = server->areas[area_id]; + if (!area->owners.contains(id)) { + sendServerMessage("You are not CM in that area."); + return; + } + + argv.removeAt(0); + QString sender_name = ooc_name; + QString ooc_message = argv.join(" "); + server->broadcast(AOPacket("CT", {"[CM]" + sender_name, ooc_message}), area_id); +} + +void AOClient::cmdS(int argc, QStringList argv) +{ + int all_areas = server->areas.size() - 1; + QString sender_name = ooc_name; + QString ooc_message = argv.join(" "); + + for (int i = 0; i <= all_areas; i++) { + if (server->areas[i]->owners.contains(id)) + server->broadcast(AOPacket("CT", {"[CM]" + sender_name, ooc_message}), i); + } +} From 7ae4f95e126b47a817ef0ecb6e77f397f605192c Mon Sep 17 00:00:00 2001 From: in1tiate Date: Sun, 18 Apr 2021 18:49:06 -0500 Subject: [PATCH 2/2] expose ban ids to /bans and BD --- src/commands/moderation.cpp | 1 + src/packets.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/commands/moderation.cpp b/src/commands/moderation.cpp index 6e3b99c..8f57472 100644 --- a/src/commands/moderation.cpp +++ b/src/commands/moderation.cpp @@ -179,6 +179,7 @@ void AOClient::cmdBans(int argc, QStringList argv) banned_until = "The heat death of the universe"; else banned_until = QDateTime::fromSecsSinceEpoch(ban.time).addSecs(ban.duration).toString("dd.MM.yyyy, hh:mm"); + recent_bans << "Ban ID: " + QString::number(server->db_manager->getBanID(ban.ipid)); recent_bans << "Affected IPID: " + ban.ipid; recent_bans << "Affected HDID: " + ban.hdid; recent_bans << "Reason for ban: " + ban.reason; diff --git a/src/packets.cpp b/src/packets.cpp index 5ffede7..284ccc9 100644 --- a/src/packets.cpp +++ b/src/packets.cpp @@ -28,7 +28,7 @@ void AOClient::pktHardwareId(AreaData* area, int argc, QStringList argv, AOPacke { hwid = argv[0]; if(server->db_manager->isHDIDBanned(hwid)) { - sendPacket("BD", {server->db_manager->getBanReason(hwid)}); + sendPacket("BD", {server->db_manager->getBanReason(hwid) + "\nBan ID: " + QString::number(server->db_manager->getBanID(hwid))}); socket->close(); return; }