Finetuning walking between obstacles
This commit is contained in:
parent
cd6ec994fd
commit
3e27bf8a08
@ -4,18 +4,20 @@ 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.wrappers.interactive.GameObject;
|
||||
|
||||
public class Obstacle {
|
||||
private final int id;
|
||||
private final Area area;
|
||||
private final Tile[] walkingTiles;
|
||||
private final LocalPath<Tile> path;
|
||||
private Obstacle next;
|
||||
|
||||
public Obstacle(int id, Area area, Tile... walkingTiles) {
|
||||
this.id = id;
|
||||
this.area = area;
|
||||
this.walkingTiles = walkingTiles;
|
||||
path = new LocalPath<>();
|
||||
path.addAll(walkingTiles);
|
||||
}
|
||||
|
||||
public int getID() {
|
||||
@ -38,7 +40,7 @@ public class Obstacle {
|
||||
return area.contains(Players.localPlayer());
|
||||
}
|
||||
|
||||
public Tile[] getWalkingTiles() {
|
||||
return walkingTiles;
|
||||
public LocalPath<Tile> getPath() {
|
||||
return path;
|
||||
}
|
||||
}
|
||||
|
@ -12,9 +12,9 @@ import org.dreambot.api.methods.item.GroundItems;
|
||||
import org.dreambot.api.methods.map.Area;
|
||||
import org.dreambot.api.methods.map.Tile;
|
||||
import org.dreambot.api.methods.walking.impl.Walking;
|
||||
import org.dreambot.api.methods.walking.path.impl.LocalPath;
|
||||
import org.dreambot.api.script.ScriptManager;
|
||||
import org.dreambot.api.script.TaskNode;
|
||||
import org.dreambot.api.utilities.impl.Condition;
|
||||
import org.dreambot.api.wrappers.interactive.GameObject;
|
||||
import org.dreambot.api.wrappers.items.GroundItem;
|
||||
|
||||
@ -77,8 +77,8 @@ public class HandleObstacle extends TaskNode {
|
||||
new Tile(2735, 3459, 0),
|
||||
new Tile(2735, 3495, 0),
|
||||
new Tile(2698, 3494, 0)),
|
||||
new Tile(2719, 3472, 0),
|
||||
new Tile(2727, 3482, 0)),
|
||||
new Tile(2720, 3470, 0),
|
||||
new Tile(2727, 3480, 0)),
|
||||
new Obstacle(14928, new Area(
|
||||
new Tile(2721, 3489, 3),
|
||||
new Tile(2730, 3489, 3),
|
||||
@ -170,19 +170,20 @@ public class HandleObstacle extends TaskNode {
|
||||
|
||||
boolean isWalking = false;
|
||||
|
||||
if (current.getWalkingTiles() != null && currentObject.distance() > 20) {
|
||||
LocalPath<Tile> path = current.getPath();
|
||||
if (path.size() > 0 && currentObject.distance() > 20) {
|
||||
isWalking = true;
|
||||
|
||||
if (hoverMap.get(current.getID()) == null) {
|
||||
Tile t = current.getWalkingTiles()[0];
|
||||
MiniMapTileDestination td = new MiniMapTileDestination(t);
|
||||
MiniMapTileDestination td = new MiniMapTileDestination(path.first());
|
||||
hoverMap.put(current.getID(), td.getBoundingBox());
|
||||
}
|
||||
|
||||
for (Tile t : current.getWalkingTiles()) {
|
||||
final Tile target = t.getRandomizedTile();
|
||||
Walking.clickTileOnMinimap(target);
|
||||
MethodContext.sleepUntil(() -> target.distance(Players.localPlayer()) < Calculations.random(4, 7), Calculations.random(12000, 13000));
|
||||
for (Tile t : path) {
|
||||
final Tile target = t.getRandomizedTile(1);
|
||||
Walking.clickTileOnMinimap(target)
|
||||
|
||||
MethodContext.sleepUntil(() -> target.distance(Players.localPlayer()) < Calculations.random(4, 7), Calculations.random(14000, 15000));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user