summaryrefslogtreecommitdiff
path: root/npc/functions/banker.txt
blob: 43f6f8796af6c91f09cf1b53acfefea074106c0b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
//

function	script	Banker	{
	if (BankAccount > 0) callsub S_MoveAccount;

L_Start:
	mes "[" + @npcName$ + "]";
	mes "\"Welcome to the bank!";
	mes "How can I help you?\"";
	next;
	menu	"Deposit", L_Dep,
		"Withdraw", L_With,
		"Check my balance", L_Balance,
		"Nevermind", L_Nev;
	
L_Dep:
	mes "[" + @npcName$ + "]";
	mes "\"How much would you like to deposit?\"";
	next;
	
L_Dep_Input:
	input @Amount;
	if (@Amount >= 0) goto L_Dep_Continue;
	mes "[" + @npcName$ + "]";
	mes "\"I need a positive amount. What would you like to do?\"";
	menu	"Go back", L_Start,
		"Try again", L_Dep_Input,
		"Deposit all", L_Dep_All,
		"Quit", -;
	goto L_Nev;
	
L_Dep_All:
	set @Amount, zeny;
	
L_Dep_Continue:
	
	if (zeny < @Amount) goto L_NoMoney;
	set zeny, zeny - @Amount;
	set #BankAccount, #BankAccount + @Amount;
	goto L_Balance;
	
L_With:
	mes "[" + @npcName$ + "]";
	mes "\"How much would you like to withdraw?\"";
	next;
	
L_With_Input:
	input @Amount;
	if (@Amount >= 0) goto L_With_Continue;
	mes "[" + @npcName$ + "]";
	mes "\"I need a positive amount. What would you like to do?\"";
	menu	"Go back", L_Start,
		"Try again", L_With_Input,
		"Withdraw all", L_With_All,
		"Quit", -;
	goto L_Nev;
	
L_With_All:
	set @Amount, zeny;
	
L_With_Continue:
	
	if (#BankAccount < @Amount) goto L_NoMoney;
	set zeny, zeny + @Amount;
	set #BankAccount, #BankAccount - @Amount;
	goto L_Balance;
	
L_Balance:
	mes "[" + @npcName$ + "]";
	mes "\"Your current bank balance is:";
	mes #BankAccount + " GP\"";
	goto L_Start;
	
L_Nev:
	mes "[" + @npcName$ + "]";
	mes "\"Goodbye then.\"";
	return;
	
L_NoMoney:
	mes "[" + @npcName$ + "]";
	mes "\"Oh dear, it seems that you don't have enough money.\"";
	goto L_Start;
	
S_MoveAccount:
	set #BankAccount, #BankAccount + BankAccount;
	set BankAccount, 0;
	return;
}