diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-08-20 01:40:44 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-08-20 01:40:44 +0300 |
commit | a0b1ecd9ed18cb0246629b7e3f85fa38bfde2039 (patch) | |
tree | a908548d44fdecd8657b0ab9d81d009679502838 /src | |
parent | 75c8412edc9030ff86dc80dc4143d873cda9d4d1 (diff) | |
download | manaverse-a0b1ecd9ed18cb0246629b7e3f85fa38bfde2039.tar.gz manaverse-a0b1ecd9ed18cb0246629b7e3f85fa38bfde2039.tar.bz2 manaverse-a0b1ecd9ed18cb0246629b7e3f85fa38bfde2039.tar.xz manaverse-a0b1ecd9ed18cb0246629b7e3f85fa38bfde2039.zip |
Add chat command for show/change auto item party sharing.s20160820
Diffstat (limited to 'src')
-rw-r--r-- | src/actions/commands.cpp | 66 | ||||
-rw-r--r-- | src/actions/commands.h | 1 | ||||
-rw-r--r-- | src/dyetool/actions/commands.cpp | 1 | ||||
-rw-r--r-- | src/enums/input/inputaction.h | 1 | ||||
-rw-r--r-- | src/gui/widgets/tabs/chat/partytab.cpp | 6 | ||||
-rw-r--r-- | src/input/inputactionmap.h | 6 |
6 files changed, 81 insertions, 0 deletions
diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp index e01e9e904..4f809411c 100644 --- a/src/actions/commands.cpp +++ b/src/actions/commands.cpp @@ -1822,4 +1822,70 @@ impHandler(partyExpShare) return true; } +impHandler(partyAutoItemShare) +{ + 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->getShareAutoItems()) + { + case PartyShare::YES: + // TRANSLATORS: chat message + tab->chatLog(_("Auto item sharing enabled."), + ChatMsgType::BY_SERVER); + return true; + case PartyShare::NO: + // TRANSLATORS: chat message + tab->chatLog(_("Auto item sharing disabled."), + ChatMsgType::BY_SERVER); + return true; + case PartyShare::NOT_POSSIBLE: + // TRANSLATORS: chat message + tab->chatLog(_("Auto item sharing not possible."), + ChatMsgType::BY_SERVER); + return true; + case PartyShare::UNKNOWN: + // TRANSLATORS: chat message + tab->chatLog(_("Auto item sharing unknown."), + ChatMsgType::BY_SERVER); + return true; + default: + break; + } + } + + const signed char opt = parseBoolean(args); + + switch (opt) + { + case 1: + partyHandler->setShareAutoItems( + PartyShare::YES); + break; + case 0: + partyHandler->setShareAutoItems( + 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 72d5f5c5b..627390860 100644 --- a/src/actions/commands.h +++ b/src/actions/commands.h @@ -151,6 +151,7 @@ namespace Actions decHandler(setSkillOffsetY); decHandler(partyItemShare); decHandler(partyExpShare); + decHandler(partyAutoItemShare); } // namespace Actions #undef decHandler diff --git a/src/dyetool/actions/commands.cpp b/src/dyetool/actions/commands.cpp index 2b9ef0ad3..56541134c 100644 --- a/src/dyetool/actions/commands.cpp +++ b/src/dyetool/actions/commands.cpp @@ -151,5 +151,6 @@ impHandlerVoid(setSkillOffsetX) impHandlerVoid(setSkillOffsetY) impHandlerVoid(partyItemShare) impHandlerVoid(partyExpShare) +impHandlerVoid(partyAutoItemShare) } // namespace Actions diff --git a/src/enums/input/inputaction.h b/src/enums/input/inputaction.h index 31bd6d436..3491aba78 100644 --- a/src/enums/input/inputaction.h +++ b/src/enums/input/inputaction.h @@ -683,6 +683,7 @@ enumStart(InputAction) GUILD_NOTICE, PARTY_ITEM_SHARE, PARTY_EXP_SHARE, + PARTY_AUTO_ITEM_SHARE, TOTAL } enumEnd(InputAction); diff --git a/src/gui/widgets/tabs/chat/partytab.cpp b/src/gui/widgets/tabs/chat/partytab.cpp index 6a52dc634..f39ee7a45 100644 --- a/src/gui/widgets/tabs/chat/partytab.cpp +++ b/src/gui/widgets/tabs/chat/partytab.cpp @@ -88,6 +88,12 @@ bool PartyTab::handleCommand(const std::string &restrict type, args, this); } + else if (type == "autoitem") + { + inputManager.executeChatCommand(InputAction::PARTY_AUTO_ITEM_SHARE, + args, + this); + } else if (type == "exp") { inputManager.executeChatCommand(InputAction::PARTY_EXP_SHARE, diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index 332138ed5..2d56aafec 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -5588,6 +5588,12 @@ static const InputActionData inputActionData "expshare|shareexp", UseArgs_true, Protected_true}, + {"keyPartyAutoItemShare", + defaultAction(&Actions::partyAutoItemShare), + InputCondition::INGAME, + "autoitemshare|shareautoitem|itemautoshare", + UseArgs_true, + Protected_true}, }; #undef defaultAction |