summaryrefslogtreecommitdiff
path: root/npc/003-9
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2024-07-30 00:07:51 -0300
committerJesusaves <cpntb1@ymail.com>2024-07-30 00:07:51 -0300
commite6b4cc4e9adcd27248acdd8a9c01b6a1a4cef417 (patch)
tree1fbdfd7d03c23aa827c828f2710ae57e1573d65f /npc/003-9
parentb9d9ca30323376fbf85d2c3b343ac55442037eaf (diff)
downloadserverdata-e6b4cc4e9adcd27248acdd8a9c01b6a1a4cef417.tar.gz
serverdata-e6b4cc4e9adcd27248acdd8a9c01b6a1a4cef417.tar.bz2
serverdata-e6b4cc4e9adcd27248acdd8a9c01b6a1a4cef417.tar.xz
serverdata-e6b4cc4e9adcd27248acdd8a9c01b6a1a4cef417.zip
Roulette - Gambling Fedja. Limited to low payout options only for now.
Engine and time constraints. Maybe in future, you'll be able to bet on numbers as well.
Diffstat (limited to 'npc/003-9')
-rw-r--r--npc/003-9/gambler.txt166
1 files changed, 166 insertions, 0 deletions
diff --git a/npc/003-9/gambler.txt b/npc/003-9/gambler.txt
index c68d32438..ea1cc6425 100644
--- a/npc/003-9/gambler.txt
+++ b/npc/003-9/gambler.txt
@@ -177,3 +177,169 @@ OnInit:
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, 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(), "Number (1->35)"),
+ rif(is_staff(), "Tuple (1->17)"),
+ rif(is_staff(), "Row (1->11)"),
+ rif(is_staff(), "Four group (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 {
+ 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;
+ delitem CasinoCoins, .@bet;
+ // Note that "0" doesn't count toward pretty much anything
+ mesn;
+ mes l("You rolled a: %d %s", .roulette[.@val], (.@val % 2 ? "Red" : "Black"));
+
+ // What you bet is dealt like this
+ // 0 is broken
+ // 1~37 is single number, the number you're betting on
+ // 100~111 are the specials
+ // ...???????
+
+ .@no = .roulette[.@val]; // The number rolled
+
+ switch (.@wat) {
+ 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;
+ }
+
+ 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;
+}