From 3f148c9c669dfb13be9cc0d551bd345e193c0d09 Mon Sep 17 00:00:00 2001 From: Salanto Date: Sat, 9 Jan 2021 14:50:43 +0100 Subject: [PATCH] Add /g command --- include/aoclient.h | 4 +++- src/commands.cpp | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/include/aoclient.h b/include/aoclient.h index 20baef2..7fe4993 100644 --- a/include/aoclient.h +++ b/include/aoclient.h @@ -171,6 +171,7 @@ class AOClient : public QObject { void cmdListUsers(int argc, QStringList argv); void cmdLogout(int argc, QStringList argv); void cmdPos(int argc, QStringList argv); + void cmdG(int argc, QStringList argv); // Command helper functions QStringList buildAreaList(int area_idx); @@ -202,7 +203,8 @@ class AOClient : public QObject { {"removeperm", {ACLFlags.value("MODIFY_USERS"), 2, &AOClient::cmdRemovePerms}}, {"listusers", {ACLFlags.value("MODIFY_USERS"), 0, &AOClient::cmdListUsers}}, {"logout", {ACLFlags.value("NONE"), 0, &AOClient::cmdLogout}}, - {"pos", {ACLFlags.value("NONE"), 1, &AOClient::cmdPos}} + {"pos", {ACLFlags.value("NONE"), 1, &AOClient::cmdPos}}, + {"g", {ACLFlags.value("NONE"), 1, &AOClient::cmdG}} }; QString partial_packet; diff --git a/src/commands.cpp b/src/commands.cpp index 4a66c4e..a81d062 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -371,6 +371,14 @@ void AOClient::cmdPos(int argc, QStringList argv) sendServerMessage("Position changed to " + pos + "."); } +void AOClient::cmdG(int argc, QStringList argv) +{ + QString sender_name = ooc_name; + QString sender_message = argv.join(" "); + server->broadcast(AOPacket("CT", {"[G]" + sender_name, sender_message})); + return; +} + QStringList AOClient::buildAreaList(int area_idx) { QStringList entries;