From 7a79a5fb19b07fe29112d28b8d74924e68aa007e Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 1 Mar 2015 18:20:08 +0300 Subject: Move sendSellRequest from ea namespace into eathena and tmwa. --- src/net/tmwa/buysellhandler.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/net/tmwa/buysellhandler.cpp') diff --git a/src/net/tmwa/buysellhandler.cpp b/src/net/tmwa/buysellhandler.cpp index 7a8165c89..bbf5ca3e7 100644 --- a/src/net/tmwa/buysellhandler.cpp +++ b/src/net/tmwa/buysellhandler.cpp @@ -198,4 +198,23 @@ void BuySellHandler::sendBuyRequest(const std::string &nick, chatWindow->addWhisper(nick, data, ChatMsgType::BY_PLAYER); } +void BuySellHandler::sendSellRequest(const std::string &nick, + const ShopItem *const item, + const int amount) const +{ + if (!chatWindow || nick.empty() || !item || + amount < 1 || amount > item->getQuantity()) + { + return; + } + + const std::string data = strprintf("!sellitem %d %d %d", + item->getId(), item->getPrice(), amount); + + if (config.getBoolValue("hideShopMessages")) + chatHandler->privateMessage(nick, data); + else + chatWindow->addWhisper(nick, data, ChatMsgType::BY_PLAYER); +} + } // namespace TmwAthena -- cgit v1.2.3-60-g2f50