From 296426d16390baaf76300dea1c9ff147e3a50ab6 Mon Sep 17 00:00:00 2001 From: Salanto Date: Sat, 9 Jan 2021 22:24:32 +0100 Subject: [PATCH] Add /need command --- include/aoclient.h | 4 +++- src/commands.cpp | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/aoclient.h b/include/aoclient.h index 7fe4993..85064e0 100644 --- a/include/aoclient.h +++ b/include/aoclient.h @@ -172,6 +172,7 @@ class AOClient : public QObject { void cmdLogout(int argc, QStringList argv); void cmdPos(int argc, QStringList argv); void cmdG(int argc, QStringList argv); + void cmdNeed(int argc, QStringList argv); // Command helper functions QStringList buildAreaList(int area_idx); @@ -204,7 +205,8 @@ class AOClient : public QObject { {"listusers", {ACLFlags.value("MODIFY_USERS"), 0, &AOClient::cmdListUsers}}, {"logout", {ACLFlags.value("NONE"), 0, &AOClient::cmdLogout}}, {"pos", {ACLFlags.value("NONE"), 1, &AOClient::cmdPos}}, - {"g", {ACLFlags.value("NONE"), 1, &AOClient::cmdG}} + {"g", {ACLFlags.value("NONE"), 1, &AOClient::cmdG}}, + {"need", {ACLFlags.value("NONE"), 1, &AOClient::cmdNeed}} }; QString partial_packet; diff --git a/src/commands.cpp b/src/commands.cpp index a81d062..f0ad57b 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -379,6 +379,13 @@ void AOClient::cmdG(int argc, QStringList argv) return; } +void AOClient::cmdNeed(int argc, QStringList argv) +{ + QString sender_area = server->area_names.value(current_area); + QString sender_message = argv.join(" "); + server->broadcast(AOPacket("CT", {"=== Advert ===","[" + sender_area + "] needs " + sender_message})); +} + QStringList AOClient::buildAreaList(int area_idx) { QStringList entries;