diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-03-01 18:07:04 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-03-01 18:07:04 +0300 |
commit | a91716af879291415679c807f6d2563fc078fdff (patch) | |
tree | e5dfe46798788223e3e972ecc2d677ebcf191057 /src | |
parent | 582ca3b9024277fa845aa7d5fd180b9c304b3513 (diff) | |
download | plus-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')
-rw-r--r-- | src/net/ea/buysellhandler.cpp | 18 | ||||
-rw-r--r-- | src/net/ea/buysellhandler.h | 4 | ||||
-rw-r--r-- | src/net/eathena/buysellhandler.cpp | 6 | ||||
-rw-r--r-- | src/net/eathena/buysellhandler.h | 4 | ||||
-rw-r--r-- | src/net/tmwa/buysellhandler.cpp | 18 | ||||
-rw-r--r-- | 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); |