From ee42b631f296c9e77d4257b0f84b81f990377728 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 23 Dec 2014 01:46:26 +0300 Subject: Allow buy in market with amount > 1 for non stackable items. --- src/net/eathena/markethandler.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/net/eathena/markethandler.cpp') diff --git a/src/net/eathena/markethandler.cpp b/src/net/eathena/markethandler.cpp index d7ceeabe4..e0525753e 100644 --- a/src/net/eathena/markethandler.cpp +++ b/src/net/eathena/markethandler.cpp @@ -113,13 +113,23 @@ void MarketHandler::close() } void MarketHandler::buyItem(const int itemId, + const int type, const unsigned char color A_UNUSED, const int amount) const { + const bool nonStack = type == 4 || type == 5 || type == 7 || type == 8; + int cnt = nonStack ? amount : 1; + const int amount2 = nonStack ? 1 : amount; + if (cnt > 100) + cnt = 100; + createOutPacket(CMSG_NPC_MARKET_BUY); - outMsg.writeInt16(10, "len"); - outMsg.writeInt16(static_cast(itemId), "item id"); - outMsg.writeInt32(static_cast(amount), "amount"); + outMsg.writeInt16(4 + 6 * cnt, "len"); + for (int f = 0; f < cnt; f ++) + { + outMsg.writeInt16(static_cast(itemId), "item id"); + outMsg.writeInt32(static_cast(amount2), "amount"); + } } } // namespace EAthena -- cgit v1.2.3-60-g2f50