diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-02-24 17:09:20 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-02-24 17:09:20 +0300 |
commit | 66c5eb00b62cba0244446a8306dde1ae138d2e06 (patch) | |
tree | 41fefef24147487d9753e24ca5b4e340f14b554f | |
parent | f0906ab944c982da76a5c123100e567e1db680ac (diff) | |
download | manaplus-66c5eb00b62cba0244446a8306dde1ae138d2e06.tar.gz manaplus-66c5eb00b62cba0244446a8306dde1ae138d2e06.tar.bz2 manaplus-66c5eb00b62cba0244446a8306dde1ae138d2e06.tar.xz manaplus-66c5eb00b62cba0244446a8306dde1ae138d2e06.zip |
Add chat command /gmcommands. Also add show commands to player context menu.
-rw-r--r-- | src/actions/commands.cpp | 6 | ||||
-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 | 3 | ||||
-rw-r--r-- | src/input/inputactionmap.h | 6 | ||||
-rw-r--r-- | src/net/adminhandler.h | 2 | ||||
-rw-r--r-- | src/net/eathena/adminhandler.cpp | 10 | ||||
-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 | 3 |
11 files changed, 38 insertions, 1 deletions
diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp index f1ac3d962..8bccbc9cd 100644 --- a/src/actions/commands.cpp +++ b/src/actions/commands.cpp @@ -1263,4 +1263,10 @@ impHandler(mobSpawnSearch) return true; } +impHandler(playerGmCommands) +{ + adminHandler->playerGmCommands(event.args); + return true; +} + } // namespace Actions diff --git a/src/actions/commands.h b/src/actions/commands.h index 1df1effd2..ffcdde479 100644 --- a/src/actions/commands.h +++ b/src/actions/commands.h @@ -102,6 +102,7 @@ namespace Actions decHandler(whoDrops); decHandler(mobSearch); decHandler(mobSpawnSearch); + decHandler(playerGmCommands); } // namespace Actions #undef decHandler diff --git a/src/dyetool/actions/commands.cpp b/src/dyetool/actions/commands.cpp index 2a7c81ec0..afdf1c8a3 100644 --- a/src/dyetool/actions/commands.cpp +++ b/src/dyetool/actions/commands.cpp @@ -102,5 +102,6 @@ impHandlerVoid(itemInfo) impHandlerVoid(whoDrops) impHandlerVoid(mobSearch) impHandlerVoid(mobSpawnSearch) +impHandlerVoid(playerGmCommands) } // namespace Actions diff --git a/src/enums/input/inputaction.h b/src/enums/input/inputaction.h index f74a7ddb3..d8a689063 100644 --- a/src/enums/input/inputaction.h +++ b/src/enums/input/inputaction.h @@ -631,6 +631,7 @@ enumStart(InputAction) WHO_DROPS, MOB_SEARCH, MOB_SPAWN_SEARCH, + PLAYER_GM_COMMANDS, TOTAL } enumEnd(InputAction); diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index 69ecf11c8..a5747de37 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -2664,6 +2664,9 @@ void PopupMenu::showPlayerGMCommands() // TRANSLATORS: check player ip mBrowserBox->addRow("ipcheck", _("Check ip")); // TRANSLATORS: popup menu item + // TRANSLATORS: revive player + mBrowserBox->addRow("/gmcommands 'NAME'", _("Show commands")); + // TRANSLATORS: popup menu item // TRANSLATORS: go to player position mBrowserBox->addRow("goto", _("Goto")); // TRANSLATORS: popup menu item diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index 26ed69906..15816dcd9 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -5275,6 +5275,12 @@ static const InputActionData inputActionData "mobspawnsearch|monsterspawnsearch|whereis", UseArgs_true, Protected_true}, + {"keyPlayerGmCommands", + defaultAction(&Actions::playerGmCommands), + InputCondition::INGAME, + "gmcommands|playergmcommands|playercommands", + UseArgs_true, + Protected_true}, }; #undef defaultAction diff --git a/src/net/adminhandler.h b/src/net/adminhandler.h index 38e909cdb..b839096a8 100644 --- a/src/net/adminhandler.h +++ b/src/net/adminhandler.h @@ -106,6 +106,8 @@ class AdminHandler notfinal virtual void mobSearch(const std::string &name) const = 0; virtual void mobSpawnSearch(const std::string &name) const = 0; + + virtual void playerGmCommands(const std::string &name) const = 0; }; } // namespace Net diff --git a/src/net/eathena/adminhandler.cpp b/src/net/eathena/adminhandler.cpp index 630062167..e15c1dd19 100644 --- a/src/net/eathena/adminhandler.cpp +++ b/src/net/eathena/adminhandler.cpp @@ -22,7 +22,7 @@ #include "net/eathena/adminhandler.h" -#include "being/being.h" +#include "being/localplayer.h" #include "const/gui/chat.h" @@ -187,4 +187,12 @@ void AdminHandler::mobSpawnSearch(const std::string &name) const chatHandler->talk("@whereis " + name, GENERAL_CHANNEL); } +void AdminHandler::playerGmCommands(const std::string &name) const +{ + if (name.empty() || (localPlayer && name == localPlayer->getName())) + chatHandler->talk("@commands", GENERAL_CHANNEL); + else + chatHandler->talk("#commands " + name, GENERAL_CHANNEL); +} + } // namespace EAthena diff --git a/src/net/eathena/adminhandler.h b/src/net/eathena/adminhandler.h index de65a3f48..5f18c5d63 100644 --- a/src/net/eathena/adminhandler.h +++ b/src/net/eathena/adminhandler.h @@ -81,6 +81,8 @@ class AdminHandler final : public Ea::AdminHandler void mobSpawnSearch(const std::string &name) const override final; + void playerGmCommands(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 1c745c81f..6050d2375 100644 --- a/src/net/tmwa/adminhandler.cpp +++ b/src/net/tmwa/adminhandler.cpp @@ -146,4 +146,8 @@ void AdminHandler::mobSpawnSearch(const std::string &name A_UNUSED) const { } +void AdminHandler::playerGmCommands(const std::string &name A_UNUSED) const +{ +} + } // namespace TmwAthena diff --git a/src/net/tmwa/adminhandler.h b/src/net/tmwa/adminhandler.h index 57b682703..fab21a9ed 100644 --- a/src/net/tmwa/adminhandler.h +++ b/src/net/tmwa/adminhandler.h @@ -83,6 +83,9 @@ class AdminHandler final : public Ea::AdminHandler void mobSpawnSearch(const std::string &name) const override final A_CONST; + + void playerGmCommands(const std::string &name) const override final + A_CONST; }; } // namespace TmwAthena |