From c8f7c0f5b8acdf1b1ecf48501f9468c378486d8c Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 7 Jan 2015 13:45:06 +0300 Subject: eathena: add partial support for packet SMSG_VENDING_OPEN 0x0136. --- src/net/eathena/protocol.h | 1 + src/net/eathena/vendinghandler.cpp | 26 ++++++++++++++++++++++++++ src/net/eathena/vendinghandler.h | 2 ++ 3 files changed, 29 insertions(+) diff --git a/src/net/eathena/protocol.h b/src/net/eathena/protocol.h index 33a5322fe..516358fb7 100644 --- a/src/net/eathena/protocol.h +++ b/src/net/eathena/protocol.h @@ -311,6 +311,7 @@ #define SMSG_VENDING_HIDE_BOARD 0x0132 #define SMSG_VENDING_ITEMS_LIST 0x0800 #define SMSG_VENDING_BUY_ACK 0x0135 +#define SMSG_VENDING_OPEN 0x0136 #define SMSG_ELEMENTAL_UPDATE_STATUS 0x081e #define SMSG_ELEMENTAL_INFO 0x081d diff --git a/src/net/eathena/vendinghandler.cpp b/src/net/eathena/vendinghandler.cpp index e342ccea8..8f02e4f72 100644 --- a/src/net/eathena/vendinghandler.cpp +++ b/src/net/eathena/vendinghandler.cpp @@ -39,6 +39,7 @@ VendingHandler::VendingHandler() : SMSG_VENDING_HIDE_BOARD, SMSG_VENDING_ITEMS_LIST, SMSG_VENDING_BUY_ACK, + SMSG_VENDING_OPEN, 0 }; handledMessages = _messages; @@ -69,6 +70,10 @@ void VendingHandler::handleMessage(Net::MessageIn &msg) processBuyAck(msg); break; + case SMSG_VENDING_OPEN: + processOpen(msg); + break; + default: break; } @@ -105,6 +110,8 @@ void VendingHandler::processItemsList(Net::MessageIn &msg) msg.readUInt8("identify"); msg.readUInt8("attribute"); msg.readUInt8("refine"); + for (int d = 0; d < 4; d ++) + msg.readInt16("card"); } } @@ -115,4 +122,23 @@ void VendingHandler::processBuyAck(Net::MessageIn &msg) msg.readUInt8("flag"); } +void VendingHandler::processOpen(Net::MessageIn &msg) +{ + const int count = (msg.readInt16("len") - 8) / 22; + msg.readInt32("id"); + for (int f = 0; f < count; f ++) + { + msg.readInt32("price"); + msg.readInt16("inv index"); + msg.readInt16("amount"); + msg.readUInt8("item type"); + msg.readInt16("item id"); + msg.readUInt8("identify"); + msg.readUInt8("attribute"); + msg.readUInt8("refine"); + for (int d = 0; d < 4; d ++) + msg.readInt16("card"); + } +} + } // namespace EAthena diff --git a/src/net/eathena/vendinghandler.h b/src/net/eathena/vendinghandler.h index a5b17d5fb..d29f355e1 100644 --- a/src/net/eathena/vendinghandler.h +++ b/src/net/eathena/vendinghandler.h @@ -47,6 +47,8 @@ class VendingHandler final : public MessageHandler, static void processItemsList(Net::MessageIn &msg); static void processBuyAck(Net::MessageIn &msg); + + static void processOpen(Net::MessageIn &msg); }; } // namespace EAthena -- cgit v1.2.3-70-g09d2