summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-10-09 11:22:55 +0300
committerAndrei Karas <akaras@inbox.ru>2014-10-09 11:22:55 +0300
commita2ffd7da11831cc063f25ed6bb9f6be50c3b20e8 (patch)
treec522855a48126a165ab189dc2adcb0c21de6bcdc /src
parent19ba46eb71edb10615cb02d30bb8163c277a146a (diff)
downloadmanaverse-a2ffd7da11831cc063f25ed6bb9f6be50c3b20e8.tar.gz
manaverse-a2ffd7da11831cc063f25ed6bb9f6be50c3b20e8.tar.bz2
manaverse-a2ffd7da11831cc063f25ed6bb9f6be50c3b20e8.tar.xz
manaverse-a2ffd7da11831cc063f25ed6bb9f6be50c3b20e8.zip
Add missing buy fail reasons.
Diffstat (limited to 'src')
-rw-r--r--src/net/ea/buysellhandler.cpp32
-rw-r--r--src/resources/notifications.h12
-rw-r--r--src/resources/notifytypes.h3
3 files changed, 39 insertions, 8 deletions
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
diff --git a/src/resources/notifications.h b/src/resources/notifications.h
index 2cfeca286..05ef0f50c 100644
--- a/src/resources/notifications.h
+++ b/src/resources/notifications.h
@@ -42,6 +42,18 @@ namespace NotifyManager
// TRANSLATORS: notification message
N_("Unable to buy."),
NotifyFlags::EMPTY},
+ {"buy fail no money",
+ // TRANSLATORS: notification message
+ N_("Unable to buy. You not have enought money."),
+ NotifyFlags::EMPTY},
+ {"buy fail overweight",
+ // TRANSLATORS: notification message
+ N_("Unable to buy. You overweight."),
+ NotifyFlags::EMPTY},
+ {"buy fail too many items",
+ // TRANSLATORS: notification message
+ N_("Unable to buy. You have too many items."),
+ NotifyFlags::EMPTY},
{"sell empty",
// TRANSLATORS: notification message
N_("Nothing to sell."),
diff --git a/src/resources/notifytypes.h b/src/resources/notifytypes.h
index be3af93b8..e3f528e43 100644
--- a/src/resources/notifytypes.h
+++ b/src/resources/notifytypes.h
@@ -30,6 +30,9 @@ namespace NotifyTypes
NONE = 0,
BUY_DONE,
BUY_FAILED,
+ BUY_FAILED_NO_MONEY,
+ BUY_FAILED_OVERWEIGHT,
+ BUY_FAILED_TOO_MANY_ITEMS,
SELL_LIST_EMPTY,
SOLD,
SELL_FAILED,