42 private static final short TRIDENT_ID = 12899;
43 private static final short CHARGE_LIMIT = 2500;
44 private static final DecimalFormat FORMATTER =
new DecimalFormat(
"#.#");
46 public TridentOfTheSwamp() {
47 FORMATTER.setRoundingMode(RoundingMode.FLOOR);
52 return "Trident of the Seas";
56 public boolean itemOnItem(
Player player, Item first, Item second) {
57 if (first.getId() != TRIDENT_ID && second.getId() != TRIDENT_ID) {
61 if (player.tridentSwampCharges >= CHARGE_LIMIT) {
62 player.message(
"Your Trident of the Swamp is already fully charged.");
66 int id1 = first.getId();
67 int id2 = second.getId();
69 if (id1 == TRIDENT_ID && id2 != TRIDENT_ID)
70 if (id2 != 560 && id2 != 562 && id2 != 554 && id2 != 12934)
73 if (id2 == TRIDENT_ID && id1 != TRIDENT_ID)
74 if (id1 != 560 && id1 != 562 && id1 != 554 && id1 != 12934)
82 if (death >= 1 && chaos >= 1 && fire >= 5 && scales >= 1) {
84 int charges = Math.min(Math.min(death, chaos), Math.min(scales, minF));
86 if (charges > CHARGE_LIMIT)
87 charges = CHARGE_LIMIT;
89 if (charges > CHARGE_LIMIT - player.tridentSwampCharges)
90 charges = CHARGE_LIMIT - player.tridentSwampCharges;
93 player.inventory.
remove(
new Item(560, charges), -1,
false);
94 player.inventory.
remove(
new Item(562, charges), -1,
false);
95 player.inventory.
remove(
new Item(554, charges * 5), -1,
false);
96 player.inventory.
remove(
new Item(12934, charges), -1,
false);
98 player.tridentSwampCharges += charges;
99 player.message(
"You added " + charges +
" charges to your Trident of the Swamp");
102 player.message(
"You need at least 1x zulrah scale, 1x death rune, 1x chaos rune, and 5x fire runes",
"for one charge. Your Trident of the Swamp can hold 2,500 charges.");
109 if (item.getId() != TRIDENT_ID) {
124 public boolean equipment(
Player player, Item item,
int opcode) {
125 if (item.getId() != TRIDENT_ID) {
135 private static void check(Player player) {
136 player.message(
"You have " + Utility.formatDigits(player.tridentSwampCharges) +
" charges in your Trident of the Swamp.");
139 private static void uncharge(Player player) {
140 if (player.tridentSwampCharges < 1) {
144 int amount = player.tridentSwampCharges;
145 if (!player.inventory.hasCapacityFor(
new Item(560, amount),
new Item(562, amount),
new Item(554, amount * 5))) {
146 player.message(
"You don't have enough inventory space to uncharge your trident.");
150 player.inventory.add(
new Item(560, amount), -1,
false);
151 player.inventory.add(
new Item(562, amount), -1,
false);
152 player.inventory.add(
new Item(554, amount * 5), -1,
false);
153 player.inventory.refresh();
154 player.tridentSwampCharges = 0;
155 player.message(
"You uncharge your trident.");
boolean inventory(Player player, Item item, int opcode)