From 564fa0de49a384284868eaddbbdb9f87c58a3661 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 13 Sep 2014 23:37:15 +0300 Subject: eathena: add partial support for packet SMSG_FORMAT_MESSAGE_NUMBER 0x07e2. --- src/net/eathena/chathandler.cpp | 16 +++++++++++++++- src/net/eathena/chathandler.h | 2 ++ src/net/eathena/packets.h | 2 +- src/net/eathena/protocol.h | 1 + 4 files changed, 19 insertions(+), 2 deletions(-) (limited to 'src/net') diff --git a/src/net/eathena/chathandler.cpp b/src/net/eathena/chathandler.cpp index df1c45155..1e5d343e7 100644 --- a/src/net/eathena/chathandler.cpp +++ b/src/net/eathena/chathandler.cpp @@ -61,6 +61,7 @@ ChatHandler::ChatHandler() : SMSG_COLOR_MESSAGE, SMSG_CHAT_IGNORE_LIST, SMSG_FORMAT_MESSAGE, + SMSG_FORMAT_MESSAGE_NUMBER, 0 }; handledMessages = _messages; @@ -93,6 +94,10 @@ void ChatHandler::handleMessage(Net::MessageIn &msg) processFormatMessage(msg); break; + case SMSG_FORMAT_MESSAGE_NUMBER: + processFormatMessageNumber(msg); + break; + case SMSG_COLOR_MESSAGE: processColorChat(msg); break; @@ -286,13 +291,22 @@ void ChatHandler::processChat(Net::MessageIn &msg) 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::processFormatMessageNumber(Net::MessageIn &msg) +{ + int msgId = msg.readInt16("msg id"); + int value = msg.readInt32("value"); + // +++ here need load message from configuration file + const std::string chatMsg = strprintf( + "Message #%d, value: %d", msgId, value); + 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 2238357e7..5597c9c71 100644 --- a/src/net/eathena/chathandler.h +++ b/src/net/eathena/chathandler.h @@ -88,6 +88,8 @@ class ChatHandler final : public MessageHandler, public Ea::ChatHandler void processChatIgnoreList(Net::MessageIn &msg); void processFormatMessage(Net::MessageIn &msg); + + void processFormatMessageNumber(Net::MessageIn &msg); }; } // namespace EAthena diff --git a/src/net/eathena/packets.h b/src/net/eathena/packets.h index aedb16f79..fa9bab2e5 100644 --- a/src/net/eathena/packets.h +++ b/src/net/eathena/packets.h @@ -210,7 +210,7 @@ int16_t packet_lengths[] = // #0x07C0 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 268, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 8, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 8, 25, 0, 0, 0, 0, //0 1 2 3 4 5 6 7 8 9 a b c d e f //0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 diff --git a/src/net/eathena/protocol.h b/src/net/eathena/protocol.h index 80aba31fd..fb8b4110e 100644 --- a/src/net/eathena/protocol.h +++ b/src/net/eathena/protocol.h @@ -104,6 +104,7 @@ #define SMSG_BEING_CHAT 0x008d /**< A being talks */ #define SMSG_COLOR_MESSAGE 0x02c1 #define SMSG_FORMAT_MESSAGE 0x0291 +#define SMSG_FORMAT_MESSAGE_NUMBER 0x07e2 #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