summaryrefslogtreecommitdiff
path: root/src/actions
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-08-20 01:40:44 +0300
committerAndrei Karas <akaras@inbox.ru>2016-08-20 01:40:44 +0300
commita0b1ecd9ed18cb0246629b7e3f85fa38bfde2039 (patch)
treea908548d44fdecd8657b0ab9d81d009679502838 /src/actions
parent75c8412edc9030ff86dc80dc4143d873cda9d4d1 (diff)
downloadmv-a0b1ecd9ed18cb0246629b7e3f85fa38bfde2039.tar.gz
mv-a0b1ecd9ed18cb0246629b7e3f85fa38bfde2039.tar.bz2
mv-a0b1ecd9ed18cb0246629b7e3f85fa38bfde2039.tar.xz
mv-a0b1ecd9ed18cb0246629b7e3f85fa38bfde2039.zip
Add chat command for show/change auto item party sharing.s20160820
Diffstat (limited to 'src/actions')
-rw-r--r--src/actions/commands.cpp66
-rw-r--r--src/actions/commands.h1
2 files changed, 67 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