It is but it's a little weird because to my knowledge items in Ragnarok don't have unique ids that are easily accessed through scripts. So for example if you have two items that are exactly the same and one is equipped and the other isn't the script may delete the equipped one and not the one in your inventory.
In any case here is version two. It's been slightly tested just let me know if you have any problems.
//Skorm 12-10-2016 v2.1
//Uses items from the inventory/equip instead of just equip.
prontera,184,177,5 script Ticket Trader 851,{
mes "[^FF0000Ticket Trader^000000]";
mes "I trade weapons and armours with specific refines for ^0000FFRefine Tickets^000000.";
next;
mes "[^FF0000Ticket Trader^000000]";
mes "Which equipment would you like me to convert into a ^0000FFRefine Ticket^000000?";
getinventorylist;
.@inv_len = @inventorylist_count;
copyarray .@inv_list_id[0], @inventorylist_id[0], .@inv_len;
copyarray .@inv_list_amt[0], @inventorylist_amount[0], .@inv_len;
copyarray .@inv_list_equ[0], @inventorylist_equip[0], .@inv_len;
copyarray .@inv_list_ref[0], @inventorylist_refine[0], .@inv_len;
copyarray .@inv_list_atr[0], @inventorylist_attribute[0], .@inv_len;
copyarray .@inv_list_cd1[0], @inventorylist_card1[0], .@inv_len;
copyarray .@inv_list_cd2[0], @inventorylist_card2[0], .@inv_len;
copyarray .@inv_list_cd3[0], @inventorylist_card3[0], .@inv_len;
copyarray .@inv_list_cd4[0], @inventorylist_card4[0], .@inv_len;
for( .@a = 0; .@a < .@inv_len; .@a++ ) {
if( .@inv_list_id[.@a] && compare(.allow_list$,","+.@inv_list_id[.@a]+",") )
set .@menu$, .@menu$+"^0000FF"+getitemname(.@inv_list_id[.@a])+(.@inv_list_ref[.@a]?" +"+.@inv_list_ref[.@a]:"")+"^000000:";
else {
set .@menu$, .@menu$+":";
.@len++;
}
}
next;
if( countstr(.@menu$, ":") >= getstrlen(.@menu$) ) {
mes "[^FF0000Ticket Trader^000000]";
mes "It doesn't look like anything you have equipped can be converted sorry.";
close;
}
select(.@menu$);
set .@eq_loc, @menu-1;
set .@eq_itm, .@inv_list_id[.@eq_loc];
set .@eg_rfn, .@inv_list_ref[.@eq_loc];
if( .@eq_itm < 0 ) {
mes "[^FF0000Ticket Trader^000000]";
mes "Hmm, I don't think you have anything equipped there.";
close;
}
.@ticket = getiteminfo(.@eq_itm,2) == 5 ? .weap_t_list[.@eg_rfn] : .armo_t_list[.@eg_rfn];
if( .@eg_rfn < .uprange || .@eg_rfn > .uprange[1] ) {
mes "[^FF0000Ticket Trader^000000]";
mes "Sorry but I only convert items refined between +"+.uprange+" and +"+.uprange[1]+".";
close;
} else if( !.@ticket ) {
mes "[^FF0000Ticket Trader^000000]";
mes "I don't seem to have a ticket for +"+.@eg_rfn+" refine.";
close;
}
mes "[^FF0000Ticket Trader^000000]";
mes "^800000"+getitemname(.@eq_itm)+" will be changed into ^0000FF"+getitemname(.@ticket)+"^000000.";
mes "Are you sure?";
next;
if( select("No:Yes") == 1 ) {
mes "[^FF0000Ticket Trader^000000]";
mes "Oh!- Well that was a close one then.";
close;
}
delitem2 .@eq_itm, .@inv_list_amt[.@eq_loc], 1, .@eg_rfn, .@inv_list_atr[.@eq_loc], .@inv_list_cd1[.@eq_loc], .@inv_list_cd2[.@eq_loc], .@inv_list_cd3[.@eq_loc], .@inv_list_cd4[.@eq_loc];
getitem(.@ticket,1);
mes "[^FF0000Ticket Trader^000000]";
mes "Have a nice day!";
close;
OnInit:
setarray .uprange, 7, 12;
setarray .armo_t_list[.uprange],6235,6234,6233,6232, 0,6239;
setarray .weap_t_list[.uprange],6231,6230,6229,6228, 0,6238;
.allow_list$ = ",1101,1102,1103,1104,1105,1106,1107,1108,1109,1110,1111,1112,2302,2304,2306,2308,2310,2311,2313,2315,2317,2318,2319,";
}
http://upaste.me/dce036854abee169c