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;
26 private static final DecimalFormat
FORMATTER =
new DecimalFormat(
"#.#");
29 FORMATTER.setRoundingMode(RoundingMode.FLOOR);
34 return "Serpentine helm";
47 player.
message(
"You need to uncharge your Serpentine helm first.");
53 player.
message(
"You need to uncharge your Serpentine helm first.");
61 player.
message(
true,
"You recolor your Serpentine helm into a Tanzanite helm!");
69 player.
message(
true,
"You recolor your Serpentine helm into a Magma helm!");
74 charge(player, item.
equals(first) ? second : first, item);
118 player.
message(
"Charges: <col=007F00>" + scales);
126 player.
message(
"Your Serpentine helm is already fully charged.");
131 scales = scales.
copy();
136 scales = scales.
copy();
140 player.serpentineHelmCharges += scales.
getAmount();
150 player.
send(
new SendMessage(
"You need more inventory space to do this."));
154 player.serpentineHelmCharges = 0;
162 player.
send(
new SendString(
"Are you sure you want to uncharge this item?", 14174));
166 player.
send(
new SendString(
"This will replace your helm with 20,000 Zulrah's scales.", 14182));
Handles executing an item action.
boolean drop(Player player, Item item)
static void dismantle(Player player, Item item)
static final short ZULRAH_SCALES
static final DecimalFormat FORMATTER
static void uncharge(Player player)
static void check(Player player)
static final short MAGMA_MUTAGEN
static final short TANZ_MUTAGEN
static final short CHARGED_HELM
boolean inventory(Player player, Item item, int opcode)
The execution method of the action.
boolean equipment(Player player, Item item, int opcode)
String name()
The name of the action.
static void charge(Player player, Item helm, Item scales)
boolean itemOnItem(Player player, Item first, Item second)
static final short UNCHARGED_HELM
final GenericAttributes attributes
This class represents a character controlled by a player.
final Inventory inventory
void message(String message)
int serpentineHelmCharges
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.