summaryrefslogtreecommitdiff
path: root/src/net/eathena/vendingrecv.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2018-07-26 03:02:37 +0300
committerAndrei Karas <akaras@inbox.ru>2018-07-26 22:01:35 +0300
commitde90520de303659fe639794544c2e19d462b3907 (patch)
tree36b306a26e2c9dd422aede36f2f9ca3158ffbae2 /src/net/eathena/vendingrecv.cpp
parent45527f8597dfac68e914a798184282faeb1493f2 (diff)
downloadplus-de90520de303659fe639794544c2e19d462b3907.tar.gz
plus-de90520de303659fe639794544c2e19d462b3907.tar.bz2
plus-de90520de303659fe639794544c2e19d462b3907.tar.xz
plus-de90520de303659fe639794544c2e19d462b3907.zip
Add support for changed item id size in packets.
From some packet version hercules support item id fields as int32.
Diffstat (limited to 'src/net/eathena/vendingrecv.cpp')
-rw-r--r--src/net/eathena/vendingrecv.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/net/eathena/vendingrecv.cpp b/src/net/eathena/vendingrecv.cpp
index 2e8092886..b16c3eefa 100644
--- a/src/net/eathena/vendingrecv.cpp
+++ b/src/net/eathena/vendingrecv.cpp
@@ -58,6 +58,7 @@
extern int packetVersion;
extern int serverVersion;
+extern int itemIdLen;
namespace EAthena
{
@@ -112,6 +113,8 @@ void VendingRecv::processItemsList(Net::MessageIn &msg)
packetLen = 53;
else if (msg.getVersion() >= 20150226)
packetLen = 47;
+ if (itemIdLen == 4)
+ packetLen += 10;
int offset = 8;
if (msg.getVersion() >= 20100105)
offset += 4;
@@ -133,12 +136,12 @@ void VendingRecv::processItemsList(Net::MessageIn &msg)
const int index = msg.readInt16("inv index");
const ItemTypeT type = static_cast<ItemTypeT>(
msg.readUInt8("item type"));
- const int itemId = msg.readInt16("item id");
+ const int itemId = msg.readItemId("item id");
msg.readUInt8("identify");
msg.readUInt8("attribute");
msg.readUInt8("refine");
for (int d = 0; d < maxCards; d ++)
- cards[d] = msg.readUInt16("card");
+ cards[d] = msg.readItemId("card");
ItemOptionsList *options = nullptr;
if (msg.getVersion() >= 20150226)
{
@@ -207,6 +210,8 @@ void VendingRecv::processOpen(Net::MessageIn &msg)
int packetLen = 22;
if (msg.getVersion() >= 20150226)
packetLen += 25;
+ if (itemIdLen == 4)
+ packetLen += 10;
const int count = (msg.readInt16("len") - 8) / packetLen;
msg.readInt32("id");
@@ -216,12 +221,12 @@ void VendingRecv::processOpen(Net::MessageIn &msg)
msg.readInt16("inv index");
msg.readInt16("amount");
msg.readUInt8("item type");
- msg.readInt16("item id");
+ msg.readItemId("item id");
msg.readUInt8("identify");
msg.readUInt8("attribute");
msg.readUInt8("refine");
for (int d = 0; d < maxCards; d ++)
- msg.readUInt16("card");
+ msg.readItemId("card");
if (msg.getVersion() >= 20150226)
{
for (int d = 0; d < 5; d ++)