diff options
Diffstat (limited to 'src/gui/windows')
-rw-r--r-- | src/gui/windows/shopwindow.cpp | 72 | ||||
-rw-r--r-- | src/gui/windows/shopwindow.h | 19 |
2 files changed, 49 insertions, 42 deletions
diff --git a/src/gui/windows/shopwindow.cpp b/src/gui/windows/shopwindow.cpp index e10197537..4cb922519 100644 --- a/src/gui/windows/shopwindow.cpp +++ b/src/gui/windows/shopwindow.cpp @@ -231,6 +231,7 @@ void ShopWindow::action(const ActionEvent &event) close(); return; } +#ifdef TMWA_SUPPORT else if (eventId == "yes") { startTrade(); @@ -244,6 +245,19 @@ void ShopWindow::action(const ActionEvent &event) player_relations.ignoreTrade(mTradeNick); mTradeNick.clear(); } + else if (eventId == "announce") + { + if (isBuySelected) + { + if (mBuyShopItems && mBuyShopItems->getNumberOfElements() > 0) + announce(mBuyShopItems, BUY); + } + else if (mSellShopItems && mSellShopItems->getNumberOfElements() > 0) + { + announce(mSellShopItems, SELL); + } + } +#endif else if (eventId == "delete") { if (isBuySelected) @@ -263,18 +277,6 @@ void ShopWindow::action(const ActionEvent &event) localPlayer->updateStatus(); } } - else if (eventId == "announce") - { - if (isBuySelected) - { - if (mBuyShopItems && mBuyShopItems->getNumberOfElements() > 0) - announce(mBuyShopItems, BUY); - } - else if (mSellShopItems && mSellShopItems->getNumberOfElements() > 0) - { - announce(mSellShopItems, SELL); - } - } else if (eventId == "tab_buy") { isBuySelected = true; @@ -387,28 +389,6 @@ void ShopWindow::action(const ActionEvent &event) } } -void ShopWindow::startTrade() -{ - if (!actorManager || !tradeWindow) - return; - - const Being *const being = actorManager->findBeingByName( - mTradeNick, ActorType::Player); - tradeWindow->clear(); - if (mTradeMoney) - { - tradeWindow->addAutoMoney(mTradeNick, mTradeMoney); - } - else - { - tradeWindow->addAutoItem(mTradeNick, mTradeItem, - mTradeItem->getQuantity()); - } - tradeHandler->request(being); - tradePartnerName = mTradeNick; - mTradeNick.clear(); -} - void ShopWindow::valueChanged(const SelectionEvent &event A_UNUSED) { updateButtonsAndLabels(); @@ -629,6 +609,7 @@ void ShopWindow::saveList() const shopFile.close(); } +#ifdef TMWA_SUPPORT void ShopWindow::announce(ShopItems *const list, const int mode) { if (!list) @@ -688,6 +669,28 @@ void ShopWindow::announce(ShopItems *const list, const int mode) chatHandler->channelMessage(TRADE_CHANNEL, data); } +void ShopWindow::startTrade() +{ + if (!actorManager || !tradeWindow) + return; + + const Being *const being = actorManager->findBeingByName( + mTradeNick, ActorType::Player); + tradeWindow->clear(); + if (mTradeMoney) + { + tradeWindow->addAutoMoney(mTradeNick, mTradeMoney); + } + else + { + tradeWindow->addAutoItem(mTradeNick, mTradeItem, + mTradeItem->getQuantity()); + } + tradeHandler->request(being); + tradePartnerName = mTradeNick; + mTradeNick.clear(); +} + void ShopWindow::giveList(const std::string &nick, const int mode) { if (!checkFloodCounter(mLastRequestTimeList)) @@ -1001,6 +1004,7 @@ bool ShopWindow::findShopItem(const ShopItem *const shopItem, } return false; } +#endif int ShopWindow::sumAmount(const Item *const shopItem) { diff --git a/src/gui/windows/shopwindow.h b/src/gui/windows/shopwindow.h index cff596f5c..09b7da951 100644 --- a/src/gui/windows/shopwindow.h +++ b/src/gui/windows/shopwindow.h @@ -118,16 +118,17 @@ class ShopWindow final : public Window, void saveList() const; - void announce(ShopItems *const list, const int mode); - - void giveList(const std::string &nick, const int mode); - +#ifdef TMWA_SUPPORT void setAcceptPlayer(const std::string &name) { mAcceptPlayer = name; } const std::string &getAcceptPlayer() const A_WARN_UNUSED { return mAcceptPlayer; } + void announce(ShopItems *const list, const int mode); + + void giveList(const std::string &nick, const int mode); + void sendMessage(const std::string &nick, std::string data, const bool random = false); @@ -135,16 +136,16 @@ class ShopWindow final : public Window, void processRequest(const std::string &nick, std::string data, const int mode); + void updateTimes(); + + static bool checkFloodCounter(int &counterTime) A_WARN_UNUSED; bool findShopItem(const ShopItem *const shopItem, const int mode) const A_WARN_UNUSED; +#endif static int sumAmount(const Item *const shopItem) A_WARN_UNUSED; - void updateTimes(); - - static bool checkFloodCounter(int &counterTime) A_WARN_UNUSED; - bool isShopEmpty() const A_WARN_UNUSED; #ifdef EATHENA_SUPPORT @@ -160,7 +161,9 @@ class ShopWindow final : public Window, #endif private: +#ifdef TMWA_SUPPORT void startTrade(); +#endif void updateSelection(); |