diff options
Diffstat (limited to 'src/PatchedClonkControl.cpp')
| -rw-r--r-- | src/PatchedClonkControl.cpp | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/PatchedClonkControl.cpp b/src/PatchedClonkControl.cpp index 47758d2..45b6d68 100644 --- a/src/PatchedClonkControl.cpp +++ b/src/PatchedClonkControl.cpp @@ -1,6 +1,62 @@ #include "PatchedClonkControl.hpp" +#define CMD_SIGN "/" + PatchedClonkControl::PatchedClonkControl() { } + +void PatchedClonkControl::abortCountdown() +{ + rawCommand("stop"); +} + +void PatchedClonkControl::alert() +{ + rawCommand("alert"); +} + +void PatchedClonkControl::kick(const ClientInfo& client, const QString& reason) +{ + rawCommand("kick " + client.pcName + (reason.isEmpty() ? "" : " " + reason)); +} + +void PatchedClonkControl::rawCommand(const QString& command) +{ + controller->writeToServer(CMD_SIGN + command + "\n"); +} + +void PatchedClonkControl::serverMessage(const QString& msg, bool action) +{ + if(action) + { + rawCommand("me " + msg); + } + else + { + if(msg.startsWith(CMD_SIGN)) + { + controller->writeToServer(" " + msg + "\n"); + } + else + { + controller->writeToServer(msg + "\n"); + } + } +} + +void PatchedClonkControl::setCommand(const QString& command) +{ + rawCommand("set " + command); +} + +void PatchedClonkControl::setCountdown(unsigned int countdown) +{ + rawCommand("start " + QString::number(countdown)); +} + +void PatchedClonkControl::watchdog(const QString& id) +{ + rawCommand("watchdog " + id); +} |
