diff options
Diffstat (limited to 'src/net/eathena/playerhandler.cpp')
-rw-r--r-- | src/net/eathena/playerhandler.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
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 |