From a39151db799a49eac2ae0588f99a6cad23b914c3 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 7 Jan 2015 13:03:33 +0300 Subject: eathena: add partial support for packet SMSG_VENDING_ITEMS_LIST 0x0800. --- src/net/eathena/packets.h | 2 +- src/net/eathena/protocol.h | 1 + src/net/eathena/vendinghandler.cpp | 23 +++++++++++++++++++++++ src/net/eathena/vendinghandler.h | 2 ++ 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/net/eathena/packets.h b/src/net/eathena/packets.h index 8b9741ad1..63fa106d3 100644 --- a/src/net/eathena/packets.h +++ b/src/net/eathena/packets.h @@ -215,7 +215,7 @@ int16_t packet_lengths[] = //0 1 2 3 4 5 6 7 8 9 a b c d e f //0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 // #0x0800 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 20, + -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 20, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 22, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 66, 0, 0, 0, 0, 26, 0, diff --git a/src/net/eathena/protocol.h b/src/net/eathena/protocol.h index 94ffd600c..0ee9e2bf0 100644 --- a/src/net/eathena/protocol.h +++ b/src/net/eathena/protocol.h @@ -309,6 +309,7 @@ #define SMSG_VENDING_OPEN_REQ 0x012d #define SMSG_VENDING_SHOW_BOARD 0x0131 #define SMSG_VENDING_HIDE_BOARD 0x0132 +#define SMSG_VENDING_ITEMS_LIST 0x0800 #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 8a1dd2ba8..10ced1a07 100644 --- a/src/net/eathena/vendinghandler.cpp +++ b/src/net/eathena/vendinghandler.cpp @@ -37,6 +37,7 @@ VendingHandler::VendingHandler() : SMSG_VENDING_OPEN_REQ, SMSG_VENDING_SHOW_BOARD, SMSG_VENDING_HIDE_BOARD, + SMSG_VENDING_ITEMS_LIST, 0 }; handledMessages = _messages; @@ -59,6 +60,10 @@ void VendingHandler::handleMessage(Net::MessageIn &msg) processHideBoard(msg); break; + case SMSG_VENDING_ITEMS_LIST: + processItemsList(msg); + break; + default: break; } @@ -80,4 +85,22 @@ void VendingHandler::processHideBoard(Net::MessageIn &msg) msg.readInt32("owner id"); } +void VendingHandler::processItemsList(Net::MessageIn &msg) +{ + const int count = (msg.readInt16("len") - 12) / 22; + msg.readInt32("id"); + msg.readInt32("vender id"); + for (int f = 0; f < count; f ++) + { + msg.readInt32("price"); + msg.readInt16("amount"); + msg.readInt16("inv index"); + msg.readUInt8("item type"); + msg.readInt16("item id"); + msg.readUInt8("identify"); + msg.readUInt8("attribute"); + msg.readUInt8("refine"); + } +} + } // namespace EAthena diff --git a/src/net/eathena/vendinghandler.h b/src/net/eathena/vendinghandler.h index 33cca37fd..27c8ef937 100644 --- a/src/net/eathena/vendinghandler.h +++ b/src/net/eathena/vendinghandler.h @@ -43,6 +43,8 @@ class VendingHandler final : public MessageHandler, static void processShowBoard(Net::MessageIn &msg); static void processHideBoard(Net::MessageIn &msg); + + static void processItemsList(Net::MessageIn &msg); }; } // namespace EAthena -- cgit v1.2.3-70-g09d2