Add /disemvowel
This commit is contained in:
parent
7d7f25f4cb
commit
9b54a44a52
@ -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}},
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user