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/traderecv.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/net/eathena/traderecv.cpp') diff --git a/src/net/eathena/traderecv.cpp b/src/net/eathena/traderecv.cpp index 03dcf62a6..2dcacc609 100644 --- a/src/net/eathena/traderecv.cpp +++ b/src/net/eathena/traderecv.cpp @@ -38,6 +38,7 @@ #include "resources/inventory/inventory.h" #include "resources/item/item.h" +#include "resources/item/itemoptionslist.h" #include "debug.h" @@ -87,13 +88,16 @@ void TradeRecv::processTradeItemAdd(Net::MessageIn &msg) int cards[maxCards]; for (int f = 0; f < maxCards; f++) cards[f] = msg.readUInt16("card"); + ItemOptionsList *options = nullptr; if (msg.getVersion() >= 20150226) { + options = new ItemOptionsList; for (int f = 0; f < 5; f ++) { - 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); } } @@ -108,6 +112,7 @@ void TradeRecv::processTradeItemAdd(Net::MessageIn &msg) tradeWindow->addItem2(type, itemType, cards, + options, 4, false, amount, @@ -119,6 +124,7 @@ void TradeRecv::processTradeItemAdd(Net::MessageIn &msg) Equipm_false); } } + delete options; } void TradeRecv::processTradeItemAddResponse(Net::MessageIn &msg) @@ -139,6 +145,7 @@ void TradeRecv::processTradeItemAddResponse(Net::MessageIn &msg) tradeWindow->addItem2(item->getId(), item->getType(), item->getCards(), + item->getOptions(), 4, true, mQuantity, -- cgit v1.2.3-70-g09d2