diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-02-24 18:02:24 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-02-24 18:02:24 +0300 |
commit | 227788d991459081a894428d4455ead1dd8b46d6 (patch) | |
tree | 8ddff2efce648fd89a3a51846650670d23ccc041 | |
parent | 52f9607980c82f53bbc76a5bb5825cbff61dc3b5 (diff) | |
download | mv-227788d991459081a894428d4455ead1dd8b46d6.tar.gz mv-227788d991459081a894428d4455ead1dd8b46d6.tar.bz2 mv-227788d991459081a894428d4455ead1dd8b46d6.tar.xz mv-227788d991459081a894428d4455ead1dd8b46d6.zip |
Add chat command /showstats. Also add show level stats 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 | 8 | ||||
-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, 36 insertions, 0 deletions
diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp index 0a5d098b1..a6be02b6a 100644 --- a/src/actions/commands.cpp +++ b/src/actions/commands.cpp @@ -1281,4 +1281,10 @@ impHandler(commandShowLevel) return true; } +impHandler(commandShowStats) +{ + adminHandler->showStats(event.args); + return true; +} + } // namespace Actions diff --git a/src/actions/commands.h b/src/actions/commands.h index 5740f2eb5..ad03274b8 100644 --- a/src/actions/commands.h +++ b/src/actions/commands.h @@ -105,6 +105,7 @@ namespace Actions decHandler(playerGmCommands); decHandler(playerCharGmCommands); decHandler(commandShowLevel); + decHandler(commandShowStats); } // namespace Actions #undef decHandler diff --git a/src/dyetool/actions/commands.cpp b/src/dyetool/actions/commands.cpp index 94c1a8fc2..08de4dd5f 100644 --- a/src/dyetool/actions/commands.cpp +++ b/src/dyetool/actions/commands.cpp @@ -105,5 +105,6 @@ impHandlerVoid(mobSpawnSearch) impHandlerVoid(playerGmCommands) impHandlerVoid(playerCharGmCommands) impHandlerVoid(commandShowLevel) +impHandlerVoid(commandShowStats) } // namespace Actions diff --git a/src/enums/input/inputaction.h b/src/enums/input/inputaction.h index 12906d076..a29e50eb8 100644 --- a/src/enums/input/inputaction.h +++ b/src/enums/input/inputaction.h @@ -634,6 +634,7 @@ enumStart(InputAction) PLAYER_GM_COMMANDS, PLAYER_CHAR_GM_COMMANDS, COMMAND_SHOW_LEVEL, + COMMAND_SHOW_STATS, TOTAL } enumEnd(InputAction); diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index eeadcd604..82c7264b5 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -2667,6 +2667,9 @@ void PopupMenu::showPlayerGMCommands() // TRANSLATORS: show player level mBrowserBox->addRow("/showlevel 'NAME'", _("Show level")); // TRANSLATORS: popup menu item + // TRANSLATORS: show player stats + mBrowserBox->addRow("/showstats 'NAME'", _("Show stats")); + // TRANSLATORS: popup menu item // TRANSLATORS: gm commands mBrowserBox->addRow("/gmcommands 'NAME'", _("Show commands")); // TRANSLATORS: popup menu item diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index 8e834168d..1e8e04dc0 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -5293,6 +5293,12 @@ static const InputActionData inputActionData "showlevel|exp", UseArgs_true, Protected_true}, + {"keyCommandShowStats", + defaultAction(&Actions::commandShowStats), + InputCondition::INGAME, + "showstats|stats", + UseArgs_true, + Protected_true}, }; #undef defaultAction diff --git a/src/net/adminhandler.h b/src/net/adminhandler.h index 55568fe6d..6aa537d52 100644 --- a/src/net/adminhandler.h +++ b/src/net/adminhandler.h @@ -112,6 +112,8 @@ class AdminHandler notfinal virtual void playerCharGmCommands(const std::string &name) const = 0; virtual void showLevel(const std::string &name) const = 0; + + virtual void showStats(const std::string &name) const = 0; }; } // namespace Net diff --git a/src/net/eathena/adminhandler.cpp b/src/net/eathena/adminhandler.cpp index b2a898cca..2be8fd59d 100644 --- a/src/net/eathena/adminhandler.cpp +++ b/src/net/eathena/adminhandler.cpp @@ -211,4 +211,12 @@ void AdminHandler::showLevel(const std::string &name) const chatHandler->talk("#exp " + name, GENERAL_CHANNEL); } +void AdminHandler::showStats(const std::string &name) const +{ + if (name.empty() || (localPlayer && name == localPlayer->getName())) + chatHandler->talk("@stats", GENERAL_CHANNEL); + else + chatHandler->talk("#stats " + name, GENERAL_CHANNEL); +} + } // namespace EAthena diff --git a/src/net/eathena/adminhandler.h b/src/net/eathena/adminhandler.h index 832aaab16..679cca874 100644 --- a/src/net/eathena/adminhandler.h +++ b/src/net/eathena/adminhandler.h @@ -88,6 +88,8 @@ class AdminHandler final : public Ea::AdminHandler void showLevel(const std::string &name) const override final; + void showStats(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 7b5f9d9b9..d47d9681f 100644 --- a/src/net/tmwa/adminhandler.cpp +++ b/src/net/tmwa/adminhandler.cpp @@ -158,4 +158,8 @@ void AdminHandler::showLevel(const std::string &name A_UNUSED) const { } +void AdminHandler::showStats(const std::string &name A_UNUSED) const +{ +} + } // namespace TmwAthena diff --git a/src/net/tmwa/adminhandler.h b/src/net/tmwa/adminhandler.h index 58ad0fb22..6ef65177f 100644 --- a/src/net/tmwa/adminhandler.h +++ b/src/net/tmwa/adminhandler.h @@ -91,6 +91,8 @@ class AdminHandler final : public Ea::AdminHandler A_CONST; void showLevel(const std::string &name) const override final A_CONST; + + void showStats(const std::string &name) const override final A_CONST; }; } // namespace TmwAthena |