1package com.runehive.game.world.items.containers.bank;
3import com.runehive.game.world.InterfaceConstants;
4import com.runehive.game.world.entity.mob.player.Player;
5import com.runehive.game.world.entity.mob.player.PlayerRight;
6import com.runehive.game.world.items.Item;
7import com.runehive.game.world.items.containers.ItemContainer;
8import com.runehive.net.packet.out.SendItemOnInterface;
9import com.runehive.net.packet.out.SendMessage;
10import com.runehive.net.packet.out.SendString;
12import java.util.Arrays;
13import java.util.Objects;
38 player.dialogueFactory.sendStatement(
"You need to be a donator to use this feature!",
"The donator deposit allows donators to deposit a certain amount",
"of items into their banks every 2 minutes.").execute();
42 player.attributes.set(
"DONATOR_DEPOSIT_KEY", Boolean.TRUE);
43 player.interfaceManager.openInventory(57200, 5063);
52 player.inventory.add(item);
56 player.attributes.set(
"DONATOR_DEPOSIT_KEY", Boolean.FALSE);
61 if (!
player.interfaceManager.isInterfaceOpen(57200)) {
68 if (
player.bank.getFreeSlots() <
this.size()) {
69 player.message(
"You do not have enough space in your bank to deposit these items.");
75 Arrays.stream(this.
getItems()).filter(Objects::nonNull).forEach(item -> {
76 if(
player.bank.depositFromNothing(item, 0) > 0) {
77 remove(item, -1,
false);
87 if (!
player.interfaceManager.isInterfaceOpen(57200)) {
93 if (item ==
null || item.
getId() !=
id) {
96 int contain =
player.inventory.computeAmountForId(
id);
98 if (contain < amount) {
103 if (
size() >= allowedSize) {
104 player.dialogueFactory.sendStatement(
"You can only deposit up to " + allowedSize +
" items.",
"The higher your donator rank the more spaces unlocked!").execute();
115 player.inventory.remove(current,
slot,
false);
117 player.inventory.remove(current, -1,
false);
127 if (!
player.interfaceManager.isInterfaceOpen(57200)) {
133 if (item ==
null || item.
getId() !=
id) {
139 if (contain < amount) {
143 Item current =
new Item(
id, amount);
145 if(!
player.inventory.add(current)) {
150 remove(current,
slot,
false);
152 remove(current,
slot,
false);
167 player.inventory.refresh();
The class that contains helpful information on interfaces.
static final int INVENTORY_STORE
This class represents a character controlled by a player.
void send(OutgoingPacket encoder)
The container class that represents an item that can be interacted with.
final int getId()
Gets the identification of this item.
ItemContainer(int capacity, StackPolicy policy, Item[] items)
Creates a new ItemContainer.
final int computeAmountForId(int id)
Computes the total quantity of the Items in this container with id.
boolean add(Item item)
Attempts to deposit item into this container.
final int capacity
The capacity of this container.
void shift()
Percolates the null indices to the end of the stack.
void clear()
Removes all of the items from this container.
boolean withdraw(int id, int slot, int amount)
Handles withdrawing items from the container.
void onRefresh()
Any functionality that should occur when refreshed.
DonatorDeposit(Player player)
static final int DONATOR_DEPOSIT_BOX_DISPLAY_ID
void close()
Handles closing the donator deposit box.
void confirm()
Handles confirming the deposit.
void open()
Handles opening the donator deposit box.
final Player player
The player instance.
boolean deposit(int id, int slot, int amount)
Handles deposting items into the container.
The OutgoingPacket that sends a message to a Players chatbox in the client.
The OutgoingPacket that sends a string to a Players itemcontainer in the client.
Holds all the player right data.
static boolean isDonator(Player player)
Checks if the player has donator status.
static int getDepositAmount(Player player)
Gets the deposit amount.