summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-10-16 01:11:14 +0300
committerAndrei Karas <akaras@inbox.ru>2014-10-16 01:11:14 +0300
commit2f55a0f091153b84ddb31b32af284f0bdf96fbe7 (patch)
tree142ca21f68c57450112f774083a8e73b135e566c
parent4b891f50dfc89318321eeac176415d1bef61aca6 (diff)
downloadmanaplus-2f55a0f091153b84ddb31b32af284f0bdf96fbe7.tar.gz
manaplus-2f55a0f091153b84ddb31b32af284f0bdf96fbe7.tar.bz2
manaplus-2f55a0f091153b84ddb31b32af284f0bdf96fbe7.tar.xz
manaplus-2f55a0f091153b84ddb31b32af284f0bdf96fbe7.zip
Show errors if withdraw or deposit failed.
-rw-r--r--src/net/eathena/bankhandler.cpp12
-rw-r--r--src/resources/notifications.h9
-rw-r--r--src/resources/notifytypes.h2
3 files changed, 21 insertions, 2 deletions
diff --git a/src/net/eathena/bankhandler.cpp b/src/net/eathena/bankhandler.cpp
index 99d5cf9e9..7eb3961b1 100644
--- a/src/net/eathena/bankhandler.cpp
+++ b/src/net/eathena/bankhandler.cpp
@@ -20,11 +20,15 @@
#include "net/eathena/bankhandler.h"
+#include "notifymanager.h"
+
#include "listeners/banklistener.h"
#include "net/eathena/messageout.h"
#include "net/eathena/protocol.h"
+#include "resources/notifytypes.h"
+
#include "debug.h"
extern Net::BankHandler *bankHandler;
@@ -96,18 +100,22 @@ void BankHandler::processBankStatus(Net::MessageIn &msg)
void BankHandler::processBankDeposit(Net::MessageIn &msg)
{
- msg.readInt16("reason");
+ const int reason = msg.readInt16("reason");
const int money = static_cast<int>(msg.readInt64("money"));
msg.readInt32("balance");
BankListener::distributeEvent(money);
+ if (reason)
+ NotifyManager::notify(NotifyTypes::BANK_DEPOSIT_FAILED);
}
void BankHandler::processBankWithdraw(Net::MessageIn &msg)
{
- msg.readInt16("reason");
+ const int reason = msg.readInt16("reason");
const int money = static_cast<int>(msg.readInt64("money"));
msg.readInt32("balance");
BankListener::distributeEvent(money);
+ if (reason)
+ NotifyManager::notify(NotifyTypes::BANK_WITHDRAW_FAILED);
}
} // namespace EAthena
diff --git a/src/resources/notifications.h b/src/resources/notifications.h
index 6ccdc6a9a..0afe23d6f 100644
--- a/src/resources/notifications.h
+++ b/src/resources/notifications.h
@@ -413,6 +413,15 @@ namespace NotifyManager
{"card insert success",
// TRANSLATORS: notification message
N_("Card inserted."),
+ NotifyFlags::EMPTY},
+ {"bank deposit failed",
+ // TRANSLATORS: notification message
+ N_("Deposit failed. Probably you not have money to deposit."),
+ NotifyFlags::EMPTY},
+ {"bank withdraw failed",
+ // TRANSLATORS: notification message
+ N_("Withdraw failed. Probably you not have money "
+ "in bank for withdraw."),
NotifyFlags::EMPTY}
};
} // namespace NotifyManager
diff --git a/src/resources/notifytypes.h b/src/resources/notifytypes.h
index 3a0ca731b..a3b4e3156 100644
--- a/src/resources/notifytypes.h
+++ b/src/resources/notifytypes.h
@@ -123,6 +123,8 @@ namespace NotifyTypes
HOMUNCULUS_FEED_FAIL,
CARD_INSERT_FAILED,
CARD_INSERT_SUCCESS,
+ BANK_DEPOSIT_FAILED,
+ BANK_WITHDRAW_FAILED,
TYPE_END
};