From d72a885e0b2c8a2b50a846b5c083fd158078f9c5 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 23 Aug 2015 15:35:00 +0300 Subject: Change protocol version to 5. Add packet SMSG_SCRIPT_MESSAGE (tmwa). --- src/net/tmwa/chathandler.cpp | 13 +++++++++++++ src/net/tmwa/chathandler.h | 2 ++ src/net/tmwa/network.h | 2 +- src/net/tmwa/packets.h | 2 +- src/net/tmwa/protocol.h | 1 + 5 files changed, 18 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/net/tmwa/chathandler.cpp b/src/net/tmwa/chathandler.cpp index a11c6149f..78d0f86ab 100644 --- a/src/net/tmwa/chathandler.cpp +++ b/src/net/tmwa/chathandler.cpp @@ -62,6 +62,7 @@ ChatHandler::ChatHandler() : SMSG_GM_CHAT, SMSG_MVP_EFFECT, SMSG_IGNORE_ALL_RESPONSE, + SMSG_SCRIPT_MESSAGE, 0 }; handledMessages = _messages; @@ -103,6 +104,10 @@ void ChatHandler::handleMessage(Net::MessageIn &msg) processIgnoreAllResponse(msg); break; + case SMSG_SCRIPT_MESSAGE: + processScriptMessage(msg); + break; + default: break; } @@ -622,6 +627,14 @@ void ChatHandler::processBeingChat(Net::MessageIn &msg) BLOCK_END("ChatHandler::processBeingChat") } +void ChatHandler::processScriptMessage(Net::MessageIn &msg) +{ + const int sz = msg.readInt16("len") - 5; + msg.readUInt8("message type"); + const std::string message = msg.readString(sz, "message"); + localChatTab->chatLog(message, ChatMsgType::BY_SERVER); +} + void ChatHandler::talkPet(const std::string &restrict text, const std::string &restrict channel) const { diff --git a/src/net/tmwa/chathandler.h b/src/net/tmwa/chathandler.h index 6d04abfe7..4bb199416 100644 --- a/src/net/tmwa/chathandler.h +++ b/src/net/tmwa/chathandler.h @@ -112,6 +112,8 @@ class ChatHandler final : public MessageHandler, public Ea::ChatHandler std::string chatMsg); static void processBeingChat(Net::MessageIn &msg); + + static void processScriptMessage(Net::MessageIn &msg); }; } // namespace TmwAthena diff --git a/src/net/tmwa/network.h b/src/net/tmwa/network.h index c9145f85f..0a6134e0f 100644 --- a/src/net/tmwa/network.h +++ b/src/net/tmwa/network.h @@ -30,7 +30,7 @@ * the protocol accordingly. */ #define CLIENT_PROTOCOL_VERSION 12 -#define CLIENT_TMW_PROTOCOL_VERSION 4 +#define CLIENT_TMW_PROTOCOL_VERSION 5 namespace TmwAthena { diff --git a/src/net/tmwa/packets.h b/src/net/tmwa/packets.h index a21d4661a..ce9f451df 100644 --- a/src/net/tmwa/packets.h +++ b/src/net/tmwa/packets.h @@ -84,7 +84,7 @@ int16_t packet_lengths[] = // #0x0200 26, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 19, 10, 0, 0, 0, 2, -1, 16, 0, 8, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - -1, 122, -1, -1, -1, -1, 10, -1, -1, 0, 0, 0, 0, 0, 0, 0, + -1, 122, -1, -1, -1, -1, 10, -1, -1, -1, 0, 0, 0, 0, 0, 0, }; } // namespace TmwAthena diff --git a/src/net/tmwa/protocol.h b/src/net/tmwa/protocol.h index 04a3588e4..d48e3ba5e 100644 --- a/src/net/tmwa/protocol.h +++ b/src/net/tmwa/protocol.h @@ -302,6 +302,7 @@ packet(SMSG_QUEST_PLAYER_VARS, 0x0215); packet(SMSG_BEING_MOVE3, 0x0225); packet(SMSG_MAP_MUSIC, 0x0227); packet(SMSG_NPC_CHANGETITLE, 0x0228); +packet(SMSG_SCRIPT_MESSAGE, 0x0229); #undef packet -- cgit v1.2.3-70-g09d2