From 862e8f821789014b6167f37976b80694d6d310e3 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 21 Apr 2017 04:44:53 +0300 Subject: Add item options into item and get it from server. --- src/net/eathena/vendingrecv.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/net/eathena/vendingrecv.cpp') diff --git a/src/net/eathena/vendingrecv.cpp b/src/net/eathena/vendingrecv.cpp index 119e5ffa9..bf0cd20eb 100644 --- a/src/net/eathena/vendingrecv.cpp +++ b/src/net/eathena/vendingrecv.cpp @@ -48,6 +48,7 @@ #include "resources/inventory/inventory.h" +#include "resources/item/itemoptionslist.h" #include "resources/item/shopitem.h" #include "utils/gettext.h" @@ -125,13 +126,16 @@ void VendingRecv::processItemsList(Net::MessageIn &msg) msg.readUInt8("refine"); for (int d = 0; d < maxCards; d ++) cards[d] = msg.readUInt16("card"); + ItemOptionsList *options = nullptr; if (msg.getVersion() >= 20150226) { + options = new ItemOptionsList; for (int d = 0; d < 5; d ++) { - msg.readInt16("option index"); - msg.readInt16("option value"); + const uint16_t idx = msg.readInt16("option index"); + const uint16_t val = msg.readInt16("option value"); msg.readUInt8("option param"); + options->add(idx, val); } } @@ -139,7 +143,11 @@ void VendingRecv::processItemsList(Net::MessageIn &msg) ShopItem *const item = mBuyDialog->addItem(itemId, type, color, amount, value); if (item) + { item->setInvIndex(index); + item->setOptions(options); + } + delete options; } mBuyDialog->sort(); } -- cgit v1.2.3-60-g2f50