From f0906ab944c982da76a5c123100e567e1db680ac Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 24 Feb 2016 16:27:39 +0300 Subject: Add chat command /mobspawnsearch. Add it to monster gm 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 | 5 ++++- 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, 38 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp index 2adef54ca..f1ac3d962 100644 --- a/src/actions/commands.cpp +++ b/src/actions/commands.cpp @@ -1254,4 +1254,13 @@ impHandler(mobSearch) return true; } +impHandler(mobSpawnSearch) +{ + const std::string args = event.args; + if (args.empty()) + return false; + adminHandler->mobSpawnSearch(args); + return true; +} + } // namespace Actions diff --git a/src/actions/commands.h b/src/actions/commands.h index 07b5dda2e..1df1effd2 100644 --- a/src/actions/commands.h +++ b/src/actions/commands.h @@ -101,6 +101,7 @@ namespace Actions decHandler(itemInfo); decHandler(whoDrops); decHandler(mobSearch); + decHandler(mobSpawnSearch); } // namespace Actions #undef decHandler diff --git a/src/dyetool/actions/commands.cpp b/src/dyetool/actions/commands.cpp index 18278f6a1..2a7c81ec0 100644 --- a/src/dyetool/actions/commands.cpp +++ b/src/dyetool/actions/commands.cpp @@ -101,5 +101,6 @@ impHandlerVoid(monsterInfo) impHandlerVoid(itemInfo) impHandlerVoid(whoDrops) impHandlerVoid(mobSearch) +impHandlerVoid(mobSpawnSearch) } // namespace Actions diff --git a/src/enums/input/inputaction.h b/src/enums/input/inputaction.h index 019df826a..f74a7ddb3 100644 --- a/src/enums/input/inputaction.h +++ b/src/enums/input/inputaction.h @@ -630,6 +630,7 @@ enumStart(InputAction) ITEM_INFO, WHO_DROPS, MOB_SEARCH, + MOB_SPAWN_SEARCH, TOTAL } enumEnd(InputAction); diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index 3d527e405..69ecf11c8 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -2747,10 +2747,13 @@ void PopupMenu::showMonsterGMCommands() // TRANSLATORS: popup menu item // TRANSLATORS: show monster information mBrowserBox->addRow("/monsterinfo 'BEINGSUBTYPEID'", _("Info")); - // TRANSLATORS: popup menu item // TRANSLATORS: show selected monster in current map mBrowserBox->addRow("/mobsearch 'BEINGSUBTYPEID'", _("Search")); + mBrowserBox->addRow("/mobspawnsearch 'BEINGSUBTYPEID'", + // TRANSLATORS: popup menu item + // TRANSLATORS: show selected monster spawns in all maps + _("Search spawns")); } } diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index e7322d456..26ed69906 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -5269,6 +5269,12 @@ static const InputActionData inputActionData "mobsearch|monstersearch", UseArgs_true, Protected_true}, + {"keyMobSpawnSearch", + defaultAction(&Actions::mobSpawnSearch), + InputCondition::INGAME, + "mobspawnsearch|monsterspawnsearch|whereis", + UseArgs_true, + Protected_true}, }; #undef defaultAction diff --git a/src/net/adminhandler.h b/src/net/adminhandler.h index caa5098b9..38e909cdb 100644 --- a/src/net/adminhandler.h +++ b/src/net/adminhandler.h @@ -104,6 +104,8 @@ class AdminHandler notfinal virtual void whoDrops(const std::string &name) const = 0; virtual void mobSearch(const std::string &name) const = 0; + + virtual void mobSpawnSearch(const std::string &name) const = 0; }; } // namespace Net diff --git a/src/net/eathena/adminhandler.cpp b/src/net/eathena/adminhandler.cpp index d13c29a31..630062167 100644 --- a/src/net/eathena/adminhandler.cpp +++ b/src/net/eathena/adminhandler.cpp @@ -182,4 +182,9 @@ void AdminHandler::mobSearch(const std::string &name) const chatHandler->talk("@mobsearch " + name, GENERAL_CHANNEL); } +void AdminHandler::mobSpawnSearch(const std::string &name) const +{ + chatHandler->talk("@whereis " + name, GENERAL_CHANNEL); +} + } // namespace EAthena diff --git a/src/net/eathena/adminhandler.h b/src/net/eathena/adminhandler.h index 79ce6cf23..de65a3f48 100644 --- a/src/net/eathena/adminhandler.h +++ b/src/net/eathena/adminhandler.h @@ -79,6 +79,8 @@ class AdminHandler final : public Ea::AdminHandler void mobSearch(const std::string &name) const override final; + void mobSpawnSearch(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 e26806c8d..1c745c81f 100644 --- a/src/net/tmwa/adminhandler.cpp +++ b/src/net/tmwa/adminhandler.cpp @@ -142,4 +142,8 @@ void AdminHandler::mobSearch(const std::string &name A_UNUSED) const { } +void AdminHandler::mobSpawnSearch(const std::string &name A_UNUSED) const +{ +} + } // namespace TmwAthena diff --git a/src/net/tmwa/adminhandler.h b/src/net/tmwa/adminhandler.h index 94ec3b7be..57b682703 100644 --- a/src/net/tmwa/adminhandler.h +++ b/src/net/tmwa/adminhandler.h @@ -80,6 +80,9 @@ class AdminHandler final : public Ea::AdminHandler void whoDrops(const std::string &name) const override final A_CONST; void mobSearch(const std::string &name) const override final A_CONST; + + void mobSpawnSearch(const std::string &name) const override final + A_CONST; }; } // namespace TmwAthena -- cgit v1.2.3-70-g09d2