Compare commits
2 Commits
0cb56342ee
...
8e72c90252
Author | SHA1 | Date | |
---|---|---|---|
8e72c90252
|
|||
3fce3be950
|
@ -8,11 +8,8 @@ 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.kitten.KittenTask;
|
||||
import org.dreambot.api.methods.MethodProvider;
|
||||
import org.dreambot.api.methods.interactive.Players;
|
||||
import org.dreambot.api.methods.skills.Skill;
|
||||
import org.dreambot.api.script.Category;
|
||||
import org.dreambot.api.script.ScriptManager;
|
||||
import org.dreambot.api.script.ScriptManifest;
|
||||
import org.dreambot.api.script.TaskNode;
|
||||
|
||||
|
@ -16,7 +16,6 @@ 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;
|
||||
|
||||
@ -214,13 +213,7 @@ public class HandleObstacle extends TaskNode {
|
||||
MethodContext.sleepUntil(Util::playerIsIdle, Calculations.random(3000, 3500));
|
||||
}
|
||||
|
||||
if (isWalking) {
|
||||
Mouse.setAlwaysHop(true);
|
||||
currentObject.interactForceLeft(currentObject.getActions()[0]);
|
||||
Mouse.setAlwaysHop(false);
|
||||
} else {
|
||||
currentObject.interactForceLeft(currentObject.getActions()[0]);
|
||||
}
|
||||
interact(currentObject, isWalking);
|
||||
|
||||
Rectangle hoverRect = hoverMap.get(current.getNext().getID());
|
||||
if (hoverRect != null) {
|
||||
@ -235,4 +228,24 @@ public class HandleObstacle extends TaskNode {
|
||||
|
||||
return Calculations.random(180, 350);
|
||||
}
|
||||
|
||||
public void interact(GameObject currentObject, boolean shouldHop) {
|
||||
Mouse.setAlwaysHop(shouldHop);
|
||||
currentObject.interactForceLeft(currentObject.getActions()[0]);
|
||||
Mouse.setAlwaysHop(false);
|
||||
|
||||
Tile dest = null;
|
||||
|
||||
if (MethodProvider.sleepUntil(() -> {
|
||||
Tile t = Walking.getDestination();
|
||||
return t != null;
|
||||
}, Calculations.random(1000, 1100))) {
|
||||
dest = Walking.getDestination();
|
||||
}
|
||||
|
||||
if (!currentObject.getObjectTiles().contains(dest) && !currentObject.getInteractableFrom().contains(dest)) {
|
||||
MethodProvider.log("Misclick, trying again");
|
||||
interact(currentObject, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,12 +4,10 @@ import io.reisub.dreambot.util.Constants;
|
||||
import io.reisub.dreambot.util.Util;
|
||||
import org.dreambot.api.methods.Calculations;
|
||||
import org.dreambot.api.methods.MethodContext;
|
||||
import org.dreambot.api.methods.MethodProvider;
|
||||
import org.dreambot.api.methods.container.impl.Inventory;
|
||||
import org.dreambot.api.methods.interactive.Players;
|
||||
import org.dreambot.api.methods.item.GroundItems;
|
||||
import org.dreambot.api.script.TaskNode;
|
||||
import org.dreambot.api.utilities.impl.Condition;
|
||||
import org.dreambot.api.wrappers.items.GroundItem;
|
||||
import org.dreambot.api.wrappers.items.Item;
|
||||
|
||||
|
Reference in New Issue
Block a user