summaryrefslogtreecommitdiff
path: root/src/net/eathena/mail2handler.cpp
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/mail2handler.cpp
parent0210c6c6358fa4664b935e4345c96f752b03776c (diff)
downloadmanaverse-bde03f8dc53a64ac43b84cab4cc7b7b5f6bf4f48.tar.gz
manaverse-bde03f8dc53a64ac43b84cab4cc7b7b5f6bf4f48.tar.bz2
manaverse-bde03f8dc53a64ac43b84cab4cc7b7b5f6bf4f48.tar.xz
manaverse-bde03f8dc53a64ac43b84cab4cc7b7b5f6bf4f48.zip
Add packet CMSG_MAIL2_SEND_MAIL 0x09ec.
Diffstat (limited to 'src/net/eathena/mail2handler.cpp')
-rw-r--r--src/net/eathena/mail2handler.cpp35
1 files changed, 35 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