summaryrefslogtreecommitdiff
path: root/src/actions
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-08-19 22:40:15 +0300
committerAndrei Karas <akaras@inbox.ru>2016-08-19 22:40:15 +0300
commitd8d06e4c4ff2b84fbe74c902ac4bf50d349dc018 (patch)
tree38a1580cb5d26865a8e8e6d2bd459d5ab10faf99 /src/actions
parenta348d4a8882300fa308d210e860dd29a4b974622 (diff)
downloadplus-d8d06e4c4ff2b84fbe74c902ac4bf50d349dc018.tar.gz
plus-d8d06e4c4ff2b84fbe74c902ac4bf50d349dc018.tar.bz2
plus-d8d06e4c4ff2b84fbe74c902ac4bf50d349dc018.tar.xz
plus-d8d06e4c4ff2b84fbe74c902ac4bf50d349dc018.zip
Add chat command for show/change share item drops in party.
Diffstat (limited to 'src/actions')
-rw-r--r--src/actions/commands.cpp68
-rw-r--r--src/actions/commands.h1
2 files changed, 68 insertions, 1 deletions
diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp
index f2acaea56..7ec1d8bf8 100644
--- a/src/actions/commands.cpp
+++ b/src/actions/commands.cpp
@@ -71,8 +71,8 @@
#include "resources/map/map.h"
+#include "utils/booleanoptions.h"
#include "utils/chatutils.h"
-#include "utils/gettext.h"
#include "utils/gmfunctions.h"
#include "utils/parameters.h"
#include "utils/process.h"
@@ -1690,4 +1690,70 @@ impHandler(setSkillOffsetY)
return false;
}
+impHandler(partyItemShare)
+{
+ 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->getShareItems())
+ {
+ case PartyShare::YES:
+ // TRANSLATORS: chat message
+ tab->chatLog(_("Item sharing enabled."),
+ ChatMsgType::BY_SERVER);
+ return true;
+ case PartyShare::NO:
+ // TRANSLATORS: chat message
+ tab->chatLog(_("Item sharing disabled."),
+ ChatMsgType::BY_SERVER);
+ return true;
+ case PartyShare::NOT_POSSIBLE:
+ // TRANSLATORS: chat message
+ tab->chatLog(_("Item sharing not possible."),
+ ChatMsgType::BY_SERVER);
+ return true;
+ case PartyShare::UNKNOWN:
+ // TRANSLATORS: chat message
+ tab->chatLog(_("Item sharing unknown."),
+ ChatMsgType::BY_SERVER);
+ return true;
+ default:
+ break;
+ }
+ }
+
+ const signed char opt = parseBoolean(args);
+
+ switch (opt)
+ {
+ case 1:
+ partyHandler->setShareItems(
+ PartyShare::YES);
+ break;
+ case 0:
+ partyHandler->setShareItems(
+ PartyShare::NO);
+ break;
+ case -1:
+ tab->chatLog(strprintf(BOOLEAN_OPTIONS, "item"),
+ ChatMsgType::BY_SERVER);
+ break;
+ default:
+ break;
+ }
+ return true;
+}
+
} // namespace Actions
diff --git a/src/actions/commands.h b/src/actions/commands.h
index acc13af75..e0892f384 100644
--- a/src/actions/commands.h
+++ b/src/actions/commands.h
@@ -149,6 +149,7 @@ namespace Actions
decHandler(showSkillOffsetY);
decHandler(setSkillOffsetX);
decHandler(setSkillOffsetY);
+ decHandler(partyItemShare);
} // namespace Actions
#undef decHandler