Add /gm command

This commit is contained in:
Salanto 2021-03-12 18:41:21 +01:00
parent a62b12fb7a
commit 56ef0d5958
2 changed files with 19 additions and 0 deletions

View File

@ -79,6 +79,7 @@ class AOClient : public QObject {
{"MOTD", 1ULL << 7},
{"ANNOUNCE", 1ULL << 8},
{"MODCHAT", 1ULL << 9},
{"GM", 1ULL << 10},
{"SUPER", ~0ULL}
};
@ -220,6 +221,7 @@ class AOClient : public QObject {
void cmdKick(int argc, QStringList argv);
void cmdAnnounce(int argc, QStringList argv);
void cmdM(int argc, QStringList argv);
void cmdGM(int argc, QStringList argv);
// Casing/RP
void cmdPlay(int argc, QStringList argv);
void cmdNeed(int argc, QStringList argv);
@ -308,6 +310,7 @@ class AOClient : public QObject {
{"motd", {ACLFlags.value("NONE"), 0, &AOClient::cmdMOTD}},
{"announce", {ACLFlags.value("ANNOUNCE"), 1, &AOClient::cmdAnnounce}},
{"m", {ACLFlags.value("MODCHAT"), 1, &AOClient::cmdM}},
{"gm", {ACLFlags.value("GM"), 1, &AOClient::cmdGM}}
};
QString partial_packet;

View File

@ -890,6 +890,22 @@ void AOClient::cmdM(int argc, QStringList argv)
return;
}
void AOClient::cmdGM(int argc, QStringList argv)
{
if (checkAuth(ACLFlags.value("MOTD"))) {
QString sender_name = ooc_name;
QString sender_area = server->area_names.value(current_area);
QString sender_message = argv.join(" ");
for (AOClient* client : server->clients) {
if (client->global_enabled)
client->sendPacket("CT", {"[G][" + sender_area + "]" + "["+sender_name+"][M]", sender_message});
}
}
else {
sendServerMessage("You do not have permission to use Global Mod Message.");
}
}
QStringList AOClient::buildAreaList(int area_idx)
{
QStringList entries;