prontera,160,178,5 script asdjhkajd 1_F_MARIA,{
mes "I can trade various item into TCG";
next;
.@s = select(.menu$) -1;
if ( Zeny < getd( ".option"+ .@s +"[1]" ) ) {
mes "You don't have enough Zeny";
close;
}
for ( .@i = 2; .@i < getd( ".option"+ .@s +"size" ); .@i += 2 ) {
if ( countitem( getd( ".option"+ .@s +"["+ .@i +"]" ) ) < getd( ".option"+ .@s +"["+( .@i +1 )+"]" ) ) {
mes "You do not have enough materials";
close;
}
}
Zeny -= getd( ".option"+ .@s +"[1]" );
for ( .@i = 2; .@i < getd( ".option"+ .@s +"size" ); .@i += 2 )
delitem getd( ".option"+ .@s +"["+ .@i +"]" ), getd( ".option"+ .@s +"["+( .@i +1 )+"]" );
getitem TCG_Card, getd( ".option"+ .@s );
mes "Here you go";
close;
OnInit:
// setarray .option#, <TCG given>, <zeny cost>, <req item ID 1 >, <req item 1 amount>, <req item ID 2>, ....
setarray .option0, 1, 5000000, Poring_Card, 50;
setarray .option1, 10, 5000000, Tao_Gunka_Card, 1;
setarray .option2, 20, 5000000, Ifrit_Card, 1;
setarray .option3, 30, 0, Sealed_Gloom_Card, 1;
while( getd( ".option"+ .totaloption ) ) {
setd ".option"+ .totaloption +"size", getarraysize( getd( ".option"+ .totaloption ) );
.@tmp$ = ""; .@j = 0;
for ( .@i = 2; .@i < getd( ".option"+ .totaloption +"size" ); .@i += 2 ) {
.@tmp$[.@j] = getd( ".option"+ .totaloption +"["+( .@i +1 )+"]" ) +" "+ getitemname( getd( ".option"+ .totaloption +"["+ .@i +"]" ) );
.@j++;
}
.menu$ = .menu$ + implode( .@tmp$, " + " ) + ( getd( ".option"+ .totaloption +"[1]" )? " + "+ getd( ".option"+ .totaloption +"[1]" ) +" Zeny" : "" ) + " = " + getd( ".option"+ .totaloption ) +" TCG:";
.totaloption++;
}
end;
}