Handle misclicks
This commit is contained in:
parent
3fce3be950
commit
8e72c90252
@ -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.methods.walking.path.impl.LocalPath;
|
||||||
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;
|
||||||
|
|
||||||
@ -214,13 +213,7 @@ public class HandleObstacle extends TaskNode {
|
|||||||
MethodContext.sleepUntil(Util::playerIsIdle, Calculations.random(3000, 3500));
|
MethodContext.sleepUntil(Util::playerIsIdle, Calculations.random(3000, 3500));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isWalking) {
|
interact(currentObject, isWalking);
|
||||||
Mouse.setAlwaysHop(true);
|
|
||||||
currentObject.interactForceLeft(currentObject.getActions()[0]);
|
|
||||||
Mouse.setAlwaysHop(false);
|
|
||||||
} else {
|
|
||||||
currentObject.interactForceLeft(currentObject.getActions()[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle hoverRect = hoverMap.get(current.getNext().getID());
|
Rectangle hoverRect = hoverMap.get(current.getNext().getID());
|
||||||
if (hoverRect != null) {
|
if (hoverRect != null) {
|
||||||
@ -235,4 +228,24 @@ public class HandleObstacle extends TaskNode {
|
|||||||
|
|
||||||
return Calculations.random(180, 350);
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user