57 private static final int MAXIMUM_RUNE_CAPACITY = 16_000;
60 private final Item[] ALLOWED_RUNES = {
61 new Item(554),
new Item(555),
new Item(556),
new Item(557),
new Item(558),
62 new Item(559),
new Item(560),
new Item(561),
new Item(562),
new Item(563),
63 new Item(564),
new Item(565),
new Item(566),
new Item(9075),
new Item(21880)
67 private final Player player;
70 public List<Item>
runes =
new LinkedList<>();
79 player.interfaceManager.
open(41700);
82 public void clear(
boolean open) {
83 if(open)
runes.forEach(player.inventory::add);
85 if(open) player.interfaceManager.
open(41700);
93 public void refresh() {
98 public void clearInterface() {
99 player.send(
new SendItemOnInterface(41710,
new Item[0]));
102 public void withdraw(
int item,
int amount) {
103 for (Item rune :
runes) {
104 if (rune.getId() == item) {
106 if (rune.getAmount() - amount < 0) amount = rune.getAmount();
107 player.inventory.
add(item, amount);
109 if (newAm - current < amount) amount = newAm - current;
110 rune.decrementAmountBy(amount);
111 if (rune.getAmount() == 0)
119 public void deposit(Item item,
int amount) {
120 boolean allowed =
false;
121 for (Item rune : ALLOWED_RUNES) {
122 if (rune.getId() == item.getId()) {
128 player.message(
"You can only deposit runes into the rune pouch!");
132 for (Item rune :
runes) {
133 if (item.getId() == rune.getId()) {
134 if (rune.getAmount() + amount > MAXIMUM_RUNE_CAPACITY) {
135 amount = MAXIMUM_RUNE_CAPACITY - rune.getAmount();
136 player.message(
"You can only have a total of " + Utility.formatDigits(MAXIMUM_RUNE_CAPACITY) +
" of the same rune in your rune pouch.");
138 player.inventory.remove(item.getId(), amount);
139 rune.incrementAmountBy(amount);
145 if (
runes.size() >= 3) {
146 player.message(
"Your rune pouch is currently full and can not hold any more types of runes!");
150 if (amount > MAXIMUM_RUNE_CAPACITY) {
151 amount = MAXIMUM_RUNE_CAPACITY;
152 player.message(
"You can only have a total of " + Utility.formatDigits(MAXIMUM_RUNE_CAPACITY) +
" of the same rune in your rune pouch.");
155 player.inventory.remove(item.getId(), amount);
156 runes.add(
new Item(item.getId(), amount));
160 public int getRuneAmount() {
162 for (Item rune :
runes) {
163 amount += rune.getAmount();
168 public int getRuneAmount(
int id) {
170 for (Item rune :
runes) {
171 if (rune.getId() ==
id)
172 amount += rune.getAmount();
177 public boolean contains(Item item) {
178 for (Item rune :
runes) {
179 if (rune.getId() == item.getId() && rune.getAmount() >= item.getAmount())
185 public boolean containsId(
int item) {
186 for (Item rune :
runes) {
187 if (rune.getId() == item)
193 public void remove(Item item) {
194 for (Item rune :
runes) {
195 if (rune.equalIds(item)) {
196 rune.decrementAmountBy(item.getAmount());
197 if (rune.getAmount() == 0)
204 public boolean death(Item item) {
205 if (item.getId() == 12971 && Area.inWilderness(player)) {