From a91716af879291415679c807f6d2563fc078fdff Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 1 Mar 2015 18:07:04 +0300 Subject: Move sendBuyRequest from ea namespace into eathena and tmwa. --- src/net/ea/buysellhandler.cpp | 18 ------------------ src/net/ea/buysellhandler.h | 4 ---- src/net/eathena/buysellhandler.cpp | 6 ++++++ src/net/eathena/buysellhandler.h | 4 ++++ src/net/tmwa/buysellhandler.cpp | 18 ++++++++++++++++++ src/net/tmwa/buysellhandler.h | 4 ++++ 6 files changed, 32 insertions(+), 22 deletions(-) diff --git a/src/net/ea/buysellhandler.cpp b/src/net/ea/buysellhandler.cpp index 990ec8716..3ac4951bc 100644 --- a/src/net/ea/buysellhandler.cpp +++ b/src/net/ea/buysellhandler.cpp @@ -59,24 +59,6 @@ BuySellHandler::BuySellHandler() mBuyDialog = nullptr; } -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); -} - void BuySellHandler::sendSellRequest(const std::string &nick, const ShopItem *const item, const int amount) const diff --git a/src/net/ea/buysellhandler.h b/src/net/ea/buysellhandler.h index d3a510ec2..bc5b2f395 100644 --- a/src/net/ea/buysellhandler.h +++ b/src/net/ea/buysellhandler.h @@ -37,10 +37,6 @@ class BuySellHandler notfinal : public Net::BuySellHandler A_DELETE_COPY(BuySellHandler) - virtual void sendBuyRequest(const std::string &nick, - const ShopItem *const item, - const int amount) const override final; - virtual void sendSellRequest(const std::string &nick, const ShopItem *const item, const int amount) const override final; diff --git a/src/net/eathena/buysellhandler.cpp b/src/net/eathena/buysellhandler.cpp index 1caead3c7..37cec5e1c 100644 --- a/src/net/eathena/buysellhandler.cpp +++ b/src/net/eathena/buysellhandler.cpp @@ -136,4 +136,10 @@ void BuySellHandler::requestBuyList(const std::string &nick A_UNUSED) const { } +void BuySellHandler::sendBuyRequest(const std::string &nick A_UNUSED, + const ShopItem *const item A_UNUSED, + const int amount A_UNUSED) const +{ +} + } // namespace EAthena diff --git a/src/net/eathena/buysellhandler.h b/src/net/eathena/buysellhandler.h index f28ba322e..34e897178 100644 --- a/src/net/eathena/buysellhandler.h +++ b/src/net/eathena/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); 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); -- cgit v1.2.3-70-g09d2