diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-04-02 21:16:34 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-04-02 21:16:34 +0300 |
commit | 0ab403f92f7827afc45c4e07d3527a405e2e88e8 (patch) | |
tree | 42ba407cef02e7e568bfc469d45ab3386e20edba /src/net/eathena/vendingrecv.cpp | |
parent | a08ed94e63c099467e65e98dc003b33c8e9c2034 (diff) | |
download | mv-0ab403f92f7827afc45c4e07d3527a405e2e88e8.tar.gz mv-0ab403f92f7827afc45c4e07d3527a405e2e88e8.tar.bz2 mv-0ab403f92f7827afc45c4e07d3527a405e2e88e8.tar.xz mv-0ab403f92f7827afc45c4e07d3527a405e2e88e8.zip |
Sort more packets. Add version checks inside packets.
Diffstat (limited to 'src/net/eathena/vendingrecv.cpp')
-rw-r--r-- | src/net/eathena/vendingrecv.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
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 ++) { |