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

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.
 SerpentineHelm ()
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 Private Member Functions

static void charge (Player player, Item helm, Item scales)
static void dismantle (Player player, Item item)
static void uncharge (Player player)

Static Private Attributes

static final short CHARGED_HELM = 12_931
static final DecimalFormat FORMATTER = new DecimalFormat("#.#")
static final short FULL = 11_000
static final short MAGMA_MUTAGEN = 13201
static final short TANZ_MUTAGEN = 13200
static final short UNCHARGED_HELM = 12_929
static final short ZULRAH_SCALES = 12_934

Detailed Description

Definition at line 15 of file SerpentineHelm.java.

Constructor & Destructor Documentation

◆ SerpentineHelm()

com.runehive.content.itemaction.impl.SerpentineHelm.SerpentineHelm ( )

Definition at line 28 of file SerpentineHelm.java.

28 {
29 FORMATTER.setRoundingMode(RoundingMode.FLOOR);
30 }

References FORMATTER.

Member Function Documentation

◆ charge()

void com.runehive.content.itemaction.impl.SerpentineHelm.charge ( Player player,
Item helm,
Item scales )
staticprivate

Definition at line 121 of file SerpentineHelm.java.

121 {
122 if (player.serpentineHelmCharges >= FULL) {
123 if (helm.matchesId(UNCHARGED_HELM)) {
124 player.inventory.replace(UNCHARGED_HELM, CHARGED_HELM, true);
125 }
126 player.message("Your Serpentine helm is already fully charged.");
127 return;
128 }
129
130 if (Integer.MAX_VALUE - scales.getAmount() < FULL) {
131 scales = scales.copy();
132 scales.setAmount(FULL - player.serpentineHelmCharges);
133 }
134
135 if (player.serpentineHelmCharges + scales.getAmount() > FULL) {
136 scales = scales.copy();
137 scales.setAmount(FULL - player.serpentineHelmCharges);
138 }
139
140 player.serpentineHelmCharges += scales.getAmount();
141 player.inventory.remove(scales);
142 player.inventory.replace(UNCHARGED_HELM, CHARGED_HELM, true);
143 player.message(String.format("You load %s scales into your Serpentine helm.", Utility.formatDigits(scales.getAmount())));
144 }

References CHARGED_HELM, com.runehive.game.world.items.Item.copy(), com.runehive.util.Utility.formatDigits(), FULL, com.runehive.game.world.items.Item.getAmount(), com.runehive.game.world.entity.mob.player.Player.inventory, com.runehive.game.world.items.Item.matchesId(), com.runehive.game.world.entity.mob.player.Player.message(), com.runehive.game.world.items.containers.ItemContainer.remove(), com.runehive.game.world.items.containers.ItemContainer.replace(), com.runehive.game.world.entity.mob.player.Player.serpentineHelmCharges, com.runehive.game.world.items.Item.setAmount(), and UNCHARGED_HELM.

Referenced by itemOnItem().

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

◆ check()

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

Definition at line 116 of file SerpentineHelm.java.

116 {
117 String scales = FORMATTER.format(player.serpentineHelmCharges * 100 / FULL) + "%";
118 player.message("Charges: <col=007F00>" + scales);
119 }

References FORMATTER, FULL, com.runehive.game.world.entity.mob.player.Player.message(), and com.runehive.game.world.entity.mob.player.Player.serpentineHelmCharges.

Referenced by equipment(), and inventory().

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

◆ dismantle()

void com.runehive.content.itemaction.impl.SerpentineHelm.dismantle ( Player player,
Item item )
staticprivate

Definition at line 160 of file SerpentineHelm.java.

160 {
161 player.send(new SendItemOnInterfaceSlot(14171, item, 0));
162 player.send(new SendString("Are you sure you want to uncharge this item?", 14174));
163 player.send(new SendString("Yes.", 14175));
164 player.send(new SendString("No.", 14176));
165 player.send(new SendString("", 14177));
166 player.send(new SendString("This will replace your helm with 20,000 Zulrah's scales.", 14182));
167 player.send(new SendString("", 14183));
168 player.send(new SendString(item.getName(), 14184));
169 player.send(new SendChatBoxInterface(14170));
170 player.attributes.set("UNCHARGE_HELM_KEY", item);
171 }

References com.runehive.game.world.entity.mob.Mob.attributes, com.runehive.game.world.items.Item.getName(), com.runehive.game.world.entity.mob.player.Player.send(), and com.runehive.util.generic.GenericAttributes.set().

Referenced by drop(), and inventory().

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

◆ drop()

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

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

Definition at line 104 of file SerpentineHelm.java.

104 {
105 if (item.matchesId(CHARGED_HELM)) {
106 uncharge(player);
107 return true;
108 }
109 if (item.matchesId(UNCHARGED_HELM)) {
110 dismantle(player, item);
111 return true;
112 }
113 return false;
114 }

References CHARGED_HELM, dismantle(), com.runehive.game.world.items.Item.matchesId(), uncharge(), and UNCHARGED_HELM.

Here is the call graph for this function:

◆ equipment()

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

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

Definition at line 96 of file SerpentineHelm.java.

96 {
97 if (opcode == 1) {
98 check(player);
99 }
100 return true;
101 }

References check().

Here is the call graph for this function:

◆ inventory()

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

The execution method of the action.

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

Definition at line 82 of file SerpentineHelm.java.

82 {
83 if (opcode == 3 && item.matchesId(UNCHARGED_HELM)) {
84 dismantle(player, item);
85 return true;
86 }
87
88 if (opcode == 2) {
89 check(player);
90 }
91
92 return true;
93 }

References check(), dismantle(), com.runehive.game.world.items.Item.matchesId(), and UNCHARGED_HELM.

Here is the call graph for this function:

◆ itemOnItem()

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

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

Definition at line 38 of file SerpentineHelm.java.

38 {
39 Item item = first;
40
41 if (first.getId() == UNCHARGED_HELM || first.getId() == CHARGED_HELM) {
42 item = second;
43 }
44
45 if ((first.matchesId(CHARGED_HELM) && second.matchesId(TANZ_MUTAGEN))
46 || (second.matchesId(CHARGED_HELM) && first.matchesId(TANZ_MUTAGEN))) {
47 player.message("You need to uncharge your Serpentine helm first.");
48 return true;
49 }
50
51 if ((first.matchesId(CHARGED_HELM) && second.matchesId(MAGMA_MUTAGEN))
52 || (second.matchesId(CHARGED_HELM) && first.matchesId(MAGMA_MUTAGEN))) {
53 player.message("You need to uncharge your Serpentine helm first.");
54 return true;
55 }
56
57 if ((first.matchesId(UNCHARGED_HELM) && second.matchesId(TANZ_MUTAGEN))
58 || (second.matchesId(UNCHARGED_HELM) && first.matchesId(TANZ_MUTAGEN))) {
59 player.inventory.remove(TANZ_MUTAGEN);
60 player.inventory.replace(UNCHARGED_HELM, 13_196, true);
61 player.message(true, "You recolor your Serpentine helm into a Tanzanite helm!");
62 return true;
63 }
64
65 if ((first.matchesId(UNCHARGED_HELM) && second.matchesId(MAGMA_MUTAGEN))
66 || (second.matchesId(UNCHARGED_HELM) && first.matchesId(MAGMA_MUTAGEN))) {
67 player.inventory.remove(MAGMA_MUTAGEN);
68 player.inventory.replace(UNCHARGED_HELM, 13_198, true);
69 player.message(true, "You recolor your Serpentine helm into a Magma helm!");
70 return true;
71 }
72
73 if (item.getId() == ZULRAH_SCALES) {
74 charge(player, item.equals(first) ? second : first, item);
75 return true;
76 }
77
78 return false;
79 }

References charge(), CHARGED_HELM, com.runehive.game.world.items.Item.equals(), com.runehive.game.world.items.Item.getId(), com.runehive.game.world.entity.mob.player.Player.inventory, MAGMA_MUTAGEN, com.runehive.game.world.items.Item.matchesId(), com.runehive.game.world.entity.mob.player.Player.message(), com.runehive.game.world.items.containers.ItemContainer.remove(), com.runehive.game.world.items.containers.ItemContainer.replace(), TANZ_MUTAGEN, UNCHARGED_HELM, and ZULRAH_SCALES.

Here is the call graph for this function:

◆ name()

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

The name of the action.

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

Definition at line 33 of file SerpentineHelm.java.

33 {
34 return "Serpentine helm";
35 }

◆ uncharge()

void com.runehive.content.itemaction.impl.SerpentineHelm.uncharge ( Player player)
staticprivate

Definition at line 146 of file SerpentineHelm.java.

146 {
147 Item scales = new Item(ZULRAH_SCALES, player.serpentineHelmCharges);
148
149 if (!player.inventory.hasCapacityFor(scales)) {
150 player.send(new SendMessage("You need more inventory space to do this."));
151 return;
152 }
153
154 player.serpentineHelmCharges = 0;
155 player.inventory.add(scales);
156 player.inventory.replace(CHARGED_HELM, UNCHARGED_HELM, true);
157 player.message(String.format("You uncharged your Serpentine helm and received %s of Zulra's scales.", Utility.formatDigits(scales.getAmount())));
158 }

References com.runehive.game.world.items.containers.ItemContainer.add(), CHARGED_HELM, com.runehive.util.Utility.formatDigits(), com.runehive.game.world.items.Item.getAmount(), com.runehive.game.world.items.containers.ItemContainer.hasCapacityFor(), com.runehive.game.world.entity.mob.player.Player.inventory, com.runehive.game.world.entity.mob.player.Player.message(), com.runehive.game.world.items.containers.ItemContainer.replace(), com.runehive.game.world.entity.mob.player.Player.send(), com.runehive.game.world.entity.mob.player.Player.serpentineHelmCharges, UNCHARGED_HELM, and ZULRAH_SCALES.

Referenced by drop().

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

Member Data Documentation

◆ CHARGED_HELM

final short com.runehive.content.itemaction.impl.SerpentineHelm.CHARGED_HELM = 12_931
staticprivate

Definition at line 21 of file SerpentineHelm.java.

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

◆ FORMATTER

final DecimalFormat com.runehive.content.itemaction.impl.SerpentineHelm.FORMATTER = new DecimalFormat("#.#")
staticprivate

Definition at line 26 of file SerpentineHelm.java.

Referenced by check(), and SerpentineHelm().

◆ FULL

final short com.runehive.content.itemaction.impl.SerpentineHelm.FULL = 11_000
staticprivate

Definition at line 16 of file SerpentineHelm.java.

Referenced by charge(), and check().

◆ MAGMA_MUTAGEN

final short com.runehive.content.itemaction.impl.SerpentineHelm.MAGMA_MUTAGEN = 13201
staticprivate

Definition at line 24 of file SerpentineHelm.java.

Referenced by itemOnItem().

◆ TANZ_MUTAGEN

final short com.runehive.content.itemaction.impl.SerpentineHelm.TANZ_MUTAGEN = 13200
staticprivate

Definition at line 23 of file SerpentineHelm.java.

Referenced by itemOnItem().

◆ UNCHARGED_HELM

final short com.runehive.content.itemaction.impl.SerpentineHelm.UNCHARGED_HELM = 12_929
staticprivate

Definition at line 20 of file SerpentineHelm.java.

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

◆ ZULRAH_SCALES

final short com.runehive.content.itemaction.impl.SerpentineHelm.ZULRAH_SCALES = 12_934
staticprivate

Definition at line 18 of file SerpentineHelm.java.

Referenced by itemOnItem(), and uncharge().


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