From ca20df8ccb5eac498a9eab2f3c03d30fe495ef30 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 24 Feb 2016 19:26:42 +0300 Subject: Add chat command /locate. Also add locate 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(+) diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp index 07f633d4d..68f1a71fe 100644 --- a/src/actions/commands.cpp +++ b/src/actions/commands.cpp @@ -1305,4 +1305,13 @@ impHandler(commandShowInventory) return true; } +impHandler(locatePlayer) +{ + const std::string args = event.args; + if (args.empty()) + return false; + adminHandler->locatePlayer(args); + return true; +} + } // namespace Actions diff --git a/src/actions/commands.h b/src/actions/commands.h index 903bdc222..63cbe16c6 100644 --- a/src/actions/commands.h +++ b/src/actions/commands.h @@ -109,6 +109,7 @@ namespace Actions decHandler(commandShowStorage); decHandler(commandShowCart); decHandler(commandShowInventory); + decHandler(locatePlayer); } // namespace Actions #undef decHandler diff --git a/src/dyetool/actions/commands.cpp b/src/dyetool/actions/commands.cpp index d8a030a95..555bc103b 100644 --- a/src/dyetool/actions/commands.cpp +++ b/src/dyetool/actions/commands.cpp @@ -109,5 +109,6 @@ impHandlerVoid(commandShowStats) impHandlerVoid(commandShowStorage) impHandlerVoid(commandShowCart) impHandlerVoid(commandShowInventory) +impHandlerVoid(locatePlayer) } // namespace Actions diff --git a/src/enums/input/inputaction.h b/src/enums/input/inputaction.h index bf90ef531..8c60fa849 100644 --- a/src/enums/input/inputaction.h +++ b/src/enums/input/inputaction.h @@ -638,6 +638,7 @@ enumStart(InputAction) COMMAND_SHOW_STORAGE, COMMAND_SHOW_CART, COMMAND_SHOW_INVENTORY, + LOCATE_PLAYER, TOTAL } enumEnd(InputAction); diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index c5dacf2ba..aef4c661d 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -2660,6 +2660,9 @@ void PopupMenu::addGmCommands() void PopupMenu::showPlayerGMCommands() { + // TRANSLATORS: popup menu item + // TRANSLATORS: find player position + mBrowserBox->addRow("/locateplayer 'NAME'", _("Locate")); // TRANSLATORS: popup menu item // TRANSLATORS: check player ip mBrowserBox->addRow("ipcheck", _("Check ip")); diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index c91321f3d..9dcb7b05c 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -5317,6 +5317,12 @@ static const InputActionData inputActionData "showinventory|inventorylist|itemlist", UseArgs_true, Protected_true}, + {"keyLocatePlayer", + defaultAction(&Actions::locatePlayer), + InputCondition::INGAME, + "locate|locateplayer|whereplayer", + UseArgs_true, + Protected_true}, }; #undef defaultAction diff --git a/src/net/adminhandler.h b/src/net/adminhandler.h index 50f2f6500..732a45391 100644 --- a/src/net/adminhandler.h +++ b/src/net/adminhandler.h @@ -120,6 +120,8 @@ class AdminHandler notfinal virtual void showCartList(const std::string &name) const = 0; virtual void showInventoryList(const std::string &name) const = 0; + + virtual void locatePlayer(const std::string &name) const = 0; }; } // namespace Net diff --git a/src/net/eathena/adminhandler.cpp b/src/net/eathena/adminhandler.cpp index a877d3a63..b8c70f17e 100644 --- a/src/net/eathena/adminhandler.cpp +++ b/src/net/eathena/adminhandler.cpp @@ -243,4 +243,9 @@ void AdminHandler::showInventoryList(const std::string &name) const chatHandler->talk("#itemlist " + name, GENERAL_CHANNEL); } +void AdminHandler::locatePlayer(const std::string &name) const +{ + chatHandler->talk("@where " + name, GENERAL_CHANNEL); +} + } // namespace EAthena diff --git a/src/net/eathena/adminhandler.h b/src/net/eathena/adminhandler.h index 81c7ab2e9..fe2262d73 100644 --- a/src/net/eathena/adminhandler.h +++ b/src/net/eathena/adminhandler.h @@ -96,6 +96,8 @@ class AdminHandler final : public Ea::AdminHandler void showInventoryList(const std::string &name) const override final; + void locatePlayer(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 c5abc7535..4e5b1a095 100644 --- a/src/net/tmwa/adminhandler.cpp +++ b/src/net/tmwa/adminhandler.cpp @@ -174,4 +174,8 @@ void AdminHandler::showInventoryList(const std::string &name A_UNUSED) const { } +void AdminHandler::locatePlayer(const std::string &name A_UNUSED) const +{ +} + } // namespace TmwAthena diff --git a/src/net/tmwa/adminhandler.h b/src/net/tmwa/adminhandler.h index 9b14e005d..8af855473 100644 --- a/src/net/tmwa/adminhandler.h +++ b/src/net/tmwa/adminhandler.h @@ -102,6 +102,9 @@ class AdminHandler final : public Ea::AdminHandler void showInventoryList(const std::string &name) const override final A_CONST; + + void locatePlayer(const std::string &name) const override final + A_CONST; }; } // namespace TmwAthena -- cgit v1.2.3-60-g2f50