From 54cdcc6cded841b2c5823a74f58e4f3b06f81622 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 28 Feb 2016 23:34:08 +0300 Subject: Add chat command /shownpc. --- src/actions/commands.cpp | 9 +++++++++ src/actions/commands.h | 1 + src/dyetool/actions/commands.cpp | 1 + src/enums/input/inputaction.h | 1 + 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 | 2 ++ 10 files changed, 33 insertions(+) diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp index 52855d06e..90ef67f04 100644 --- a/src/actions/commands.cpp +++ b/src/actions/commands.cpp @@ -1500,4 +1500,13 @@ impHandler(commandNpcHide) return true; } +impHandler(commandNpcShow) +{ + const std::string args = event.args; + if (args.empty()) + return false; + adminHandler->showNpc(args); + return true; +} + } // namespace Actions diff --git a/src/actions/commands.h b/src/actions/commands.h index 735338270..35c03ce62 100644 --- a/src/actions/commands.h +++ b/src/actions/commands.h @@ -133,6 +133,7 @@ namespace Actions decHandler(commandUnjail); decHandler(commandNpcMove); decHandler(commandNpcHide); + decHandler(commandNpcShow); } // namespace Actions #undef decHandler diff --git a/src/dyetool/actions/commands.cpp b/src/dyetool/actions/commands.cpp index d458e21ab..4d44cb655 100644 --- a/src/dyetool/actions/commands.cpp +++ b/src/dyetool/actions/commands.cpp @@ -133,5 +133,6 @@ impHandlerVoid(commandJail) impHandlerVoid(commandUnjail) impHandlerVoid(commandNpcMove) impHandlerVoid(commandNpcHide) +impHandlerVoid(commandNpcShow) } // namespace Actions diff --git a/src/enums/input/inputaction.h b/src/enums/input/inputaction.h index 6e8f41368..7a1fe53d7 100644 --- a/src/enums/input/inputaction.h +++ b/src/enums/input/inputaction.h @@ -662,6 +662,7 @@ enumStart(InputAction) COMMAND_UNJAIL, COMMAND_NPC_MOVE, COMMAND_NPC_HIDE, + COMMAND_NPC_SHOW, TOTAL } enumEnd(InputAction); diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index d93ccf960..ecc9a40ad 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -5461,6 +5461,12 @@ static const InputActionData inputActionData "npchide|hidenpc", UseArgs_true, Protected_true}, + {"keyCommandNpcShow", + defaultAction(&Actions::commandNpcShow), + InputCondition::INGAME, + "npcshow|shownpc", + UseArgs_true, + Protected_true}, }; #undef defaultAction diff --git a/src/net/adminhandler.h b/src/net/adminhandler.h index 8f74a4693..f6fb0c562 100644 --- a/src/net/adminhandler.h +++ b/src/net/adminhandler.h @@ -168,6 +168,8 @@ class AdminHandler notfinal const int y) const = 0; virtual void hideNpc(const std::string &name) const = 0; + + virtual void showNpc(const std::string &name) const = 0; }; } // namespace Net diff --git a/src/net/eathena/adminhandler.cpp b/src/net/eathena/adminhandler.cpp index d80cf3171..dbe0e7731 100644 --- a/src/net/eathena/adminhandler.cpp +++ b/src/net/eathena/adminhandler.cpp @@ -342,4 +342,9 @@ void AdminHandler::hideNpc(const std::string &name) const Gm::runCommand("hidenpc", name); } +void AdminHandler::showNpc(const std::string &name) const +{ + Gm::runCommand("shownpc", name); +} + } // namespace EAthena diff --git a/src/net/eathena/adminhandler.h b/src/net/eathena/adminhandler.h index 36b40e12e..b19cc39ee 100644 --- a/src/net/eathena/adminhandler.h +++ b/src/net/eathena/adminhandler.h @@ -144,6 +144,8 @@ class AdminHandler final : public Ea::AdminHandler void hideNpc(const std::string &name) const override final; + void showNpc(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 af89a91f8..847339164 100644 --- a/src/net/tmwa/adminhandler.cpp +++ b/src/net/tmwa/adminhandler.cpp @@ -267,4 +267,8 @@ void AdminHandler::hideNpc(const std::string &name A_UNUSED) const { } +void AdminHandler::showNpc(const std::string &name A_UNUSED) const +{ +} + } // namespace TmwAthena diff --git a/src/net/tmwa/adminhandler.h b/src/net/tmwa/adminhandler.h index 5a0233ab5..c3aa20ed1 100644 --- a/src/net/tmwa/adminhandler.h +++ b/src/net/tmwa/adminhandler.h @@ -156,6 +156,8 @@ class AdminHandler final : public Ea::AdminHandler const int y) const override final A_CONST; void hideNpc(const std::string &name) const override final A_CONST; + + void showNpc(const std::string &name) const override final A_CONST; }; } // namespace TmwAthena -- cgit v1.2.3-70-g09d2