- Joined
- Jan 8, 2015
- Messages
- 1,427
- Thread Author
- #1
The code I used is the following;
Any ideas where it can go wrong?
Java:
public static boolean walkToArea(final Area area) {
final Coordinate destination = area.getRandomCoordinate();
final WebPath path = Traversal.getDefaultWeb().getPathBuilder().buildTo(destination);
return path != null && path.step(true);
}
Java:
@Override
public boolean validate() {
return Inventory.isFull() || Inventory.isEmpty();
}
@Override
public void execute() {
if (Methods.atBank()) {
if (Inventory.isFull()) {
if (!Bank.isOpen()) {
Bank.open();
} else {
clickDepositAllButton();
}
} else {
if (Bank.isOpen()) {
Bank.close();
} else {
walkToMiningSpot();
}
}
} else if (Methods.atMiningSpot()) {
if (Inventory.isFull()) {
walkToBank();
}
} else {
if (Inventory.isFull()) {
walkToBank();
} else {
walkToMiningSpot();
}
}
}
private boolean clickDepositAllButton() {
InterfaceComponent button = Interfaces.getAt(12, 25);
if (button != null) {
if (button.isValid() && button.isVisible()) {
LazyAIOMiner.status = "Depositing items";
if (button.click()) {
Execution.delayUntil(() - > Inventory.isEmpty(), 1000, 1500);
return true;
}
}
}
return false;
}
private boolean walkToBank() {
LazyAIOMiner.status = "Walking to bank";
return Methods.walkToArea(LazyAIOMiner.bankArea);
/*Coordinate location = LazyAIOMiner.bankArea.getRandomCoordinate();
WebPath bankPath = Traversal.getDefaultWeb().getPathBuilder().buildTo(location);
if (bankPath != null) {
LazyAIOMiner.status = "Walking to bank";
return bankPath.step();
}
return false;*/
}
private boolean walkToMiningSpot() {
LazyAIOMiner.status = "Walking to mining spot";
return Methods.walkToArea(LazyAIOMiner.mineArea);
/*Coordinate location = LazyAIOMiner.mineArea.getRandomCoordinate();
WebPath minePath = Traversal.getDefaultWeb().getPathBuilder().buildTo(location);
if (minePath != null) {
LazyAIOMiner.status = "Walking to mining spot";
return minePath.step();
}
return false;*/
}
Any ideas where it can go wrong?