diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-08-19 22:40:15 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-08-19 22:40:15 +0300 |
commit | d8d06e4c4ff2b84fbe74c902ac4bf50d349dc018 (patch) | |
tree | 38a1580cb5d26865a8e8e6d2bd459d5ab10faf99 /src/actions/commands.cpp | |
parent | a348d4a8882300fa308d210e860dd29a4b974622 (diff) | |
download | mv-d8d06e4c4ff2b84fbe74c902ac4bf50d349dc018.tar.gz mv-d8d06e4c4ff2b84fbe74c902ac4bf50d349dc018.tar.bz2 mv-d8d06e4c4ff2b84fbe74c902ac4bf50d349dc018.tar.xz mv-d8d06e4c4ff2b84fbe74c902ac4bf50d349dc018.zip |
Add chat command for show/change share item drops in party.
Diffstat (limited to 'src/actions/commands.cpp')
-rw-r--r-- | src/actions/commands.cpp | 68 |
1 files changed, 67 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 |