summaryrefslogtreecommitdiff
path: root/src/net/eathena/inventoryrecv.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-04-01 23:40:55 +0300
committerAndrei Karas <akaras@inbox.ru>2016-04-01 23:40:55 +0300
commit6cda8f1c63f599ceeeac8a13c3fa657f5554d941 (patch)
tree581eb71d56311d3a460364327176f54ffd723fae /src/net/eathena/inventoryrecv.cpp
parentbd2007020b853b4a8c214a6831fa9b9de226cb59 (diff)
downloadmv-6cda8f1c63f599ceeeac8a13c3fa657f5554d941.tar.gz
mv-6cda8f1c63f599ceeeac8a13c3fa657f5554d941.tar.bz2
mv-6cda8f1c63f599ceeeac8a13c3fa657f5554d941.tar.xz
mv-6cda8f1c63f599ceeeac8a13c3fa657f5554d941.zip
Sort more packets. Add version checks inside packets.
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)
{