RuneHive-Game
Loading...
Searching...
No Matches
com.runehive.content.skill.impl.farming.Farming Class Reference

Public Member Functions

 Farming (Player player)
void fromJson (JsonObject object)
void regionChange (Player player)
JsonObject toJson ()

Static Public Member Functions

static boolean firstClickObject (Player player, GameObject object)
static double getBonus (Player player)
static boolean itemOnObject (Player player, GameObject object, Item item, int slot)
static boolean secondClickObject (Player player, GameObject object)
static void tick (Player player)

Private Attributes

final List< FarmingZonezones = new LinkedList<>()

Detailed Description

Definition at line 13 of file Farming.java.

Constructor & Destructor Documentation

◆ Farming()

com.runehive.content.skill.impl.farming.Farming.Farming ( Player player)

Definition at line 16 of file Farming.java.

16 {
17 zones.add(new CatherbyZone(player));
18 zones.add(new ArdougneZone(player));
19 zones.add(new FaladorZone(player));
20 zones.add(new PhasmatyZone(player));
21 }

References zones.

Member Function Documentation

◆ firstClickObject()

boolean com.runehive.content.skill.impl.farming.Farming.firstClickObject ( Player player,
GameObject object )
static

Definition at line 51 of file Farming.java.

51 {
52 boolean success = false;
53 for (FarmingZone zone : player.farming.zones) {
54 if (zone.isViewable(player.getPosition())) {
55 success |= zone.clickObject(object, 1);
56 }
57 }
58 return success;
59 }
boolean clickObject(GameObject object, int opcode)
Handles clicking a farming patch.
boolean isViewable(Position position)
Checks if a position can see this farming zone.

References com.runehive.content.skill.impl.farming.zones.FarmingZone.clickObject(), com.runehive.game.world.entity.mob.player.Player.farming, com.runehive.game.world.entity.Entity.getPosition(), com.runehive.content.skill.impl.farming.zones.FarmingZone.isViewable(), and zones.

Here is the call graph for this function:

◆ fromJson()

void com.runehive.content.skill.impl.farming.Farming.fromJson ( JsonObject object)

Definition at line 87 of file Farming.java.

87 {
88 for (FarmingZone zone : zones) {
89 if (!object.has(zone.getClass().getSimpleName())) {
90 continue;
91 }
92
93 JsonArray thing = object.get(zone.getClass().getSimpleName()).getAsJsonArray();
94 zone.fromJson(thing);
95 }
96 }

References zones.

◆ getBonus()

double com.runehive.content.skill.impl.farming.Farming.getBonus ( Player player)
static

Definition at line 33 of file Farming.java.

33 {
34 double bonus = 0;
35 if(player.equipment.getId(0) == 13646)
36 bonus += 0.4;
37 if(player.equipment.getId(4) == 13642)
38 bonus += 0.8;
39 if(player.equipment.getId(7) == 13640)
40 bonus += 0.6;
41 if(player.equipment.getId(10) == 13644)
42 bonus += 0.2;
43
44 if(player.equipment.containsAll(13646, 13642, 13640, 13644))
45 bonus = 2.5;
46
47 return bonus;
48 }
final int getId(int index)
Gets the item id located on index.
final boolean containsAll(int... identifiers)
Determines if this container contains all identifiers.

References com.runehive.game.world.items.containers.ItemContainer.containsAll(), com.runehive.game.world.entity.mob.player.Player.equipment, and com.runehive.game.world.items.containers.ItemContainer.getId().

Referenced by com.runehive.game.world.entity.skill.SkillManager.addExperience().

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

◆ itemOnObject()

boolean com.runehive.content.skill.impl.farming.Farming.itemOnObject ( Player player,
GameObject object,
Item item,
int slot )
static

Definition at line 23 of file Farming.java.

23 {
24 boolean success = false;
25 for (FarmingZone zone : player.farming.zones) {
26 if (zone.isViewable(player.getPosition())) {
27 success |= zone.itemOnObject(object, item, slot);
28 }
29 }
30 return success;
31 }
boolean itemOnObject(GameObject object, Item item, int slot)
Handles using an item on a farming patch.

References com.runehive.game.world.entity.mob.player.Player.farming, com.runehive.game.world.entity.Entity.getPosition(), com.runehive.content.skill.impl.farming.zones.FarmingZone.isViewable(), com.runehive.content.skill.impl.farming.zones.FarmingZone.itemOnObject(), and zones.

Here is the call graph for this function:

◆ regionChange()

void com.runehive.content.skill.impl.farming.Farming.regionChange ( Player player)

Definition at line 75 of file Farming.java.

75 {
76 zones.forEach(zone -> zone.sendPatchConfigs(player));
77 }

References zones.

◆ secondClickObject()

boolean com.runehive.content.skill.impl.farming.Farming.secondClickObject ( Player player,
GameObject object )
static

Definition at line 61 of file Farming.java.

61 {
62 boolean success = false;
63 for (FarmingZone zone : player.farming.zones) {
64 if (zone.isViewable(player.getPosition())) {
65 success |= zone.clickObject(object, 2);
66 }
67 }
68 return success;
69 }

References com.runehive.content.skill.impl.farming.zones.FarmingZone.clickObject(), com.runehive.game.world.entity.mob.player.Player.farming, com.runehive.game.world.entity.Entity.getPosition(), com.runehive.content.skill.impl.farming.zones.FarmingZone.isViewable(), and zones.

Here is the call graph for this function:

◆ tick()

void com.runehive.content.skill.impl.farming.Farming.tick ( Player player)
static

Definition at line 71 of file Farming.java.

71 {
72 player.farming.zones.forEach(FarmingZone::tick);
73 }
final void tick()
Ticks the farming patches in this zone.

References com.runehive.game.world.entity.mob.player.Player.farming, com.runehive.content.skill.impl.farming.zones.FarmingZone.tick(), and zones.

Referenced by com.runehive.game.world.entity.mob.player.PlayerAssistant.sequence().

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

◆ toJson()

JsonObject com.runehive.content.skill.impl.farming.Farming.toJson ( )

Definition at line 79 of file Farming.java.

79 {
80 JsonObject object = new JsonObject();
81 for (FarmingZone zone : zones) {
82 object.add(zone.getClass().getSimpleName(), zone.toJson());
83 }
84 return object;
85 }

References zones.

Member Data Documentation

◆ zones

final List<FarmingZone> com.runehive.content.skill.impl.farming.Farming.zones = new LinkedList<>()
private

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