summaryrefslogtreecommitdiff
path: root/src
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
parente49cbd2dfc23b1ad0b8f568a7b0e8bc054546230 (diff)
downloadmanaverse-fef6ebca9c454f99d44e950c4628270b124c445f.tar.gz
manaverse-fef6ebca9c454f99d44e950c4628270b124c445f.tar.bz2
manaverse-fef6ebca9c454f99d44e950c4628270b124c445f.tar.xz
manaverse-fef6ebca9c454f99d44e950c4628270b124c445f.zip
eathena: add support for send chat command from server.
Changed client net version to 8.
Diffstat (limited to 'src')
-rw-r--r--src/net/eathena/network.h2
-rw-r--r--src/net/eathena/packets.h2
-rw-r--r--src/net/eathena/playerhandler.cpp24
-rw-r--r--src/net/eathena/playerhandler.h2
-rw-r--r--src/net/eathena/protocol.h2
5 files changed, 30 insertions, 2 deletions
diff --git a/src/net/eathena/network.h b/src/net/eathena/network.h
index 05d5f0cb4..89bd5f816 100644
--- a/src/net/eathena/network.h
+++ b/src/net/eathena/network.h
@@ -29,7 +29,7 @@
* Protocol version, reported to the eAthena char and mapserver who can adjust
* the protocol accordingly.
*/
-#define CLIENT_PROTOCOL_VERSION 7
+#define CLIENT_PROTOCOL_VERSION 8
namespace EAthena
{
diff --git a/src/net/eathena/packets.h b/src/net/eathena/packets.h
index 30e3d86f7..51639545d 100644
--- a/src/net/eathena/packets.h
+++ b/src/net/eathena/packets.h
@@ -282,7 +282,7 @@ int16_t packet_lengths[] =
//0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
// #0x0B00
16, -1, 10, -1, -1, -1, -1, 0, 27, 0, -1, -1, 0, 0, 0, 0,
- -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ -1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
// #0x0B40
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
diff --git a/src/net/eathena/playerhandler.h b/src/net/eathena/playerhandler.h
index 22a2cd56e..bc2dab173 100644
--- a/src/net/eathena/playerhandler.h
+++ b/src/net/eathena/playerhandler.h
@@ -109,6 +109,8 @@ class PlayerHandler final : public MessageHandler, public Ea::PlayerHandler
static void processPlayerAutoShadowSpellList(Net::MessageIn &msg);
static void processPlayerRankPoints(Net::MessageIn &msg);
+
+ static void processPlayerClientCommand(Net::MessageIn &msg);
};
} // namespace EAthena
diff --git a/src/net/eathena/protocol.h b/src/net/eathena/protocol.h
index 156597505..4c8e67b5b 100644
--- a/src/net/eathena/protocol.h
+++ b/src/net/eathena/protocol.h
@@ -437,6 +437,8 @@
#define SMSG_MAP_MUSIC 0x0b05
+#define SMSG_PLAYER_CLIENT_COMMAND 0x0b16
+
#define SMSG_CART_INFO 0x0121
#define SMSG_CART_REMOVE 0x012b