From 9956ff63ccfaee02ed68d0125007b90849cc1ee5 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 29 Feb 2016 01:55:41 +0300 Subject: Add chat command /partyrecall. Also add it to npc context menu. --- src/actions/commands.cpp | 9 +++++++++ src/actions/commands.h | 1 + src/dyetool/actions/commands.cpp | 1 + src/enums/input/inputaction.h | 1 + src/gui/popups/popupmenu.cpp | 22 ++++++++++++++++++++++ src/input/inputactionmap.h | 6 ++++++ src/net/adminhandler.h | 2 ++ src/net/eathena/adminhandler.cpp | 5 +++++ src/net/eathena/adminhandler.h | 2 ++ src/net/tmwa/adminhandler.cpp | 4 ++++ src/net/tmwa/adminhandler.h | 2 ++ 11 files changed, 55 insertions(+) (limited to 'src') diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp index bbde5c4a8..afc1c6d80 100644 --- a/src/actions/commands.cpp +++ b/src/actions/commands.cpp @@ -1518,4 +1518,13 @@ impHandler(commandChangePartyLeader) return true; } +impHandler(commandPartyRecall) +{ + const std::string args = event.args; + if (args.empty()) + return false; + adminHandler->partyRecall(args); + return true; +} + } // namespace Actions diff --git a/src/actions/commands.h b/src/actions/commands.h index efc436c97..76b20effd 100644 --- a/src/actions/commands.h +++ b/src/actions/commands.h @@ -135,6 +135,7 @@ namespace Actions decHandler(commandNpcHide); decHandler(commandNpcShow); decHandler(commandChangePartyLeader); + decHandler(commandPartyRecall); } // namespace Actions #undef decHandler diff --git a/src/dyetool/actions/commands.cpp b/src/dyetool/actions/commands.cpp index 1f8fd5cbd..3778e2611 100644 --- a/src/dyetool/actions/commands.cpp +++ b/src/dyetool/actions/commands.cpp @@ -135,5 +135,6 @@ impHandlerVoid(commandNpcMove) impHandlerVoid(commandNpcHide) impHandlerVoid(commandNpcShow) impHandlerVoid(commandChangePartyLeader) +impHandlerVoid(commandPartyRecall) } // namespace Actions diff --git a/src/enums/input/inputaction.h b/src/enums/input/inputaction.h index 63241a642..ba7135e05 100644 --- a/src/enums/input/inputaction.h +++ b/src/enums/input/inputaction.h @@ -664,6 +664,7 @@ enumStart(InputAction) COMMAND_NPC_HIDE, COMMAND_NPC_SHOW, COMMAND_CHANGE_PARTY_LEADER, + COMMAND_PARTY_RECALL, TOTAL } enumEnd(InputAction); diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index 49073811d..13e54ba3e 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -1563,6 +1563,19 @@ void PopupMenu::handleLink(const std::string &link, } replaceAll(cmd, "'CARDS'", cards); replaceAll(cmd, "'ECARDS'", escapeString(cards)); + if (actorManager) + { + if (!being) + { + being = actorManager->findBeingByName(mName, + ActorType::Player); + } + } + if (being) + replaceAll(cmd, "'PARTY'", being->getPartyName()); + else + replaceAll(cmd, "'PARTY'", ""); + const size_t pos = cmd.find(' '); const std::string type(cmd, 0, pos); std::string args(cmd, pos == std::string::npos ? cmd.size() : pos + 1); @@ -2756,6 +2769,15 @@ void PopupMenu::showPlayerGMCommands(const std::string &name) mBrowserBox->addRow("/alive 'NAME'", _("Revive")); if (!legacy) { + Being *const being = actorManager->findBeingByName(name, + ActorType::Player); + if (being && !being->getPartyName().empty()) + { + mBrowserBox->addRow("/partyrecall 'PARTY'", + // TRANSLATORS: popup menu item + // TRANSLATORS: recall all party to player location + _("Recall party")); + } if (localPlayer && localPlayer->isInParty()) { const Party *const party = localPlayer->getParty(); diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index 90fb66f8c..0fb223d53 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -5473,6 +5473,12 @@ static const InputActionData inputActionData "gmpartyleader|changepartyleader", UseArgs_true, Protected_true}, + {"keyCommandPartyRecall", + defaultAction(&Actions::commandPartyRecall), + InputCondition::INGAME, + "partyrecall|recallparty", + UseArgs_true, + Protected_true}, }; #undef defaultAction diff --git a/src/net/adminhandler.h b/src/net/adminhandler.h index da919e25c..878e24782 100644 --- a/src/net/adminhandler.h +++ b/src/net/adminhandler.h @@ -172,6 +172,8 @@ class AdminHandler notfinal virtual void showNpc(const std::string &name) const = 0; virtual void changePartyLeader(const std::string &name) const = 0; + + virtual void partyRecall(const std::string &name) const = 0; }; } // namespace Net diff --git a/src/net/eathena/adminhandler.cpp b/src/net/eathena/adminhandler.cpp index 07b99347e..29e346af8 100644 --- a/src/net/eathena/adminhandler.cpp +++ b/src/net/eathena/adminhandler.cpp @@ -352,4 +352,9 @@ void AdminHandler::changePartyLeader(const std::string &name) const Gm::runCommand("changeleader", name); } +void AdminHandler::partyRecall(const std::string &name) const +{ + Gm::runCommand("partyrecall", name); +} + } // namespace EAthena diff --git a/src/net/eathena/adminhandler.h b/src/net/eathena/adminhandler.h index 756f60187..c34e6d049 100644 --- a/src/net/eathena/adminhandler.h +++ b/src/net/eathena/adminhandler.h @@ -148,6 +148,8 @@ class AdminHandler final : public Ea::AdminHandler void changePartyLeader(const std::string &name) const override final; + void partyRecall(const std::string &name) const override final; + protected: static std::string mStatsName; }; diff --git a/src/net/tmwa/adminhandler.cpp b/src/net/tmwa/adminhandler.cpp index 4ae9e5346..88c9683fe 100644 --- a/src/net/tmwa/adminhandler.cpp +++ b/src/net/tmwa/adminhandler.cpp @@ -275,4 +275,8 @@ void AdminHandler::changePartyLeader(const std::string &name A_UNUSED) const { } +void AdminHandler::partyRecall(const std::string &name A_UNUSED) const +{ +} + } // namespace TmwAthena diff --git a/src/net/tmwa/adminhandler.h b/src/net/tmwa/adminhandler.h index 069913ab8..5d43c14ff 100644 --- a/src/net/tmwa/adminhandler.h +++ b/src/net/tmwa/adminhandler.h @@ -161,6 +161,8 @@ class AdminHandler final : public Ea::AdminHandler void changePartyLeader(const std::string &name) const override final A_CONST; + + void partyRecall(const std::string &name) const override final A_CONST; }; } // namespace TmwAthena -- cgit v1.2.3-70-g09d2