1package com.runehive.game.world.items.containers.bank;
3import com.runehive.game.world.entity.mob.player.Player;
4import com.runehive.game.world.entity.mob.player.PlayerRight;
5import com.runehive.game.world.items.Item;
6import com.runehive.net.packet.out.SendItemOnInterface;
7import com.runehive.net.packet.out.SendMessage;
8import com.runehive.net.packet.out.SendString;
9import com.runehive.util.MessageColor;
10import com.runehive.util.Utility;
12import static com.runehive.game.world.items.containers.bank.VaultCurrency.BLOOD_MONEY;
13import static com.runehive.game.world.items.containers.bank.VaultCurrency.COINS;
41 player.interfaceManager.open(56300);
61 return add(currency, amount,
false);
69 player.inventory.addOrDrop(
new Item(currency.
id, (
int) amount));
73 if (container + amount >= Long.MAX_VALUE) {
77 if (currency == COINS) {
79 }
else if (currency == BLOOD_MONEY) {
91 if (currency == COINS) {
93 }
else if (currency == BLOOD_MONEY) {
102 if (Long.MAX_VALUE == container) {
107 if (Long.MAX_VALUE - container < amount) {
108 amount = (int) (Long.MAX_VALUE - container);
111 int invAmount =
player.inventory.computeAmountForId(currency.
id);
114 if (invAmount < amount) {
115 bankAmount =
player.bank.computeAmountForId(currency.
id);
116 if (invAmount + bankAmount <= 0) {
122 if (invAmount > amount) {
126 if (bankAmount > amount - invAmount) {
127 bankAmount = amount - invAmount;
130 amount = invAmount + bankAmount;
133 player.inventory.remove(currency.
id, invAmount);
135 player.bank.remove(currency.
id, bankAmount);
137 add(currency, amount);
141 if (
player.interfaceManager.isInterfaceOpen(56300)) {
156 if (container == 0) {
160 if (amount > Integer.MAX_VALUE) {
164 if (amount > container) {
167 int contain =
player.inventory.computeAmountForId(currency.
id);
168 if (contain + amount > Integer.MAX_VALUE) {
169 amount = contain - amount;
171 if (
player.inventory.add(
new Item(currency.
id, (
int) amount))) {
172 remove(currency, (int) amount);
176 if (
player.interfaceManager.isInterfaceOpen(56300)) {
This class represents a character controlled by a player.
The container class that represents an item that can be interacted with.
long getContainer(VaultCurrency currency)
final Player player
The player instance.
BankVault(Player player)
Constructs a new BankVault.
void deposit(VaultCurrency currency, int amount)
Deposits an an amount into the player's bank vaut.
void withdraw(VaultCurrency currency, long amount)
Withdraws a certain amount into the player's bank vault container.
boolean contains(VaultCurrency currency, int amount)
Checks if player's bank container contains a certain amount.
boolean add(VaultCurrency currency, long amount, boolean message)
Adds an amount into the player's bank vault with no checks.
void value(VaultCurrency currency)
Sends message to player about their container value.
boolean add(VaultCurrency currency, long amount)
Adds an amount into the player's bank vault with no checks.
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.
static String formatPrice(final long amount)
Formats a price for longs.
Holds all the player right data.
All the bank vault currency types.
Holds an enum of colors for ease.