add /mods

This commit is contained in:
in1tiate 2021-03-09 19:29:59 -06:00
parent 49071e6936
commit f0d6b4eb53
2 changed files with 26 additions and 0 deletions

View File

@ -197,6 +197,7 @@ class AOClient : public QObject {
void cmdBgLock(int argc, QStringList argv);
void cmdBgUnlock(int argc, QStringList argv);
// Moderation
void cmdMods(int argc, QStringList argv);
void cmdBan(int argc, QStringList argv);
void cmdKick(int argc, QStringList argv);
// Casing/RP
@ -270,6 +271,7 @@ class AOClient : public QObject {
{"randomchar", {ACLFlags.value("NONE"), 0, &AOClient::cmdRandomChar}},
{"switch", {ACLFlags.value("NONE"), 1, &AOClient::cmdSwitch}},
{"toggleglobal", {ACLFlags.value("NONE"), 0, &AOClient::cmdToggleGlobal}},
{"mods", {ACLFlags.value("NONE"), 0, &AOClient::cmdMods}},
};
QString partial_packet;

View File

@ -692,6 +692,30 @@ void AOClient::cmdToggleGlobal(int argc, QStringList argv)
sendServerMessage("Global chat set to " + str_en);
}
void AOClient::cmdMods(int argc, QStringList argv)
{
QStringList entries;
QSettings config("config/config.ini", QSettings::IniFormat);
config.beginGroup("Options");
QString auth_type = config.value("auth", "simple").toString();
int online_count = 0;
for (AOClient* client : server->clients) {
if (client->authenticated) {
entries << "---";
if (auth_type != "simple")
entries << "Moderator: " + moderator_name;
entries << "OOC name: " + ooc_name;
entries << "ID: " + QString::number(client->id);
entries << "Area: " + QString::number(client->current_area);
entries << "Character: " + client->current_char;
online_count++;
}
}
entries << "---";
entries << "Total online: " << QString::number(online_count);
sendServerMessage(entries.join("\n"));
}
QStringList AOClient::buildAreaList(int area_idx)
{
QStringList entries;