Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/frontend/StarClientCommandProcessor.cpp
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2023-07-22 22:31:04 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2023-07-22 22:31:04 +1000
commitcb19eef701b5c9e27d0464795fffcf8a4d795a21 (patch)
tree5cfbdf49ebd7ac9539891eea850e244887d4c355 /source/frontend/StarClientCommandProcessor.cpp
parent4fbd67daccfa69df6988bdf17c67ee3d5f3049c5 (diff)
Add character swapping (no GUI yet)
Diffstat (limited to 'source/frontend/StarClientCommandProcessor.cpp')
-rw-r--r--source/frontend/StarClientCommandProcessor.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/source/frontend/StarClientCommandProcessor.cpp b/source/frontend/StarClientCommandProcessor.cpp
index ec5b27c..c7a510f 100644
--- a/source/frontend/StarClientCommandProcessor.cpp
+++ b/source/frontend/StarClientCommandProcessor.cpp
@@ -50,7 +50,8 @@ ClientCommandProcessor::ClientCommandProcessor(UniverseClientPtr universeClient,
{"giveessentialitem", bind(&ClientCommandProcessor::giveEssentialItem, this, _1)},
{"maketechavailable", bind(&ClientCommandProcessor::makeTechAvailable, this, _1)},
{"enabletech", bind(&ClientCommandProcessor::enableTech, this, _1)},
- {"upgradeship", bind(&ClientCommandProcessor::upgradeShip, this, _1)}
+ {"upgradeship", bind(&ClientCommandProcessor::upgradeShip, this, _1)},
+ {"swap", bind(&ClientCommandProcessor::swap, this, _1)}
};
}
@@ -304,7 +305,7 @@ String ClientCommandProcessor::playTime() {
String ClientCommandProcessor::deathCount() {
auto deaths = m_universeClient->mainPlayer()->log()->deathCount();
- return strf("Total deaths: {}{}", deaths, deaths == 0 ? ". Well done!" : "");
+ return deaths ? strf("Total deaths: {}", deaths) : "Total deaths: 0. Well done!";
}
String ClientCommandProcessor::cinema(String const& argumentsString) {
@@ -408,4 +409,16 @@ String ClientCommandProcessor::upgradeShip(String const& argumentsString) {
return strf("Upgraded ship");
}
+String ClientCommandProcessor::swap(String const& argumentsString) {
+ auto arguments = m_parser.tokenizeToStringList(argumentsString);
+
+ if (arguments.size() == 0)
+ return "Not enouch arguments to /swap";
+
+ if (m_universeClient->switchPlayer(arguments[0]))
+ return "Successfully swapped player";
+ else
+ return "Failed to swap player";
+}
+
}