[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
+1
View File
@@ -2,6 +2,7 @@
<project version="4"> <project version="4">
<component name="ProjectModuleManager"> <component name="ProjectModuleManager">
<modules> <modules>
<module fileurl="file://$PROJECT_DIR$/.idea/Randoms.iml" filepath="$PROJECT_DIR$/.idea/Randoms.iml" />
<module fileurl="file://$PROJECT_DIR$/Randoms.iml" filepath="$PROJECT_DIR$/Randoms.iml" /> <module fileurl="file://$PROJECT_DIR$/Randoms.iml" filepath="$PROJECT_DIR$/Randoms.iml" />
</modules> </modules>
</component> </component>
@@ -19,38 +19,35 @@ import java.util.ArrayList;
*/ */
public class BobsIsland implements Random { public class BobsIsland implements Random {
private final int PORTAL = 8987; private static final Tile CENTER = new Tile(2525,4777);
private ArrayList<SceneObject> portals; private static final int PORTAL_ID = 8987;
private final Area ISLAND = new Area(new Tile(2511, 4765), new Tile(2511, 4790), new Tile(2542, 4790), new Tile(2542, 4765));
public BobsIsland() { public BobsIsland() {
portals = new ArrayList<>();
} }
@Override @Override
public boolean activate() { public boolean activate() {
return ISLAND.contains(Players.getMyPlayer().getLocation()); return CENTER.distanceTo() < 25;
} }
@Override @Override
public void execute() { public void execute() {
//Fill The ArrayList SceneObject[] portals = SceneObjects.getNearest(PORTAL_ID);
for (SceneObject portal : SceneObjects.getNearest(PORTAL)) {
if (portal != null) {
portals.add(portal);
}
}
//Loop through the portals for(final SceneObject portal : portals){
for (final SceneObject portal : portals) { if(portal != null){
if (portal != null) { portal.interact(SceneObjects.Option.FIRST);
portal.interact(0);
Time.sleep(new SleepCondition() { Time.sleep(new SleepCondition() {
@Override @Override
public boolean isValid() { public boolean isValid() {
return portal.distanceTo() < 2; return portal.distanceTo() < 2;
} }
}, 7500); }, 10000);
Time.sleep(1000);
if(CENTER.distanceTo() > 24){
break;
}
} }
} }
} }