poring_i02,108,124,4 script Badge Reward 15030,{
function chckweight;
mes .n$;
mes rand(2) ? "I'm tired as always." : "Not slacking, I hope i can still provide good stuffs.";
mes callfunc("F_Hi");
mes "I can sell you items reward from Badge Rewards, to your ^0055FF"+ #BADGEPoints +"^000000 Badge Point"+ (#BADGEPoints > 1 ? "s" : "") +".";
mes " ";
mes "Would you like to have a look at?";
next;
soundeffect "aster_die.wav",0;
.@menu = select("- Information:- Badge Rewards (^FF0000"+#BADGEPoints+"^000000):- ^777777Close^000000");
switch(.@menu) {
case 1:
mes .n$;
mes "Here...";
close;
break;
case 2:
mes "^FF0000Information:^000000";
mes "^777777 -------------------- ^000000";
mes "Total Balance : ^0055FF"+ #BADGEPoints +"^000000 Badge Point"+ (#BADGEPoints > 1 ? "s" : "") +"";
callshop "badge_shop",1;
npcshopattach "badge_shop";
dispbottom "Total of : " + #BADGEPoints + " Badge Point"+ (#BADGEPoints > 1 ? "s" : "") +"", 0xffff00;
end;
break;
case 3:
mes .n$;
mes "Alright, please come back whenever your ready.";
close;
break;
}
OnBuyItem:
setarray .@cost, 0;
for( .@i = 0; .@i < getarraysize(@bought_nameid); .@i++ ) {
.@cost += .@costs[.@i] += (.items[.@i+1] * @bought_quantity[.@i]);
mes .n$;
mes "^777777Item: ^ff0000"+ getitemname(@bought_nameid[.@i]) +"^777777";
mes "^777777Total Quantity: ^ff0000"+ @bought_quantity[.@i] +"^000000";
mes "^777777Item Price: ^ff0000"+ .@costs[.@i] +"^000000";
mes "^777777 -------------------- ^000000";
}
mes "^777777Total Price: ^009900"+ .@cost +"^000000";
next;
if(select("- Purchase:- Cancel") == 1) {
mes .n$;
if(.@cost > #BADGEPoints) {
mes "I'm sorry but you don't have enough Badge Point"+ (#BADGEPoints > 1 ? "s" : "") +".";
} else {
for( .@i = 0; .@i < getarraysize(@bought_nameid); .@i++ ) {
getitem @bought_nameid[.@i], @bought_quantity[.@i];
message strcharinfo(0), "You have purchased "+ @bought_quantity[.@i] +"x "+ getitemname(@bought_nameid[.@i]) +""+ (@bought_quantity[.@i] > 1 ? "s" : "") +".";
#BADGEPoints -= .@costs[.@i];
mes "^6E6E6EYou have purchased "+ @bought_quantity[.@i] +"x "+ getitemname(@bought_nameid[.@i]) +""+ (@bought_quantity[.@i] > 1 ? "s" : "") +".^000000";
mes "^777777 -------------------- ^000000";
}
mes "^777777Total Price: ^009900"+ .@cost +"^000000";
emotion e_cash;
next;
mes .n$;
mes "The deal has successfully completed.";
}
deletearray @bought_nameid[0], getarraysize(@bought_nameid);
deletearray @bought_quantity[0], getarraysize(@bought_quantity);
close;
} else {
mes .n$;
mes "Alright then, come back anytime you want.";
message strcharinfo(0), "Trade canceled.";
close;
}
end;
function chckweight {
if (!checkweight(getarg(0),1)) {
mes .n$;
mes "Your weight is too high.";
close;
}
return;
}
OnInit:
.n$ = "[ ^BBB6CCBadge Reward^000000 ]";
.required_ItemID = 7539;
setarray .items[0],
12114,2,
12115,2,
12116,2,
12117,2,
13891,15,
13892,15,
13893,15,
13894,15;
npcshopdelitem "badge_shop",512;
for( set .@i,0; .@i < getarraysize(.items); set .@i, .@i + 2 )
npcshopadditem "badge_shop", .items[.@i], .items[ .@i + 1 ];
}
- shop badge_shop -1,512:-1