54public class RecipeForDisasterStore
extends Store {
56 public final StoreItem[] items = {
57 new StoreItem(7453, 1, OptionalInt.of(10000), Optional.of(
CurrencyType.COINS)),
58 new StoreItem(7454, 1, OptionalInt.of(20000), Optional.of(
CurrencyType.COINS)),
59 new StoreItem(7455, 1, OptionalInt.of(30000), Optional.of(
CurrencyType.COINS)),
60 new StoreItem(7456, 1, OptionalInt.of(40000), Optional.of(
CurrencyType.COINS)),
61 new StoreItem(7457, 1, OptionalInt.of(50000), Optional.of(
CurrencyType.COINS)),
62 new StoreItem(7458, 1, OptionalInt.of(60000), Optional.of(
CurrencyType.COINS)),
63 new StoreItem(7459, 1, OptionalInt.of(70000), Optional.of(
CurrencyType.COINS)),
64 new StoreItem(7460, 1, OptionalInt.of(80000), Optional.of(
CurrencyType.COINS)),
65 new StoreItem(7461, 1, OptionalInt.of(90000), Optional.of(
CurrencyType.COINS)),
66 new StoreItem(7462, 1, OptionalInt.of(100000), Optional.of(
CurrencyType.COINS))
69 public RecipeForDisasterStore() {
71 this.container.setItems(items,
true);
72 Arrays.stream(items).filter(Objects::nonNull).forEach(item -> itemCache.put(item.getId(), item.getAmount()));
76 public void itemContainerAction(
Player player,
int id,
int slot,
int action,
boolean purchase) {
80 this.sendPurchaseValue(player, slot);
84 int amount = action == 2 ? 1 : action == 3 ? 10 : action == 4 ? 100 : -100;
86 throw new IllegalArgumentException(
"The action given was invalid. [ACTION=" + action +
"]");
89 this.purchase(player,
new Item(
id, amount), slot);
96 public void refresh(
Player player) {
97 player.send(
new SendString(
"Store size: " + items.length, 47507));
100 players.stream().filter(Objects::nonNull).forEach(p -> player.send(
new SendItemOnInterface(47551, container.toArray())));
104 public void open(
Player player) {
105 player.attributes.set(
"SHOP", name);
107 if (!STORES.containsKey(name)) {
108 STORES.put(name,
this);
111 StoreItem[] storeItems =
new StoreItem[10];
113 int unlocked = player.glovesTier;
116 for (
int index = 0; index < unlocked; index++) {
117 if (index > unlocked)
119 storeItems[index] = items[index];
122 for (
int i = 0; i < unlocked; i++) {
123 player.send(
new SendString(storeItems[i].getShopValue() +
"," + currencyType.getId(), 47552 + i));
126 player.send(
new SendString(
"Store size: " + unlocked, 47507));
129 final int scrollBarSize = lastItem <= 32 ? 0 : (lastItem / 8) * 72;
136 public void close(
Player player) {
137 players.remove(player);
138 player.attributes.remove(
"SHOP");
152 public boolean decrementStock() {
static final int INTERFACE_ID