//===== eAthena Script ======================================= //= Custom-Currency Multi-Shop //===== By: ================================================== //= Euphy //===== Current Version: ===================================== //= 1.2 [mod] //= Uses variables instead of item currency. //===== Description: ========================================= //= Allows for better organization in a single shop call. //= Note that there are two configuration areas. //============================================================ // -------------------- Config 1 -------------------- // For each shop added, copy this MSHOPX dummy data. // Write your shop names in the select() function. - shop MSHOP1 -1,512:-1 - shop MSHOP2 -1,512:-1 prontera,163,174,4 script A Shop 984,{ set @s, select("Weapons:Headgears"); // -------------------------------------------------- message strcharinfo(0),"This shop only accepts "+.CurrencyName$[@s]+"."; dispbottom "You have "+getd(.Currency$[@s])+" "+.CurrencyName$[@s]+"."; callshop "MSHOP"+@s,1; npcshopattach "MSHOP"+@s; end; OnBuyItem: set .@i,0; while (.@i < getarraysize(@bought_nameid)) { set .@j, 0; while (.@j < getarraysize(getd(".Shop"+@s))) { if(getd(".Shop"+@s+"["+.@j+"]") == @bought_nameid[.@i]) { set @itemcost, (getd(".Shop"+@s+"["+(.@j+1)+"]") * @bought_quantity[.@i]); set @totalcost, @totalcost + @itemcost; break; } set .@j, .@j+2; } set .@i, .@i+1; } if (@totalcost > getd(.Currency$[@s])) dispbottom "You don't have enough "+.CurrencyName$[@s]+"."; else { set .@i,0; while (.@i < getarraysize(@bought_nameid)) { getitem @bought_nameid[.@i], @bought_quantity[.@i]; dispbottom "Purchased "+@bought_quantity[.@i]+"x "+getitemname(@bought_nameid[.@i])+"."; set .@i, .@i+1; } set getd(.Currency$[@s]), getd(.Currency$[@s])-@totalcost; } set @totalcost, 0; deletearray @bought_nameid[0], 128; deletearray @bought_quantity[0], 128; end; OnInit: // -------------------- Config 2 -------------------- // Currency: The variable to use, // in the same order as the shops. // Currency Name: The name to display. // Shop order follows that of the select() call, // and is formatted "ID1,Count1,ID2,Count2,..." setarray .Currency$[1],"#CASHPOINTS","#KAFRAPOINTS"; setarray .CurrencyName$[1],"Cash Points","Kafra Points"; setarray .Shop1[0],1202,5,1229,20; setarray .Shop2[0],5116,15; // -------------------------------------------------- set .@i,1; while (.@i <= getarraysize(.Currency$)) { set .@j,0; while (.@j < getarraysize(getd(".Shop"+.@i))) { npcshopdelitem "MSHOP"+.@i,512; npcshopadditem "MSHOP"+.@i, getd(".Shop"+.@i+"["+.@j+"]"), getd(".Shop"+.@i+"["+(.@j+1)+"]"); set .@j, .@j+2; } set .@i, .@i+1; } end; }