1package com.osroyale.content.skill.impl.farming.zones;
3import com.google.gson.JsonArray;
4import com.google.gson.JsonElement;
5import com.google.gson.JsonObject;
6import com.osroyale.content.skill.impl.farming.patches.FarmingPatch;
7import com.osroyale.game.world.Interactable;
8import com.osroyale.game.world.entity.mob.player.Player;
9import com.osroyale.game.world.items.Item;
10import com.osroyale.game.world.object.GameObject;
11import com.osroyale.game.world.position.Position;
12import com.osroyale.game.world.region.Region;
13import com.osroyale.net.packet.out.SendConfig;
14import com.osroyale.util.Utility;
58public class FarmingZone {
61 private static final int PATCH_CONFIG = 529;
75 this.boundary = boundary;
86 patches[index] = patch;
97 boolean success =
false;
99 if (patch.within(
object.getPosition())) {
100 success |= patch.clickObject(opcode);
115 boolean success =
false;
117 if (patch.within(
object.getPosition())) {
118 success |= patch.itemOnObject(item, slot);
135 for (
int index = 0; index < patches.length; index++) {
136 config |= patches[index].getConfig() << (index << 3);
139 player.send(
new SendConfig(PATCH_CONFIG, config));
156 return Utility.inside(boundary, position) ||
Utility.withinDistance(boundary, position,
Region.SIZE);
159 public JsonArray toJson() {
160 JsonArray array =
new JsonArray();
162 array.add(patch.toJson());
167 public void fromJson(JsonArray array) {
169 for (JsonElement element : array) {
170 patches[index++].fromJson((JsonObject) element);
boolean itemOnObject(GameObject object, Item item, int slot)
final void sendPatchConfigs(Player player)
boolean isViewable(Position position)
boolean clickObject(GameObject object, int opcode)