diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-04-01 23:40:55 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-04-01 23:40:55 +0300 |
commit | 6cda8f1c63f599ceeeac8a13c3fa657f5554d941 (patch) | |
tree | 581eb71d56311d3a460364327176f54ffd723fae | |
parent | bd2007020b853b4a8c214a6831fa9b9de226cb59 (diff) | |
download | manaplus-6cda8f1c63f599ceeeac8a13c3fa657f5554d941.tar.gz manaplus-6cda8f1c63f599ceeeac8a13c3fa657f5554d941.tar.bz2 manaplus-6cda8f1c63f599ceeeac8a13c3fa657f5554d941.tar.xz manaplus-6cda8f1c63f599ceeeac8a13c3fa657f5554d941.zip |
Sort more packets. Add version checks inside packets.
-rw-r--r-- | src/net/eathena/inventoryrecv.cpp | 40 | ||||
-rw-r--r-- | src/net/eathena/packetsin.inc | 9 |
2 files changed, 40 insertions, 9 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) { diff --git a/src/net/eathena/packetsin.inc b/src/net/eathena/packetsin.inc index ff75eba81..c677d5c3c 100644 --- a/src/net/eathena/packetsin.inc +++ b/src/net/eathena/packetsin.inc @@ -128,6 +128,7 @@ packet(SMSG_PARTY_INVITED, 0x02c6, 30, &PartyRecv::processParty // 20071002 if (packetVersion >= 20071002) { + packet(SMSG_PLAYER_INVENTORY, 0x01ee, -1, &InventoryRecv::processPlayerInventory, 20071002); packet(SMSG_PLAYER_CART_ITEMS, 0x01ef, -1, &InventoryRecv::processPlayerCartItems, 20071002); packet(SMSG_PARTY_ITEM_PICKUP, 0x02b8, 22, &PartyRecv::processPartyItemPickup, 20071002); } @@ -148,6 +149,7 @@ packet(SMSG_BEING_ACTION2, 0x02e1, 33, &BeingRecv::processBeing // 20080102 if (packetVersion >= 20080102) { + packet(SMSG_PLAYER_INVENTORY, 0x02e8, -1, &InventoryRecv::processPlayerInventory, 20080102); packet(SMSG_PLAYER_CART_ITEMS, 0x02e9, -1, &InventoryRecv::processPlayerCartItems, 20080102); packet(SMSG_MAP_LOGIN_SUCCESS, 0x02eb, 14, &GameRecv::processMapLogin, 20080102); packet(SMSG_BEING_FONT, 0x02ef, 8, &BeingRecv::processBeingFont, 20080102); @@ -238,10 +240,12 @@ if (packetVersion >= 20120618) packet(SMSG_BEING_STATUS_CHANGE, 0x0983, 29, &BeingRecv::processBeingStatusChange, 20120618); } + // 20120925 if (packetVersion >= 20120925) { packet(SMSG_PLAYER_INVENTORY_ADD, 0x0990, 31, &InventoryRecv::processPlayerInventoryAdd, 20120925); + packet(SMSG_PLAYER_INVENTORY, 0x0991, -1, &InventoryRecv::processPlayerInventory, 20120925); packet(SMSG_PLAYER_EQUIPMENT, 0x0992, -1, &InventoryRecv::processPlayerEquipment, 20120925); packet(SMSG_PLAYER_CART_ITEMS, 0x0993, -1, &InventoryRecv::processPlayerCartItems, 20120925); packet(SMSG_PLAYER_CART_EQUIP, 0x0994, -1, &InventoryRecv::processPlayerCartEquip, 20120925); @@ -440,12 +444,11 @@ packet(SMSG_PLAYER_CART_REMOVE, 0x0125, 8, &InventoryRecv::processP packet(SMSG_PLAYER_CHAT, 0x008e, -1, &ChatRecv::processChat, 0); packet(SMSG_PLAYER_GUILD_PARTY_INFO, 0x0195, 102, &BeingRecv::processPlayerGuilPartyInfo, 0); packet(SMSG_PLAYER_HEAL, 0x013d, 6, &PlayerRecv::processPlayerHeal, 0); - -// 20150000 or near packet(SMSG_PLAYER_IDENTIFIED, 0x0179, 5, &InventoryRecv::processPlayerIdentified, 0); packet(SMSG_PLAYER_IDENTIFY_LIST, 0x0177, -1, &InventoryRecv::processPlayerIdentifyList, 0); packet(SMSG_PLAYER_INSERT_CARD, 0x017d, 7, &InventoryRecv::processPlayerInsertCard, 0); -packet(SMSG_PLAYER_INVENTORY, 0x0991, -1, &InventoryRecv::processPlayerInventory, 0); + +// 20150000 or near packet(SMSG_PLAYER_INVENTORY_REMOVE, 0x00af, 6, &InventoryRecv::processPlayerInventoryRemove, 0); packet(SMSG_PLAYER_INVENTORY_REMOVE2, 0x07fa, 8, &InventoryRecv::processPlayerInventoryRemove2, 0); packet(SMSG_PLAYER_INVENTORY_USE, 0x01c8, 13, &Ea::InventoryRecv::processPlayerInventoryUse, 0); |