summaryrefslogtreecommitdiff
path: root/src/net/eathena
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-08-11 19:52:27 +0300
committerAndrei Karas <akaras@inbox.ru>2017-08-11 19:52:27 +0300
commitbde03f8dc53a64ac43b84cab4cc7b7b5f6bf4f48 (patch)
tree5165f4faf0f911c9900171bdf714fcf070cc5a13 /src/net/eathena
parent0210c6c6358fa4664b935e4345c96f752b03776c (diff)
downloadplus-bde03f8dc53a64ac43b84cab4cc7b7b5f6bf4f48.tar.gz
plus-bde03f8dc53a64ac43b84cab4cc7b7b5f6bf4f48.tar.bz2
plus-bde03f8dc53a64ac43b84cab4cc7b7b5f6bf4f48.tar.xz
plus-bde03f8dc53a64ac43b84cab4cc7b7b5f6bf4f48.zip
Add packet CMSG_MAIL2_SEND_MAIL 0x09ec.
Diffstat (limited to 'src/net/eathena')
-rw-r--r--src/net/eathena/mail2handler.cpp35
-rw-r--r--src/net/eathena/mail2handler.h5
-rw-r--r--src/net/eathena/packetsout.inc10
3 files changed, 50 insertions, 0 deletions
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)
{