1package com.runehive.content;
3import com.runehive.net.packet.out.SendItemOnInterface;
4import com.runehive.net.packet.out.SendString;
5import com.runehive.game.world.entity.mob.player.Player;
6import com.runehive.game.world.entity.mob.prayer.Prayer;
7import com.runehive.game.world.items.Item;
8import com.runehive.game.world.items.ItemComparator;
9import com.runehive.game.world.items.containers.pricechecker.PriceType;
10import com.runehive.util.Utility;
12import java.math.BigInteger;
13import java.text.NumberFormat;
14import java.util.Locale;
15import java.util.PriorityQueue;
16import java.util.Queue;
34 items.add(item.copy());
40 items.add(item.copy());
44 final Queue<Item> temp =
new PriorityQueue<>(items);
46 for (
int index = 0, taken = 0; index < keep.length; index++) {
47 keep[index] = temp.poll();
48 items.remove(keep[index]);
50 if (keep[index] !=
null) {
51 if (keep[index].getAmount() == keep.length - taken) {
55 if (keep[index].getAmount() > keep.length - taken) {
56 items.add(
new Item(keep[index].getId(), keep[index].getAmount() - (keep.length - taken)));
57 keep[index].
setAmount(keep.length - taken);
70 player.
send(
new SendString(
"You're marked with a \\n<col=ff0000>skull. </col>This reduces the \\nitems you keep from \\nthree to zero!", 17110));
73 player.
send(
new SendString(
"You're marked with a \\n<col=ff0000>skull. </col>This reduces the \\nitems you keep from \\nthree to zero! \\nHowever, you also have the \\n<col=ff0000>Protect </col>Items prayer \\nactive, which saves you \\none extra item!", 17110));
76 player.
send(
new SendString(
"You have no factors affecting \\nthe items you keep.", 17110));
79 player.
send(
new SendString(
"You have the <col=ff0000>Protect Item</col> \\nprayer active, which saves \\nyou none extra item!", 17110));
86 player.
send(
new SendString(
"Carried wealth: \\n<col=ff0000>Nothing!", 17115));
87 }
else if (carried >= Long.MAX_VALUE) {
88 player.
send(
new SendString(
"Carried wealth: \\n<col=ff0000>Too much!", 17115));
93 Item[] dropped = items.toArray(
new Item[0]);
95 BigInteger risked = BigInteger.ZERO;
96 while (items.peek() !=
null) {
97 final Item dropping = items.poll();
99 if (dropping ==
null) {
103 risked = risked.add(
new BigInteger(String.valueOf(dropping.
getValue(
PriceType.
VALUE))).multiply(
new BigInteger(String.valueOf(dropping.
getAmount()))));
108 if (risked.equals(BigInteger.ZERO)) {
109 player.
send(
new SendString(
"Risked wealth: \\n<col=ff0000>Nothing!", 17116));
111 player.
send(
new SendString(
"Risked wealth: \\n<col=ff0000>" + NumberFormat.getNumberInstance(Locale.US).format(risked) +
"</col> coins.", 17116));
static void open(Player player)
void open(int identification)
Opens an interface for the player.
This class represents a character controlled by a player.
final Inventory inventory
final Equipment equipment
final InterfaceManager interfaceManager
void send(OutgoingPacket encoder)
boolean isActive(Prayer... prayers)
Checks if all given prayers are active.
The container class that represents an item that can be interacted with.
final void setAmount(int amount)
Sets the quantity of this item.
final int getAmount()
Gets the quantity of this item.
int getValue(PriceType type)
Gets the value for this item.
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.
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.
VALUE
The value price type.