From f8423bd2d31ac4da409cabdc84fa2e3962336103 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 25 Feb 2016 21:54:31 +0300 Subject: Add chat command /disguise. 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 | 6 ++++++ 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 | 3 +++ src/net/tmwa/adminhandler.h | 2 ++ 11 files changed, 38 insertions(+) (limited to 'src') diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp index 3f12c0ed2..8cc076fba 100644 --- a/src/actions/commands.cpp +++ b/src/actions/commands.cpp @@ -1420,4 +1420,13 @@ impHandler(commandAlive) return true; } +impHandler(commandDisguise) +{ + const std::string args = event.args; + if (args.empty()) + return false; + adminHandler->disguise(args); + return true; +} + } // namespace Actions diff --git a/src/actions/commands.h b/src/actions/commands.h index af8a9d64d..fa21e942c 100644 --- a/src/actions/commands.h +++ b/src/actions/commands.h @@ -124,6 +124,7 @@ namespace Actions decHandler(commandKillable); decHandler(commandHeal); decHandler(commandAlive); + decHandler(commandDisguise); } // namespace Actions #undef decHandler diff --git a/src/dyetool/actions/commands.cpp b/src/dyetool/actions/commands.cpp index 9908193f4..9069ee00a 100644 --- a/src/dyetool/actions/commands.cpp +++ b/src/dyetool/actions/commands.cpp @@ -124,5 +124,6 @@ impHandlerVoid(commandKiller) impHandlerVoid(commandKillable) impHandlerVoid(commandHeal) impHandlerVoid(commandAlive) +impHandlerVoid(commandDisguise) } // namespace Actions diff --git a/src/enums/input/inputaction.h b/src/enums/input/inputaction.h index 8deb60cfc..15ae2db45 100644 --- a/src/enums/input/inputaction.h +++ b/src/enums/input/inputaction.h @@ -653,6 +653,7 @@ enumStart(InputAction) COMMAND_KILLABLE, COMMAND_HEAL, COMMAND_ALIVE, + COMMAND_DISGUISE, TOTAL } enumEnd(InputAction); diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index d442c0d99..e287313d7 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -2854,6 +2854,9 @@ void PopupMenu::showNpcGMCommands() // TRANSLATORS: popup menu item // TRANSLATORS: warp to npc mBrowserBox->addRow("/gotonpc 'NAME'", _("Goto")); + // TRANSLATORS: popup menu item + // TRANSLATORS: disguise to npc + mBrowserBox->addRow("/disguise 'BEINGSUBTYPEID'", _("Disguise")); } } } @@ -2875,6 +2878,9 @@ void PopupMenu::showMonsterGMCommands() // TRANSLATORS: popup menu item // TRANSLATORS: spawn slave monster _("Spawn slave")); + // TRANSLATORS: popup menu item + // TRANSLATORS: disguise to monster + mBrowserBox->addRow("/disguise 'BEINGSUBTYPEID'", _("Disguise")); mBrowserBox->addRow("##3---"); // TRANSLATORS: popup menu item // TRANSLATORS: show monster information diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index 8f839e716..cf2e882fc 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -5407,6 +5407,12 @@ static const InputActionData inputActionData "alive|revive", UseArgs_true, Protected_true}, + {"keyCommandDisguise", + defaultAction(&Actions::commandDisguise), + InputCondition::INGAME, + "disguise", + UseArgs_true, + Protected_true}, }; #undef defaultAction diff --git a/src/net/adminhandler.h b/src/net/adminhandler.h index 04ec9bb6f..72b5157da 100644 --- a/src/net/adminhandler.h +++ b/src/net/adminhandler.h @@ -148,6 +148,8 @@ class AdminHandler notfinal virtual void killable(const std::string &name) const = 0; virtual void heal(const std::string &name) const = 0; + + virtual void disguise(const std::string &name) const = 0; }; } // namespace Net diff --git a/src/net/eathena/adminhandler.cpp b/src/net/eathena/adminhandler.cpp index 1965cee9d..bf97226b3 100644 --- a/src/net/eathena/adminhandler.cpp +++ b/src/net/eathena/adminhandler.cpp @@ -290,4 +290,9 @@ void AdminHandler::alive(const std::string &name) const Gm::runCharCommand("alive", name); } +void AdminHandler::disguise(const std::string &name) const +{ + Gm::runCommand("disguise", name); +} + } // namespace EAthena diff --git a/src/net/eathena/adminhandler.h b/src/net/eathena/adminhandler.h index dcb7fd7b8..d495f2aad 100644 --- a/src/net/eathena/adminhandler.h +++ b/src/net/eathena/adminhandler.h @@ -124,6 +124,8 @@ class AdminHandler final : public Ea::AdminHandler void alive(const std::string &name) const override final; + void disguise(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 6fcc1bd6e..8d1276f6e 100644 --- a/src/net/tmwa/adminhandler.cpp +++ b/src/net/tmwa/adminhandler.cpp @@ -228,5 +228,8 @@ void AdminHandler::alive(const std::string &name) const Gm::runCommand("revive", name); } +void AdminHandler::disguise(const std::string &name A_UNUSED) const +{ +} } // namespace TmwAthena diff --git a/src/net/tmwa/adminhandler.h b/src/net/tmwa/adminhandler.h index 99a141517..0a5e034f7 100644 --- a/src/net/tmwa/adminhandler.h +++ b/src/net/tmwa/adminhandler.h @@ -136,6 +136,8 @@ class AdminHandler final : public Ea::AdminHandler void heal(const std::string &name) const override final A_CONST; void alive(const std::string &name) const override final; + + void disguise(const std::string &name) const override final; }; } // namespace TmwAthena -- cgit v1.2.3-60-g2f50