1package com.runehive.content.itemaction.impl;
3import com.runehive.content.itemaction.ItemAction;
4import com.runehive.game.world.entity.combat.ranged.RangedAmmunition;
5import com.runehive.game.world.entity.mob.player.Player;
6import com.runehive.game.world.items.Item;
7import com.runehive.net.packet.out.SendMessage;
8import com.runehive.util.Utility;
10import java.math.RoundingMode;
11import java.text.DecimalFormat;
14 private static final short FULL = 16_383;
18 private static final DecimalFormat
FORMATTER =
new DecimalFormat(
"#.#");
21 FORMATTER.setRoundingMode(RoundingMode.FLOOR);
26 return "Toxic Blowpipe";
49 if (ammo ==
null || !ammo.
isDart()) {
50 player.
send(
new SendMessage(
"You can't load your blowpipe with this!"));
62 }
else if (opcode == 3) {
87 player.
send(
new SendMessage(
"Darts: <col=007F00>" + ammo +
"</col>. Charges: <col=007F00>" + scales));
91 if (item.
getId() == 12924) {
93 if (Integer.MAX_VALUE - current < 20_000) {
94 player.
send(
new SendMessage(
"You need to deposit some of your scales first."));
100 player.
send(
new SendMessage(
"You dismantle your blowpipe and receive 20,000 of Zulra's scales."));
103 player.
send(
new SendMessage(
"You need at least one free slot to unload your blowpipe."));
114 player.blowpipeDarts =
null;
115 player.
send(
new SendMessage(
"You unload the darts out of your blowpipe."));
121 player.
send(
new SendMessage(
"Your blowpipe is already fully charged."));
126 scales = scales.
copy();
131 scales = scales.
copy();
135 player.blowpipeScales += scales.
getAmount();
143 player.
send(
new SendMessage(
"Your blowpipe doesn't have any charges."));
148 player.
send(
new SendMessage(
"You need to unload your blowpipe first."));
154 player.
send(
new SendMessage(
"You need more inventory space to do this."));
158 player.blowpipeScales = 0;
166 player.
send(
new SendMessage(
"Your blowpipe is already fully loaded."));
175 player.blowpipeDarts = ammo;
182 player.
send(
new SendMessage(
"You need to unload your blowpipe before adding a different type of dart!"));
Handles executing an item action.
static final DecimalFormat FORMATTER
boolean equipment(Player player, Item item, int opcode)
static final short ZULRAH_SCALES
boolean itemOnItem(Player player, Item first, Item second)
static void check(Player player)
String name()
The name of the action.
boolean drop(Player player, Item item)
static final short CHARGED_BLOWPIPE
static void unload(Player player, Item item)
static void load(Player player, Item ammo)
static final short UNCHARGED_BLOWPIPE
static void charge(Player player, Item scales)
static void uncharge(Player player)
boolean inventory(Player player, Item item, int opcode)
The execution method of the action.
This class represents a character controlled by a player.
final Inventory inventory
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.
final void incrementAmountBy(int amount)
Increments the amount by amount.
final int computeAmountForId(int id)
Computes the total quantity of the Items in this container with 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.
Handles miscellaneous methods.
static String formatDigits(final int amount)
Formats digits for integers.
static RangedAmmunition find(Item weapon, Item item)