summaryrefslogtreecommitdiff
path: root/src/net/eathena/playerhandler.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-05-01 16:16:37 +0300
committerAndrei Karas <akaras@inbox.ru>2015-05-01 16:16:37 +0300
commitfef6ebca9c454f99d44e950c4628270b124c445f (patch)
tree2955cd8be025c6460147909c9c97b0f9c213ecb4 /src/net/eathena/playerhandler.cpp
parente49cbd2dfc23b1ad0b8f568a7b0e8bc054546230 (diff)
downloadmanaplus-fef6ebca9c454f99d44e950c4628270b124c445f.tar.gz
manaplus-fef6ebca9c454f99d44e950c4628270b124c445f.tar.bz2
manaplus-fef6ebca9c454f99d44e950c4628270b124c445f.tar.xz
manaplus-fef6ebca9c454f99d44e950c4628270b124c445f.zip
eathena: add support for send chat command from server.
Changed client net version to 8.
Diffstat (limited to 'src/net/eathena/playerhandler.cpp')
-rw-r--r--src/net/eathena/playerhandler.cpp24
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