summaryrefslogtreecommitdiff
path: root/src/net/tmwa
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-03-01 18:20:08 +0300
committerAndrei Karas <akaras@inbox.ru>2015-03-01 18:20:08 +0300
commit7a79a5fb19b07fe29112d28b8d74924e68aa007e (patch)
tree13fb4fb88157e27aae0928ad539a27fb6026cfcf /src/net/tmwa
parenta91716af879291415679c807f6d2563fc078fdff (diff)
downloadplus-7a79a5fb19b07fe29112d28b8d74924e68aa007e.tar.gz
plus-7a79a5fb19b07fe29112d28b8d74924e68aa007e.tar.bz2
plus-7a79a5fb19b07fe29112d28b8d74924e68aa007e.tar.xz
plus-7a79a5fb19b07fe29112d28b8d74924e68aa007e.zip
Move sendSellRequest from ea namespace into eathena and tmwa.
Diffstat (limited to 'src/net/tmwa')
-rw-r--r--src/net/tmwa/buysellhandler.cpp19
-rw-r--r--src/net/tmwa/buysellhandler.h4
2 files changed, 23 insertions, 0 deletions
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
diff --git a/src/net/tmwa/buysellhandler.h b/src/net/tmwa/buysellhandler.h
index f32d85669..8730cab7e 100644
--- a/src/net/tmwa/buysellhandler.h
+++ b/src/net/tmwa/buysellhandler.h
@@ -49,6 +49,10 @@ class BuySellHandler final : public MessageHandler, public Ea::BuySellHandler
const ShopItem *const item,
const int amount) const override final;
+ void sendSellRequest(const std::string &nick,
+ const ShopItem *const item,
+ const int amount) const override final;
+
protected:
static void processNpcBuy(Net::MessageIn &msg);