From 0ab403f92f7827afc45c4e07d3527a405e2e88e8 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 2 Apr 2016 21:16:34 +0300 Subject: Sort more packets. Add version checks inside packets. --- src/net/eathena/vendingrecv.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'src/net/eathena/vendingrecv.cpp') diff --git a/src/net/eathena/vendingrecv.cpp b/src/net/eathena/vendingrecv.cpp index 9750ca520..3b3b000e5 100644 --- a/src/net/eathena/vendingrecv.cpp +++ b/src/net/eathena/vendingrecv.cpp @@ -79,7 +79,17 @@ void VendingRecv::processHideBoard(Net::MessageIn &msg) void VendingRecv::processItemsList(Net::MessageIn &msg) { - const int count = (msg.readInt16("len") - 12) / 22; + int packetLen = 22; + if ((serverVersion >= 8 || serverVersion == 0) && + msg.getVersion() >= 20150226) + { + packetLen += 25; + } + int offset = 8; + if (msg.getVersion() >= 20100105) + offset += 4; + + const int count = (msg.readInt16("len") - offset) / 22; const BeingId id = msg.readBeingId("id"); const Being *const being = actorManager->findBeing(id); if (!being) @@ -87,7 +97,8 @@ void VendingRecv::processItemsList(Net::MessageIn &msg) int cards[maxCards]; CREATEWIDGETV(mBuyDialog, BuyDialog, being->getName()); mBuyDialog->setMoney(PlayerInfo::getAttribute(Attributes::MONEY)); - msg.readInt32("vender id"); + if (msg.getVersion() >= 20100105) + msg.readInt32("vender id"); for (int f = 0; f < count; f ++) { const int value = msg.readInt32("price"); @@ -103,7 +114,7 @@ void VendingRecv::processItemsList(Net::MessageIn &msg) cards[d] = 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 ++) { -- cgit v1.2.3-70-g09d2