RuneHive-Game
Loading...
Searching...
No Matches
com.runehive.content.itemaction.impl.CelestialRing Class Reference
Inheritance diagram for com.runehive.content.itemaction.impl.CelestialRing:
Collaboration diagram for com.runehive.content.itemaction.impl.CelestialRing:

Public Member Functions

boolean drop (Player player, Item item)
boolean equipment (Player player, Item item, int opcode)
boolean inventory (Player player, Item item, int opcode)
 The execution method of the action.
boolean itemOnItem (Player player, Item first, Item second)
String name ()
 The name of the action.
Public Member Functions inherited from com.runehive.content.itemaction.ItemAction
int delay ()
 The item click delay of the action.
String message (Item item)
 The message of the action.
String toString ()

Static Public Member Functions

static void check (Player player)

Static Public Attributes

static final short CHARGED_RING = 25541
static final short STARDUST = 25527
static final short UNCHARGED_RING = 25539

Private Member Functions

void charge (Player player, int amount, int itemId)

Detailed Description

Definition at line 9 of file CelestialRing.java.

Member Function Documentation

◆ charge()

void com.runehive.content.itemaction.impl.CelestialRing.charge ( Player player,
int amount,
int itemId )
private

Definition at line 88 of file CelestialRing.java.

88 {
89 if (amount > player.inventory.computeAmountForId(STARDUST)) {
90 amount = player.inventory.computeAmountForId(STARDUST);
91 }
92 if (amount > 0) {
93 if (itemId == UNCHARGED_RING) {
94 player.inventory.remove(UNCHARGED_RING, 1);
95 player.inventory.add(CHARGED_RING, 1);
96 }
97 player.inventory.remove(STARDUST, amount);
98 player.inventory.refresh();
99 player.celestialRingCharges += amount;
100 player.message("You added " + amount + " charges to your "+name()+"");
101 }
102 }

References com.runehive.game.world.items.containers.ItemContainer.add(), CHARGED_RING, com.runehive.game.world.items.containers.ItemContainer.computeAmountForId(), com.runehive.game.world.entity.mob.player.Player.inventory, com.runehive.game.world.entity.mob.player.Player.message(), name(), com.runehive.game.world.items.containers.inventory.Inventory.refresh(), com.runehive.game.world.items.containers.ItemContainer.remove(), STARDUST, and UNCHARGED_RING.

Referenced by inventory(), and itemOnItem().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ check()

void com.runehive.content.itemaction.impl.CelestialRing.check ( Player player)
static

Definition at line 84 of file CelestialRing.java.

84 {
85 player.message("You have " + Utility.formatDigits(player.celestialRingCharges) + " charges in your Celestial ring.");
86 }

References com.runehive.game.world.entity.mob.player.Player.celestialRingCharges, com.runehive.util.Utility.formatDigits(), and com.runehive.game.world.entity.mob.player.Player.message().

Referenced by equipment(), and com.runehive.net.packet.in.WieldItemPacketListener.handlePacket().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ drop()

boolean com.runehive.content.itemaction.impl.CelestialRing.drop ( Player player,
Item item )

Reimplemented from com.runehive.content.itemaction.ItemAction.

Definition at line 69 of file CelestialRing.java.

69 {
70 if (item.getId() != CHARGED_RING) {
71 return false;
72 }
73 if (player.celestialRingCharges > 0) {
74 player.inventory.remove(CHARGED_RING);
75 player.inventory.add(UNCHARGED_RING, 1);
76 player.inventory.add(STARDUST, player.celestialRingCharges);
77 player.celestialRingCharges = 0;
78 player.message("You uncharge your "+name()+".");
79 }
80
81 return true;
82 }

References com.runehive.game.world.items.containers.ItemContainer.add(), com.runehive.game.world.entity.mob.player.Player.celestialRingCharges, CHARGED_RING, com.runehive.game.world.items.Item.getId(), com.runehive.game.world.entity.mob.player.Player.inventory, com.runehive.game.world.entity.mob.player.Player.message(), name(), com.runehive.game.world.items.containers.ItemContainer.remove(), STARDUST, and UNCHARGED_RING.

Here is the call graph for this function:

◆ equipment()

boolean com.runehive.content.itemaction.impl.CelestialRing.equipment ( Player player,
Item item,
int opcode )

Reimplemented from com.runehive.content.itemaction.ItemAction.

Definition at line 57 of file CelestialRing.java.

57 {
58 if (item.getId() != CHARGED_RING) {
59 return false;
60 }
61 if (opcode == 1) {
62 check(player);
63 return true;
64 }
65 return true;
66 }

References CHARGED_RING, check(), and com.runehive.game.world.items.Item.getId().

Here is the call graph for this function:

◆ inventory()

boolean com.runehive.content.itemaction.impl.CelestialRing.inventory ( Player player,
Item item,
int opcode )

The execution method of the action.

Reimplemented from com.runehive.content.itemaction.ItemAction.

Definition at line 39 of file CelestialRing.java.

39 {
40 if (item.getId() != UNCHARGED_RING && item.getId() != CHARGED_RING) {
41 return false;
42 }
43
44 if (opcode == 1 && item.getId() == CHARGED_RING) {
45 player.equipment.equip(new Item(CHARGED_RING));
46 return true;
47 }
48 if (opcode == 2) {
49 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())));
50 return true;
51 }
52
53 return false;
54 }

References charge(), CHARGED_RING, com.runehive.game.world.items.containers.ItemContainer.computeAmountForId(), com.runehive.game.world.items.containers.equipment.Equipment.equip(), com.runehive.game.world.entity.mob.player.Player.equipment, com.runehive.game.world.items.Item.getId(), com.runehive.game.world.entity.mob.player.Player.inventory, com.runehive.game.world.entity.mob.player.Player.send(), STARDUST, and UNCHARGED_RING.

Here is the call graph for this function:

◆ itemOnItem()

boolean com.runehive.content.itemaction.impl.CelestialRing.itemOnItem ( Player player,
Item first,
Item second )

Reimplemented from com.runehive.content.itemaction.ItemAction.

Definition at line 21 of file CelestialRing.java.

21 {
22 if ((first.getId() != UNCHARGED_RING && second.getId() != UNCHARGED_RING) && (first.getId() != CHARGED_RING && second.getId() != CHARGED_RING)) {
23 return false;
24 }
25
26 if(first.getId() == STARDUST || second.getId() == STARDUST) {
27 if (first.getId() == UNCHARGED_RING || second.getId() == UNCHARGED_RING) {
28 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)));
29 } else {
30 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)));
31 }
32 return true;
33 }
34
35 return false;
36 }

References charge(), CHARGED_RING, com.runehive.game.world.items.containers.ItemContainer.computeAmountForId(), com.runehive.game.world.items.Item.getId(), com.runehive.game.world.entity.mob.player.Player.inventory, com.runehive.game.world.entity.mob.player.Player.send(), STARDUST, and UNCHARGED_RING.

Here is the call graph for this function:

◆ name()

String com.runehive.content.itemaction.impl.CelestialRing.name ( )

The name of the action.

Reimplemented from com.runehive.content.itemaction.ItemAction.

Definition at line 16 of file CelestialRing.java.

16 {
17 return "Celestial ring";
18 }

Referenced by charge(), and drop().

Here is the caller graph for this function:

Member Data Documentation

◆ CHARGED_RING

final short com.runehive.content.itemaction.impl.CelestialRing.CHARGED_RING = 25541
static

◆ STARDUST

final short com.runehive.content.itemaction.impl.CelestialRing.STARDUST = 25527
static

Definition at line 13 of file CelestialRing.java.

Referenced by charge(), drop(), inventory(), and itemOnItem().

◆ UNCHARGED_RING

final short com.runehive.content.itemaction.impl.CelestialRing.UNCHARGED_RING = 25539
static

The documentation for this class was generated from the following file: