From bde03f8dc53a64ac43b84cab4cc7b7b5f6bf4f48 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 11 Aug 2017 19:52:27 +0300 Subject: Add packet CMSG_MAIL2_SEND_MAIL 0x09ec. --- src/net/eathena/mail2handler.cpp | 35 +++++++++++++++++++++++++++++++++++ src/net/eathena/mail2handler.h | 5 +++++ src/net/eathena/packetsout.inc | 10 ++++++++++ src/net/mail2handler.h | 5 +++++ src/net/tmwa/mail2handler.cpp | 7 +++++++ src/net/tmwa/mail2handler.h | 5 +++++ 6 files changed, 67 insertions(+) diff --git a/src/net/eathena/mail2handler.cpp b/src/net/eathena/mail2handler.cpp index 0e87a3731..ab4aace0e 100644 --- a/src/net/eathena/mail2handler.cpp +++ b/src/net/eathena/mail2handler.cpp @@ -22,6 +22,8 @@ #include "const/net/inventory.h" +#include "being/localplayer.h" + #include "net/eathena/messageout.h" #include "net/eathena/updateprotocol.h" #include "net/eathena/protocolout.h" @@ -91,4 +93,37 @@ void Mail2Handler::removeItem(const Item *const item, outMsg.writeInt16(CAST_S16(amount), "amount"); } +void Mail2Handler::sendMail(const std::string &to, + const std::string &title, + const std::string &body, + const int64_t &money) const +{ + if (packetVersion < 20131230 || + serverVersion < 19) + { + return; + } + if (localPlayer == nullptr) + return; + + const std::string from = localPlayer->getName(); + const int titleSz = title.size(); + const int bodySz = body.size(); + int16_t sz = 2 + 2 + 24 + 24 + 8 + 2 + 2 + titleSz + bodySz; + if (packetVersion >= 20160600) + sz += 4; + + createOutPacket(CMSG_MAIL2_SEND_MAIL); + outMsg.writeInt16(sz, "len"); + outMsg.writeString(to, 24, "to"); + outMsg.writeString(from, 24, "from"); + outMsg.writeInt64(money, "money"); + outMsg.writeInt16(CAST_S16(title.size()), "title len"); + outMsg.writeInt16(CAST_S16(body.size()), "body len"); + if (packetVersion >= 20160600) + outMsg.writeInt32(0, "to char id"); + outMsg.writeString(title, titleSz, "title"); + outMsg.writeString(body, bodySz, "body"); +} + } // namespace EAthena diff --git a/src/net/eathena/mail2handler.h b/src/net/eathena/mail2handler.h index b71b8a59b..ff6530866 100644 --- a/src/net/eathena/mail2handler.h +++ b/src/net/eathena/mail2handler.h @@ -42,6 +42,11 @@ class Mail2Handler final : public Net::Mail2Handler void removeItem(const Item *const item, const int amount) const override final; + + void sendMail(const std::string &to, + const std::string &title, + const std::string &body, + const int64_t &money) const override final; }; } // namespace EAthena diff --git a/src/net/eathena/packetsout.inc b/src/net/eathena/packetsout.inc index 29e741669..4c996253c 100644 --- a/src/net/eathena/packetsout.inc +++ b/src/net/eathena/packetsout.inc @@ -321,6 +321,7 @@ packet(CMSG_CHECK_NAME, 0x0000, 0, nullptr); packet(CMSG_MAIL2_OPEN_WRITE_MAIL, 0x0000, 0, nullptr); packet(CMSG_MAIL2_ADD_ITEM_TO_MAIL, 0x0000, 0, nullptr); packet(CMSG_MAIL2_REMOVE_ITEM_MAIL, 0x0000, 0, nullptr); +packet(CMSG_MAIL2_SEND_MAIL, 0x0000, 0, nullptr); #else // 20040713 if (packetVersion >= 20040713) @@ -1205,6 +1206,10 @@ if (packetVersion >= 20131230) packet(CMSG_STORAGE_PASSWORD, 0x091d, 36, clif->pStoragePassword); packet(CMSG_ITEM_LIST_WINDOW_SELECT, 0x022d, -1, clif->pItemListWindowSelected); } +if (packetVersion >= 20131230) +{ + packet(CMSG_MAIL2_SEND_MAIL, 0x09ec, -1, clif->pRodexSendMail); +} // 20140115 if (packetVersion >= 20140115) @@ -2647,6 +2652,11 @@ if (packetVersion == 20160330) packet(CMSG_NAME_REQUEST, 0x096a, 6, clif->pGetCharNameRequest); } +if (packetVersion >= 20160330) +{ + packet(CMSG_MAIL2_SEND_MAIL, 0x0a6e, -1, clif->pRodexSendMail); +} + // 20160420 if (packetVersion == 20160420) { diff --git a/src/net/mail2handler.h b/src/net/mail2handler.h index a2e3e9b94..8dd43e413 100644 --- a/src/net/mail2handler.h +++ b/src/net/mail2handler.h @@ -48,6 +48,11 @@ class Mail2Handler notfinal virtual void removeItem(const Item *const item, const int amount) const = 0; + + virtual void sendMail(const std::string &to, + const std::string &title, + const std::string &body, + const int64_t &money) const = 0; }; } // namespace Net diff --git a/src/net/tmwa/mail2handler.cpp b/src/net/tmwa/mail2handler.cpp index daf874448..0913f4c5c 100644 --- a/src/net/tmwa/mail2handler.cpp +++ b/src/net/tmwa/mail2handler.cpp @@ -49,4 +49,11 @@ void Mail2Handler::removeItem(const Item *const item A_UNUSED, { } +void Mail2Handler::sendMail(const std::string &to A_UNUSED, + const std::string &title A_UNUSED, + const std::string &body A_UNUSED, + const int64_t &money A_UNUSED) const +{ +} + } // namespace TmwAthena diff --git a/src/net/tmwa/mail2handler.h b/src/net/tmwa/mail2handler.h index c0780e128..3c28371bf 100644 --- a/src/net/tmwa/mail2handler.h +++ b/src/net/tmwa/mail2handler.h @@ -42,6 +42,11 @@ class Mail2Handler final : public Net::Mail2Handler void removeItem(const Item *const item, const int amount) const override final; + + void sendMail(const std::string &to, + const std::string &title, + const std::string &body, + const int64_t &money) const override final; }; } // namespace TmwAthena -- cgit v1.2.3-70-g09d2