summaryrefslogtreecommitdiff
path: root/src/net/eathena/inventoryrecv.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/eathena/inventoryrecv.cpp')
-rw-r--r--src/net/eathena/inventoryrecv.cpp40
1 files changed, 34 insertions, 6 deletions
diff --git a/src/net/eathena/inventoryrecv.cpp b/src/net/eathena/inventoryrecv.cpp
index 34e3301a1..f50da9572 100644
--- a/src/net/eathena/inventoryrecv.cpp
+++ b/src/net/eathena/inventoryrecv.cpp
@@ -60,6 +60,7 @@
#include "debug.h"
extern int serverVersion;
+extern int packetVersion;
namespace EAthena
{
@@ -317,7 +318,17 @@ void InventoryRecv::processPlayerInventory(Net::MessageIn &msg)
msg.readInt16("len");
- const int number = (msg.getLength() - 4) / 24;
+ int packetLen = 7;
+ if (msg.getVersion() >= 20120925)
+ packetLen += 4 + 1;
+ else
+ packetLen += 1 + 2;
+ if (packetVersion >= 5)
+ packetLen += 8;
+ if (msg.getVersion() >= 20080102)
+ packetLen += 4;
+
+ const int number = (msg.getLength() - 4) / packetLen;
for (int loop = 0; loop < number; loop++)
{
@@ -325,14 +336,31 @@ void InventoryRecv::processPlayerInventory(Net::MessageIn &msg)
const int itemId = msg.readInt16("item id");
const ItemTypeT itemType = static_cast<ItemTypeT>(
msg.readUInt8("item type"));
+ if (msg.getVersion() < 20120925)
+ msg.readUInt8("identified");
const int amount = msg.readInt16("count");
- msg.readInt32("wear state / equip");
+ if (msg.getVersion() >= 20120925)
+ msg.readInt32("wear state / equip");
+ else
+ msg.readInt16("wear state / equip");
int cards[maxCards];
- for (int f = 0; f < maxCards; f++)
- cards[f] = msg.readInt16("card");
- msg.readInt32("hire expire date (?)");
+ if (packetVersion >= 5)
+ {
+ for (int f = 0; f < maxCards; f++)
+ cards[f] = msg.readInt16("card");
+ }
+ else
+ {
+ for (int f = 0; f < maxCards; f++)
+ cards[f] = 0;
+ }
+ if (msg.getVersion() >= 20080102)
+ msg.readInt32("hire expire date (?)");
ItemFlags flags;
- flags.byte = msg.readUInt8("flags");
+ if (msg.getVersion() >= 20120925)
+ flags.byte = msg.readUInt8("flags");
+ else
+ flags.byte = 0;
if (inventory)
{