From ebcf64c0ab592793bae3a9f77b5d87e912e0c2f6 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 15 Oct 2017 19:10:54 +0300 Subject: Add packet SMSG_MAIL2_MAIL_LIST_PAGE 0x0ac2. --- src/net/eathena/mail2recv.cpp | 61 +++++++++++++++++++++++++++++++------------ src/net/eathena/packetsin.inc | 6 +++++ 2 files changed, 51 insertions(+), 16 deletions(-) (limited to 'src/net') diff --git a/src/net/eathena/mail2recv.cpp b/src/net/eathena/mail2recv.cpp index 1afb69d16..09208d94b 100644 --- a/src/net/eathena/mail2recv.cpp +++ b/src/net/eathena/mail2recv.cpp @@ -52,6 +52,8 @@ #include "debug.h" +extern int packetVersion; + namespace EAthena { @@ -334,24 +336,51 @@ void Mail2Recv::processMailListPage(Net::MessageIn &msg) return; } msg.readInt16("len"); - mailWindow->setOpenType(fromInt(msg.readUInt8("open type"), - MailOpenTypeT)); - const int cnt = msg.readUInt8("cnt"); - const bool isEnd = msg.readUInt8("isEnd") != 0; - for (int f = 0; f < cnt; f ++) + bool isEnd = true; + if (packetVersion < 20170419) { - MailMessage *const mail = new MailMessage; - mail->id = msg.readInt64("mail id"); - mail->read = msg.readUInt8("is read") != 0U ? true : false; - mail->type = static_cast( - msg.readUInt8("type")); - mail->sender = msg.readString(24, "sender name"); - mail->time = CAST_S32(cur_time - msg.readInt32("reg time")); - mail->strTime = timeToStr(mail->time); - mail->expireTime = msg.readInt32("expire time"); - mail->title = msg.readString(-1, "title"); - mailWindow->addMail(mail); + mailWindow->setOpenType(fromInt(msg.readUInt8("open type"), + MailOpenTypeT)); + const int cnt = msg.readUInt8("cnt"); + isEnd = msg.readUInt8("isEnd") != 0; + for (int f = 0; f < cnt; f ++) + { + MailMessage *const mail = new MailMessage; + mail->id = msg.readInt64("mail id"); + mail->read = msg.readUInt8("is read") != 0U ? true : false; + mail->type = static_cast( + msg.readUInt8("type")); + mail->sender = msg.readString(24, "sender name"); + if (packetVersion < 20170419) + { + mail->time = CAST_S32(cur_time - msg.readInt32("reg time")); + mail->strTime = timeToStr(mail->time); + } + mail->expireTime = msg.readInt32("expire time"); + mail->title = msg.readString(-1, "title"); + mailWindow->addMail(mail); + } } + else + { + isEnd = msg.readUInt8("isEnd") != 0; + while (msg.getUnreadLength() > 0) + { + MailMessage *const mail = new MailMessage; + // +++ need save open type into MailMessage + msg.readUInt8("open type"); + mail->id = msg.readInt64("mail id"); + mail->read = msg.readUInt8("is read") != 0U ? true : false; + mail->type = static_cast( + msg.readUInt8("type")); + mail->sender = msg.readString(24, "sender name"); + mail->strTime = "-"; + mail->expireTime = msg.readInt32("expire time"); + mail->title = msg.readString(-1, "title"); + mailWindow->addMail(mail); + } + } + if (isEnd) mailWindow->setLastPage(); } diff --git a/src/net/eathena/packetsin.inc b/src/net/eathena/packetsin.inc index b12e6c212..382756a14 100644 --- a/src/net/eathena/packetsin.inc +++ b/src/net/eathena/packetsin.inc @@ -958,6 +958,12 @@ if (packetVersion >= 20170329) packet(SMSG_CHAR_MAP_INFO, 0x0ac5, 156, &CharServerRecv::processCharMapInfo, 20170329); } +// 20170419 +if (packetVersion >= 20170419) +{ + packet(SMSG_MAIL2_MAIL_LIST_PAGE, 0x0ac2, -1, &Mail2Recv::processMailListPage, 20170419); +} + // 20170502 if (packetVersion >= 20170502) { -- cgit v1.2.3-70-g09d2