diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-04-02 21:25:09 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-04-02 21:25:09 +0300 |
commit | 9ea600fb354e7de0b9a66dc065ca039e3f75d7f8 (patch) | |
tree | a94ca9bfd4ec2c0f671892bb5645abf8cb15e760 | |
parent | 0ab403f92f7827afc45c4e07d3527a405e2e88e8 (diff) | |
download | mv-9ea600fb354e7de0b9a66dc065ca039e3f75d7f8.tar.gz mv-9ea600fb354e7de0b9a66dc065ca039e3f75d7f8.tar.bz2 mv-9ea600fb354e7de0b9a66dc065ca039e3f75d7f8.tar.xz mv-9ea600fb354e7de0b9a66dc065ca039e3f75d7f8.zip |
Sort more packets. Add version checks inside packets.
-rw-r--r-- | src/net/eathena/packetsin.inc | 4 | ||||
-rw-r--r-- | src/net/eathena/vendingrecv.cpp | 11 |
2 files changed, 11 insertions, 4 deletions
diff --git a/src/net/eathena/packetsin.inc b/src/net/eathena/packetsin.inc index 9eb7e1868..71670e760 100644 --- a/src/net/eathena/packetsin.inc +++ b/src/net/eathena/packetsin.inc @@ -30,6 +30,7 @@ packet(SMSG_PLAYER_STATUS_CHANGE, 0x0119, 13, &BeingRecv::processPlaye packet(SMSG_SKILL_DAMAGE, 0x0114, 31, &BeingRecv::processSkillDamage, 1); packet(SMSG_SKILL_ENTRY, 0x011f, 16, &BeingRecv::processSkillEntry, 1); packet(SMSG_VENDING_ITEMS_LIST, 0x0133, -1, &VendingRecv::processItemsList, 1); +packet(SMSG_VENDING_OPEN, 0x0136, -1, &VendingRecv::processOpen, 1); packet(SMSG_SKILL_CASTING, 0x013e, 24, &BeingRecv::processSkillCasting, 1); packet(SMSG_BEING_STATUS_CHANGE, 0x0196, 9, &BeingRecv::processBeingStatusChange, 1); packet(SMSG_QUEST_LIST, 0x02b1, -1, &QuestRecv::processAddQuests, 1); @@ -645,7 +646,6 @@ packet(SMSG_VENDING_BUY_ACK, 0x0135, 7, &VendingRecv::processBuy packet(SMSG_VENDING_HIDE_BOARD, 0x0132, 6, &VendingRecv::processHideBoard, 0); // 20150000 or near -packet(SMSG_VENDING_OPEN, 0x0136, -1, &VendingRecv::processOpen, 0); packet(SMSG_VENDING_OPEN_REQ, 0x012d, 4, &VendingRecv::processOpenReq, 0); packet(SMSG_VENDING_OPEN_STATUS, 0x0a28, 3, &VendingRecv::processOpenStatus, 0); packet(SMSG_VENDING_REPORT, 0x0137, 6, &VendingRecv::processReport, 0); @@ -685,7 +685,7 @@ if (serverVersion > 0) // 20150226 if ((serverVersion >= 8 || serverVersion == 0) && packetVersion >= 20150226) { - packet(SMSG_VENDING_OPEN, 0x0136, -1, &VendingRecv::processOpen, 0); + 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); diff --git a/src/net/eathena/vendingrecv.cpp b/src/net/eathena/vendingrecv.cpp index 3b3b000e5..4c609a766 100644 --- a/src/net/eathena/vendingrecv.cpp +++ b/src/net/eathena/vendingrecv.cpp @@ -143,7 +143,14 @@ void VendingRecv::processBuyAck(Net::MessageIn &msg) void VendingRecv::processOpen(Net::MessageIn &msg) { - const int count = (msg.readInt16("len") - 8) / 22; + int packetLen = 22; + if ((serverVersion >= 8 || serverVersion == 0) && + msg.getVersion() >= 20150226) + { + packetLen += 25; + } + + const int count = (msg.readInt16("len") - 8) / packetLen; msg.readInt32("id"); for (int f = 0; f < count; f ++) { @@ -159,7 +166,7 @@ void VendingRecv::processOpen(Net::MessageIn &msg) msg.readInt16("card"); // ++ need change to msg.getVersion() if ((serverVersion >= 8 || serverVersion == 0) && - packetVersion >= 20150226) + msg.getVersion() >= 20150226) { for (int d = 0; d < 5; d ++) { |