Add /gimp
- Also adds some documentation of other joke mod commands to aoclient.h.
This commit is contained in:
parent
cff51674bb
commit
23d50b9216
@ -231,7 +231,7 @@ class AOClient : public QObject {
|
|||||||
/**
|
/**
|
||||||
* @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.
|
||||||
*/
|
*/
|
||||||
bool is_gimped;
|
bool is_gimped = false;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
/**
|
/**
|
||||||
@ -1399,6 +1399,60 @@ class AOClient : public QObject {
|
|||||||
*/
|
*/
|
||||||
void cmd8Ball(int argc, QStringList argv);
|
void cmd8Ball(int argc, QStringList argv);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Replaces a target client's in-character messages with strings randomly selected from gimp.txt.
|
||||||
|
*
|
||||||
|
* @details The only argument is the **the target's ID** whom the client wants to gimp.
|
||||||
|
*
|
||||||
|
* @iscommand
|
||||||
|
*/
|
||||||
|
void cmdGimp(int argc, QStringList argv);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Allows a gimped client to speak normally.
|
||||||
|
*
|
||||||
|
* @details The only argument is **the target's ID** whom the client wants to ungimp.
|
||||||
|
*
|
||||||
|
* @iscommand
|
||||||
|
*/
|
||||||
|
void cmdUnGimp(int argc, QStringList argv);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Removes all vowels from a target client's in-character messages.
|
||||||
|
*
|
||||||
|
* @details The only argument is **the target's ID** whom the client wants to disemvowel.
|
||||||
|
*
|
||||||
|
* @iscommand
|
||||||
|
*/
|
||||||
|
void cmdDisemvowel(int argc, QStringList argv);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Allows a disemvoweled client to speak normally.
|
||||||
|
*
|
||||||
|
* @details The only argument is **the target's ID** whom the client wants to undisemvowel.
|
||||||
|
*
|
||||||
|
* @iscommand
|
||||||
|
*/
|
||||||
|
void cmdUnDisemvowel(int argc, QStringList argv);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Scrambles the words of a target client's in-character messages.
|
||||||
|
*
|
||||||
|
* @details The only argument is **the target's ID** whom the client wants to shake.
|
||||||
|
*
|
||||||
|
* @iscommand
|
||||||
|
*/
|
||||||
|
void cmdShake(int argc, QStringList argv);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Allows a shaken client to speak normally.
|
||||||
|
*
|
||||||
|
* @details The only argument is **the target's ID** whom the client wants to unshake.
|
||||||
|
*
|
||||||
|
* @iscommand
|
||||||
|
*/
|
||||||
|
void cmdUnShake(int argc, QStringList argv);
|
||||||
|
|
||||||
///@}
|
///@}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1593,6 +1647,7 @@ class AOClient : public QObject {
|
|||||||
{"8ball", {ACLFlags.value("NONE"), 1, &AOClient::cmd8Ball}},
|
{"8ball", {ACLFlags.value("NONE"), 1, &AOClient::cmd8Ball}},
|
||||||
{"lm", {ACLFlags.value("MODCHAT"), 1, &AOClient::cmdLM}},
|
{"lm", {ACLFlags.value("MODCHAT"), 1, &AOClient::cmdLM}},
|
||||||
{"allow_blankposting", {ACLFlags.value("MODCHAT"), 0, &AOClient::cmdAllow_Blankposting}},
|
{"allow_blankposting", {ACLFlags.value("MODCHAT"), 0, &AOClient::cmdAllow_Blankposting}},
|
||||||
|
{"gimp", {ACLFlags.value("MUTE"), 1, &AOClient::cmdGimp}},
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -243,6 +243,11 @@ class Server : public QObject {
|
|||||||
*/
|
*/
|
||||||
QStringList reprimands_list;
|
QStringList reprimands_list;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief List holding the contents of gimp.txt, used by AOClient::cmdGimp.
|
||||||
|
*/
|
||||||
|
QStringList gimp_list;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
/**
|
/**
|
||||||
* @brief Handles a new connection.
|
* @brief Handles a new connection.
|
||||||
|
@ -1276,6 +1276,26 @@ void AOClient::cmdAllow_Blankposting(int argc, QStringList argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AOClient::cmdGimp(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_gimped)
|
||||||
|
sendServerMessage("That player is already gimped!");
|
||||||
|
else {
|
||||||
|
sendServerMessage("Gimped player.");
|
||||||
|
target->sendServerMessage("You have been gimped! " + getReprimand());
|
||||||
|
}
|
||||||
|
target->is_gimped = true;
|
||||||
|
}
|
||||||
|
|
||||||
QStringList AOClient::buildAreaList(int area_idx)
|
QStringList AOClient::buildAreaList(int area_idx)
|
||||||
{
|
{
|
||||||
QStringList entries;
|
QStringList entries;
|
||||||
|
@ -182,7 +182,7 @@ bool ConfigManager::fileExists(QFileInfo* file)
|
|||||||
|
|
||||||
bool ConfigManager::verifyCommandConfig()
|
bool ConfigManager::verifyCommandConfig()
|
||||||
{
|
{
|
||||||
QStringList filelist = {"8ball", "praise", "reprimands"};
|
QStringList filelist = {"8ball", "praise", "reprimands", "gimp"};
|
||||||
foreach (QString filename, filelist) {
|
foreach (QString filename, filelist) {
|
||||||
QFileInfo file("config/text/" + filename + ".txt");
|
QFileInfo file("config/text/" + filename + ".txt");
|
||||||
if (!(fileExists(&file))) {
|
if (!(fileExists(&file))) {
|
||||||
|
@ -441,6 +441,11 @@ AOPacket AOClient::validateIcPacket(AOPacket packet)
|
|||||||
return invalid;
|
return invalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_gimped) {
|
||||||
|
QString gimp_message = server->gimp_list[(genRand(1, server->gimp_list.size() - 1))];
|
||||||
|
incoming_msg = gimp_message;
|
||||||
|
}
|
||||||
|
|
||||||
last_message = incoming_msg;
|
last_message = incoming_msg;
|
||||||
args.append(incoming_msg);
|
args.append(incoming_msg);
|
||||||
|
|
||||||
|
@ -221,6 +221,7 @@ void Server::loadCommandConfig()
|
|||||||
magic_8ball_answers.append(loadConfigFile("8ball"));
|
magic_8ball_answers.append(loadConfigFile("8ball"));
|
||||||
praise_list.append(loadConfigFile("praise"));
|
praise_list.append(loadConfigFile("praise"));
|
||||||
reprimands_list.append(loadConfigFile("reprimands"));
|
reprimands_list.append(loadConfigFile("reprimands"));
|
||||||
|
gimp_list.append(loadConfigFile("gimp"));
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList Server::loadConfigFile(QString filename)
|
QStringList Server::loadConfigFile(QString filename)
|
||||||
|
Loading…
Reference in New Issue
Block a user