diff options
-rw-r--r-- | src/gui/windows/buydialog.cpp | 1 | ||||
-rw-r--r-- | src/net/eathena/markethandler.cpp | 16 | ||||
-rw-r--r-- | src/net/eathena/markethandler.h | 1 | ||||
-rw-r--r-- | src/net/markethandler.h | 1 | ||||
-rw-r--r-- | src/net/tmwa/markethandler.cpp | 1 | ||||
-rw-r--r-- | src/net/tmwa/markethandler.h | 1 |
6 files changed, 18 insertions, 3 deletions
diff --git a/src/gui/windows/buydialog.cpp b/src/gui/windows/buydialog.cpp index 4340a671f..3503bed44 100644 --- a/src/gui/windows/buydialog.cpp +++ b/src/gui/windows/buydialog.cpp @@ -453,6 +453,7 @@ void BuyDialog::action(const ActionEvent &event) else { marketHandler->buyItem(item->getId(), + item->getType(), item->getColor(), mAmountItems); } 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; diff --git a/src/net/markethandler.h b/src/net/markethandler.h index 8e31d8613..83964bd80 100644 --- a/src/net/markethandler.h +++ b/src/net/markethandler.h @@ -37,6 +37,7 @@ class MarketHandler notfinal virtual void close() = 0; virtual void buyItem(const int itemId, + const int type, const unsigned char color, const int amount) const = 0; }; diff --git a/src/net/tmwa/markethandler.cpp b/src/net/tmwa/markethandler.cpp index 4ac91a5a8..6a1a0b18d 100644 --- a/src/net/tmwa/markethandler.cpp +++ b/src/net/tmwa/markethandler.cpp @@ -52,6 +52,7 @@ void MarketHandler::close() } void MarketHandler::buyItem(const int itemId A_UNUSED, + const int type A_UNUSED, const unsigned char color A_UNUSED, const int amount A_UNUSED) const { diff --git a/src/net/tmwa/markethandler.h b/src/net/tmwa/markethandler.h index b9d1a013e..519884c1f 100644 --- a/src/net/tmwa/markethandler.h +++ b/src/net/tmwa/markethandler.h @@ -40,6 +40,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; |