Add general Run task
This commit is contained in:
parent
a9ef578e50
commit
17f2a005ca
@ -2,11 +2,11 @@ package io.reisub.dreambot.cagility;
|
||||
|
||||
import io.reisub.dreambot.cagility.tasks.HandleObstacle;
|
||||
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.Constants;
|
||||
import io.reisub.dreambot.util.randomevents.GenieSolver;
|
||||
import io.reisub.dreambot.util.tasks.Eat;
|
||||
import io.reisub.dreambot.util.tasks.Run;
|
||||
import io.reisub.dreambot.util.tasks.kitten.KittenTask;
|
||||
import org.dreambot.api.methods.skills.Skill;
|
||||
import org.dreambot.api.script.Category;
|
||||
@ -32,7 +32,7 @@ public class CAgility extends CTaskScript {
|
||||
|
||||
addNodes(
|
||||
new Eat(),
|
||||
new TurnOnRun(),
|
||||
new Run(),
|
||||
new HandleObstacle(HandleObstacle.Course.SEERS),
|
||||
new PickupMark()
|
||||
);
|
||||
|
@ -6,10 +6,10 @@ import io.reisub.dreambot.cshopper.tasks.Open;
|
||||
import io.reisub.dreambot.cshopper.tasks.Stop;
|
||||
import io.reisub.dreambot.util.CTaskScript;
|
||||
import io.reisub.dreambot.util.Constants;
|
||||
import io.reisub.dreambot.util.tasks.Run;
|
||||
import org.dreambot.api.methods.container.impl.Inventory;
|
||||
import org.dreambot.api.script.Category;
|
||||
import org.dreambot.api.script.ScriptManifest;
|
||||
import org.dreambot.api.script.impl.TaskScript;
|
||||
import org.dreambot.api.wrappers.items.Item;
|
||||
|
||||
import java.awt.*;
|
||||
@ -36,6 +36,7 @@ public class CShopper extends CTaskScript {
|
||||
buyTask = new Buy();
|
||||
|
||||
addNodes(
|
||||
new Run(),
|
||||
new Open(),
|
||||
buyTask,
|
||||
new Hop(),
|
||||
|
@ -1,20 +1,31 @@
|
||||
package io.reisub.dreambot.cagility.tasks;
|
||||
package io.reisub.dreambot.util.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 {
|
||||
public class Run extends TaskNode {
|
||||
private final int min, max;
|
||||
private int threshold;
|
||||
|
||||
public TurnOnRun() {
|
||||
threshold = Calculations.random(75, 100);
|
||||
public Run() {
|
||||
this(75, 100);
|
||||
}
|
||||
|
||||
public Run(int threshold) {
|
||||
this(threshold, threshold+1);
|
||||
}
|
||||
|
||||
public Run(int min, int max) {
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
this.threshold = Calculations.random(min, max);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean accept() {
|
||||
return !Walking.isRunEnabled() && Walking.getRunEnergy() > threshold;
|
||||
return !Walking.isRunEnabled() && Walking.getRunEnergy() >= threshold;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -22,7 +33,7 @@ public class TurnOnRun extends TaskNode {
|
||||
Walking.toggleRun();
|
||||
|
||||
if (MethodContext.sleepUntil(Walking::isRunEnabled, Calculations.random(1500, 2000))) {
|
||||
threshold = Calculations.random(75, 100);
|
||||
threshold = Calculations.random(min, max);
|
||||
}
|
||||
|
||||
return Calculations.random(200, 400);
|
Loading…
x
Reference in New Issue
Block a user