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

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 Attributes

static final short ETHER_ID = 21820
static final short THAMMARONS_SCEPTRE_CHARGED_ID = 22555
static final short THAMMARONS_SCEPTRE_UNCHARGED_ID = 22552

Private Member Functions

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

Detailed Description

Definition at line 10 of file ThammaronsSceptre.java.

Member Function Documentation

◆ charge()

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

Definition at line 95 of file ThammaronsSceptre.java.

95 {
96 if (amount > player.inventory.computeAmountForId(ETHER_ID)) {
97 amount = player.inventory.computeAmountForId(ETHER_ID);
98 }
99 if (amount > 0) {
100 player.inventory.remove(ETHER_ID, amount);
101 player.inventory.refresh();
102 player.thammoranSceptreCharges += amount;
103 player.message("You added " + amount + " charges to your "+name()+"");
104 }
105 }

References com.runehive.game.world.items.containers.ItemContainer.computeAmountForId(), ETHER_ID, 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(), and com.runehive.game.world.items.containers.ItemContainer.remove().

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.ThammaronsSceptre.check ( Player player)
private

Definition at line 91 of file ThammaronsSceptre.java.

91 {
92 player.message("You have " + Utility.formatDigits(player.thammoranSceptreCharges) + " charges in your "+name()+".");
93 }

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

Referenced by equipment(), 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.ThammaronsSceptre.drop ( Player player,
Item item )

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

Definition at line 76 of file ThammaronsSceptre.java.

76 {
77 if (item.getId() != THAMMARONS_SCEPTRE_CHARGED_ID) {
78 return false;
79 }
80
81 player.inventory.remove(THAMMARONS_SCEPTRE_CHARGED_ID);
82 player.inventory.add(THAMMARONS_SCEPTRE_UNCHARGED_ID, 1);
83 player.inventory.add(ETHER_ID, 1000 + player.thammoranSceptreCharges);
84 player.thammoranSceptreCharges = 0;
85
86 player.message("You uncharge your "+name()+".");
87
88 return true;
89 }

References com.runehive.game.world.items.containers.ItemContainer.add(), ETHER_ID, 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(), THAMMARONS_SCEPTRE_CHARGED_ID, THAMMARONS_SCEPTRE_UNCHARGED_ID, and com.runehive.game.world.entity.mob.player.Player.thammoranSceptreCharges.

Here is the call graph for this function:

◆ equipment()

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

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

Definition at line 64 of file ThammaronsSceptre.java.

64 {
65 if (item.getId() != THAMMARONS_SCEPTRE_CHARGED_ID) {
66 return false;
67 }
68 if (opcode == 1) {
69 check(player);
70 return true;
71 }
72 return true;
73 }

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

Here is the call graph for this function:

◆ inventory()

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

The execution method of the action.

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

Definition at line 50 of file ThammaronsSceptre.java.

50 {
51 if (item.getId() != THAMMARONS_SCEPTRE_CHARGED_ID) {
52 return false;
53 }
54
55 if (opcode == 2) {
56 check(player);
57 return true;
58 }
59
60 return false;
61 }

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

Here is the call graph for this function:

◆ itemOnItem()

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

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

Definition at line 22 of file ThammaronsSceptre.java.

22 {
23 System.out.println("?????");
24 if ((first.getId() != THAMMARONS_SCEPTRE_UNCHARGED_ID && second.getId() != THAMMARONS_SCEPTRE_UNCHARGED_ID) && (first.getId() != THAMMARONS_SCEPTRE_CHARGED_ID && second.getId() != THAMMARONS_SCEPTRE_CHARGED_ID)) {
25 System.out.println("dfgdfgdfg");
26 return false;
27 }
28
29 if(first.getId() == ETHER_ID || second.getId() == ETHER_ID) {
30 if (first.getId() == THAMMARONS_SCEPTRE_UNCHARGED_ID || second.getId() == THAMMARONS_SCEPTRE_UNCHARGED_ID) {
31 if(!player.inventory.contains(ETHER_ID, 1000)) {
32 player.message("You need at least 1000 "+ ItemDefinition.get(ETHER_ID).getName() +" to charge the "+name()+".");
33 return true;
34 }
35 player.inventory.remove(ETHER_ID, 1000);
36 player.inventory.remove(THAMMARONS_SCEPTRE_UNCHARGED_ID);
37 player.inventory.add(THAMMARONS_SCEPTRE_CHARGED_ID, 1);
38 player.inventory.refresh();
39 } else {
40 System.out.println("Recharge craws bow");
41 player.send(new SendInputAmount("How many charges would you like add? (0-"+player.inventory.computeAmountForId(ETHER_ID)+")", 10, input -> charge(player, Integer.parseInt(input))));
42 }
43 return true;
44 }
45
46 return false;
47 }

References com.runehive.game.world.items.containers.ItemContainer.add(), charge(), com.runehive.game.world.items.containers.ItemContainer.computeAmountForId(), com.runehive.game.world.items.containers.ItemContainer.contains(), ETHER_ID, com.runehive.game.world.items.ItemDefinition.get(), com.runehive.game.world.items.Item.getId(), com.runehive.game.world.items.ItemDefinition.getName(), 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(), com.runehive.game.world.entity.mob.player.Player.send(), THAMMARONS_SCEPTRE_CHARGED_ID, and THAMMARONS_SCEPTRE_UNCHARGED_ID.

Here is the call graph for this function:

◆ name()

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

The name of the action.

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

Definition at line 17 of file ThammaronsSceptre.java.

17 {
18 return "Thammaron's sceptre";
19 }

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

Here is the caller graph for this function:

Member Data Documentation

◆ ETHER_ID

final short com.runehive.content.itemaction.impl.ThammaronsSceptre.ETHER_ID = 21820
static

Definition at line 14 of file ThammaronsSceptre.java.

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

◆ THAMMARONS_SCEPTRE_CHARGED_ID

◆ THAMMARONS_SCEPTRE_UNCHARGED_ID

final short com.runehive.content.itemaction.impl.ThammaronsSceptre.THAMMARONS_SCEPTRE_UNCHARGED_ID = 22552
static

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