Add /shake
- also adds /unshake
This commit is contained in:
parent
9b54a44a52
commit
8e4f8c31c7
@ -1684,6 +1684,8 @@ class AOClient : public QObject {
|
|||||||
{"reload", {ACLFlags.value("SUPER"), 0, &AOClient::cmdReload}},
|
{"reload", {ACLFlags.value("SUPER"), 0, &AOClient::cmdReload}},
|
||||||
{"disemvowel", {ACLFlags.value("MUTE"), 1, &AOClient::cmdDisemvowel}},
|
{"disemvowel", {ACLFlags.value("MUTE"), 1, &AOClient::cmdDisemvowel}},
|
||||||
{"undisemvowel", {ACLFlags.value("MUTE"), 1, &AOClient::cmdUnDisemvowel}},
|
{"undisemvowel", {ACLFlags.value("MUTE"), 1, &AOClient::cmdUnDisemvowel}},
|
||||||
|
{"shake", {ACLFlags.value("MUTE"), 1, &AOClient::cmdShake}},
|
||||||
|
{"unshake", {ACLFlags.value("MUTE"), 1, &AOClient::cmdUnShake}},
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1414,6 +1414,46 @@ void AOClient::cmdUnDisemvowel(int argc, QStringList argv)
|
|||||||
target->is_disemvoweled = false;
|
target->is_disemvoweled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AOClient::cmdShake(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_shaken)
|
||||||
|
sendServerMessage("That player is already shaken!");
|
||||||
|
else {
|
||||||
|
sendServerMessage("Shook player.");
|
||||||
|
target->sendServerMessage("A moderator has shaken your words! " + getReprimand());
|
||||||
|
}
|
||||||
|
target->is_shaken = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AOClient::cmdUnShake(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_shaken))
|
||||||
|
sendServerMessage("That player is not shaken!");
|
||||||
|
else {
|
||||||
|
sendServerMessage("Unshook player.");
|
||||||
|
target->sendServerMessage("A moderator has unshook you! " + getReprimand(true));
|
||||||
|
}
|
||||||
|
target->is_shaken = false;
|
||||||
|
}
|
||||||
|
|
||||||
QStringList AOClient::buildAreaList(int area_idx)
|
QStringList AOClient::buildAreaList(int area_idx)
|
||||||
{
|
{
|
||||||
QStringList entries;
|
QStringList entries;
|
||||||
|
@ -449,6 +449,12 @@ AOPacket AOClient::validateIcPacket(AOPacket packet)
|
|||||||
incoming_msg = gimp_message;
|
incoming_msg = gimp_message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_shaken) {
|
||||||
|
QStringList parts = incoming_msg.split(" ");
|
||||||
|
std::random_shuffle(parts.begin(), parts.end());
|
||||||
|
incoming_msg = parts.join(" ");
|
||||||
|
}
|
||||||
|
|
||||||
if (is_disemvoweled) {
|
if (is_disemvoweled) {
|
||||||
QString disemvoweled_message = incoming_msg.remove(QRegExp("[AEIOUaeiou]"));
|
QString disemvoweled_message = incoming_msg.remove(QRegExp("[AEIOUaeiou]"));
|
||||||
incoming_msg = disemvoweled_message;
|
incoming_msg = disemvoweled_message;
|
||||||
|
Loading…
Reference in New Issue
Block a user