From 61de258859b600011284a49d54bca1f31ecb6d3d Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 24 Feb 2016 19:46:26 +0300 Subject: Add chat command /showaccountinfo. Also add it to player 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 | 3 +++ 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 | 3 +++ 11 files changed, 37 insertions(+) (limited to 'src') diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp index 68f1a71fe..e6721e4f0 100644 --- a/src/actions/commands.cpp +++ b/src/actions/commands.cpp @@ -1314,4 +1314,13 @@ impHandler(locatePlayer) return true; } +impHandler(commandShowAccountInfo) +{ + const std::string args = event.args; + if (args.empty()) + return false; + adminHandler->showAccountInfo(args); + return true; +} + } // namespace Actions diff --git a/src/actions/commands.h b/src/actions/commands.h index 63cbe16c6..45f4364b1 100644 --- a/src/actions/commands.h +++ b/src/actions/commands.h @@ -110,6 +110,7 @@ namespace Actions decHandler(commandShowCart); decHandler(commandShowInventory); decHandler(locatePlayer); + decHandler(commandShowAccountInfo); } // namespace Actions #undef decHandler diff --git a/src/dyetool/actions/commands.cpp b/src/dyetool/actions/commands.cpp index 555bc103b..83695c88b 100644 --- a/src/dyetool/actions/commands.cpp +++ b/src/dyetool/actions/commands.cpp @@ -110,5 +110,6 @@ impHandlerVoid(commandShowStorage) impHandlerVoid(commandShowCart) impHandlerVoid(commandShowInventory) impHandlerVoid(locatePlayer) +impHandlerVoid(commandShowAccountInfo) } // namespace Actions diff --git a/src/enums/input/inputaction.h b/src/enums/input/inputaction.h index 8c60fa849..b59873d35 100644 --- a/src/enums/input/inputaction.h +++ b/src/enums/input/inputaction.h @@ -639,6 +639,7 @@ enumStart(InputAction) COMMAND_SHOW_CART, COMMAND_SHOW_INVENTORY, LOCATE_PLAYER, + COMMAND_SHOW_ACCOUNT_INFO, TOTAL } enumEnd(InputAction); diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index aef4c661d..46d35d0d9 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -2667,6 +2667,9 @@ void PopupMenu::showPlayerGMCommands() // TRANSLATORS: check player ip mBrowserBox->addRow("ipcheck", _("Check ip")); // TRANSLATORS: popup menu item + // TRANSLATORS: show player account info + mBrowserBox->addRow("/showaccountinfo 'NAME'", _("Show account info")); + // TRANSLATORS: popup menu item // TRANSLATORS: show player level mBrowserBox->addRow("/showlevel 'NAME'", _("Show level")); // TRANSLATORS: popup menu item diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index 9dcb7b05c..e1541690e 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -5323,6 +5323,12 @@ static const InputActionData inputActionData "locate|locateplayer|whereplayer", UseArgs_true, Protected_true}, + {"keyCommandShowAccountInfo", + defaultAction(&Actions::commandShowAccountInfo), + InputCondition::INGAME, + "showaccountinfo|showaccinfo|accinfo", + UseArgs_true, + Protected_true}, }; #undef defaultAction diff --git a/src/net/adminhandler.h b/src/net/adminhandler.h index 732a45391..0fe07136a 100644 --- a/src/net/adminhandler.h +++ b/src/net/adminhandler.h @@ -122,6 +122,8 @@ class AdminHandler notfinal virtual void showInventoryList(const std::string &name) const = 0; virtual void locatePlayer(const std::string &name) const = 0; + + virtual void showAccountInfo(const std::string &name) const = 0; }; } // namespace Net diff --git a/src/net/eathena/adminhandler.cpp b/src/net/eathena/adminhandler.cpp index b8c70f17e..468be7117 100644 --- a/src/net/eathena/adminhandler.cpp +++ b/src/net/eathena/adminhandler.cpp @@ -248,4 +248,9 @@ void AdminHandler::locatePlayer(const std::string &name) const chatHandler->talk("@where " + name, GENERAL_CHANNEL); } +void AdminHandler::showAccountInfo(const std::string &name) const +{ + chatHandler->talk("@accinfo " + name, GENERAL_CHANNEL); +} + } // namespace EAthena diff --git a/src/net/eathena/adminhandler.h b/src/net/eathena/adminhandler.h index fe2262d73..e82f88af2 100644 --- a/src/net/eathena/adminhandler.h +++ b/src/net/eathena/adminhandler.h @@ -98,6 +98,8 @@ class AdminHandler final : public Ea::AdminHandler void locatePlayer(const std::string &name) const override final; + void showAccountInfo(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 4e5b1a095..d8af64d7b 100644 --- a/src/net/tmwa/adminhandler.cpp +++ b/src/net/tmwa/adminhandler.cpp @@ -178,4 +178,8 @@ void AdminHandler::locatePlayer(const std::string &name A_UNUSED) const { } +void AdminHandler::showAccountInfo(const std::string &name A_UNUSED) const +{ +} + } // namespace TmwAthena diff --git a/src/net/tmwa/adminhandler.h b/src/net/tmwa/adminhandler.h index 8af855473..bec2c6c40 100644 --- a/src/net/tmwa/adminhandler.h +++ b/src/net/tmwa/adminhandler.h @@ -105,6 +105,9 @@ class AdminHandler final : public Ea::AdminHandler void locatePlayer(const std::string &name) const override final A_CONST; + + void showAccountInfo(const std::string &name) const override final + A_CONST; }; } // namespace TmwAthena -- cgit v1.2.3-60-g2f50