1package com.runehive.content.skill.impl.farming.patches;
3import com.google.gson.JsonObject;
4import com.runehive.Config;
5import com.runehive.content.skillcape.SkillCape;
6import com.runehive.content.skill.impl.farming.FarmingConstants;
7import com.runehive.content.skill.impl.farming.zones.FarmingZone;
8import com.runehive.game.action.Action;
9import com.runehive.game.action.policy.WalkablePolicy;
10import com.runehive.game.world.Interactable;
11import com.runehive.game.world.entity.mob.player.Player;
12import com.runehive.game.world.entity.skill.Skill;
13import com.runehive.util.RandomUtils;
44 private boolean harvest(
int min,
int max) {
51 player.dialogueFactory.sendStatement(
"You need secateurs to harvest here.").execute();
55 min = min *
compost.produceIncrease() / 100;
72 protected boolean canSchedule() {
73 return !
player.locking.locked() &&
player.inventory.getFreeSlots() > 0;
77 protected void onSchedule() {
80 player.message(
"You begin to harvest the crop for " +
plant.getProductType() +
".");
84 public void execute() {
85 if (
player.inventory.getFreeSlots() <= 0) {
118 public void onCancel(
boolean logout) {
129 public String getName() {
130 return "Farming Harvest";
149 return super.clickObject(opcode);
160 JsonObject
object = super.toJson();
161 object.addProperty(
"harvest",
harvest);
167 harvest =
object.get(
"harvest").getAsInt();
168 super.fromJson(
object);
The class that contains setting-related constants for the server.
static final double FARMING_MODIFICATION
The experience modification for farming.
static final int SECATEURS
static final int MAGIC_SECATEURS
final Interactable[] boundaries
FarmingPatch(Player player, FarmingZone zone, Interactable[] boundaries)
HarvestablePatch(Player player, FarmingZone zone, Interactable[] boundaries)
Constructs a new HarvestablePatch object.
boolean clickObject(int opcode)
abstract int getMaxAmount()
boolean harvest(int min, int max)
Harvests produce in this patch if the requirements are met.
Action< Player > createHarvestAction(Player player, int min, int max)
Creates the harvesting action.
int harvest
The harvest amount.
void fromJson(JsonObject object)
abstract int getMinAmount()
A zone that manages farming patches.
Represents an action an entity can execute.
This class represents a character controlled by a player.
Represents a trainable and usable skill.
static final int FARMING
The farming skill id.
A static-util class that provides additional functionality for generating pseudo-random numbers.
static int inclusive(int min, int max)
Returns a pseudo-random int value between inclusive min and inclusive max.
static boolean isEquipped(Player player, SkillCape cape)
A queue policy determines whether the action can occur while walking.
NON_WALKABLE
This indicates actions cannot occur while walking.
An object implementing Interactable has uses.