diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-12-23 01:46:26 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-12-23 01:46:26 +0300 |
commit | ee42b631f296c9e77d4257b0f84b81f990377728 (patch) | |
tree | ccc1d65da1e39f896e1d25dda4ad851d2a57b746 /src/net/eathena | |
parent | 9be90b76adb1518c4ffe0e365a18c5afcc3158f2 (diff) | |
download | mv-ee42b631f296c9e77d4257b0f84b81f990377728.tar.gz mv-ee42b631f296c9e77d4257b0f84b81f990377728.tar.bz2 mv-ee42b631f296c9e77d4257b0f84b81f990377728.tar.xz mv-ee42b631f296c9e77d4257b0f84b81f990377728.zip |
Allow buy in market with amount > 1 for non stackable items.
Diffstat (limited to 'src/net/eathena')
-rw-r--r-- | src/net/eathena/markethandler.cpp | 16 | ||||
-rw-r--r-- | src/net/eathena/markethandler.h | 1 |
2 files changed, 14 insertions, 3 deletions
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<int16_t>(itemId), "item id"); - outMsg.writeInt32(static_cast<int16_t>(amount), "amount"); + outMsg.writeInt16(4 + 6 * cnt, "len"); + for (int f = 0; f < cnt; f ++) + { + outMsg.writeInt16(static_cast<int16_t>(itemId), "item id"); + outMsg.writeInt32(static_cast<int16_t>(amount2), "amount"); + } } } // namespace EAthena diff --git a/src/net/eathena/markethandler.h b/src/net/eathena/markethandler.h index 055023038..ee69d73aa 100644 --- a/src/net/eathena/markethandler.h +++ b/src/net/eathena/markethandler.h @@ -42,6 +42,7 @@ class MarketHandler final : public MessageHandler, void close() override final; void buyItem(const int itemId, + const int type, const unsigned char color, const int amount) const override final; |