diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-04-03 00:06:52 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-04-03 00:06:52 +0300 |
commit | ff938a161709b376a09f4310b984d7f0e30a7e8f (patch) | |
tree | 6020ba1c46fb95075dcc4ed1bedae6be0237bfa5 /src/net/eathena | |
parent | a72f322477d04f12b6c666837945b0ed94ee5d67 (diff) | |
download | manaverse-ff938a161709b376a09f4310b984d7f0e30a7e8f.tar.gz manaverse-ff938a161709b376a09f4310b984d7f0e30a7e8f.tar.bz2 manaverse-ff938a161709b376a09f4310b984d7f0e30a7e8f.tar.xz manaverse-ff938a161709b376a09f4310b984d7f0e30a7e8f.zip |
Sort more packets. Add version checks inside packets.
Diffstat (limited to 'src/net/eathena')
-rw-r--r-- | src/net/eathena/inventoryrecv.cpp | 52 | ||||
-rw-r--r-- | src/net/eathena/packetsin.inc | 4 |
2 files changed, 40 insertions, 16 deletions
diff --git a/src/net/eathena/inventoryrecv.cpp b/src/net/eathena/inventoryrecv.cpp index 7a99ad717..0887dfbeb 100644 --- a/src/net/eathena/inventoryrecv.cpp +++ b/src/net/eathena/inventoryrecv.cpp @@ -944,18 +944,22 @@ void InventoryRecv::processPlayerCartEquip(Net::MessageIn &msg) { BLOCK_START("InventoryRecv::processPlayerCartEquip") msg.readInt16("len"); - 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++) { const int index = msg.readInt16("index") - INVENTORY_OFFSET; @@ -963,15 +967,28 @@ void InventoryRecv::processPlayerCartEquip(Net::MessageIn &msg) const ItemTypeT itemType = static_cast<ItemTypeT>( msg.readUInt8("item type")); const int amount = 1; - msg.readInt32("location"); - msg.readInt32("wear state"); + if (msg.getVersion() >= 20120925) + { + msg.readInt32("location"); + msg.readInt32("wear state"); + } + else + { + msg.readUInt8("identified"); + msg.readInt16("location"); + msg.readInt16("wear state"); + msg.readUInt8("is damaged"); + } const uint8_t refine = msg.readUInt8("refine level"); int cards[maxCards]; for (int f = 0; f < maxCards; f++) cards[f] = msg.readInt16("card"); - msg.readInt32("hire expire date"); - msg.readInt16("bind on equip"); - msg.readInt16("sprite"); + if (msg.getVersion() >= 20071002) + msg.readInt32("hire expire date"); + if (msg.getVersion() >= 20080102) + msg.readInt16("bind on equip"); + if (msg.getVersion() >= 20100629) + msg.readInt16("sprite"); if ((serverVersion >= 8 || serverVersion == 0) && msg.getVersion() >= 20150226) { @@ -984,7 +1001,10 @@ void InventoryRecv::processPlayerCartEquip(Net::MessageIn &msg) } } 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, diff --git a/src/net/eathena/packetsin.inc b/src/net/eathena/packetsin.inc index bec8aa983..6a061978b 100644 --- a/src/net/eathena/packetsin.inc +++ b/src/net/eathena/packetsin.inc @@ -33,6 +33,7 @@ packet(SMSG_PLAYER_STORAGE_ADD, 0x00f4, 21, &InventoryRecv::processP packet(SMSG_PLAYER_STATUS_CHANGE, 0x0119, 13, &BeingRecv::processPlayerStatusChange, 1); packet(SMSG_SKILL_DAMAGE, 0x0114, 31, &BeingRecv::processSkillDamage, 1); packet(SMSG_SKILL_ENTRY, 0x011f, 16, &BeingRecv::processSkillEntry, 1); +packet(SMSG_PLAYER_CART_EQUIP, 0x0122, -1, &InventoryRecv::processPlayerCartEquip, 1); packet(SMSG_PLAYER_CART_ADD, 0x0124, 21, &InventoryRecv::processPlayerCartAdd, 1); packet(SMSG_VENDING_ITEMS_LIST, 0x0133, -1, &VendingRecv::processItemsList, 1); packet(SMSG_VENDING_OPEN, 0x0136, -1, &VendingRecv::processOpen, 1); @@ -422,6 +423,7 @@ if (packetVersion >= 20071002) packet(SMSG_PLAYER_INVENTORY, 0x01ee, -1, &InventoryRecv::processPlayerInventory, 20071002); packet(SMSG_PLAYER_CART_ITEMS, 0x01ef, -1, &InventoryRecv::processPlayerCartItems, 20071002); packet(SMSG_PLAYER_STORAGE_ITEMS, 0x0295, -1, &InventoryRecv::processPlayerStorage, 20071002); + packet(SMSG_PLAYER_CART_EQUIP, 0x0297, -1, &InventoryRecv::processPlayerCartEquip, 20071002); packet(SMSG_PARTY_ITEM_PICKUP, 0x02b8, 22, &PartyRecv::processPartyItemPickup, 20071002); packet(SMSG_PLAYER_INVENTORY_ADD, 0x02d4, 29, &InventoryRecv::processPlayerInventoryAdd, 20071002); } @@ -443,6 +445,7 @@ packet(SMSG_BEING_ACTION2, 0x02e1, 33, &BeingRecv::processBeing if (packetVersion >= 20080102) { packet(SMSG_PLAYER_EQUIPMENT, 0x02d0, -1, &InventoryRecv::processPlayerEquipment, 20080102); + packet(SMSG_PLAYER_CART_EQUIP, 0x02d2, -1, &InventoryRecv::processPlayerCartEquip, 20080102); packet(SMSG_PLAYER_INVENTORY, 0x02e8, -1, &InventoryRecv::processPlayerInventory, 20080102); packet(SMSG_PLAYER_CART_ITEMS, 0x02e9, -1, &InventoryRecv::processPlayerCartItems, 20080102); packet(SMSG_PLAYER_STORAGE_ITEMS, 0x02ea, -1, &InventoryRecv::processPlayerStorage, 20080102); @@ -561,6 +564,7 @@ if (packetVersion >= 20100608) if (packetVersion >= 20100629) { packet(SMSG_PLAYER_EQUIPMENT, 0x02d0, -1, &InventoryRecv::processPlayerEquipment, 20100629); + packet(SMSG_PLAYER_CART_EQUIP, 0x02d2, -1, &InventoryRecv::processPlayerCartEquip, 20100629); } // 20100701 |