summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-04-02 23:44:39 +0300
committerAndrei Karas <akaras@inbox.ru>2016-04-02 23:44:39 +0300
commita72f322477d04f12b6c666837945b0ed94ee5d67 (patch)
treec9b9d2b9217a9860e9cf2a2c99fb63777a1a0e37
parentc2b28b1860ce02a4e9b9b6694e801de83652440e (diff)
downloadplus-a72f322477d04f12b6c666837945b0ed94ee5d67.tar.gz
plus-a72f322477d04f12b6c666837945b0ed94ee5d67.tar.bz2
plus-a72f322477d04f12b6c666837945b0ed94ee5d67.tar.xz
plus-a72f322477d04f12b6c666837945b0ed94ee5d67.zip
Sort more packets. Add version checks inside packets.
-rw-r--r--src/net/eathena/inventoryrecv.cpp53
-rw-r--r--src/net/eathena/packetsin.inc10
2 files changed, 44 insertions, 19 deletions
diff --git a/src/net/eathena/inventoryrecv.cpp b/src/net/eathena/inventoryrecv.cpp
index 9587da970..7a99ad717 100644
--- a/src/net/eathena/inventoryrecv.cpp
+++ b/src/net/eathena/inventoryrecv.cpp
@@ -110,18 +110,22 @@ void InventoryRecv::processPlayerEquipment(Net::MessageIn &msg)
Ea::InventoryRecv::mEquips.clear();
equipment->setBackend(&Ea::InventoryRecv::mEquips);
}
- 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++)
{
@@ -129,15 +133,29 @@ void InventoryRecv::processPlayerEquipment(Net::MessageIn &msg)
const int itemId = msg.readInt16("item id");
const ItemTypeT itemType = static_cast<ItemTypeT>(
msg.readUInt8("item type"));
- msg.readInt32("location");
- const int equipType = msg.readInt32("wear state");
+ int equipType;
+ if (msg.getVersion() >= 20120925)
+ {
+ msg.readInt32("location");
+ equipType = msg.readInt32("wear state");
+ }
+ else
+ {
+ msg.readUInt8("identified");
+ msg.readInt16("location");
+ equipType = msg.readInt16("wear state");
+ msg.readUInt8("is damaged");
+ }
const uint8_t refine = CAST_U8(msg.readInt8("refine"));
int cards[maxCards];
for (int f = 0; f < maxCards; f++)
cards[f] = msg.readInt16("card");
- msg.readInt32("hire expire date (?)");
- msg.readInt16("equip type");
- msg.readInt16("item sprite number");
+ if (msg.getVersion() >= 20071002)
+ msg.readInt32("hire expire date (?)");
+ if (msg.getVersion() >= 20080102)
+ msg.readInt16("equip type");
+ if (msg.getVersion() >= 20100629)
+ msg.readInt16("item sprite number");
if ((serverVersion >= 8 || serverVersion == 0) &&
msg.getVersion() >= 20150226)
{
@@ -150,7 +168,10 @@ void InventoryRecv::processPlayerEquipment(Net::MessageIn &msg)
}
}
ItemFlags flags;
- flags.byte = msg.readUInt8("flags");
+ if (msg.getVersion() >= 20120925)
+ flags.byte = msg.readUInt8("flags");
+ else
+ flags.byte = 0;
if (inventory)
{
inventory->setItem(index,
diff --git a/src/net/eathena/packetsin.inc b/src/net/eathena/packetsin.inc
index d8256e53e..bec8aa983 100644
--- a/src/net/eathena/packetsin.inc
+++ b/src/net/eathena/packetsin.inc
@@ -24,6 +24,7 @@
packet(SMSG_BEING_FAKE_NAME, 0x0078, 54, &BeingRecv::processBeingFakeName, 1);
packet(SMSG_WHISPER, 0x0097, -1, &ChatRecv::processWhisper, 1);
packet(SMSG_WHISPER_RESPONSE, 0x0098, 3, &ChatRecv::processWhisperResponse, 1);
+packet(SMSG_PLAYER_EQUIPMENT, 0x00a4, -1, &InventoryRecv::processPlayerEquipment, 1);
packet(SMSG_BEING_CHANGE_LOOKS_OUTDATED, 0x00c3, 8, nullptr, 1);
packet(SMSG_TRADE_REQUEST, 0x00e5, 26, &TradeRecv::processTradeRequest, 1);
packet(SMSG_TRADE_ITEM_ADD, 0x00e9, 19, &TradeRecv::processTradeItemAdd, 1);
@@ -441,6 +442,7 @@ packet(SMSG_BEING_ACTION2, 0x02e1, 33, &BeingRecv::processBeing
// 20080102
if (packetVersion >= 20080102)
{
+ packet(SMSG_PLAYER_EQUIPMENT, 0x02d0, -1, &InventoryRecv::processPlayerEquipment, 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);
@@ -448,7 +450,6 @@ if (packetVersion >= 20080102)
packet(SMSG_BEING_FONT, 0x02ef, 8, &BeingRecv::processBeingFont, 20080102);
}
-
// 20080318
packet(SMSG_NPC_SHOW_PROGRESS_BAR, 0x02f0, 10, &NpcRecv::processNpcShowProgressBar, 20080318);
packet(SMSG_NPC_PROGRESS_BAR_ABORT, 0x02f2, 2, &NpcRecv::processProgressBarAbort, 20080318);
@@ -557,6 +558,11 @@ if (packetVersion >= 20100608)
packet(SMSG_SEARCHSTORE_CLICK_ACK, 0x083d, 6, &SearchStoreRecv::processSearchClickAck, 20100608);
}
+if (packetVersion >= 20100629)
+{
+ packet(SMSG_PLAYER_EQUIPMENT, 0x02d0, -1, &InventoryRecv::processPlayerEquipment, 20100629);
+}
+
// 20100701
if (packetVersion >= 20100701)
{
@@ -618,7 +624,6 @@ if (packetVersion >= 20120925)
packet(SMSG_PLAYER_UNEQUIP, 0x099a, 9, &InventoryRecv::processPlayerUnEquip, 20120925);
}
-
// 20121010
packet(SMSG_MAP_TYPE_PROPERTY2, 0x099b, 8, &BeingRecv::processMapTypeProperty, 20121010);
@@ -704,7 +709,6 @@ if ((serverVersion >= 8 || serverVersion == 0) && packetVersion >= 20150226)
{
packet(SMSG_VENDING_OPEN, 0x0136, -1, &VendingRecv::processOpen, 20150226);
packet(SMSG_VENDING_ITEMS_LIST, 0x0800, -1, &VendingRecv::processItemsList, 20150226);
-
packet(SMSG_TRADE_ITEM_ADD, 0x0a09, 45, &TradeRecv::processTradeItemAdd, 20150226);
packet(SMSG_PLAYER_STORAGE_ADD, 0x0a0a, 47, &InventoryRecv::processPlayerStorageAdd, 20150226);
packet(SMSG_PLAYER_CART_ADD, 0x0a0b, 47, &InventoryRecv::processPlayerCartAdd, 20150226);