From fef6ebca9c454f99d44e950c4628270b124c445f Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 1 May 2015 16:16:37 +0300 Subject: eathena: add support for send chat command from server. Changed client net version to 8. --- src/net/eathena/playerhandler.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/net/eathena/playerhandler.cpp') diff --git a/src/net/eathena/playerhandler.cpp b/src/net/eathena/playerhandler.cpp index 2a087ee6a..b866dcb5c 100644 --- a/src/net/eathena/playerhandler.cpp +++ b/src/net/eathena/playerhandler.cpp @@ -28,10 +28,14 @@ #include "gui/windows/statuswindow.h" +#include "input/inputmanager.h" + #include "net/eathena/messageout.h" #include "net/eathena/protocol.h" #include "net/eathena/inventoryhandler.h" +#include "utils/stringutils.h" + #include "debug.h" extern Net::PlayerHandler *playerHandler; @@ -72,6 +76,7 @@ PlayerHandler::PlayerHandler() : SMSG_PLAYER_EQUIP_TICK_ACK, SMSG_AUTOSHADOW_SPELL_LIST, SMSG_PLAYER_RANK_POINTS, + SMSG_PLAYER_CLIENT_COMMAND, 0 }; handledMessages = _messages; @@ -191,6 +196,10 @@ void PlayerHandler::handleMessage(Net::MessageIn &msg) processPlayerRankPoints(msg); break; + case SMSG_PLAYER_CLIENT_COMMAND: + processPlayerClientCommand(msg); + break; + default: break; } @@ -637,4 +646,19 @@ void PlayerHandler::processPlayerRankPoints(Net::MessageIn &msg) msg.readInt32("fame"); } +void PlayerHandler::processPlayerClientCommand(Net::MessageIn &msg) +{ + const int sz = msg.readInt16("len") - 4; + std::string command = msg.readString(sz, "command"); + std::string cmd; + std::string args; + + if (!parse2Str(command, cmd, args)) + { + cmd = command; + args.clear(); + } + inputManager.executeChatCommand(cmd, args, nullptr); +} + } // namespace EAthena -- cgit v1.2.3-60-g2f50