private boolean dialogIsClear() { // recieving axe and tinderbox if (WIDGIT .INFO_BAR_3 .COMPONENT(1) .text() .toLowerCase() .contains("the survival guide gives you")) { WIDGIT.INFO_BAR_3.COMPONENT(3).click(); return false; } if (WIDGIT.INFO_BAR_2.COMPONENT(1).text().toLowerCase().contains("viewing the items")) { openInvo(); return false; } if (WIDGIT.INFO_BAR_2.COMPONENT(1).text().toLowerCase().contains("you get some logs")) { WIDGIT.INFO_BAR_2.COMPONENT(2).click(); return false; } if (WIDGIT .INFO_BAR_2 .COMPONENT(1) .text() .toLowerCase() .contains("you gained some experience")) { ctx.game.tab(Game.Tab.STATS); return false; } return true; }
private STATE getState() { if (distanceTo(centre) > 5 || distanceTo(centre) < -1) { return STATE.WALKING; } // player is close to survival expert if (WIDGIT.INFO_BAR_2.COMPONENT(0).text().toLowerCase().contains("cut down a tree")) { return STATE.CUTTING; } if (WIDGIT.INFO_BAR_2.COMPONENT(0).text().toLowerCase().contains("making a fire")) { return STATE.LIGHTING; } if (WIDGIT.INFO_BAR_1.COMPONENT(0).text().toLowerCase().contains("your skill stats")) { return STATE.DONE; } if (dialogIsClear()) { if (!playerHas(axe)) { return STATE.TALKING; } // player has an axe if (needsInvo) { if (ctx.game.tab(Game.Tab.INVENTORY)) { if (playerHas(logs)) { if (playerHas(tinderbox)) return STATE.LIGHTING; return STATE.TALKING; } // player needs logs return STATE.CUTTING; } // failed to open inventory return STATE.TALKING; } // doesnt need invo anymore if (ctx.game.tab() == Game.Tab.STATS) return STATE.DONE; return STATE.TALKING; } return STATE.IDLE; }
private boolean cutLogs() { if (!ctx.game.tab(Game.Tab.INVENTORY)) { return false; } int logCount = count(logs); if (WIDGIT.INFO_BAR_2.COMPONENT(1).text().toLowerCase().contains("flashing backpack")) { TAB.BACKPACK.open(); return false; } if (interactWithObject(treeID, "Chop down")) { return count(logs) > logCount; } else { return false; } }