summaryrefslogtreecommitdiff
path: root/src/net/tmwa
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-03-01 18:07:04 +0300
committerAndrei Karas <akaras@inbox.ru>2015-03-01 18:07:04 +0300
commita91716af879291415679c807f6d2563fc078fdff (patch)
treee5dfe46798788223e3e972ecc2d677ebcf191057 /src/net/tmwa
parent582ca3b9024277fa845aa7d5fd180b9c304b3513 (diff)
downloadplus-a91716af879291415679c807f6d2563fc078fdff.tar.gz
plus-a91716af879291415679c807f6d2563fc078fdff.tar.bz2
plus-a91716af879291415679c807f6d2563fc078fdff.tar.xz
plus-a91716af879291415679c807f6d2563fc078fdff.zip
Move sendBuyRequest from ea namespace into eathena and tmwa.
Diffstat (limited to 'src/net/tmwa')
-rw-r--r--src/net/tmwa/buysellhandler.cpp18
-rw-r--r--src/net/tmwa/buysellhandler.h4
2 files changed, 22 insertions, 0 deletions
diff --git a/src/net/tmwa/buysellhandler.cpp b/src/net/tmwa/buysellhandler.cpp
index 2e5f79127..7a8165c89 100644
--- a/src/net/tmwa/buysellhandler.cpp
+++ b/src/net/tmwa/buysellhandler.cpp
@@ -180,4 +180,22 @@ void BuySellHandler::requestBuyList(const std::string &nick) const
}
}
+void BuySellHandler::sendBuyRequest(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("!buyitem %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 01137e5f8..f32d85669 100644
--- a/src/net/tmwa/buysellhandler.h
+++ b/src/net/tmwa/buysellhandler.h
@@ -45,6 +45,10 @@ class BuySellHandler final : public MessageHandler, public Ea::BuySellHandler
void requestBuyList(const std::string &nick)
const override final;
+ void sendBuyRequest(const std::string &nick,
+ const ShopItem *const item,
+ const int amount) const override final;
+
protected:
static void processNpcBuy(Net::MessageIn &msg);