[FIX] FIxed Bobs Island Solver

This commit is contained in:
Fryslan
2016-06-05 23:27:35 +02:00
parent 3fba67901e
commit 509f12fe68
2 changed files with 14 additions and 16 deletions
@@ -19,38 +19,35 @@ import java.util.ArrayList;
*/
public class BobsIsland implements Random {
private final int PORTAL = 8987;
private ArrayList<SceneObject> portals;
private final Area ISLAND = new Area(new Tile(2511, 4765), new Tile(2511, 4790), new Tile(2542, 4790), new Tile(2542, 4765));
private static final Tile CENTER = new Tile(2525,4777);
private static final int PORTAL_ID = 8987;
public BobsIsland() {
portals = new ArrayList<>();
}
@Override
public boolean activate() {
return ISLAND.contains(Players.getMyPlayer().getLocation());
return CENTER.distanceTo() < 25;
}
@Override
public void execute() {
//Fill The ArrayList
for (SceneObject portal : SceneObjects.getNearest(PORTAL)) {
if (portal != null) {
portals.add(portal);
}
}
SceneObject[] portals = SceneObjects.getNearest(PORTAL_ID);
//Loop through the portals
for (final SceneObject portal : portals) {
if (portal != null) {
portal.interact(0);
for(final SceneObject portal : portals){
if(portal != null){
portal.interact(SceneObjects.Option.FIRST);
Time.sleep(new SleepCondition() {
@Override
public boolean isValid() {
return portal.distanceTo() < 2;
}
}, 7500);
}, 10000);
Time.sleep(1000);
if(CENTER.distanceTo() > 24){
break;
}
}
}
}