diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-03-01 18:20:08 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-03-01 18:20:08 +0300 |
commit | 7a79a5fb19b07fe29112d28b8d74924e68aa007e (patch) | |
tree | 13fb4fb88157e27aae0928ad539a27fb6026cfcf /src | |
parent | a91716af879291415679c807f6d2563fc078fdff (diff) | |
download | manaplus-7a79a5fb19b07fe29112d28b8d74924e68aa007e.tar.gz manaplus-7a79a5fb19b07fe29112d28b8d74924e68aa007e.tar.bz2 manaplus-7a79a5fb19b07fe29112d28b8d74924e68aa007e.tar.xz manaplus-7a79a5fb19b07fe29112d28b8d74924e68aa007e.zip |
Move sendSellRequest from ea namespace into eathena and tmwa.
Diffstat (limited to 'src')
-rw-r--r-- | src/net/ea/buysellhandler.cpp | 29 | ||||
-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 | 19 | ||||
-rw-r--r-- | src/net/tmwa/buysellhandler.h | 4 |
6 files changed, 34 insertions, 32 deletions
diff --git a/src/net/ea/buysellhandler.cpp b/src/net/ea/buysellhandler.cpp index 3ac4951bc..8af3cb4f0 100644 --- a/src/net/ea/buysellhandler.cpp +++ b/src/net/ea/buysellhandler.cpp @@ -22,7 +22,6 @@ #include "net/ea/buysellhandler.h" -#include "configuration.h" #include "inventory.h" #include "notifymanager.h" @@ -30,19 +29,12 @@ #include "enums/being/attributes.h" -#include "gui/windows/chatwindow.h" +#include "gui/windows/buydialog.h" #include "gui/windows/buyselldialog.h" #include "gui/windows/npcselldialog.h" -#include "gui/windows/buydialog.h" -#include "gui/windows/shopwindow.h" - -#include "net/chathandler.h" - #include "net/ea/eaprotocol.h" -#include "utils/timer.h" - #include "resources/notifytypes.h" #include "debug.h" @@ -59,25 +51,6 @@ BuySellHandler::BuySellHandler() mBuyDialog = nullptr; } -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); -} - void BuySellHandler::processNpcBuySellChoice(Net::MessageIn &msg) { if (!BuySellDialog::isActive()) diff --git a/src/net/ea/buysellhandler.h b/src/net/ea/buysellhandler.h index bc5b2f395..e972b1208 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 sendSellRequest(const std::string &nick, - const ShopItem *const item, - const int amount) const override final; - protected: static void processNpcBuySellChoice(Net::MessageIn &msg); diff --git a/src/net/eathena/buysellhandler.cpp b/src/net/eathena/buysellhandler.cpp index 37cec5e1c..1d1b81788 100644 --- a/src/net/eathena/buysellhandler.cpp +++ b/src/net/eathena/buysellhandler.cpp @@ -142,4 +142,10 @@ void BuySellHandler::sendBuyRequest(const std::string &nick A_UNUSED, { } +void BuySellHandler::sendSellRequest(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 34e897178..5e09d0abe 100644 --- a/src/net/eathena/buysellhandler.h +++ b/src/net/eathena/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); 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); |