44 private static final short TRIDENT_ID = 11907;
45 private static final short CHARGE_LIMIT = 2500;
46 private static final DecimalFormat FORMATTER =
new DecimalFormat(
"#.#");
48 public TridentOfTheSeas() {
49 FORMATTER.setRoundingMode(RoundingMode.FLOOR);
54 return "Trident of the Seas";
58 public boolean itemOnItem(
Player player, Item first, Item second) {
59 if (first.getId() != TRIDENT_ID && second.getId() != TRIDENT_ID) {
64 if (player.tridentSeasCharges > 0) {
65 player.message(
"You must empty your trident charges before doing this.");
71 if (player.tridentSeasCharges >= CHARGE_LIMIT) {
72 player.message(
"Your Trident of the Seas is already fully charged.");
76 int id1 = first.getId();
77 int id2 = second.getId();
79 if (id1 == TRIDENT_ID && id2 != TRIDENT_ID)
80 if (id2 != 560 && id2 != 562 && id2 != 554 && id2 != 995)
83 if (id2 == TRIDENT_ID && id1 != TRIDENT_ID)
84 if (id1 != 560 && id1 != 562 && id1 != 554 && id1 != 995)
92 if (death >= 1 && chaos >= 1 && fire >= 5 && coins >= 10) {
94 int minC = coins / 10;
95 int charges = Math.min(Math.min(death, chaos), Math.min(minF, minC));
97 if (charges > CHARGE_LIMIT)
98 charges = CHARGE_LIMIT;
100 if (charges > CHARGE_LIMIT - player.tridentSeasCharges)
101 charges = CHARGE_LIMIT - player.tridentSeasCharges;
104 player.inventory.
remove(
new Item(560, charges), -1,
false);
105 player.inventory.
remove(
new Item(562, charges), -1,
false);
106 player.inventory.
remove(
new Item(554, charges * 5), -1,
false);
107 player.inventory.
remove(
new Item(995, charges * 10), -1,
false);
109 player.tridentSeasCharges += charges;
110 player.message(
"You added " + charges +
" charges to your Trident of the Seas");
113 player.message(
"You need at least 1 x death rune, 1 x chaos rune, 5 x fire runes and 10gp for one charge.",
"Your Trident of the Seas can hold ");
120 if (item.getId() != TRIDENT_ID) {
135 public boolean equipment(
Player player, Item item,
int opcode) {
136 if (item.getId() != TRIDENT_ID) {
146 private static void check(Player player) {
147 player.message(
"You have " + Utility.formatDigits(player.tridentSeasCharges) +
" charges in your Trident of the Seas.");
150 private static void uncharge(Player player) {
151 if (player.tridentSeasCharges < 1) {
155 int amount = player.tridentSeasCharges;
156 if (!player.inventory.hasCapacityFor(
new Item(560, amount),
new Item(562, amount),
new Item(554, amount * 5))) {
157 player.message(
"You don't have enough inventory space to uncharge your trident.");
161 player.inventory.add(
new Item(560, amount), -1,
false);
162 player.inventory.add(
new Item(562, amount), -1,
false);
163 player.inventory.add(
new Item(554, amount * 5), -1,
false);
164 player.inventory.refresh();
165 player.tridentSeasCharges = 0;
166 player.message(
"You uncharge your trident.");
boolean inventory(Player player, Item item, int opcode)
static Optional< CreationData > forItems(Item first, Item second)