summaryrefslogtreecommitdiff
path: root/world/map/npc/functions/banker.txt
blob: 8ecb85fba99722606c6364603bf2e52cba161df9 (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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
//

function|script|Banker|,
{
    if (BankAccount == 0)
        goto L_Start;
    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,
        "Open my storage", L_Storage,
        "Change Bank Options", L_Change,
        "Nevermind", L_Nev;
    close;

// need to close window before opening storage.
L_Storage:
    if (#BankOptions & OPT_STORAGE_CLOSE) close2;
    openstorage;
    if (#BankOptions & OPT_STORAGE_CLOSE) end;
    goto L_Start;

L_Dep:
    mes "[" + @npcname$ + "]";
    mes "\"How much would you like to deposit?\"";
    next;
    menu
        "Other", L_Dep_Input,
        "5,000 GP", L_Dep_5k,
        "10,000 GP", L_Dep_10k,
        "25,000 GP", L_Dep_25k,
        "50,000 GP", L_Dep_50k,
        "100,000 GP", L_Dep_100k,
        "250,000 GP", L_Dep_250k,
        "500,000 GP", L_Dep_500k,
        "1,000,000 GP", L_Dep_1kk,
        "All of my money", L_Dep_All,
        "I've changed my mind", L_Start,
        "Quit", -;
    return;

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,
        "Nevermind", -;
    goto L_Nev;

L_Dep_5k:
    if (Zeny<5000)
        goto L_NoMoney;
    set @Amount, 5000;
    goto L_Dep_Continue;

L_Dep_10k:
    if (Zeny<10000)
        goto L_NoMoney;
    set @Amount, 10000;
    goto L_Dep_Continue;

L_Dep_25k:
    if (Zeny<25000)
        goto L_NoMoney;
    set @Amount, 25000;
    goto L_Dep_Continue;

L_Dep_50k:
    if (Zeny<50000)
        goto L_NoMoney;
    set @Amount, 50000;
    goto L_Dep_Continue;

L_Dep_100k:
    if (Zeny<100000)
        goto L_NoMoney;
    set @Amount, 100000;
    goto L_Dep_Continue;

L_Dep_250k:
    if (Zeny<250000)
        goto L_NoMoney;
    set @Amount, 250000;
    goto L_Dep_Continue;

L_Dep_500k:
    if (Zeny<500000)
        goto L_NoMoney;
    set @Amount, 500000;
    goto L_Dep_Continue;

L_Dep_1kk:
    if (Zeny<1000000)
        goto L_NoMoney;
    set @Amount, 1000000;
    goto L_Dep_Continue;

L_Dep_All:
    if (Zeny<1)
        goto L_NoMoney;
    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?\"";
    menu
        "Other", L_With_Input,
        "5,000 GP", L_With_5k,
        "10,000 GP", L_With_10k,
        "25,000 GP", L_With_25k,
        "50,000 GP", L_With_50k,
        "100,000 GP", L_With_100k,
        "250,000 GP", L_With_250k,
        "500,000 GP", L_With_500k,
        "1,000,000 GP", L_With_1kk,
        "All of my money", L_With_All,
        "I've changed my mind", L_Start,
        "Quit", -;
    return;

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,
        "Nevermind", -;
    goto L_Nev;

L_With_5k:
    if (#BankAccount < 5000)
        goto L_NoMoney;
    set @Amount, 5000;
    goto L_With_Continue;

L_With_10k:
    if (#BankAccount < 10000)
        goto L_NoMoney;
    set @Amount, 10000;
    goto L_With_Continue;

L_With_25k:
    if (#BankAccount < 25000)
        goto L_NoMoney;
    set @Amount, 25000;
    goto L_With_Continue;

L_With_50k:
    if (#BankAccount < 50000)
        goto L_NoMoney;
    set @Amount, 50000;
    goto L_With_Continue;

L_With_100k:
    if (#BankAccount < 100000)
        goto L_NoMoney;
    set @Amount, 100000;
    goto L_With_Continue;

L_With_250k:
    if (#BankAccount < 250000)
        goto L_NoMoney;
    set @Amount, 250000;
    goto L_With_Continue;

L_With_500k:
    if (#BankAccount < 500000)
        goto L_NoMoney;
    set @Amount, 500000;
    goto L_With_Continue;

L_With_1kk:
    if (#BankAccount < 1000000)
        goto L_NoMoney;
    set @Amount, 1000000;
    goto L_With_Continue;

L_With_All:
    if (#BankAccount < 0)
        goto L_NoMoney;
    set @Amount, #BankAccount;

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\"";
    if (#BankOptions & OPT_BANK_CLOSE) close;
    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;

L_Change:
    setarray @menuitems$, "Keep the current settings", "Close NPC dialog after selecting storage option", "Close NPC dialog after checking your balance";
    if (#BankOptions & OPT_STORAGE_CLOSE) set @menuitems$[1], "Return to main menu after leaving storage";
    if (#BankOptions & OPT_BANK_CLOSE) set @menuitems$[2], "Return to main menu after leaving bank";
    menu
        @menuitems$[0], L_Start,
        @menuitems$[1], L_Change_Storage,
        @menuitems$[2], L_Change_Bank;

L_Change_Storage:
    set #BankOptions, (#BankOptions ^ OPT_STORAGE_CLOSE);
    goto L_Start;

L_Change_Bank:
    set #BankOptions, (#BankOptions ^ OPT_BANK_CLOSE);
    goto L_Start;
}