diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-02-26 01:03:32 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-02-26 01:03:32 +0300 |
commit | cc3e067e9fdf2a1306e62d13dea0fdb315a925c9 (patch) | |
tree | 10cde9feeab91bb2b80404345ace5975dcbc54b3 | |
parent | 9bc12d91bb8d149ea49db42bdfb62781081457c8 (diff) | |
download | manaplus-cc3e067e9fdf2a1306e62d13dea0fdb315a925c9.tar.gz manaplus-cc3e067e9fdf2a1306e62d13dea0fdb315a925c9.tar.bz2 manaplus-cc3e067e9fdf2a1306e62d13dea0fdb315a925c9.tar.xz manaplus-cc3e067e9fdf2a1306e62d13dea0fdb315a925c9.zip |
Add chat command /jail. Also add it to player context menu.
-rw-r--r-- | src/actions/commands.cpp | 9 | ||||
-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/popups/popupmenu.cpp | 3 | ||||
-rw-r--r-- | src/input/inputactionmap.h | 6 | ||||
-rw-r--r-- | src/net/adminhandler.h | 2 | ||||
-rw-r--r-- | src/net/eathena/adminhandler.cpp | 5 | ||||
-rw-r--r-- | src/net/eathena/adminhandler.h | 2 | ||||
-rw-r--r-- | src/net/tmwa/adminhandler.cpp | 4 | ||||
-rw-r--r-- | src/net/tmwa/adminhandler.h | 2 |
11 files changed, 36 insertions, 0 deletions
diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp index ab9a8dda7..1ad0cf9a9 100644 --- a/src/actions/commands.cpp +++ b/src/actions/commands.cpp @@ -1456,4 +1456,13 @@ impHandler(commandKill) return true; } +impHandler(commandJail) +{ + const std::string args = event.args; + if (args.empty()) + return false; + adminHandler->jail(args); + return true; +} + } // namespace Actions diff --git a/src/actions/commands.h b/src/actions/commands.h index ac7ff1ca7..655b039d0 100644 --- a/src/actions/commands.h +++ b/src/actions/commands.h @@ -129,6 +129,7 @@ namespace Actions decHandler(commandHide); decHandler(commandNuke); decHandler(commandKill); + decHandler(commandJail); } // namespace Actions #undef decHandler diff --git a/src/dyetool/actions/commands.cpp b/src/dyetool/actions/commands.cpp index 09cd7e56c..5c7398e04 100644 --- a/src/dyetool/actions/commands.cpp +++ b/src/dyetool/actions/commands.cpp @@ -129,5 +129,6 @@ impHandlerVoid(commandImmortal) impHandlerVoid(commandHide) impHandlerVoid(commandNuke) impHandlerVoid(commandKill) +impHandlerVoid(commandJail) } // namespace Actions diff --git a/src/enums/input/inputaction.h b/src/enums/input/inputaction.h index 43efada74..516f20d27 100644 --- a/src/enums/input/inputaction.h +++ b/src/enums/input/inputaction.h @@ -658,6 +658,7 @@ enumStart(InputAction) COMMAND_HIDE, COMMAND_NUKE, COMMAND_KILL, + COMMAND_JAIL, TOTAL } enumEnd(InputAction); diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index 0fa5a2ca6..866e8cdf4 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -2767,6 +2767,9 @@ void PopupMenu::showPlayerGMCommands() // TRANSLATORS: enable immortal mode for player mBrowserBox->addRow("/immortal 'NAME'", _("Immortal")); // TRANSLATORS: popup menu item + // TRANSLATORS: send player to jail + mBrowserBox->addRow("/jail 'NAME'", _("Jail")); + // TRANSLATORS: popup menu item // TRANSLATORS: hide player mBrowserBox->addRow("/hide 'NAME'", _("Hide")); mBrowserBox->addRow("##3---"); diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index 95e609876..90098ef3b 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -5437,6 +5437,12 @@ static const InputActionData inputActionData "kill", UseArgs_true, Protected_true}, + {"keyCommandJail", + defaultAction(&Actions::commandJail), + InputCondition::INGAME, + "jail", + UseArgs_true, + Protected_true}, }; #undef defaultAction diff --git a/src/net/adminhandler.h b/src/net/adminhandler.h index 1fa8ffc27..1ea6cb325 100644 --- a/src/net/adminhandler.h +++ b/src/net/adminhandler.h @@ -158,6 +158,8 @@ class AdminHandler notfinal virtual void nuke(const std::string &name) const = 0; virtual void kill(const std::string &name) const = 0; + + virtual void jail(const std::string &name) const = 0; }; } // namespace Net diff --git a/src/net/eathena/adminhandler.cpp b/src/net/eathena/adminhandler.cpp index 3618b1357..92cb06531 100644 --- a/src/net/eathena/adminhandler.cpp +++ b/src/net/eathena/adminhandler.cpp @@ -315,4 +315,9 @@ void AdminHandler::kill(const std::string &name) const Gm::runCharCommand("kill", name); } +void AdminHandler::jail(const std::string &name) const +{ + Gm::runCommand("jail", name); +} + } // namespace EAthena diff --git a/src/net/eathena/adminhandler.h b/src/net/eathena/adminhandler.h index 548bea7f6..23419ad27 100644 --- a/src/net/eathena/adminhandler.h +++ b/src/net/eathena/adminhandler.h @@ -134,6 +134,8 @@ class AdminHandler final : public Ea::AdminHandler void kill(const std::string &name) const override final; + void jail(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 2437218df..488a9d05c 100644 --- a/src/net/tmwa/adminhandler.cpp +++ b/src/net/tmwa/adminhandler.cpp @@ -249,4 +249,8 @@ void AdminHandler::kill(const std::string &name A_UNUSED) const { } +void AdminHandler::jail(const std::string &name A_UNUSED) const +{ +} + } // namespace TmwAthena diff --git a/src/net/tmwa/adminhandler.h b/src/net/tmwa/adminhandler.h index 7f5b5730d..8b5c65dec 100644 --- a/src/net/tmwa/adminhandler.h +++ b/src/net/tmwa/adminhandler.h @@ -146,6 +146,8 @@ class AdminHandler final : public Ea::AdminHandler void nuke(const std::string &name) const override final; void kill(const std::string &name) const override final; + + void jail(const std::string &name) const override final; }; } // namespace TmwAthena |