diff --git a/include/aoclient.h b/include/aoclient.h index d8f8f31..fa755a6 100644 --- a/include/aoclient.h +++ b/include/aoclient.h @@ -1684,6 +1684,8 @@ class AOClient : public QObject { {"reload", {ACLFlags.value("SUPER"), 0, &AOClient::cmdReload}}, {"disemvowel", {ACLFlags.value("MUTE"), 1, &AOClient::cmdDisemvowel}}, {"undisemvowel", {ACLFlags.value("MUTE"), 1, &AOClient::cmdUnDisemvowel}}, + {"shake", {ACLFlags.value("MUTE"), 1, &AOClient::cmdShake}}, + {"unshake", {ACLFlags.value("MUTE"), 1, &AOClient::cmdUnShake}}, }; /** diff --git a/src/commands.cpp b/src/commands.cpp index 2e7ef18..b5a47d6 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -1414,6 +1414,46 @@ void AOClient::cmdUnDisemvowel(int argc, QStringList argv) 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 entries; diff --git a/src/packets.cpp b/src/packets.cpp index c211455..a922595 100644 --- a/src/packets.cpp +++ b/src/packets.cpp @@ -449,6 +449,12 @@ AOPacket AOClient::validateIcPacket(AOPacket packet) 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) { QString disemvoweled_message = incoming_msg.remove(QRegExp("[AEIOUaeiou]")); incoming_msg = disemvoweled_message;