viewing paste lucky spin | C++

Posted on the
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
//========================================================================================
//Title: Spin the Roulette(Lucky Spin)
//Version: 1.0 //Author: Wii
//Version: 1.1 //Author: Denz
//Version: 1.2 //Author: Denz || ADDED: VIP REGISTRATION & NONE VIP
//Created: 12/24/2015
//Compatibility: rAthena | Herc | rAmod
//========================================================================================
prontera,164,174,3      script  Lucky Spin      80,{
        mes "[Daily Lucky Spin]";
        mes callfunc("F_Hi")+" "+strcharinfo(0)+"!";
        mes "Do you want to try your luck today?";
        cutin "reward",4;
        next;
        .@s = select("~ Yes!! Spin the Roulette:~ Reward List");
        if (.@s == 2) {
                mes "[Daily Lucky Spin Reward]";
                callsub S_Prize;
                callfunc("close3");
        }
        if (countitem(.lucky_ticket) < .ticket_amount) {
                mes "[Daily Lucky Spin]";
                mes "You need to Pay me ^0000FF"+.ticket_amount+"x "+getitemname(.lucky_ticket)+(Sex?"^000000 Mister!":"^000000 Miss!");
                callfunc("close3");
        }
        close2;
       
        set .@r,rand(.total_rate);
        for (.@j = 0; .@j < getarraysize($@LKS_rt); .@j++)
                if ((.@r -= $@LKS_rt[.@j]) <= 0) break;
 
        .@reward = $@LKS_pr[.@j];
        .@amount = $@LKS_am[.@j];
       
        .@round = rand(72,96);
        .@diff = .@round % 24;
        if (.@diff > .@j) {
                .@fix_round = .@diff - .@j;
                .@round -= .@fix_round;
        }
        else if (.@diff < .@j) {
                .@fix_round = .@j - .@diff;
                .@round += .@fix_round;
        }
       
        set .@max_r,24;
        set .@min_r,1;
       
        .@last = .@round - 9;
        .@speed = 500;
       
        for (set .@i,0; .@i <= .@round; .@i++) {
                .@l = .@l + 1;
                if (.@l > .@max_r)
                        .@l = .@min_r;
                cutin "reward_"+.@l,4;
                soundeffect "slot_tick.wav",0;
                if (.@speed > 50)
                        .@speed -= 50;
                if (.@i >= .@last)
                        .@speed += 100;
                sleep2 .@speed;
        }
        getitem .@reward, .@amount;
        mes "[Daily Lucky Spin]";
        mes "Congratulation !! You get ^FF0000"+getitemname(.@reward)+"^000000";               
        announce "[Lucky Spin]: "+strcharinfo(0)+" has win "+.@amount+"x "+getitemname(.@reward)+"!",bc_map,0x00FF00;
        delitem .lucky_ticket, .ticket_amount;
        callfunc("close3");
 
S_Prize:
        for (.@i = 0; .@i < getarraysize($@LKS_pr); .@i++)
                mes "- ^FF0000"+((getitemslots($@LKS_pr[.@i]))?""+getitemname($@LKS_pr[0])+"["+getitemslots($@LKS_pr[.@i])+"]":""+getitemname($@LKS_pr[.@i])+"")+"^000000";
        return;
 
OnInit:
        //SET ITEM ID LUCKY SPIN PRICE
        setarray $@LKS_pr[0],17270, 17271, 17272, 17273, 17274, 17275, 6240, 6241, 18509, 20761, 12412, 13718, 6231, 6235, 12922, 12912, 6225, 6226, 12902, 16770, 31369, 7619, 7620, 13995; //ITEM ID
 
        //SET ITEM ID LUCKY SPIN AMOUNT
        setarray $@LKS_am[0],1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1; //ITEM AMOUNT
       
        //SET ITEM ID LUCKY SPIN RATE
        setarray $@LKS_rt[0],10, 10, 10, 10, 10, 10, 5, 5, 1, 1, 20, 20, 5, 5, 20, 10, 5, 5, 10, 10, 1, 20, 20, 20;
       
        for (.@i = 0; .@i < getarraysize($@LKS_rt); .@i++)
                .total_rate = .total_rate + $@LKS_rt[.@i];
        //debugmes "total rate: "+.total_rate;
       
        .lucky_ticket = 22869; // item id that will be used for ticket to roll lucky spin
        .ticket_amount = 1; // amount of lucky_ticket needed to spin
        end;
}
Viewed 463 times, submitted by lizblood97.