- import java.util.Map;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.Script;
- import org.rsbot.script.wrappers.RSObject;
- import org.rsbot.script.wrappers.RSTile;
- @ScriptManifest(authors = {"Craze"}, category = "Money", version = 1.00, name = "BananaBasket")
- public class AIOBananaBasket extends Script {
- private RSTile[] toCaveExit= {new RSTile(2444, 5178), new RSTile(2452, 5166), new RSTile(2466, 5168), new RSTile(2478, 5171)};
- private RSTile[] toBananaTreeField= {new RSTile(2869, 3166), new RSTile(2879, 3158), new RSTile(2893, 3155), new RSTile(2898, 3169), new RSTile(2912, 3172)};
- private RSTile[] toClimbingRock= {new RSTile(2909, 3172), new RSTile(2893, 3166), new RSTile(2875, 3164), new RSTile(2858, 3168)};
- private RSTile[] toBankArea= {new RSTile(2478, 5171), new RSTile(2466, 5168), new RSTile(2452, 5166), new RSTile(2444, 5178)};
- private RSTile cave = new RSTile(2861, 9571);
- private int CaveExit = 9358;
- private int ClimbingRope = 1764;
- private int Basket = 5376;
- private int Banana = 1963;
- private int BananaBasket = 5416;
- private int ClimbingRock = 492;
- private int CaveEntrance = 31284;
- private int Bank = 2619;
- private int BananaTree = 2073;
- private boolean walkToField(){
- if(playerInArea(2448, 5179, 2442, 5175)) {
- walking.walkPathMM(toCaveExit);
- RSObject Rope = null;
- Rope = objects.getNearest(ClimbingRope);
- Rope.doAction("Climb");
- walking.walkPathMM(toBananaTreeField);
- }
- return true;
- }
- private boolean walkToBank() {
- walking.walkPathMM(toClimbingRock);
- EnterCave();
- walking.walkPathMM(toBankArea);
- return true;
- }
- private boolean walk(RSTile dest) {
- if(calc.distanceTo(walking.getDestination()) < random(4, 6)) {
- if(!walking.walkTo(dest)) {
- sleep(600, 900);
- return true;
- }
- }
- return false;
- }
- private boolean atBank() {
- if(playerInArea(2448, 5179, 2442, 5175)) {
- RSObject booth = objects.getNearest(Bank);
- return calc.tileOnScreen(booth.getLocation());
- } else {
- walking.walkTileMM(new RSTile(2445, 5178));
- return false;
- }
- }
- private boolean atField() {
- if(playerInArea(2926, 3172, 2909, 3156)) {
- RSObject tree =objects.getNearest(BananaTree);
- return calc.tileOnScreen(tree.getLocation());
- } else {
- walking.walkTileMM(new RSTile(2914, 3160));
- return false;
- }
- }
- private boolean doBank(){
- if(!bank.isOpen()){
- log("Going to open the bank.");
- RSObject booth = objects.getNearest(Bank);
- if(calc.tileOnScreen(booth.getLocation())) booth.doAction("Use-quickly");
- return false;
- }
- return false;
- }
- private boolean useBank(){
- if(bank.isOpen()){
- bank.depositAll();
- bank.withdraw(Basket, 23);
- return true;
- }
- return false;
- }
- private boolean playerInArea(int minX, int minY, int maxX, int maxY) {
- int x = getMyPlayer().getLocation().getX();
- int y = getMyPlayer().getLocation().getY();
- if (x >= minX && x <= maxX && y >= minY && y <= maxY) return true;
- return false;
- }
- private boolean pickBananas() {
- if(playerInArea(2926, 3172, 2909, 3156)){
- RSObject tree = null;
- try{
- tree = objects.getNearest(2073);
- } catch(Exception e){
- log("No Tree's Found");
- }
- if(tree!=null){
- tree.doAction("Pick");
- tree.getLocation();
- }
- }
- return false;
- }
- private boolean fillBaskets() {
- RSObject basket = null;
- try{
- basket = objects.getNearest(5376);
- } catch(Exception e){
- log("Inventory isn't full!");
- }
- if(basket!=null){
- basket.doAction("Fill");
- basket.getLocation();
- }
- return false;
- }
- private boolean EnterCave(){
- if(playerInArea(2860, 3170, 2853, 3167)){
- RSObject Rocks = null;
- try{
- Rocks= objects.getNearest(492);
- } catch(Exception e){
- log("Not Close Enough to Climbing Rock");
- }
- if(Rocks!=null){
- Rocks.doAction("Climb-down");
- }
- }
- walk(cave);
- RSObject CaveEntrance = null;
- try{
- CaveEntrance = objects.getNearest(31284);
- }catch(Exception e){
- log("Cave Entrance Isn't Visible");
- }
- if(CaveEntrance!=null){
- CaveEntrance.doAction("Enter");
- }
- return false;
- }
- public int loop() {
- if(inventory.isFull()){
- if(atBank()){
- doBank();
- useBank();
- } else {
- walkToBank();
- }
- } else {
- if(atField()){
- pickBananas();
- fillBaskets();
- }else{
- walkToField();
- }
- }
- return random(200,400);
- }
- public boolean onStart(Map<String, String>args) {
- return true;
- }
- public void onFinish() {
- }
- }