summaryrefslogtreecommitdiffstats
path: root/src/PatchedClonkControl.cpp
diff options
context:
space:
mode:
authorMarkus Mittendrein <git@maxmitti.tk>2017-04-06 17:22:23 +0200
committerMarkus Mittendrein <git@maxmitti.tk>2017-04-06 17:22:52 +0200
commit21d4d5f0de6bd8ed1cdab4f7fe6b9596dd390252 (patch)
tree53af18c9eb2098721dca970f0316d832938b231e /src/PatchedClonkControl.cpp
parent3fe710cb029522b86ef27c322f0cb793b1368051 (diff)
downloadmanager-21d4d5f0de6bd8ed1cdab4f7fe6b9596dd390252.tar.gz
manager-21d4d5f0de6bd8ed1cdab4f7fe6b9596dd390252.zip
Move clonk control specific parts into ClonkControl
There are still many clonk commands hardcoded through the pass-CRSM-Commands
Diffstat (limited to 'src/PatchedClonkControl.cpp')
-rw-r--r--src/PatchedClonkControl.cpp56
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);
+}