Add Seers course
This commit is contained in:
parent
3c8daa5189
commit
eededcb580
@ -2,6 +2,7 @@ package io.reisub.dreambot.cagility;
|
|||||||
|
|
||||||
import io.reisub.dreambot.cagility.tasks.HandleObstacle;
|
import io.reisub.dreambot.cagility.tasks.HandleObstacle;
|
||||||
import io.reisub.dreambot.cagility.tasks.PickupMark;
|
import io.reisub.dreambot.cagility.tasks.PickupMark;
|
||||||
|
import io.reisub.dreambot.cagility.tasks.TurnOnRun;
|
||||||
import io.reisub.dreambot.util.CTaskScript;
|
import io.reisub.dreambot.util.CTaskScript;
|
||||||
import io.reisub.dreambot.util.Constants;
|
import io.reisub.dreambot.util.Constants;
|
||||||
import io.reisub.dreambot.util.randomevents.GenieSolver;
|
import io.reisub.dreambot.util.randomevents.GenieSolver;
|
||||||
@ -27,7 +28,8 @@ public class CAgility extends CTaskScript {
|
|||||||
addNodes(
|
addNodes(
|
||||||
new Eat(),
|
new Eat(),
|
||||||
KittenTask.createKittenTask(),
|
KittenTask.createKittenTask(),
|
||||||
new HandleObstacle(HandleObstacle.Course.CANIFIS),
|
new TurnOnRun(),
|
||||||
|
new HandleObstacle(HandleObstacle.Course.SEERS),
|
||||||
new PickupMark()
|
new PickupMark()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -3,16 +3,19 @@ package io.reisub.dreambot.cagility;
|
|||||||
import org.dreambot.api.methods.interactive.GameObjects;
|
import org.dreambot.api.methods.interactive.GameObjects;
|
||||||
import org.dreambot.api.methods.interactive.Players;
|
import org.dreambot.api.methods.interactive.Players;
|
||||||
import org.dreambot.api.methods.map.Area;
|
import org.dreambot.api.methods.map.Area;
|
||||||
|
import org.dreambot.api.methods.map.Tile;
|
||||||
import org.dreambot.api.wrappers.interactive.GameObject;
|
import org.dreambot.api.wrappers.interactive.GameObject;
|
||||||
|
|
||||||
public class Obstacle {
|
public class Obstacle {
|
||||||
private final int id;
|
private final int id;
|
||||||
private final Area[] areas;
|
private final Area area;
|
||||||
|
private final Tile[] walkingTiles;
|
||||||
private Obstacle next;
|
private Obstacle next;
|
||||||
|
|
||||||
public Obstacle(int id, Area... areas) {
|
public Obstacle(int id, Area area, Tile... walkingTiles) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.areas = areas;
|
this.area = area;
|
||||||
|
this.walkingTiles = walkingTiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getID() {
|
public int getID() {
|
||||||
@ -32,12 +35,10 @@ public class Obstacle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPlayerInArea() {
|
public boolean isPlayerInArea() {
|
||||||
for (Area area : areas) {
|
return area.contains(Players.localPlayer());
|
||||||
if (area.contains(Players.localPlayer())) {
|
}
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
public Tile[] getWalkingTiles() {
|
||||||
|
return walkingTiles;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import io.reisub.dreambot.cagility.Obstacle;
|
|||||||
import io.reisub.dreambot.util.Constants;
|
import io.reisub.dreambot.util.Constants;
|
||||||
import io.reisub.dreambot.util.Util;
|
import io.reisub.dreambot.util.Util;
|
||||||
import org.dreambot.api.input.Mouse;
|
import org.dreambot.api.input.Mouse;
|
||||||
|
import org.dreambot.api.input.mouse.destination.impl.MiniMapTileDestination;
|
||||||
import org.dreambot.api.methods.Calculations;
|
import org.dreambot.api.methods.Calculations;
|
||||||
import org.dreambot.api.methods.MethodContext;
|
import org.dreambot.api.methods.MethodContext;
|
||||||
import org.dreambot.api.methods.interactive.Players;
|
import org.dreambot.api.methods.interactive.Players;
|
||||||
@ -13,6 +14,7 @@ import org.dreambot.api.methods.map.Tile;
|
|||||||
import org.dreambot.api.methods.walking.impl.Walking;
|
import org.dreambot.api.methods.walking.impl.Walking;
|
||||||
import org.dreambot.api.script.ScriptManager;
|
import org.dreambot.api.script.ScriptManager;
|
||||||
import org.dreambot.api.script.TaskNode;
|
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.interactive.GameObject;
|
||||||
import org.dreambot.api.wrappers.items.GroundItem;
|
import org.dreambot.api.wrappers.items.GroundItem;
|
||||||
|
|
||||||
@ -68,6 +70,44 @@ public class HandleObstacle extends TaskNode {
|
|||||||
new Tile(3516, 3476, 2),
|
new Tile(3516, 3476, 2),
|
||||||
new Tile(3516, 3484, 2),
|
new Tile(3516, 3484, 2),
|
||||||
new Tile(3507, 3484, 2)))
|
new Tile(3507, 3484, 2)))
|
||||||
|
),
|
||||||
|
SEERS(
|
||||||
|
new Obstacle(14927, new Area(
|
||||||
|
new Tile(2697, 3459, 0),
|
||||||
|
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 Obstacle(14928, new Area(
|
||||||
|
new Tile(2721, 3489, 3),
|
||||||
|
new Tile(2730, 3489, 3),
|
||||||
|
new Tile(2730, 3497, 3),
|
||||||
|
new Tile(2721, 3497, 3))),
|
||||||
|
new Obstacle(14932, new Area(
|
||||||
|
new Tile(2715, 3487, 2),
|
||||||
|
new Tile(2715, 3498, 2),
|
||||||
|
new Tile(2704, 3498, 2),
|
||||||
|
new Tile(2704, 3487, 2))),
|
||||||
|
new Obstacle(14929, new Area(
|
||||||
|
new Tile(2708, 3482, 2),
|
||||||
|
new Tile(2717, 3482, 2),
|
||||||
|
new Tile(2717, 3475, 2),
|
||||||
|
new Tile(2708, 3475, 2))),
|
||||||
|
new Obstacle(14930, new Area(
|
||||||
|
new Tile(2716, 3468, 3),
|
||||||
|
new Tile(2699, 3468, 3),
|
||||||
|
new Tile(2699, 3476, 3),
|
||||||
|
new Tile(2707, 3476, 3),
|
||||||
|
new Tile(2708, 3474, 3),
|
||||||
|
new Tile(2716, 3474, 3))),
|
||||||
|
new Obstacle(14931, new Area(
|
||||||
|
new Tile(2704, 3467, 2),
|
||||||
|
new Tile(2693, 3467, 2),
|
||||||
|
new Tile(2693, 3459, 2),
|
||||||
|
new Tile(2704, 3459, 2)))
|
||||||
|
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
private final Obstacle[] obstacles;
|
private final Obstacle[] obstacles;
|
||||||
@ -128,7 +168,26 @@ public class HandleObstacle extends TaskNode {
|
|||||||
final GameObject currentObject = current.getGameObject();
|
final GameObject currentObject = current.getGameObject();
|
||||||
if (currentObject == null) return Calculations.random(300, 500);
|
if (currentObject == null) return Calculations.random(300, 500);
|
||||||
|
|
||||||
if (!currentObject.isOnScreen()) {
|
boolean isWalking = false;
|
||||||
|
|
||||||
|
if (current.getWalkingTiles() != null && currentObject.distance() > 20) {
|
||||||
|
isWalking = true;
|
||||||
|
|
||||||
|
if (hoverMap.get(current.getID()) == null) {
|
||||||
|
Tile t = current.getWalkingTiles()[0];
|
||||||
|
MiniMapTileDestination td = new MiniMapTileDestination(t);
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
while (!currentObject.isOnScreen() || currentObject.distance() > 15) {
|
||||||
|
isWalking = true;
|
||||||
Walking.walk(currentObject);
|
Walking.walk(currentObject);
|
||||||
MethodContext.sleepUntil(() -> Players.localPlayer().distance(currentObject) < 3, Calculations.random(5000, 5500));
|
MethodContext.sleepUntil(() -> Players.localPlayer().distance(currentObject) < 3, Calculations.random(5000, 5500));
|
||||||
}
|
}
|
||||||
@ -137,7 +196,9 @@ public class HandleObstacle extends TaskNode {
|
|||||||
hoverMap.put(current.getID(), currentObject.getBoundingBox());
|
hoverMap.put(current.getID(), currentObject.getBoundingBox());
|
||||||
}
|
}
|
||||||
|
|
||||||
MethodContext.sleepUntil(Util::playerIsIdle, Calculations.random(3000, 3500));
|
if (!isWalking) {
|
||||||
|
MethodContext.sleepUntil(Util::playerIsIdle, Calculations.random(3000, 3500));
|
||||||
|
}
|
||||||
|
|
||||||
currentObject.interact();
|
currentObject.interact();
|
||||||
|
|
||||||
@ -146,7 +207,11 @@ public class HandleObstacle extends TaskNode {
|
|||||||
Mouse.move(hoverRect);
|
Mouse.move(hoverRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
Util.sleepUntilMovingAndAnimating(Calculations.random(6000, 7000));
|
if (isWalking) {
|
||||||
|
Util.sleepUntilMovingAndAnimating(Calculations.random(12000, 13000));
|
||||||
|
} else {
|
||||||
|
Util.sleepUntilMovingAndAnimating(Calculations.random(6000, 7000));
|
||||||
|
}
|
||||||
|
|
||||||
return Calculations.random(180, 350);
|
return Calculations.random(180, 350);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,30 @@
|
|||||||
|
package io.reisub.dreambot.cagility.tasks;
|
||||||
|
|
||||||
|
import org.dreambot.api.methods.Calculations;
|
||||||
|
import org.dreambot.api.methods.MethodContext;
|
||||||
|
import org.dreambot.api.methods.walking.impl.Walking;
|
||||||
|
import org.dreambot.api.script.TaskNode;
|
||||||
|
|
||||||
|
public class TurnOnRun extends TaskNode {
|
||||||
|
private int threshold;
|
||||||
|
|
||||||
|
public TurnOnRun() {
|
||||||
|
threshold = Calculations.random(75, 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean accept() {
|
||||||
|
return !Walking.isRunEnabled() && Walking.getRunEnergy() > threshold;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int execute() {
|
||||||
|
Walking.toggleRun();
|
||||||
|
|
||||||
|
if (MethodContext.sleepUntil(Walking::isRunEnabled, Calculations.random(1500, 2000))) {
|
||||||
|
threshold = Calculations.random(75, 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Calculations.random(200, 400);
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user