summaryrefslogtreecommitdiff
path: root/src/actions/commands.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-08-19 22:59:49 +0300
committerAndrei Karas <akaras@inbox.ru>2016-08-19 22:59:49 +0300
commit0a4ee3a9df73daf0350080b9e147f7b4bd535429 (patch)
treeeaa1a163801b3f8f09adadd3797f54cad40441a7 /src/actions/commands.cpp
parentd8d06e4c4ff2b84fbe74c902ac4bf50d349dc018 (diff)
downloadmv-0a4ee3a9df73daf0350080b9e147f7b4bd535429.tar.gz
mv-0a4ee3a9df73daf0350080b9e147f7b4bd535429.tar.bz2
mv-0a4ee3a9df73daf0350080b9e147f7b4bd535429.tar.xz
mv-0a4ee3a9df73daf0350080b9e147f7b4bd535429.zip
Add chat command for show/change share experience in party.
Diffstat (limited to 'src/actions/commands.cpp')
-rw-r--r--src/actions/commands.cpp66
1 files changed, 66 insertions, 0 deletions
diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp
index 7ec1d8bf8..e01e9e904 100644
--- a/src/actions/commands.cpp
+++ b/src/actions/commands.cpp
@@ -1756,4 +1756,70 @@ impHandler(partyItemShare)
return true;
}
+impHandler(partyExpShare)
+{
+ if (!localPlayer)
+ return false;
+
+ if (localPlayer->isInParty() == false)
+ return true;
+
+ ChatTab *tab = event.tab;
+ if (tab == nullptr)
+ tab = localChatTab;
+ if (tab == nullptr)
+ return true;
+
+ const std::string args = event.args;
+ if (args.empty())
+ {
+ switch (partyHandler->getShareExperience())
+ {
+ case PartyShare::YES:
+ // TRANSLATORS: chat message
+ tab->chatLog(_("Experience sharing enabled."),
+ ChatMsgType::BY_SERVER);
+ return true;
+ case PartyShare::NO:
+ // TRANSLATORS: chat message
+ tab->chatLog(_("Experience sharing disabled."),
+ ChatMsgType::BY_SERVER);
+ return true;
+ case PartyShare::NOT_POSSIBLE:
+ // TRANSLATORS: chat message
+ tab->chatLog(_("Experience sharing not possible."),
+ ChatMsgType::BY_SERVER);
+ return true;
+ case PartyShare::UNKNOWN:
+ // TRANSLATORS: chat message
+ tab->chatLog(_("Experience sharing unknown."),
+ ChatMsgType::BY_SERVER);
+ return true;
+ default:
+ break;
+ }
+ }
+
+ const signed char opt = parseBoolean(args);
+
+ switch (opt)
+ {
+ case 1:
+ partyHandler->setShareExperience(
+ PartyShare::YES);
+ break;
+ case 0:
+ partyHandler->setShareExperience(
+ PartyShare::NO);
+ break;
+ case -1:
+ tab->chatLog(strprintf(BOOLEAN_OPTIONS, "exp"),
+ ChatMsgType::BY_SERVER);
+ break;
+ default:
+ break;
+ }
+ return true;
+}
+
} // namespace Actions