From 3eb2a28b8c79cad5071d9512054783f1a1cef602 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 23 Feb 2016 21:11:48 +0300 Subject: Add chat command /monsterinfo --- 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 | 9 +++++++++ src/net/eathena/adminhandler.h | 2 ++ src/net/tmwa/adminhandler.cpp | 4 ++++ src/net/tmwa/adminhandler.h | 2 ++ 10 files changed, 37 insertions(+) (limited to 'src') diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp index b9482ba32..8ec8ca78b 100644 --- a/src/actions/commands.cpp +++ b/src/actions/commands.cpp @@ -1218,4 +1218,13 @@ impHandler(ignorePickup) return false; } +impHandler(monsterInfo) +{ + const std::string args = event.args; + if (args.empty()) + return false; + adminHandler->monsterInfo(args); + return true; +} + } // namespace Actions diff --git a/src/actions/commands.h b/src/actions/commands.h index e49dcaddd..62b64b1b3 100644 --- a/src/actions/commands.h +++ b/src/actions/commands.h @@ -97,6 +97,7 @@ namespace Actions decHandler(addPickup); decHandler(removePickup); decHandler(ignorePickup); + decHandler(monsterInfo); } // namespace Actions #undef decHandler diff --git a/src/dyetool/actions/commands.cpp b/src/dyetool/actions/commands.cpp index a8fda78bd..2d4f71c13 100644 --- a/src/dyetool/actions/commands.cpp +++ b/src/dyetool/actions/commands.cpp @@ -97,5 +97,6 @@ impHandlerVoid(npcClipboard) impHandlerVoid(addPickup) impHandlerVoid(removePickup) impHandlerVoid(ignorePickup) +impHandlerVoid(monsterInfo) } // namespace Actions diff --git a/src/enums/input/inputaction.h b/src/enums/input/inputaction.h index c35439497..32b97864a 100644 --- a/src/enums/input/inputaction.h +++ b/src/enums/input/inputaction.h @@ -626,6 +626,7 @@ enumStart(InputAction) BAR_TO_CHAT, SEEN, TARGET_SKILL_UNIT, + MONSTER_INFO, TOTAL } enumEnd(InputAction); diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index a808a8208..65f28e6f9 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -5245,6 +5245,12 @@ static const InputActionData inputActionData "targetskillunit|targetskill", UseArgs_false, Protected_false}, + {"keyMonsterInfo", + defaultAction(&Actions::monsterInfo), + InputCondition::INGAME, + "monsterinfo|mobinfo|mi", + UseArgs_true, + Protected_true}, }; #undef defaultAction diff --git a/src/net/adminhandler.h b/src/net/adminhandler.h index 71796c01d..87b8bf486 100644 --- a/src/net/adminhandler.h +++ b/src/net/adminhandler.h @@ -96,6 +96,8 @@ class AdminHandler notfinal virtual void unequipAll(const Being *const being) const = 0; virtual void requestStats(const std::string &name) const = 0; + + virtual void monsterInfo(const std::string &name) const = 0; }; } // namespace Net diff --git a/src/net/eathena/adminhandler.cpp b/src/net/eathena/adminhandler.cpp index 1b49e4c45..878cd2156 100644 --- a/src/net/eathena/adminhandler.cpp +++ b/src/net/eathena/adminhandler.cpp @@ -24,6 +24,10 @@ #include "being/being.h" +#include "const/gui/chat.h" + +#include "net/chathandler.h" + #include "net/eathena/messageout.h" #include "net/eathena/protocolout.h" @@ -158,4 +162,9 @@ void AdminHandler::requestStats(const std::string &name) const outMsg.writeString(name, 24, "name"); } +void AdminHandler::monsterInfo(const std::string &name) const +{ + chatHandler->talk("@monsterinfo " + name, GENERAL_CHANNEL); +} + } // namespace EAthena diff --git a/src/net/eathena/adminhandler.h b/src/net/eathena/adminhandler.h index 19f26db7e..abbd292c9 100644 --- a/src/net/eathena/adminhandler.h +++ b/src/net/eathena/adminhandler.h @@ -71,6 +71,8 @@ class AdminHandler final : public Ea::AdminHandler void requestStats(const std::string &name) const override final; + void monsterInfo(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 743eeb534..ba984ff01 100644 --- a/src/net/tmwa/adminhandler.cpp +++ b/src/net/tmwa/adminhandler.cpp @@ -126,4 +126,8 @@ void AdminHandler::requestStats(const std::string &name A_UNUSED) const { } +void AdminHandler::monsterInfo(const std::string &name A_UNUSED) const +{ +} + } // namespace TmwAthena diff --git a/src/net/tmwa/adminhandler.h b/src/net/tmwa/adminhandler.h index 3a0f6fec5..32d535892 100644 --- a/src/net/tmwa/adminhandler.h +++ b/src/net/tmwa/adminhandler.h @@ -72,6 +72,8 @@ class AdminHandler final : public Ea::AdminHandler void requestStats(const std::string &name) const override final A_CONST; + + void monsterInfo(const std::string &name) const override final A_CONST; }; } // namespace TmwAthena -- cgit v1.2.3-70-g09d2