diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-04-03 23:31:37 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-04-03 23:31:37 +0300 |
commit | bae0bf20b36f224796af64298f6139365e97b815 (patch) | |
tree | d78fcfa947199c569ec9d03136fae7df0852aeb3 /src/net/eathena/inventoryrecv.cpp | |
parent | f644bad683cf30f2f98fd6cd911b8bf53e98e01c (diff) | |
download | plus-bae0bf20b36f224796af64298f6139365e97b815.tar.gz plus-bae0bf20b36f224796af64298f6139365e97b815.tar.bz2 plus-bae0bf20b36f224796af64298f6139365e97b815.tar.xz plus-bae0bf20b36f224796af64298f6139365e97b815.zip |
Add packet SMSG_PLAYER_CART_ITEMS 0x0123.
Diffstat (limited to 'src/net/eathena/inventoryrecv.cpp')
-rw-r--r-- | src/net/eathena/inventoryrecv.cpp | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/src/net/eathena/inventoryrecv.cpp b/src/net/eathena/inventoryrecv.cpp index 9a4c83760..c3f752a6d 100644 --- a/src/net/eathena/inventoryrecv.cpp +++ b/src/net/eathena/inventoryrecv.cpp @@ -1057,26 +1057,52 @@ void InventoryRecv::processPlayerCartEquip(Net::MessageIn &msg) void InventoryRecv::processPlayerCartItems(Net::MessageIn &msg) { +//+++ BLOCK_START("InventoryRecv::processPlayerCartItems") Ea::InventoryRecv::mInventoryItems.clear(); msg.readInt16("len"); - const int number = (msg.getLength() - 4) / 23; + 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++) { const int index = msg.readInt16("item index") - INVENTORY_OFFSET; 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"); int cards[maxCards]; - for (int f = 0; f < maxCards; f++) - cards[f] = msg.readInt16("card"); - msg.readInt32("hire expire date (?)"); + if (msg.getVersion() >= 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; mCartItems.push_back(Ea::InventoryItem(index, itemId, |