diff --git a/include/aoclient.h b/include/aoclient.h index 52cb9cc..d8f8f31 100644 --- a/include/aoclient.h +++ b/include/aoclient.h @@ -221,12 +221,12 @@ class AOClient : public QObject { /** * @brief If true, the client's in-character messages will have their word order randomised. */ - bool is_shaken; + bool is_shaken = false; /** * @brief If true, the client's in-character messages will have their vowels (English alphabet only) removed. */ - bool is_disemvoweled; + bool is_disemvoweled = false; /** * @brief If true, the client's in-character messages will be overwritten by a randomly picked predetermined message. @@ -1682,6 +1682,8 @@ class AOClient : public QObject { {"ungimp", {ACLFlags.value("MUTE"), 1, &AOClient::cmdUnGimp}}, {"baninfo", {ACLFlags.value("BAN"), 1, &AOClient::cmdBanInfo}}, {"reload", {ACLFlags.value("SUPER"), 0, &AOClient::cmdReload}}, + {"disemvowel", {ACLFlags.value("MUTE"), 1, &AOClient::cmdDisemvowel}}, + {"undisemvowel", {ACLFlags.value("MUTE"), 1, &AOClient::cmdUnDisemvowel}}, }; /** diff --git a/src/commands.cpp b/src/commands.cpp index f9c8b22..2e7ef18 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -1374,6 +1374,46 @@ void AOClient::cmdReload(int argc, QStringList argv) sendServerMessage("Reloaded configurations"); } +void AOClient::cmdDisemvowel(int argc, QStringList argv) +{ + bool conv_ok = false; + int uid = argv[0].toInt(&conv_ok); + if (!conv_ok) { + sendServerMessage("Invalid user ID."); + return; + } + + AOClient* target = server->getClientByID(uid); + + if (target->is_disemvoweled) + sendServerMessage("That player is already disemvoweled!"); + else { + sendServerMessage("Disemvoweled player."); + target->sendServerMessage("You have been disemvoweled! " + getReprimand()); + } + target->is_disemvoweled = true; +} + +void AOClient::cmdUnDisemvowel(int argc, QStringList argv) +{ + bool conv_ok = false; + int uid = argv[0].toInt(&conv_ok); + if (!conv_ok) { + sendServerMessage("Invalid user ID."); + return; + } + + AOClient* target = server->getClientByID(uid); + + if (!(target->is_disemvoweled)) + sendServerMessage("That player is not disemvoweled!"); + else { + sendServerMessage("Undisemvoweled player."); + target->sendServerMessage("A moderator has undisemvoweled you! " + getReprimand(true)); + } + target->is_disemvoweled = false; +} + QStringList AOClient::buildAreaList(int area_idx) { QStringList entries; diff --git a/src/packets.cpp b/src/packets.cpp index cfa12ee..c211455 100644 --- a/src/packets.cpp +++ b/src/packets.cpp @@ -449,6 +449,11 @@ AOPacket AOClient::validateIcPacket(AOPacket packet) incoming_msg = gimp_message; } + if (is_disemvoweled) { + QString disemvoweled_message = incoming_msg.remove(QRegExp("[AEIOUaeiou]")); + incoming_msg = disemvoweled_message; + } + last_message = incoming_msg; args.append(incoming_msg);