summaryrefslogblamecommitdiff
path: root/npc/009-8/gambler.txt
blob: 6de6fc4554ad5f5e60c7f0c500d9ad2439cf06df (plain) (tree)

























































                                                                                                                                                     
             



                               

                                              










                                                              
                               
                                                      














                                                         
                                                    




                                   


                                               









                                       
                                                        





















                                                      
// TMW2 Scripts
// Author:
//    Jesusalva
// Description:
//    The Illegal Gambler

009-8,37,34,0	script	Illegal Gambler#009-8	NPC_PLAYER,{
    .@showMenu=true;
    goto L_Menu;

L_Menu:
    if (.@showMenu) {
        mesn;
        mesc l("Hey, welcome to Halinarzo's illegal Casino! Everything here is illegal, even the prizes, so don't blame anyone if you get scammed!");
        next;
        mesn;
        mesc l("So, do you want to play a game of Creps?!"); // ;-- TRANSLATORS, wordplay of "Craps"
        next;
        .@showMenu=false;
    }
    menu
        rif(countitem(CasinoCoins) >= 1, l("Let's play!")), L_Spin,
        l("Information"), L_Info,
        l("Leave"), L_Quit;

L_Info:
    mes "";
    mesn;
    mesc l("Chill, Creps is very similar to Craps! I'll throw two dices and you have to bet if I'll win or lose!");
    mesc l("If I get a 7 or 11 (natural) I win, and if I get a 2, 3 or 12 I lose (craps).");
    mesc l("If I get anything else, the number is my point, and rules change: Getting that number I win (point), getting a 7 I lose (craps).");
    mes "";
    mesc l("Prizes:");
    mesc l("If you guess right, you'll win 70 GP!");
    mesc l("If you're wrong, your winning streak is reset.");
    mesc l("Winning Streak is also reset on logout or when you leave the Inn.");
    mesc l("If you get %d successive right guesses, you'll get a %s!", 7, getitemlink(VneckJumper));
    mes "";
    mesc l("Sure, in regular Craps you can bet for the roll results and whatnot, but this is not Craps, this is Creps! So, are you going to play?");
    next;
    goto L_Menu;


L_Spin:
    mes "";
    mesc l("So how will ya bet, champ?!");
    select
        l("I bet on your victory!"),
        l("I bet on your defeat!");
    mes "";
    .@lose = @menu - 1;
    delitem CasinoCoins, 1;
    .@point = 0; .@result = -1;

    // Loop
    do
    {
        mesc l("Roll the dices!");
        next;
        .@c$ = any("", "red_");
        .@d1 = rand2(1,6);
        .@d2 = rand2(1,6);
        .@sc = .@d1 + .@d2;
        img(sprintf("dice/%s%d", .@c$, .@d1));
        img(sprintf("dice/%s%d", .@c$, .@d2));
        mesc l("I rolled a %d!", .@sc);

        if (!.@point) {
            // Classic rules
            if (.@sc == 7 || .@sc == 11) {
                mesc l("A natural! I win!"), 2;
                .@result = true;
            } else if (.@sc == 2 || .@sc == 3 || .@sc == 12) {
                mesc l("Craps! I lose!"), 1;
                .@result = false;
            } else {
                .@point = .@sc;
                mesc l("My point is %d!", .@point), 3;
            }
        } else {
            // Point rules
            if (.@sc == 7) {
                mesc l("Craps! I lose!"), 1;
                .@result = false;
            } else if (.@sc == .@point) {
                mesc l("I made my point! I win!"), 2;
                .@result = true;
            } // No else clause, keep rolling the dice
        }
    } while (.@result == -1);

    // Check if you won your bet
    if ((.@result && !.@lose) || (!.@result && .@lose)) {
        mesc b(l("I guess you guessed correctly!"));
        Zeny += 70;
        @craps_winstreak += 1;
        // Streak reward
        if (@craps_winstreak == 7)
            getitem VneckJumper, 1;
        // Christmas Event
        if (@craps_winstreak == 2)
            X24Event(X24_GROUP1, X24_G1_CRAPS);
        // Maybe you want another game?
        next;
        if (countitem(CasinoCoins))
            mesc l("New game?");
        else
            goto L_Quit;
        if (askyesno() == ASK_YES)
            goto L_Spin;
        goto L_Quit;
    } else {
        mesc b(l("Luck wasn't on your side today!")), 1;
        @craps_winstreak = 0;
    }
    dnext;
    goto L_Menu;

L_Quit:
    closeclientdialog;
    close;

OnInit:
    .sex = G_MALE;
    .distance = 4;
    .@npcId = getnpcid(.name$);
    setunitdata(.@npcId, UDT_HEADTOP,    TopHat);
    setunitdata(.@npcId, UDT_HEADMIDDLE, CopperArmor);
    setunitdata(.@npcId, UDT_HEADBOTTOM, JeansShorts);
    npcsit;
    end;

}