40 public static final short UNCHARGED_RING = 25539;
41 public static final short CHARGED_RING = 25541;
42 public static final short STARDUST = 25527;
46 return "Celestial ring";
50 public boolean itemOnItem(
Player player, Item first, Item second) {
51 if ((first.getId() != UNCHARGED_RING && second.getId() != UNCHARGED_RING) && (first.getId() != CHARGED_RING && second.getId() != CHARGED_RING)) {
55 if(first.getId() == STARDUST || second.getId() == STARDUST) {
56 if (first.getId() == UNCHARGED_RING || second.getId() == UNCHARGED_RING) {
57 player.send(
new SendInputAmount(
"How many charges would you like add? (0-"+player.inventory.
computeAmountForId(STARDUST)+
")", 10, input -> charge(player, Integer.parseInt(input), UNCHARGED_RING)));
59 player.send(
new SendInputAmount(
"How many charges would you like add? (0-"+player.inventory.
computeAmountForId(STARDUST)+
")", 10, input -> charge(player, Integer.parseInt(input), CHARGED_RING)));
69 if (item.getId() != UNCHARGED_RING && item.getId() != CHARGED_RING) {
73 if (opcode == 1 && item.getId() == CHARGED_RING) {
74 player.equipment.equip(
new Item(CHARGED_RING));
78 player.send(
new SendInputAmount(
"How many charges would you like add? (0-"+player.inventory.
computeAmountForId(STARDUST)+
")", 10, input -> charge(player, Integer.parseInt(input), item.getId())));
86 public boolean equipment(
Player player, Item item,
int opcode) {
87 if (item.getId() != CHARGED_RING) {
98 public boolean drop(Player player, Item item) {
99 if (item.getId() != CHARGED_RING) {
102 if (player.celestialRingCharges > 0) {
103 player.inventory.remove(CHARGED_RING);
104 player.inventory.add(UNCHARGED_RING, 1);
105 player.inventory.add(STARDUST, player.celestialRingCharges);
106 player.celestialRingCharges = 0;
107 player.message(
"You uncharge your "+
name()+
".");
113 public static void check(Player player) {
114 player.message(
"You have " + Utility.formatDigits(player.celestialRingCharges) +
" charges in your Celestial ring.");
117 private void charge(Player player,
int amount,
int itemId) {
118 if (amount > player.inventory.computeAmountForId(STARDUST)) {
119 amount = player.inventory.computeAmountForId(STARDUST);
122 if (itemId == UNCHARGED_RING) {
123 player.inventory.remove(UNCHARGED_RING, 1);
124 player.inventory.add(CHARGED_RING, 1);
126 player.inventory.remove(STARDUST, amount);
127 player.inventory.refresh();
128 player.celestialRingCharges += amount;
129 player.message(
"You added " + amount +
" charges to your "+
name()+
"");
boolean inventory(Player player, Item item, int opcode)