55public class SkillcapeStore
extends Store {
57 private final StoreItem[] items =
Skillcape.getItems();
59 public SkillcapeStore() {
61 this.container.setItems(items,
true);
62 Arrays.stream(items).filter(Objects::nonNull).forEach(item -> itemCache.put(item.getId(), item.getAmount()));
66 public void itemContainerAction(
Player player,
int id,
int slot,
int action,
boolean purchase) {
70 this.sendPurchaseValue(player, slot);
74 int amount = action == 2 ? 1 : action == 3 ? 10 : action == 4 ? 100 : -100;
76 throw new IllegalArgumentException(
"The action given was invalid. [ACTION=" + action +
"]");
79 this.purchase(player,
new Item(
id, amount), slot);
86 public boolean purchase(
Player player, Item item,
int slot) {
90 player.message(
"Something went wrong with your purchase!");
94 if (player.skills.
getMaxLevel(cape.getSkill()) < 99) {
95 player.message(
"You need a " +
Skill.
getName(cape.getSkill()) +
" level of 99 to purchase this cape!");
99 if (super.purchase(player, item, slot)) {
100 player.inventory.
addOrDrop(
new Item(item.getId() + 1, 1));
109 public void refresh(
Player player) {
115 public void open(
Player player) {
116 player.attributes.set(
"SHOP", name);
118 if (!STORES.containsKey(name)) {
119 STORES.put(name,
this);
123 player.send(
new SendString(100000 +
"," + currencyType.getId(), 47552 + index));
136 public void close(
Player player) {
138 player.attributes.remove(
"SHOP");
152 public boolean decrementStock() {
static final int INTERFACE_ID