1package com.runehive.game.world.items.containers.impl;
3import com.runehive.Config;
4import com.runehive.game.world.InterfaceConstants;
5import com.runehive.game.world.entity.mob.player.Player;
6import com.runehive.game.world.items.Item;
7import com.runehive.game.world.items.containers.ItemContainer;
8import com.runehive.game.world.items.containers.ItemContainerAdapter;
9import com.runehive.game.world.items.containers.pricechecker.PriceType;
10import com.runehive.game.world.position.Area;
11import com.runehive.net.packet.out.*;
12import com.runehive.util.Utility;
13import plugin.itemon.item.LootingBagPlugin;
46 if (
player.attributes.get(
"BANK_KEY", Boolean.class)) {
58 player.send(
new SendMessage(
"You can't put items in the bag unless you're in the Wilderness."));
62 player.send(
new SendMessage(
"You can't deposit un-tradeable items into the looting bag."));
65 if (!
player.inventory.contains(item)) {
66 player.send(
new SendMessage(
"You can not deposit an item that you do not have!"));
73 if (!
player.inventory.contains(LootingBagPlugin.OPENED_ID) && !
player.inventory.contains(LootingBagPlugin.CLOSED_ID)) {
83 player.dialogueFactory.sendOption(
84 "Deposit 1", () ->
deposit(item, 1),
85 "Deposit 5", () ->
deposit(item, 5),
88 player.dialogueFactory.onAction(() ->
player.send(
new SendInputMessage(
"Enter the amount you would like to deposit into the looting bag:", 12, input -> {
89 player.dialogueFactory.clear();
90 deposit(item, Integer.parseInt(input));
101 int contain =
player.inventory.computeAmountForId(item.
getId());
102 if (contain < amount) {
109 player.inventory.remove(current);
125 removed =
player.bank.depositFromNothing(item,
player.bank.bankTab);
128 int deposited =
player.bank.depositFromNothing(item,
player.bank.bankTab);
129 if (deposited == 0) {
132 removed += deposited;
164 return "You do not have enough space in your looting bag.";
The class that contains setting-related constants for the server.
static final int INVENTORY_TAB
The class that contains helpful information on interfaces.
static final int INVENTORY_STORE
This class represents a character controlled by a player.
The container class that represents an item that can be interacted with.
final int getId()
Gets the identification of this item.
final int getAmount()
Gets the quantity of this item.
Item createWithAmount(int newAmount)
Creates a new item with newAmount and the same identifier as this instance.
ItemContainerAdapter(Player player)
Creates a new ItemContainerAdapter.
final Player player
The Player instance.
final Item[] toNonNullArray()
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 boolean addListener(ItemContainerListener listener)
Adds an ItemContainerListener to this container.
long containerValue(PriceType type)
Gets the total worth of the container using the item's values.
final Item[] toArray()
Returns a shallow copy of the backing array.
An ItemContainerAdapter implementation that listens for changes to the looting bag.
String getCapacityExceededMsg()
LootingBagListener(Player player)
void onRefresh()
Any functionality that should occur when refreshed.
void withdrawBank(Item item, int slot)
Handles the actual depositing of looting bag.
boolean allowed(Item item)
Checks if the player is allowed to deposit items into the looting bag.
void close()
Handles closing the looting bag.
boolean deposit(Item item, int amount)
Handles the actual depositing of looting bag.
LootingBag(Player player)
Constructs a new LootingBag.
final Player player
The player instance.
void depositMenu(Item item)
Handles opening the looting bag menu.
Handles checking if mobs are in a certain area.
static boolean inWilderness(Position position)
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.
Handles miscellaneous methods.
static String formatDigits(final int amount)
Formats digits for integers.
An enumerated type defining policies for stackable Items.
STANDARD
The STANDARD policy, items are only stacked if they are defined as stackable in their ItemDefinition ...
VALUE
The value price type.