From a2ffd7da11831cc063f25ed6bb9f6be50c3b20e8 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 9 Oct 2014 11:22:55 +0300 Subject: Add missing buy fail reasons. --- src/net/ea/buysellhandler.cpp | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) (limited to 'src/net') diff --git a/src/net/ea/buysellhandler.cpp b/src/net/ea/buysellhandler.cpp index f2252d1fe..14378de4a 100644 --- a/src/net/ea/buysellhandler.cpp +++ b/src/net/ea/buysellhandler.cpp @@ -170,18 +170,34 @@ void BuySellHandler::processNpcSell(Net::MessageIn &msg) const void BuySellHandler::processNpcBuyResponse(Net::MessageIn &msg) const { - if (msg.readUInt8("response") == 0U) + const uint8_t response = msg.readUInt8("response"); + if (response == 0U) { NotifyManager::notify(NotifyTypes::BUY_DONE); + return; } - else + // Reset player money since buy dialog already assumed purchase + // would go fine + if (mBuyDialog) + mBuyDialog->setMoney(PlayerInfo::getAttribute(Attributes::MONEY)); + switch (response) { - // Reset player money since buy dialog already assumed purchase - // would go fine - if (mBuyDialog) - mBuyDialog->setMoney(PlayerInfo::getAttribute(Attributes::MONEY)); - NotifyManager::notify(NotifyTypes::BUY_FAILED); - } + case 1: + NotifyManager::notify(NotifyTypes::BUY_FAILED_NO_MONEY); + break; + + case 2: + NotifyManager::notify(NotifyTypes::BUY_FAILED_OVERWEIGHT); + break; + + case 3: + NotifyManager::notify(NotifyTypes::BUY_FAILED_TOO_MANY_ITEMS); + break; + + default: + NotifyManager::notify(NotifyTypes::BUY_FAILED); + break; + }; } } // namespace Ea -- cgit v1.2.3-60-g2f50