summaryrefslogtreecommitdiff
path: root/src/net/eathena/inventoryrecv.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-04-02 23:44:39 +0300
committerAndrei Karas <akaras@inbox.ru>2016-04-02 23:44:39 +0300
commita72f322477d04f12b6c666837945b0ed94ee5d67 (patch)
treec9b9d2b9217a9860e9cf2a2c99fb63777a1a0e37 /src/net/eathena/inventoryrecv.cpp
parentc2b28b1860ce02a4e9b9b6694e801de83652440e (diff)
downloadmanaverse-a72f322477d04f12b6c666837945b0ed94ee5d67.tar.gz
manaverse-a72f322477d04f12b6c666837945b0ed94ee5d67.tar.bz2
manaverse-a72f322477d04f12b6c666837945b0ed94ee5d67.tar.xz
manaverse-a72f322477d04f12b6c666837945b0ed94ee5d67.zip
Sort more packets. Add version checks inside packets.
Diffstat (limited to 'src/net/eathena/inventoryrecv.cpp')
-rw-r--r--src/net/eathena/inventoryrecv.cpp53
1 files changed, 37 insertions, 16 deletions
diff --git a/src/net/eathena/inventoryrecv.cpp b/src/net/eathena/inventoryrecv.cpp
index 9587da970..7a99ad717 100644
--- a/src/net/eathena/inventoryrecv.cpp
+++ b/src/net/eathena/inventoryrecv.cpp
@@ -110,18 +110,22 @@ void InventoryRecv::processPlayerEquipment(Net::MessageIn &msg)
Ea::InventoryRecv::mEquips.clear();
equipment->setBackend(&Ea::InventoryRecv::mEquips);
}
- 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++)
{
@@ -129,15 +133,29 @@ void InventoryRecv::processPlayerEquipment(Net::MessageIn &msg)
const int itemId = msg.readInt16("item id");
const ItemTypeT itemType = static_cast<ItemTypeT>(
msg.readUInt8("item type"));
- msg.readInt32("location");
- const int equipType = msg.readInt32("wear state");
+ int equipType;
+ if (msg.getVersion() >= 20120925)
+ {
+ msg.readInt32("location");
+ equipType = msg.readInt32("wear state");
+ }
+ else
+ {
+ msg.readUInt8("identified");
+ msg.readInt16("location");
+ equipType = msg.readInt16("wear state");
+ msg.readUInt8("is damaged");
+ }
const uint8_t refine = CAST_U8(msg.readInt8("refine"));
int cards[maxCards];
for (int f = 0; f < maxCards; f++)
cards[f] = msg.readInt16("card");
- msg.readInt32("hire expire date (?)");
- msg.readInt16("equip type");
- msg.readInt16("item sprite number");
+ if (msg.getVersion() >= 20071002)
+ msg.readInt32("hire expire date (?)");
+ if (msg.getVersion() >= 20080102)
+ msg.readInt16("equip type");
+ if (msg.getVersion() >= 20100629)
+ msg.readInt16("item sprite number");
if ((serverVersion >= 8 || serverVersion == 0) &&
msg.getVersion() >= 20150226)
{
@@ -150,7 +168,10 @@ void InventoryRecv::processPlayerEquipment(Net::MessageIn &msg)
}
}
ItemFlags flags;
- flags.byte = msg.readUInt8("flags");
+ if (msg.getVersion() >= 20120925)
+ flags.byte = msg.readUInt8("flags");
+ else
+ flags.byte = 0;
if (inventory)
{
inventory->setItem(index,