I didn't see any security issues, but two small things that could be handled a bit smoother.
The first is to add a check if the items bought can be carried by the player.
if (!checkweight2(@bought_nameid, @bought_quantity)) {
mes("Sorry, you can't carry all these items!");
close3;
}
The second is that if you use shop and the player has not enough zeny even though you want to pay with points, he can't put the item in the buy window. So pointshop is the better option.
- pointshop hourly_shop -1,Goldpc_Points,13534:-1.
If you use pointshop you also could omit the whole npcshopattach implementation, if you do not care about the cutin and the message boxes in between.
Putting the two above mentioned changes into you npc it could look like this:
- pointshop hourly_shop -1,Goldpc_Points,13534:-1.
prontera,156,181,5 script Hourly Point Manager::GOLDPCCAFE 10380,{
cutin("ep18_merchant.png", 2);
callshop("hourly_shop", 1);
npcshopattach("hourly_shop");
end;
OnBuyItem:
mes("[Hourly Point Manager]");
if (!checkweight2(@bought_nameid, @bought_quantity)) {
mes("Sorry, you can't carry all these items!");
close3;
}
for (.@i = 0; .@i < getarraysize(@bought_nameid); .@i++){
.@itemIndex = inarray(.Shop, @bought_nameid[.@i]);
.@costs += (.Shop[.@itemIndex + 1] * @bought_quantity[.@i]);
}
if (.@costs > Goldpc_Points) {
mes("You don't have enough Hourly Points.");
close3;
}
Goldpc_Points -= .@costs;
for(.@i = 0; .@i < getarraysize(@bought_nameid); .@i++) {
getitem(@bought_nameid[.@i], @bought_quantity[.@i]);
dispbottom("Purchased " + @bought_quantity[.@i] + " x " + getitemname(@bought_nameid[.@i]) + ".");
}
mes("Purchased successfully!");
mes("You have ^0000ff" + Goldpc_Points + "^000000 points remaining.");
close3;
OnInit:
setarray(.Shop[0], 13534, 1, 13810, 1, 14532, 1, 14606, 1, 12211, 1, 7776, 25);
npcshopitem("hourly_shop", 13534, 1, 13810, 1, 14532, 1, 14606, 1, 12211, 1, 7776, 25);
}