Skip to content
Permalink
Browse files
Don't allow gang bank transactions of negative values
  • Loading branch information
RussellLVP committed Jun 21, 2020
1 parent 8a53029 commit 488502b74afb11779567941a8813faec530965f8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
@@ -260,6 +260,7 @@
"GBANK_NOT_IN_GANG": "@error You need to be in a gang in order to access its bank account.",
"GBANK_NO_AVAILABLE_CASH": "@error You cannot carry more than %$ in cash.",
"GBANK_NO_AVAILABLE_BALANCE": "@error The bank is not willing to store more than %$ for your gang.",
"GBANK_NO_EMPTY_TRANSACTIONS": "@error You need to choose a positive amount of money for this transaction.",
"GBANK_BALANCE": "{2196F3}* %s's account balance is {BBDEFB}%${2196F3}. Your bank is willing to store up to {BBDEFB}%${2196F3}.",
"GBANK_STORED": "{2196F3}* You have deposited {BBDEFB}%${2196F3}. %s's new account balance is {BBDEFB}%${2196F3}.",
"GBANK_WITHDRAWN": "{2196F3}* You have withdrawn {BBDEFB}%${2196F3}. %s's new account balance is {BBDEFB}%${2196F3}.",
@@ -977,6 +977,11 @@ class GangCommands {
return;
}

if (amount <= 0) {
player.sendMessage(Message.GBANK_NO_EMPTY_TRANSACTIONS);
return;
}

const balance = await this.manager_.finance.getAccountBalance(gang.id);
const availableBalance = GangFinance.kMaximumBankAmount - balance;

@@ -1034,6 +1039,11 @@ class GangCommands {
return;
}

if (amount <= 0) {
player.sendMessage(Message.GBANK_NO_EMPTY_TRANSACTIONS);
return;
}

// Actually give |player| the money they've withdrawn.
if (!this.finance_().givePlayerCash(player, amount)) {
player.sendMessage(

0 comments on commit 488502b

Please sign in to comment.