62 lines
1.5 KiB
Java
62 lines
1.5 KiB
Java
package io.reisub.dreambot.cagility;
|
|
|
|
import io.reisub.dreambot.util.Util;
|
|
import org.dreambot.api.methods.interactive.GameObjects;
|
|
import org.dreambot.api.methods.interactive.Players;
|
|
import org.dreambot.api.methods.map.Area;
|
|
import org.dreambot.api.methods.map.Tile;
|
|
import org.dreambot.api.methods.walking.path.impl.LocalPath;
|
|
import org.dreambot.api.utilities.impl.Condition;
|
|
import org.dreambot.api.wrappers.interactive.GameObject;
|
|
|
|
public class Obstacle {
|
|
private final int id;
|
|
private final Area area;
|
|
private final LocalPath<Tile> path;
|
|
private Condition startCondition;
|
|
private Obstacle next;
|
|
|
|
public Obstacle(int id, Area area, Tile... walkingTiles) {
|
|
this.id = id;
|
|
this.area = area;
|
|
path = new LocalPath<>();
|
|
path.addAll(walkingTiles);
|
|
|
|
startCondition = Util::playerIsIdle;
|
|
}
|
|
|
|
public Obstacle(int id, Area area, Condition startCondition, Tile... walkingTiles) {
|
|
this(id, area, walkingTiles);
|
|
|
|
this.startCondition = startCondition;
|
|
}
|
|
|
|
public int getID() {
|
|
return this.id;
|
|
}
|
|
|
|
public GameObject getGameObject() {
|
|
return GameObjects.closest(getID());
|
|
}
|
|
|
|
public Obstacle getNext() {
|
|
return this.next;
|
|
}
|
|
|
|
public void setNext(Obstacle next) {
|
|
this.next = next;
|
|
}
|
|
|
|
public boolean isPlayerInArea() {
|
|
return area.contains(Players.localPlayer());
|
|
}
|
|
|
|
public LocalPath<Tile> getPath() {
|
|
return path;
|
|
}
|
|
|
|
public boolean canStart() {
|
|
return startCondition.verify();
|
|
}
|
|
}
|