summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-08-11 17:10:52 +0300
committerAndrei Karas <akaras@inbox.ru>2017-08-11 17:10:52 +0300
commitd3329d1900d306643706478cb2685dec7a1100e4 (patch)
tree5fe6c480db39a53d43c9f2dee3b1974eeebbdeef
parenta5dc57c1f52878c66ce5548ebe9e0d519cbbfbac (diff)
downloadplus-d3329d1900d306643706478cb2685dec7a1100e4.tar.gz
plus-d3329d1900d306643706478cb2685dec7a1100e4.tar.bz2
plus-d3329d1900d306643706478cb2685dec7a1100e4.tar.xz
plus-d3329d1900d306643706478cb2685dec7a1100e4.zip
Add packet CMSG_MAIL2_ADD_ITEM_TO_MAIL 0x0a04.
-rw-r--r--src/net/eathena/mail2handler.cpp16
-rw-r--r--src/net/eathena/mail2handler.h3
-rw-r--r--src/net/eathena/packetsout.inc2
-rw-r--r--src/net/mail2handler.h5
-rw-r--r--src/net/tmwa/mail2handler.cpp5
-rw-r--r--src/net/tmwa/mail2handler.h3
6 files changed, 34 insertions, 0 deletions
diff --git a/src/net/eathena/mail2handler.cpp b/src/net/eathena/mail2handler.cpp
index 550d5f6c1..5d7f50ba3 100644
--- a/src/net/eathena/mail2handler.cpp
+++ b/src/net/eathena/mail2handler.cpp
@@ -20,10 +20,14 @@
#include "net/eathena/mail2handler.h"
+#include "const/net/inventory.h"
+
#include "net/eathena/messageout.h"
#include "net/eathena/updateprotocol.h"
#include "net/eathena/protocolout.h"
+#include "resources/item/item.h"
+
#include "debug.h"
namespace EAthena
@@ -45,4 +49,16 @@ void Mail2Handler::openWriteMail(const std::string &receiver) const
outMsg.writeString(receiver, 24, "receiver name");
}
+void Mail2Handler::addItem(const Item *const item,
+ const int amount) const
+{
+ if (item == nullptr)
+ return;
+
+ createOutPacket(CMSG_MAIL2_ADD_ITEM_TO_MAIL);
+ outMsg.writeInt16(CAST_S16(
+ item->getInvIndex() + INVENTORY_OFFSET), "index");
+ outMsg.writeInt16(CAST_S16(amount), "amount");
+}
+
} // namespace EAthena
diff --git a/src/net/eathena/mail2handler.h b/src/net/eathena/mail2handler.h
index 66bc11c44..f239eff86 100644
--- a/src/net/eathena/mail2handler.h
+++ b/src/net/eathena/mail2handler.h
@@ -36,6 +36,9 @@ class Mail2Handler final : public Net::Mail2Handler
~Mail2Handler();
void openWriteMail(const std::string &receiver) const override final;
+
+ void addItem(const Item *const item,
+ const int amount) const override final;
};
} // namespace EAthena
diff --git a/src/net/eathena/packetsout.inc b/src/net/eathena/packetsout.inc
index 3cbc29988..fcb22bcc8 100644
--- a/src/net/eathena/packetsout.inc
+++ b/src/net/eathena/packetsout.inc
@@ -318,6 +318,7 @@ packet(CMSG_BOOKING_SEARCH_REQ, 0x0000, 0, nullptr);
packet(CMSG_BOOKING_DELETE_REQ, 0x0000, 0, nullptr);
packet(CMSG_BOOKING_UPDATE_REQ, 0x0000, 0, nullptr);
packet(CMSG_MAIL2_OPEN_WRITE_MAIL, 0x0000, 0, nullptr);
+packet(CMSG_MAIL2_ADD_ITEM_TO_MAIL, 0x0000, 0, nullptr);
#else
// 20040713
if (packetVersion >= 20040713)
@@ -1376,6 +1377,7 @@ if (packetVersion == 20140416)
packet(CMSG_STORAGE_PASSWORD, 0x095c, 36, clif->pStoragePassword);
packet(CMSG_NAME_REQUEST, 0x096a, 6, clif->pGetCharNameRequest);
packet(CMSG_MAIL2_OPEN_WRITE_MAIL, 0x0a08, 26, clif->pRodexOpenWriteMail);
+ packet(CMSG_MAIL2_ADD_ITEM_TO_MAIL, 0x0a04, 6, clif->pRodexAddItem);
}
// 20140605
diff --git a/src/net/mail2handler.h b/src/net/mail2handler.h
index ad6d2d88c..f53d17a98 100644
--- a/src/net/mail2handler.h
+++ b/src/net/mail2handler.h
@@ -25,6 +25,8 @@
#include "localconsts.h"
+class Item;
+
namespace Net
{
@@ -40,6 +42,9 @@ class Mail2Handler notfinal
{ }
virtual void openWriteMail(const std::string &receiver) const = 0;
+
+ virtual void addItem(const Item *const item,
+ const int amount) const = 0;
};
} // namespace Net
diff --git a/src/net/tmwa/mail2handler.cpp b/src/net/tmwa/mail2handler.cpp
index 2175a5bd3..9f07f2585 100644
--- a/src/net/tmwa/mail2handler.cpp
+++ b/src/net/tmwa/mail2handler.cpp
@@ -39,4 +39,9 @@ void Mail2Handler::openWriteMail(const std::string &receiver A_UNUSED) const
{
}
+void Mail2Handler::addItem(const Item *const item A_UNUSED,
+ const int amount A_UNUSED) const
+{
+}
+
} // namespace TmwAthena
diff --git a/src/net/tmwa/mail2handler.h b/src/net/tmwa/mail2handler.h
index 7842d101c..a8cceb0cb 100644
--- a/src/net/tmwa/mail2handler.h
+++ b/src/net/tmwa/mail2handler.h
@@ -36,6 +36,9 @@ class Mail2Handler final : public Net::Mail2Handler
~Mail2Handler();
void openWriteMail(const std::string &receiver) const override final;
+
+ void addItem(const Item *const item,
+ const int amount) const override final;
};
} // namespace TmwAthena