diff options
Diffstat (limited to 'src/actions')
-rw-r--r-- | src/actions/commands.cpp | 66 | ||||
-rw-r--r-- | src/actions/commands.h | 1 |
2 files changed, 67 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 diff --git a/src/actions/commands.h b/src/actions/commands.h index e0892f384..72d5f5c5b 100644 --- a/src/actions/commands.h +++ b/src/actions/commands.h @@ -150,6 +150,7 @@ namespace Actions decHandler(setSkillOffsetX); decHandler(setSkillOffsetY); decHandler(partyItemShare); + decHandler(partyExpShare); } // namespace Actions #undef decHandler |