From 3b77e87f120b096510f5c6af721563683057b101 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 12 Mar 2015 16:45:40 +0300 Subject: eathena: add partial support for packet SMSG_MAIL_READ_MAIL 0x0242. --- src/net/eathena/mailhandler.cpp | 30 ++++++++++++++++++++++++++++++ src/net/eathena/mailhandler.h | 2 ++ src/net/eathena/packets.h | 2 +- src/net/eathena/protocol.h | 1 + 4 files changed, 34 insertions(+), 1 deletion(-) diff --git a/src/net/eathena/mailhandler.cpp b/src/net/eathena/mailhandler.cpp index 95c729c9b..e1da3ca6b 100644 --- a/src/net/eathena/mailhandler.cpp +++ b/src/net/eathena/mailhandler.cpp @@ -41,6 +41,7 @@ MailHandler::MailHandler() : { SMSG_MAIL_OPEN_WINDOW, SMSG_MAIL_MAILS_LIST, + SMSG_MAIL_READ_MAIL, 0 }; handledMessages = _messages; @@ -59,6 +60,10 @@ void MailHandler::handleMessage(Net::MessageIn &msg) processMailList(msg); break; + case SMSG_MAIL_READ_MAIL: + processReadMail(msg); + break; + default: break; } @@ -100,6 +105,31 @@ void MailHandler::processMailList(Net::MessageIn &msg) } } +void MailHandler::processReadMail(Net::MessageIn &msg) +{ + UNIMPLIMENTEDPACKET; + + const int sz = msg.readInt16("len") - 101; + msg.readInt32("message id"); + msg.readString(40, "title"); + msg.readString(24, "sender name"); + msg.readInt16("unused?"); + msg.readInt32("unused"); + msg.readInt32("money"); + msg.readInt32("item amount"); + msg.readInt16("item id"); + msg.readInt16("item type"); + msg.readUInt8("identify"); + msg.readUInt8("attribute"); + msg.readUInt8("refine"); + for (int f = 0; f < 4; f ++) + msg.readInt16("card"); + const int msgLen = msg.readUInt8("msg len"); + if (msgLen != sz) + logger->log("error: wrong message size"); + msg.readString(sz, "message"); +} + void MailHandler::refresh() { createOutPacket(CMSG_MAIL_REFRESH_INBOX); diff --git a/src/net/eathena/mailhandler.h b/src/net/eathena/mailhandler.h index 9aecc0705..162eeee41 100644 --- a/src/net/eathena/mailhandler.h +++ b/src/net/eathena/mailhandler.h @@ -60,6 +60,8 @@ class MailHandler final : public MessageHandler, public Net::MailHandler static void processMailOpen(Net::MessageIn &msg); static void processMailList(Net::MessageIn &msg); + + static void processReadMail(Net::MessageIn &msg); }; } // namespace EAthena diff --git a/src/net/eathena/packets.h b/src/net/eathena/packets.h index 7b91f5567..897e8fdca 100644 --- a/src/net/eathena/packets.h +++ b/src/net/eathena/packets.h @@ -88,7 +88,7 @@ int16_t packet_lengths[] = -1, -1, 0, 8, 10, 0, 282, 0, 0, 15, 0, 0, 0, 19, 71, 5, 12, 0, 0, 0, 0, -1, 0, 0, 282, 0, 4, 0, 6, 0, 0, 0, // #0x0240 - -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + -1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, -1, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 4, 0, 6, 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, 0, 0, diff --git a/src/net/eathena/protocol.h b/src/net/eathena/protocol.h index b2daa3dbf..ef20ce002 100644 --- a/src/net/eathena/protocol.h +++ b/src/net/eathena/protocol.h @@ -306,6 +306,7 @@ #define SMSG_CHAT_TALKIE_BOX 0x0191 #define SMSG_MAIL_MAILS_LIST 0x0240 +#define SMSG_MAIL_READ_MAIL 0x0242 #define SMSG_MAIL_OPEN_WINDOW 0x0260 #define SMSG_FAMILY_ASK_FOR_CHILD 0x01f6 -- cgit v1.2.3-70-g09d2