summaryrefslogtreecommitdiff
path: root/src/net/eathena/inventoryrecv.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-04-03 00:06:52 +0300
committerAndrei Karas <akaras@inbox.ru>2016-04-03 00:06:52 +0300
commitff938a161709b376a09f4310b984d7f0e30a7e8f (patch)
tree6020ba1c46fb95075dcc4ed1bedae6be0237bfa5 /src/net/eathena/inventoryrecv.cpp
parenta72f322477d04f12b6c666837945b0ed94ee5d67 (diff)
downloadmanaplus-ff938a161709b376a09f4310b984d7f0e30a7e8f.tar.gz
manaplus-ff938a161709b376a09f4310b984d7f0e30a7e8f.tar.bz2
manaplus-ff938a161709b376a09f4310b984d7f0e30a7e8f.tar.xz
manaplus-ff938a161709b376a09f4310b984d7f0e30a7e8f.zip
Sort more packets. Add version checks inside packets.
Diffstat (limited to 'src/net/eathena/inventoryrecv.cpp')
-rw-r--r--src/net/eathena/inventoryrecv.cpp52
1 files changed, 36 insertions, 16 deletions
diff --git a/src/net/eathena/inventoryrecv.cpp b/src/net/eathena/inventoryrecv.cpp
index 7a99ad717..0887dfbeb 100644
--- a/src/net/eathena/inventoryrecv.cpp
+++ b/src/net/eathena/inventoryrecv.cpp
@@ -944,18 +944,22 @@ void InventoryRecv::processPlayerCartEquip(Net::MessageIn &msg)
{
BLOCK_START("InventoryRecv::processPlayerCartEquip")
msg.readInt16("len");
- int sz;
- if ((serverVersion >= 8 || serverVersion == 0) &&
- msg.getVersion() >= 20150226)
- {
- sz = 57;
- }
+
+ int packetLen = 2 + 2 + 1 + 1 + 8;
+ if (msg.getVersion() >= 20120925)
+ packetLen += 4 + 4 + 1;
else
- {
- sz = 31;
- }
+ packetLen += 1 + 2 + 2 + 1;
+ if (msg.getVersion() >= 20071002)
+ packetLen += 4;
+ if (msg.getVersion() >= 20080102)
+ packetLen += 2;
+ if (msg.getVersion() >= 20100629)
+ packetLen += 2;
+ if (msg.getVersion() >= 20150226)
+ packetLen += 26;
- const int number = (msg.getLength() - 4) / sz;
+ const int number = (msg.getLength() - 4) / packetLen;
for (int loop = 0; loop < number; loop++)
{
const int index = msg.readInt16("index") - INVENTORY_OFFSET;
@@ -963,15 +967,28 @@ void InventoryRecv::processPlayerCartEquip(Net::MessageIn &msg)
const ItemTypeT itemType = static_cast<ItemTypeT>(
msg.readUInt8("item type"));
const int amount = 1;
- msg.readInt32("location");
- msg.readInt32("wear state");
+ if (msg.getVersion() >= 20120925)
+ {
+ msg.readInt32("location");
+ msg.readInt32("wear state");
+ }
+ else
+ {
+ msg.readUInt8("identified");
+ msg.readInt16("location");
+ msg.readInt16("wear state");
+ msg.readUInt8("is damaged");
+ }
const uint8_t refine = msg.readUInt8("refine level");
int cards[maxCards];
for (int f = 0; f < maxCards; f++)
cards[f] = msg.readInt16("card");
- msg.readInt32("hire expire date");
- msg.readInt16("bind on equip");
- msg.readInt16("sprite");
+ if (msg.getVersion() >= 20071002)
+ msg.readInt32("hire expire date");
+ if (msg.getVersion() >= 20080102)
+ msg.readInt16("bind on equip");
+ if (msg.getVersion() >= 20100629)
+ msg.readInt16("sprite");
if ((serverVersion >= 8 || serverVersion == 0) &&
msg.getVersion() >= 20150226)
{
@@ -984,7 +1001,10 @@ void InventoryRecv::processPlayerCartEquip(Net::MessageIn &msg)
}
}
ItemFlags flags;
- flags.byte = msg.readUInt8("flags");
+ if (msg.getVersion() >= 20120925)
+ flags.byte = msg.readUInt8("flags");
+ else
+ flags.byte = 0;
mCartItems.push_back(Ea::InventoryItem(index,
itemId,