summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-04-02 17:39:36 +0300
committerAndrei Karas <akaras@inbox.ru>2016-04-02 17:39:36 +0300
commitcd9eb5baf58e38af1393e77b81f9b37fc4246056 (patch)
tree06496134432aaff7fa39c0b9a1045012943cff24
parent3a22819ed043fd9effd09c28a9a6d476c5cbd877 (diff)
downloadmv-cd9eb5baf58e38af1393e77b81f9b37fc4246056.tar.gz
mv-cd9eb5baf58e38af1393e77b81f9b37fc4246056.tar.bz2
mv-cd9eb5baf58e38af1393e77b81f9b37fc4246056.tar.xz
mv-cd9eb5baf58e38af1393e77b81f9b37fc4246056.zip
Sort more packets. Add version checks inside packets.
-rw-r--r--src/net/eathena/inventoryrecv.cpp49
-rw-r--r--src/net/eathena/packetsin.inc8
2 files changed, 48 insertions, 9 deletions
diff --git a/src/net/eathena/inventoryrecv.cpp b/src/net/eathena/inventoryrecv.cpp
index a6515640e..8add24d77 100644
--- a/src/net/eathena/inventoryrecv.cpp
+++ b/src/net/eathena/inventoryrecv.cpp
@@ -387,9 +387,27 @@ void InventoryRecv::processPlayerStorage(Net::MessageIn &msg)
Ea::InventoryRecv::mInventoryItems.clear();
msg.readInt16("len");
- msg.readString(24, "storage name");
- const int number = (msg.getLength() - 4 - 24) / 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;
+
+ int number;
+ if (msg.getVersion() >= 20120925)
+ {
+ msg.readString(24, "storage name");
+ number = (msg.getLength() - 4 - 24) / packetLen;
+ }
+ else
+ {
+ number = (msg.getLength() - 4) / packetLen;
+ }
for (int loop = 0; loop < number; loop++)
{
@@ -397,14 +415,31 @@ void InventoryRecv::processPlayerStorage(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 (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;
Ea::InventoryRecv::mInventoryItems.push_back(Ea::InventoryItem(
index,
diff --git a/src/net/eathena/packetsin.inc b/src/net/eathena/packetsin.inc
index fdde2ef51..d9c0ef36b 100644
--- a/src/net/eathena/packetsin.inc
+++ b/src/net/eathena/packetsin.inc
@@ -153,6 +153,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_PARTY_ITEM_PICKUP, 0x02b8, 22, &PartyRecv::processPartyItemPickup, 20071002);
}
@@ -174,10 +175,12 @@ if (packetVersion >= 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);
packet(SMSG_MAP_LOGIN_SUCCESS, 0x02eb, 14, &GameRecv::processMapLogin, 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);
@@ -289,11 +292,13 @@ if (packetVersion >= 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);
+ packet(SMSG_PLAYER_STORAGE_ITEMS, 0x0995, -1, &InventoryRecv::processPlayerStorage, 20120925);
packet(SMSG_PLAYER_STORAGE_EQUIP, 0x0996, -1, &InventoryRecv::processPlayerStorageEquip, 20120925);
packet(SMSG_BEING_VIEW_EQUIPMENT, 0x0997, -1, &BeingRecv::processBeingViewEquipment, 20120925);
packet(SMSG_PLAYER_EQUIP, 0x0999, 11, &InventoryRecv::processPlayerEquip, 20120925);
}
+
// 20121010
packet(SMSG_MAP_TYPE_PROPERTY2, 0x099b, 8, &BeingRecv::processMapTypeProperty, 20121010);
@@ -508,10 +513,9 @@ packet(SMSG_PLAYER_STAT_UPDATE_4, 0x00bc, 6, &Ea::PlayerRecv::process
packet(SMSG_PLAYER_STAT_UPDATE_5, 0x00bd, 44, &PlayerRecv::processPlayerStatUpdate5, 0);
packet(SMSG_PLAYER_STAT_UPDATE_6, 0x00be, 5, &Ea::PlayerRecv::processPlayerStatUpdate6, 0);
packet(SMSG_PLAYER_STOP, 0x0088, 10, &Ea::BeingRecv::processPlayerStop, 0);
+packet(SMSG_PLAYER_STORAGE_CLOSE, 0x00f8, 2, &Ea::InventoryRecv::processPlayerStorageClose, 0);
// 20150000 or near
-packet(SMSG_PLAYER_STORAGE_CLOSE, 0x00f8, 2, &Ea::InventoryRecv::processPlayerStorageClose, 0);
-packet(SMSG_PLAYER_STORAGE_ITEMS, 0x0995, -1, &InventoryRecv::processPlayerStorage, 0);
packet(SMSG_PLAYER_STORAGE_PASSWORD, 0x023a, 4, &InventoryRecv::processPlayerStoragePassword, 0);
packet(SMSG_PLAYER_STORAGE_PASSWORD_RESULT, 0x023c, 6, &InventoryRecv::processPlayerStoragePasswordResult, 0);
packet(SMSG_PLAYER_STORAGE_REMOVE, 0x00f6, 8, &InventoryRecv::processPlayerStorageRemove, 0);