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

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 CRAWS_CHARGED_ID = 22550
static final short CRAWS_UNCHARGED_ID = 22547
static final short ETHER_ID = 21820

Private Member Functions

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

Detailed Description

Definition at line 10 of file CrawsBow.java.

Member Function Documentation

◆ charge()

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

Definition at line 93 of file CrawsBow.java.

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

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

Definition at line 89 of file CrawsBow.java.

89 {
90 player.message("You have " + Utility.formatDigits(player.crawsBowCharges) + " charges in your "+name()+".");
91 }

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

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.CrawsBow.drop ( Player player,
Item item )

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

Definition at line 74 of file CrawsBow.java.

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

References com.runehive.game.world.items.containers.ItemContainer.add(), CRAWS_CHARGED_ID, CRAWS_UNCHARGED_ID, com.runehive.game.world.entity.mob.player.Player.crawsBowCharges, 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(), and com.runehive.game.world.items.containers.ItemContainer.remove().

Here is the call graph for this function:

◆ equipment()

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

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

Definition at line 62 of file CrawsBow.java.

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

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

Here is the call graph for this function:

◆ inventory()

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

The execution method of the action.

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

Definition at line 48 of file CrawsBow.java.

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

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

Here is the call graph for this function:

◆ itemOnItem()

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

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

Definition at line 22 of file CrawsBow.java.

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

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(), CRAWS_CHARGED_ID, CRAWS_UNCHARGED_ID, 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(), and com.runehive.game.world.entity.mob.player.Player.send().

Here is the call graph for this function:

◆ name()

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

The name of the action.

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

Definition at line 17 of file CrawsBow.java.

17 {
18 return "Craw's bow";
19 }

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

Here is the caller graph for this function:

Member Data Documentation

◆ CRAWS_CHARGED_ID

◆ CRAWS_UNCHARGED_ID

final short com.runehive.content.itemaction.impl.CrawsBow.CRAWS_UNCHARGED_ID = 22547
static

◆ ETHER_ID

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

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