From 857b503b43dc7e2a452f1897efc2100b028f843a Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 13 Sep 2014 23:03:43 +0300 Subject: eathena: add partial support for packet SMSG_FORMAT_MESSAGE 0x0291. --- src/net/eathena/chathandler.cpp | 14 ++++++++++++++ src/net/eathena/chathandler.h | 2 ++ src/net/eathena/packets.h | 2 +- src/net/eathena/protocol.h | 1 + 4 files changed, 18 insertions(+), 1 deletion(-) (limited to 'src/net/eathena') diff --git a/src/net/eathena/chathandler.cpp b/src/net/eathena/chathandler.cpp index beae2731b..df1c45155 100644 --- a/src/net/eathena/chathandler.cpp +++ b/src/net/eathena/chathandler.cpp @@ -60,6 +60,7 @@ ChatHandler::ChatHandler() : SMSG_IGNORE_ALL_RESPONSE, SMSG_COLOR_MESSAGE, SMSG_CHAT_IGNORE_LIST, + SMSG_FORMAT_MESSAGE, 0 }; handledMessages = _messages; @@ -88,6 +89,10 @@ void ChatHandler::handleMessage(Net::MessageIn &msg) processChat(msg); break; + case SMSG_FORMAT_MESSAGE: + processFormatMessage(msg); + break; + case SMSG_COLOR_MESSAGE: processColorChat(msg); break; @@ -279,6 +284,15 @@ void ChatHandler::processChat(Net::MessageIn &msg) processChatContinue(msg.readRawString(chatMsgLength, "message")); } +void ChatHandler::processFormatMessage(Net::MessageIn &msg) +{ + BLOCK_START("ChatHandler::processChat") + int msgId = msg.readInt16("msg id"); + // +++ here need load message from configuration file + const std::string chatMsg = strprintf("Message #%d", msgId); + processChatContinue(chatMsg); +} + void ChatHandler::processColorChat(Net::MessageIn &msg) { BLOCK_START("ChatHandler::processChat") diff --git a/src/net/eathena/chathandler.h b/src/net/eathena/chathandler.h index 08103bc86..2238357e7 100644 --- a/src/net/eathena/chathandler.h +++ b/src/net/eathena/chathandler.h @@ -86,6 +86,8 @@ class ChatHandler final : public MessageHandler, public Ea::ChatHandler void processGmChat2(Net::MessageIn &msg); void processChatIgnoreList(Net::MessageIn &msg); + + void processFormatMessage(Net::MessageIn &msg); }; } // namespace EAthena diff --git a/src/net/eathena/packets.h b/src/net/eathena/packets.h index 36af9a997..aedb16f79 100644 --- a/src/net/eathena/packets.h +++ b/src/net/eathena/packets.h @@ -94,7 +94,7 @@ int16_t packet_lengths[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // #0x0280 0, 0, 0, 6, 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, 4, 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, -1, -1, 107, 6, -1, 0, 0, 0, 191, 0, 0, 0, 0, 0, 0, // #0x02C0 diff --git a/src/net/eathena/protocol.h b/src/net/eathena/protocol.h index 20e041374..f6456a924 100644 --- a/src/net/eathena/protocol.h +++ b/src/net/eathena/protocol.h @@ -102,6 +102,7 @@ #define SMSG_BEING_ACTION2 0x02e1 #define SMSG_BEING_CHAT 0x008d /**< A being talks */ #define SMSG_COLOR_MESSAGE 0x02c1 +#define SMSG_FORMAT_MESSAGE 0x0291 #define SMSG_BEING_NAME_RESPONSE 0x0095 /**< Has to be requested */ #define SMSG_BEING_NAME_RESPONSE2 0x0220 /**< Has to be requested */ #define SMSG_BEING_CHANGE_DIRECTION 0x009c -- cgit v1.2.3-70-g09d2