prontera,155,181,5 script Lotti Girl 1_F_MARIA,{
mes "[Lotti Girl]";
mes "It costs "+ .cost[1] +"x "+ getitemname( .cost[0] ) +" to play.";
mes " ";
for ( .@i = 0; .@i < 20; ++.@i )
mes $lotti_girl_ladder$[.@i];
if ( countitem( .cost[0] ) < .cost[1] ) close;
next;
if ( select( "Deal me in!", "No way..." ) == 2 ) close;
mes "[Lotti Girl]";
while ( true ) {
mes "Here we go...";
delitem .cost[0], .cost[1];
.@rand = rand(.totalchance);
.@r = 0;
while ( ( .@rand = .@rand - getd( ".p"+ .@r +"[0]" ) ) >= 0 ) .@r++;
.@size = getarraysize( getd(".p"+ .@r ) );
for ( .@i = 1; .@i < .@size; .@i += 2 )
getitem getd( ".p"+ .@r +"["+ .@i +"]" ), getd( ".p"+ .@r +"["+( .@i +1 )+"]" );
if ( getd( ".p"+ .@r +"[0]" ) < 50 ) // announce if below 50% chance
announce "Congratulations to "+strcharinfo(0)+" for getting "+ .ann$[.@r] +"!", bc_all;
if ( getd( ".p"+ .@r +"[0]" ) < 10 ) { // score the ladder if below 10% chance
copyarray $lotti_girl_ladder$[1], $lotti_girl_ladder$[0], 19;
$lotti_girl_ladder$ = strcharinfo(0) +" gains "+ .ann$[.@r] +" at "+ gettimestr( "%d/%m/%Y %H:%M %p", 21 );
}
mes " ";
mes "wanna try again ?";
next;
if ( select( "Yes", "No" ) == 2 ) close;
mes "[Lotti Girl]";
if ( countitem( .cost[0] ) < .cost[1] ) {
mes "it seems you have ran out of "+ getitemname( .cost[0] );
close;
}
}
close;
OnInit:
setarray .cost, 7227,300;
setarray .p1, 70, 607,25;
setarray .p2, 70, 13710,1;
setarray .p3, 40, 5471,1;
setarray .p4, 40, 5210,1;
setarray .p5, 40, 5224,1;
setarray .p6, 50, 2357,1, 2524,1, 2421,1, 2115,1;
setarray .p7, 25, 2701,1;
setarray .p8, 5, 2394,1;
setarray .p9, 30+30+60+60+60+50+75+95, 12214,1; // default ... the chance are added up by 100-n%
.total = 9;
freeloop true;
for ( .@i = 1; .@i <= .total; ++.@i ) {
.totalchance += getd(".p"+ .@i );
.@size = getarraysize( getd(".p"+ .@i ) );
for ( .@j = 1; .@j < .@size; .@j += 2 ) {
.ann$[.@i] += getd( ".p"+ .@i +"["+( .@j +1 )+"]" ) +"x "+ getitemname( getd( ".p"+ .@i +"["+ .@j +"]" ) );
if ( .@j < .@size -2 )
.ann$[.@i] += ",";
}
}
freeloop false;
end;
}