1package com.runehive.content.itemaction.impl;
3import com.runehive.content.itemaction.ItemAction;
4import com.runehive.game.world.entity.mob.player.Player;
5import com.runehive.game.world.items.Item;
6import com.runehive.net.packet.out.SendChatBoxInterface;
7import com.runehive.net.packet.out.SendItemOnInterfaceSlot;
8import com.runehive.net.packet.out.SendMessage;
9import com.runehive.net.packet.out.SendString;
10import com.runehive.util.Utility;
12import java.math.RoundingMode;
13import java.text.DecimalFormat;
16 private static final short FULL = 11_000;
23 private static final DecimalFormat
FORMATTER =
new DecimalFormat(
"#.#");
26 FORMATTER.setRoundingMode(RoundingMode.FLOOR);
43 charge(player, item.
equals(first) ? second : first, item);
83 player.
message(
"Charges: <col=007F00>" + scales);
91 player.
message(
"Your Magma helm is already fully charged.");
96 scales = scales.
copy();
101 scales = scales.
copy();
105 player.magmaHelmCharges += scales.
getAmount();
115 player.
send(
new SendMessage(
"You need more inventory space to do this."));
119 player.magmaHelmCharges = 0;
127 player.
send(
new SendString(
"Are you sure you want to restore this item?", 14174));
131 player.
send(
new SendString(
"This will replace your helm with the original Serpentine helm.", 14182));
Handles executing an item action.
boolean equipment(Player player, Item item, int opcode)
static final short UNCHARGED_HELM
static final DecimalFormat FORMATTER
static final short CHARGED_HELM
boolean drop(Player player, Item item)
static void check(Player player)
static void restore(Player player, Item item)
boolean itemOnItem(Player player, Item first, Item second)
String name()
The name of the action.
static void charge(Player player, Item helm, Item scales)
boolean inventory(Player player, Item item, int opcode)
The execution method of the action.
static void uncharge(Player player)
static final short ZULRAH_SCALES
final GenericAttributes attributes
This class represents a character controlled by a player.
final Inventory inventory
void message(String message)
void send(OutgoingPacket encoder)
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 getId()
Gets the identification of this item.
final int getAmount()
Gets the quantity of this item.
Item copy()
A substitute for Object#clone() that creates another 'copy' of this instance.
boolean equals(Object obj)
boolean matchesId(int id)
boolean remove(Item item)
Attempts to withdraw item from this container.
boolean add(Item item)
Attempts to deposit item into this container.
final boolean replace(int oldId, int newId, int index, boolean refresh)
Replaces the first occurrence of the Item having the identifier oldId with newId.
final boolean hasCapacityFor(Item... item)
Determines if this container has the capacity for item.
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.
public< K, E > void set(K key, E attribute)
Sets a generic attribute.