Optimize Seers agility course

This commit is contained in:
Yuri Moens 2021-10-28 00:00:55 +02:00
parent 7f44187e6b
commit 1aa793b4bf
Signed by: ymo
GPG Key ID: F6D51D6FE15BE924
2 changed files with 22 additions and 4 deletions

View File

@ -44,5 +44,9 @@ public class CAgility extends CTaskScript {
int marks = PickupMark.marksPickedUp;
getUI().drawString("Marks picked up: " + marks + " (" + getUI().getHourlyRate(marks) + " per hour)");
if (HandleObstacle.current != null && HandleObstacle.current.getGameObject() != null && HandleObstacle.current.getGameObject().getModel() != null) {
HandleObstacle.current.getGameObject().getModel().drawWireFrame(g);
}
}
}

View File

@ -4,6 +4,9 @@ import io.reisub.dreambot.cagility.Obstacle;
import io.reisub.dreambot.util.Constants;
import io.reisub.dreambot.util.Util;
import org.dreambot.api.input.Mouse;
import org.dreambot.api.input.event.impl.InteractionEvent;
import org.dreambot.api.input.event.impl.InteractionSetting;
import org.dreambot.api.input.mouse.destination.impl.EntityDestination;
import org.dreambot.api.input.mouse.destination.impl.MiniMapTileDestination;
import org.dreambot.api.methods.Calculations;
import org.dreambot.api.methods.MethodContext;
@ -84,7 +87,8 @@ public class HandleObstacle extends TaskNode {
new Tile(2721, 3489, 3),
new Tile(2730, 3489, 3),
new Tile(2730, 3497, 3),
new Tile(2721, 3497, 3))),
new Tile(2721, 3497, 3)),
() -> Players.localPlayer().getTile().equals(new Tile(2729, 3491, 3))),
new Obstacle(14932, new Area(
new Tile(2715, 3487, 2),
new Tile(2715, 3498, 2),
@ -145,7 +149,7 @@ public class HandleObstacle extends TaskNode {
private final Course course;
private final Map<Integer, Rectangle> hoverMap;
private Obstacle current;
public static Obstacle current;
private int retries = 0;
public HandleObstacle(Course course) {
@ -196,6 +200,7 @@ public class HandleObstacle extends TaskNode {
}
Tile finalTarget = target;
if (!MethodProvider.sleepUntil(() -> Players.localPlayer().isMoving(), Calculations.random(1200, 1500))) continue;
MethodContext.sleepUntil(() -> finalTarget.distance(Players.localPlayer()) < Calculations.random(4, 7), Calculations.random(14000, 15000));
}
}
@ -221,6 +226,10 @@ public class HandleObstacle extends TaskNode {
Mouse.move(hoverRect);
}
if (!Util.sleepUntilMoving(Calculations.random(1200, 1500))) {
return Calculations.random(180, 350);
}
if (isWalking) {
Util.sleepUntilMovingAndAnimating(Calculations.random(12000, 13000));
} else {
@ -232,7 +241,10 @@ public class HandleObstacle extends TaskNode {
public void interact(GameObject currentObject, boolean shouldHop) {
Mouse.setAlwaysHop(shouldHop);
currentObject.interactForceLeft(currentObject.getActions()[0]);
EntityDestination ed = new EntityDestination(currentObject);
InteractionEvent ie = new InteractionEvent(ed);
ie.interact(currentObject.getActions()[0], InteractionSetting.EMPTY_SETTING, InteractionSetting.FORCE_LEFT_CLICK);
//currentObject.interactForceLeft(currentObject.getActions()[0]);
Mouse.setAlwaysHop(false);
Tile dest = null;
@ -244,6 +256,8 @@ public class HandleObstacle extends TaskNode {
dest = Walking.getDestination();
}
if (dest == null) return;
if (!currentObject.getObjectTiles().contains(dest) && !currentObject.getInteractableFrom().contains(dest)) {
MethodProvider.log("Misclick, trying again ");
interact(currentObject, true);