Add /disemvowel

This commit is contained in:
MangosArentLiterature 2021-04-14 01:45:26 -05:00
parent 7d7f25f4cb
commit 9b54a44a52
3 changed files with 49 additions and 2 deletions

View File

@ -221,12 +221,12 @@ class AOClient : public QObject {
/** /**
* @brief If true, the client's in-character messages will have their word order randomised. * @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. * @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. * @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}}, {"ungimp", {ACLFlags.value("MUTE"), 1, &AOClient::cmdUnGimp}},
{"baninfo", {ACLFlags.value("BAN"), 1, &AOClient::cmdBanInfo}}, {"baninfo", {ACLFlags.value("BAN"), 1, &AOClient::cmdBanInfo}},
{"reload", {ACLFlags.value("SUPER"), 0, &AOClient::cmdReload}}, {"reload", {ACLFlags.value("SUPER"), 0, &AOClient::cmdReload}},
{"disemvowel", {ACLFlags.value("MUTE"), 1, &AOClient::cmdDisemvowel}},
{"undisemvowel", {ACLFlags.value("MUTE"), 1, &AOClient::cmdUnDisemvowel}},
}; };
/** /**

View File

@ -1374,6 +1374,46 @@ void AOClient::cmdReload(int argc, QStringList argv)
sendServerMessage("Reloaded configurations"); 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 AOClient::buildAreaList(int area_idx)
{ {
QStringList entries; QStringList entries;

View File

@ -449,6 +449,11 @@ AOPacket AOClient::validateIcPacket(AOPacket packet)
incoming_msg = gimp_message; incoming_msg = gimp_message;
} }
if (is_disemvoweled) {
QString disemvoweled_message = incoming_msg.remove(QRegExp("[AEIOUaeiou]"));
incoming_msg = disemvoweled_message;
}
last_message = incoming_msg; last_message = incoming_msg;
args.append(incoming_msg); args.append(incoming_msg);