prontera,155,185,4 script Card trader 2_VENDING_MACHINE1,{
mes "[Card trader]";
mes "Please select the card you wish to trade.";
getinventorylist;
for ( .@i = 0; .@i < @inventorylist_count; ++.@i ) {
if ( getiteminfo( @inventorylist_id[.@i], ITEMINFO_TYPE ) == IT_CARD ) {
.@menu$ += getitemname( @inventorylist_id[.@i] ) +":";
.@cardid[.@c++] = @inventorylist_id[.@i];
}
}
.@menu$ += "No Card - Close";
next;
.@s = select( .@menu$ ) -1;
if ( .@s == .@c ) close;
while ( .@cardid[.@s] != .mvpcardid[.@i] && .@i < .mvpcards ) { ++.@i; }
if ( .@i < .mvpcards )
.@rate = 3;
else
.@rate = 1;
mes "[Card trader]";
dispbottom countitem( .@cardid[.@s] ) +"";
if ( countitem( .@cardid[.@s] ) > 1 ) {
mes "Input how many you want to trade ?";
next;
input .@amount, 0, countitem( .@cardid[.@s] );
if ( !.@amount ) close;
mes "[Card trader]";
mes "Are you sure you want to trade";
mes .@amount +"x "+ getitemname( .@cardid[.@s] );
mes " for "+( .@rate * .@amount )+" Poring Coins ?";
}
else {
.@amount = 1;
mes "Are you sure you want to trade a "+ getitemname( .@cardid[.@s] ) +" for "+ .@rate +" Poring Coins ?";
}
next;
if ( select ( "Yes.", "No" ) == 2 ) close;
delitem .@cardid[.@s], .@amount;
getitem Poring_Coin, .@rate * .@amount;
close;
OnInit:
.mvpcards = query_sql("select item_db.id from item_db right join mob_db on item_db.id = mob_db.dropcardid where mexp > 0 and type = 6 group by name_japanese;", .mvpcardid);
end;
}