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
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
|
// TMW2 scripts.
// Author:
// Jesusalva
// Description:
// Tulimshar Inn Receptionist
003-9,42,123,0 script Gambler Master NPC_LOF_NOBLEMAN,{
mesn;
mesq l("Hello! Welcome to the Inn! I am an Alliance officer, and I oversee gambling all over the world!");
next;
mesn;
mesq l("So how can I help you?");
do
{
next;
select
l("How does Gambling works?"),
l("How can I obtain casino coins?"),
l("Nothing, thanks.");
mes "";
switch (@menu) {
case 1:
mesn;
mesq l("You find a slot machine or another gambler, and make a bet!");
next;
mesn;
mesq l("If you're right, you'll gain more Casino Coins! And even other nice things!");
next;
mesn;
mesq l("But if you're wrong, you'll have to pay up! There's no refunds. This is gambling, if you lose you lose!");
next;
mesn;
mesq l("If you're afraid of losing everything, then DEFINITELY do not gamble. %%2");
break;
case 2:
mesn;
mesq l("I dunno. I don't think they're sold anywhere.");
next;
mesn;
mesq l("I know a few bandits stole a few, and Lava Slimes love to eat Casino Coins.");
next;
mesn;
mesq l("I've even heard of people whom dug Casino Coins out of the ground, but as I said, I don't know. But you'll certainly come across a few o your adventures!");
break;
}
} while (@menu != 3);
close;
OnInit:
.sex = G_MALE;
.distance = 5;
end;
}
003-9,40,127,0 script Gambler#003-9 NPC_FLOPPED_NOBLEMAN,{
L_Menu:
mesn;
mesc l("Hey, do you want to play a game of Black Jack?");
mesc l("You need a @@ to play.", getitemlink(CasinoCoins));
mesc l("If a tie happens, I'll give your coin back.");
next;
menu
rif(countitem(CasinoCoins) >= 1, l("Let's play!")), L_Spin,
l("Information"), L_Info,
l("Leave"), L_Close;
L_Info:
mes "";
mesc l("Rules:");
mesc l("A card will be drawn. ");
mesc l("Each card is worth its own value. Note that \"A\"ce is always worth %s.", b(l("1 point")));
mesc l("And if a Valet (\"J\") is drawn, it'll be worth 11 points. This is different from regular Black Jack!"), 1;
mes "";
mesc l("If you get a 21 you win the round. If you go over you lose. After you \"stand\", I'll make my own draws. If my value is bigger than yours, you lose as well.");
next;
mesc l("Prizes:");
mesc l("If you beat me, you get Experience and money!");
mesc l("If a tie happens, you'll get your coin back.");
mes "";
mesc l("If you get a Black Jack (21), you'll get a %s!", getitemlink(Beard));
next;
goto L_Menu;
L_Spin:
.@myScore = 0;
.@aiScore = 0;
delitem CasinoCoins, 1;
goto L_PCLoop;
L_PCLoop:
.@card = rand2(1,11);
.@myScore += .@card;
img(sprintf("cards/card%s%d", any("Clubs", "Diamonds", "Hearts", "Spades"), .@card));
mesc l("Your Score: %d", .@myScore);
if (.@myScore == 21) goto L_BlackJack;
else if (.@myScore > 21) goto L_Busted;
mes "";
select
l("Hit"),
l("Stand");
mes "";
if (@menu == 1) goto L_PCLoop;
mes "";
mesc ".:: " + l("Dealer's Turn") + " ::.", 1;
mes "";
next;
clear;
goto L_AILoop;
L_AILoop:
.@card = rand2(1,11);
.@aiScore += .@card;
img(sprintf("cards/card%s%d", any("Clubs", "Diamonds", "Hearts", "Spades"), .@card));
mesc l("Your Score: %d", .@myScore);
mesc l("Dealer Score: %d", .@aiScore);
if (.@aiScore == 21) goto L_Busted;
else if (.@aiScore > 21) goto L_Victory;
next;
// Determine if AI will hit or stand
// A good AI would never hit at 18+ when dealing first,
// or would just always hit when .@aiScore < .@myScore
// But I want it to be fun, not good.
switch (.@aiScore) {
case 20: .@rng = 0; break;
case 19: .@rng = 1; break;
case 18: .@rng = 10; break;
case 17: .@rng = 25; break;
case 16: .@rng = 35; break;
case 15: .@rng = 45; break;
case 14: .@rng = 55; break;
case 13: .@rng = 70; break;
case 12: .@rng = 80; break;
case 11: .@rng = 95; break;
default: .@rng = 100; break;
}
mes "";
if (rand2(100) < .@rng) goto L_AILoop;
mes "";
mesc ".:: " + l("Tally") + " ::.", 1;
mes "";
//next;
if (.@aiScore > .@myScore) goto L_Busted;
else if (.@myScore > .@aiScore) goto L_Victory;
else goto L_Draw;
L_BlackJack:
getitem Beard, 1;
mesc ".:: " + l("Blackjack!") + " ::.", 3;
mesc l("You have won the match.");
close;
L_Busted:
mesc ".:: " + l("Busted!") + " ::.", 1;
mesc l("You have lost the match.");
close;
L_Victory:
mesc ".:: " + l("Victory") + " ::.", 3;
mesc l("You have won the match.");
getexp 6 * BaseLevel * (1+REBIRTH), JobLevel * (1+REBIRTH);
Zeny += rand2(45, 75);
close;
L_Draw:
mesc ".:: " + l("Draw") + " ::.", 2;
mesc l("No one won the match.");
getitem CasinoCoins, 1;
close;
L_Close:
closeclientdialog;
close;
OnInit:
.sex = G_MALE;
.distance = 5;
end;
}
// Random NPC
003-9,42,130,0 script Gambling Fedja NPC_PLAYER,{
showavatar "";
mesn;
//mesq l("To be honest, the roulette is clocked. And when the repair staff came, they said something about ...???");
mesq l("Do you want to play Roulette? Note that right now, due to gambling regulations, I'm not able to offer you all the bet options.");
mes "";
tutmes l("A wheel with numbered from 0 to 36 will be spun, and you must bet on the result. The \"0\" almost always means you lose the bet. %s", "[@@https://www.deviantart.com/giromcalica/art/Roulette-Table-Transparent-447658369|table@@] [@@https://www.britannica.com/topic/roulette-gambling-game|info@@]"), l("Roulette");
if (!countitem(CasinoCoins)) close;
next;
L_Start:
setskin "";
showavatar "";
.@bet=0; // how much you're betting
.@wat=0; // what you're betting on.
.@pay=0; // Payout you have earned
clear;
mesc l("How much you'll bet? You have %s Casino Coins.", fnum(countitem(CasinoCoins)));
input .@bet, 0, min(1000, countitem(CasinoCoins));
if (.@bet < 1 || .@bet > countitem(CasinoCoins)) goto L_Quit;
L_Select:
mesc l("What do you want to bet on? Payout is noted, 1:1 will also give you %d gold per coin on bet.", 10);
select
rif(is_staff() && .@bet <= 500, "Number (1->35)"),
rif(is_staff(), "Tuple (1->17)"),
rif(is_staff(), "Row (1->11)"),
"Corner (1->8)",
"Group of 12 (1->2)",
"Column (1->2)",
"Odd/Even, Red/Black, Group of 18 (1->1)";
if (@menu >= 5) {
setskin "roulette_special";
select
"first 12",
"second 12",
"third 12",
"1 to 18",
"19 to 36",
"even",
"odd",
"red",
"black",
"column a",
"column b",
"column c";
.@wat = 99+@menu;
} else if (@menu == 4) {
setskin "roulette_corner";
select
"012:023:1245:2356:4578:5689:781011:891112:10111314:11121415:13141617:14151718:16171920:17182021:19202223:20212324:22232526:23242627:25262829:26272930:28293132:29303233:31323435:32333536";
.@wat = 199 + @menu;
} else {
setskin "roulette_number";
}
if (!.@wat) end;
L_Spin:
setskin "";
showavatar 1300;
mesn;
mes l("Press \"Roll\" when you're ready.");
select l("Roll!");
freeloop(true);
.@val=rand2(0,36);
// Display the graph
.@rolls=37*any(1,3)+.@val;
for (.@i=0;.@i<.@rolls;.@i++) {
.@cur=(.@i%37);
showavatar 1301+.@cur;
sleep2(10);
}
showavatar 1301+.@val;
if (.@bet < 1 || .@bet > countitem(CasinoCoins)) end;
delitem CasinoCoins, .@bet;
// Note that "0" doesn't count toward pretty much anything
mesn;
.@c$ = (.@val % 2 ? l("Red") : l("Black"));
if (!.@val)
.@c$=l("Green");
mes l("You rolled a: %d %s", .roulette[.@val], .@c$);
.@no = .roulette[.@val]; // The number rolled
switch (.@wat) {
// ..............
// .:: Special ::.
// ................
case 100: // 1st twelve
.@pay += (is_between(0, 12, .@no) ? .@bet*2 : 0);
break;
case 101: // 2nd twelve
.@pay += (is_between(12, 24, .@no) ? .@bet*2 : 0);
break;
case 102: // 3rd twelve
.@pay += (is_between(24, 36, .@no) ? .@bet*2 : 0);
break;
case 103: // 1 to 18
.@pay += (is_between(0, 18, .@no) ? .@bet : 0);
break;
case 104: // 19 to 36
.@pay += (is_between(18, 36, .@no) ? .@bet : 0);
break;
case 105: // even
.@pay += ((!(.@no % 2) && .@val) ? .@bet : 0);
break;
case 106: // odd
.@pay += ((.@no % 2) ? .@bet : 0);
break;
case 107: // red
.@pay += ((.@val % 2) ? .@bet : 0);
break;
case 108: // black
.@pay += ((!(.@val % 2) && .@val) ? .@bet : 0);
break;
case 109: // column A
if (.@no == 1 || .@no == 4 || .@no == 7 || .@no == 10 ||
.@no == 13 || .@no == 16 || .@no == 19 || .@no == 22 ||
.@no == 25 || .@no == 28 || .@no == 31 || .@no == 34)
.@pay += .@bet*2;
break;
case 110: // column B
if (.@no == 2 || .@no == 5 || .@no == 8 || .@no == 11 ||
.@no == 14 || .@no == 17 || .@no == 20 || .@no == 23 ||
.@no == 26 || .@no == 29 || .@no == 32 || .@no == 35)
.@pay += .@bet*2;
break;
case 111: // column C
if (.@no == 3 || .@no == 6 || .@no == 9 || .@no == 12 ||
.@no == 15 || .@no == 18 || .@no == 21 || .@no == 24 ||
.@no == 27 || .@no == 30 || .@no == 33 || .@no == 36)
.@pay += .@bet*2;
break;
// ..............
// .:: Corners ::.
// ................
case 200: // 012
if (.@no == 0 || .@no == 1 || .@no == 2)
.@pay += .@bet * 8;
break;
case 201: // 023
if (.@no == 0 || .@no == 2 || .@no == 3)
.@pay += .@bet * 8;
break;
case 202: // 1245
if (.@no == 1 || .@no == 2 || .@no == 4 || .@no == 5)
.@pay += .@bet * 8;
break;
case 203: // 2356
if (.@no == 2 || .@no == 3 || .@no == 5 || .@no == 6)
.@pay += .@bet * 8;
break;
case 204: // 4578
if (.@no == 4 || .@no == 5 || .@no == 7 || .@no == 8)
.@pay += .@bet * 8;
break;
case 205: // 5689
if (.@no == 5 || .@no == 6 || .@no == 8 || .@no == 9)
.@pay += .@bet * 8;
break;
case 206: // 781011
if (.@no == 7 || .@no == 8 || .@no == 10 || .@no == 11)
.@pay += .@bet * 8;
break;
case 207: // 891112
if (.@no == 8 || .@no == 9 || .@no == 11 || .@no == 12)
.@pay += .@bet * 8;
break;
case 208: // 10111314
if (.@no == 10 || .@no == 11 || .@no == 13 || .@no == 14)
.@pay += .@bet * 8;
break;
case 209: // 11121415
if (.@no == 11 || .@no == 12 || .@no == 14 || .@no == 15)
.@pay += .@bet * 8;
break;
case 210: // 13141617
if (.@no == 13 || .@no == 14 || .@no == 16 || .@no == 17)
.@pay += .@bet * 8;
break;
case 211: // 14151718
if (.@no == 14 || .@no == 15 || .@no == 17 || .@no == 18)
.@pay += .@bet * 8;
break;
case 212: // 16171920
if (.@no == 16 || .@no == 17 || .@no == 19 || .@no == 20)
.@pay += .@bet * 8;
break;
case 213: // 17182021
if (.@no == 17 || .@no == 18 || .@no == 20 || .@no == 21)
.@pay += .@bet * 8;
break;
case 214: // 19202223
if (.@no == 19 || .@no == 20 || .@no == 22 || .@no == 23)
.@pay += .@bet * 8;
break;
case 215: // 20212324
if (.@no == 20 || .@no == 21 || .@no == 23 || .@no == 24)
.@pay += .@bet * 8;
break;
case 216: // 22232526
if (.@no == 22 || .@no == 23 || .@no == 25 || .@no == 26)
.@pay += .@bet * 8;
break;
case 217: // 23242627
if (.@no == 23 || .@no == 24 || .@no == 26 || .@no == 27)
.@pay += .@bet * 8;
break;
case 218: // 25262829
if (.@no == 25 || .@no == 26 || .@no == 28 || .@no == 29)
.@pay += .@bet * 8;
break;
case 219: // 26272930
if (.@no == 26 || .@no == 27 || .@no == 29 || .@no == 30)
.@pay += .@bet * 8;
break;
case 220: // 28293132
if (.@no == 28 || .@no == 29 || .@no == 31 || .@no == 32)
.@pay += .@bet * 8;
break;
case 221: // 29303233
if (.@no == 29 || .@no == 30 || .@no == 32 || .@no == 33)
.@pay += .@bet * 8;
break;
case 222: // 31323435
if (.@no == 31 || .@no == 32 || .@no == 34 || .@no == 35)
.@pay += .@bet * 8;
break;
case 223: // 32333536
if (.@no == 32 || .@no == 33 || .@no == 35 || .@no == 36)
.@pay += .@bet * 8;
break;
}
if (.@pay) {
getitem CasinoCoins, .@pay;
mesc l("Congratulations! You've earned %s coins for the %d you had bet.", fnum(.@pay), .@bet), 2;
if (.@pay == .@bet)
Zeny+=.@pay * 10;
}
.@pay = 0;
mesc l("Do you want to bet again?");
menu
rif(countitem(CasinoCoins) >= .@bet, l("Yes, please repeat my bet")), L_Spin,
rif(countitem(CasinoCoins) >= .@bet, l("Yes, same amount something else")), L_Select,
l("Yes, but some other amount."), L_Start,
l("I'm cool, thanks!"), L_Quit;
close;
L_Quit:
closeclientdialog;
close;
OnInit:
setarray .roulette, 0, 32, 15, 19, 4, 21, 2, 25, 17, 34, 6, 27, 13, 36, 11, 30, 8, 23, 10, 5, 24, 16, 33, 1, 20, 14, 31, 9, 22, 18, 29, 7, 28, 12, 35, 3, 26;
.@npcId = getnpcid(.name$);
setunitdata(.@npcId, UDT_HEADTOP, TopHat);
setunitdata(.@npcId, UDT_HEADMIDDLE, GoldenLightPlatemail);
setunitdata(.@npcId, UDT_HEADBOTTOM, RaidTrousers);
.sex = G_MALE;
.distance = 4;
npcsit;
end;
}
|