diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-02-28 23:24:54 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-02-28 23:24:54 +0300 |
commit | a7f88de7bbea019bf443da0aa31b03d2273739df (patch) | |
tree | fd42726656766b6fb6b6b256105be7633e3a7372 | |
parent | a240a48c1e2c3abb240f5957d949a7b6b1753ca5 (diff) | |
download | plus-a7f88de7bbea019bf443da0aa31b03d2273739df.tar.gz plus-a7f88de7bbea019bf443da0aa31b03d2273739df.tar.bz2 plus-a7f88de7bbea019bf443da0aa31b03d2273739df.tar.xz plus-a7f88de7bbea019bf443da0aa31b03d2273739df.zip |
Add chat command /hidenpc. Also add it to npc 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 | 11 | ||||
-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, 40 insertions, 4 deletions
diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp index ec377be79..52855d06e 100644 --- a/src/actions/commands.cpp +++ b/src/actions/commands.cpp @@ -1491,4 +1491,13 @@ impHandler(commandNpcMove) return true; } +impHandler(commandNpcHide) +{ + const std::string args = event.args; + if (args.empty()) + return false; + adminHandler->hideNpc(args); + return true; +} + } // namespace Actions diff --git a/src/actions/commands.h b/src/actions/commands.h index f05921487..735338270 100644 --- a/src/actions/commands.h +++ b/src/actions/commands.h @@ -132,6 +132,7 @@ namespace Actions decHandler(commandJail); decHandler(commandUnjail); decHandler(commandNpcMove); + decHandler(commandNpcHide); } // namespace Actions #undef decHandler diff --git a/src/dyetool/actions/commands.cpp b/src/dyetool/actions/commands.cpp index 4d8906489..d458e21ab 100644 --- a/src/dyetool/actions/commands.cpp +++ b/src/dyetool/actions/commands.cpp @@ -132,5 +132,6 @@ impHandlerVoid(commandKill) impHandlerVoid(commandJail) impHandlerVoid(commandUnjail) impHandlerVoid(commandNpcMove) +impHandlerVoid(commandNpcHide) } // namespace Actions diff --git a/src/enums/input/inputaction.h b/src/enums/input/inputaction.h index c59ae7ca1..6e8f41368 100644 --- a/src/enums/input/inputaction.h +++ b/src/enums/input/inputaction.h @@ -661,6 +661,7 @@ enumStart(InputAction) COMMAND_JAIL, COMMAND_UNJAIL, COMMAND_NPC_MOVE, + COMMAND_NPC_HIDE, TOTAL } enumEnd(InputAction); diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index f3b87cbf9..76e684766 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -2907,17 +2907,20 @@ void PopupMenu::showNpcGMCommands() const bool legacy = Net::getNetworkType() == ServerType::TMWATHENA; if (!legacy) { + // TRANSLATORS: popup menu item + // TRANSLATORS: hide npc + mBrowserBox->addRow("/hidenpc 'EXTNAME'", _("Hide")); + mBrowserBox->addRow("##3---"); mBrowserBox->addRow("/npcmove 'EEXTNAME' 'PLAYERX' 'PLAYERY'", // TRANSLATORS: popup menu item // TRANSLATORS: warp npc to player location _("Recall")); - mBrowserBox->addRow("##3---"); - // TRANSLATORS: popup menu item - // TRANSLATORS: warp to npc - mBrowserBox->addRow("/gotonpc 'EXTNAME'", _("Goto")); // TRANSLATORS: popup menu item // TRANSLATORS: disguise to npc mBrowserBox->addRow("/disguise 'BEINGSUBTYPEID'", _("Disguise")); + // TRANSLATORS: popup menu item + // TRANSLATORS: warp to npc + mBrowserBox->addRow("/gotonpc 'EXTNAME'", _("Goto")); } } } diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index 40b2c0c4c..d93ccf960 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -5455,6 +5455,12 @@ static const InputActionData inputActionData "npcmove|movenpc|warpnpc|npcwarp", UseArgs_true, Protected_true}, + {"keyCommandNpcHide", + defaultAction(&Actions::commandNpcHide), + InputCondition::INGAME, + "npchide|hidenpc", + UseArgs_true, + Protected_true}, }; #undef defaultAction diff --git a/src/net/adminhandler.h b/src/net/adminhandler.h index 8674a341d..8f74a4693 100644 --- a/src/net/adminhandler.h +++ b/src/net/adminhandler.h @@ -166,6 +166,8 @@ class AdminHandler notfinal virtual void npcMove(const std::string &name, const int x, const int y) const = 0; + + virtual void hideNpc(const std::string &name) const = 0; }; } // namespace Net diff --git a/src/net/eathena/adminhandler.cpp b/src/net/eathena/adminhandler.cpp index cc1465ee0..d80cf3171 100644 --- a/src/net/eathena/adminhandler.cpp +++ b/src/net/eathena/adminhandler.cpp @@ -337,4 +337,9 @@ void AdminHandler::npcMove(const std::string &name, name.c_str())); } +void AdminHandler::hideNpc(const std::string &name) const +{ + Gm::runCommand("hidenpc", name); +} + } // namespace EAthena diff --git a/src/net/eathena/adminhandler.h b/src/net/eathena/adminhandler.h index 60103ea24..36b40e12e 100644 --- a/src/net/eathena/adminhandler.h +++ b/src/net/eathena/adminhandler.h @@ -142,6 +142,8 @@ class AdminHandler final : public Ea::AdminHandler const int x, const int y) const override final; + void hideNpc(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 2dd1464c5..af89a91f8 100644 --- a/src/net/tmwa/adminhandler.cpp +++ b/src/net/tmwa/adminhandler.cpp @@ -263,4 +263,8 @@ void AdminHandler::npcMove(const std::string &name A_UNUSED, { } +void AdminHandler::hideNpc(const std::string &name A_UNUSED) const +{ +} + } // namespace TmwAthena diff --git a/src/net/tmwa/adminhandler.h b/src/net/tmwa/adminhandler.h index 3bed8949c..5a0233ab5 100644 --- a/src/net/tmwa/adminhandler.h +++ b/src/net/tmwa/adminhandler.h @@ -154,6 +154,8 @@ class AdminHandler final : public Ea::AdminHandler void npcMove(const std::string &name, const int x, const int y) const override final A_CONST; + + void hideNpc(const std::string &name) const override final A_CONST; }; } // namespace TmwAthena |