Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 7th, 2012  |  syntax: None  |  size: 4.62 KB  |  hits: 10  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. import java.util.Map;
  2. import org.rsbot.script.ScriptManifest;
  3. import org.rsbot.script.Script;
  4. import org.rsbot.script.wrappers.RSObject;
  5. import org.rsbot.script.wrappers.RSTile;
  6.  
  7.  
  8. @ScriptManifest(authors = {"Craze"}, category = "Money", version = 1.00, name = "BananaBasket")
  9. public class AIOBananaBasket extends Script {
  10.         private RSTile[] toCaveExit= {new RSTile(2444, 5178), new RSTile(2452, 5166), new RSTile(2466, 5168), new RSTile(2478, 5171)};
  11.         private RSTile[] toBananaTreeField= {new RSTile(2869, 3166), new RSTile(2879, 3158), new RSTile(2893, 3155), new RSTile(2898, 3169), new RSTile(2912, 3172)};
  12.         private RSTile[] toClimbingRock= {new RSTile(2909, 3172), new RSTile(2893, 3166), new RSTile(2875, 3164), new RSTile(2858, 3168)};
  13.         private RSTile[] toBankArea= {new RSTile(2478, 5171), new RSTile(2466, 5168), new RSTile(2452, 5166), new RSTile(2444, 5178)};
  14.         private RSTile cave = new RSTile(2861, 9571);
  15.         private int CaveExit = 9358;
  16.         private int ClimbingRope = 1764;
  17.         private int Basket = 5376;
  18.         private int Banana = 1963;
  19.         private int BananaBasket = 5416;
  20.         private int ClimbingRock = 492;
  21.         private int CaveEntrance = 31284;
  22.         private int Bank = 2619;
  23.         private int BananaTree = 2073;
  24.        
  25.         private boolean walkToField(){
  26.                 if(playerInArea(2448, 5179, 2442, 5175)) {
  27.                         walking.walkPathMM(toCaveExit);
  28.                         RSObject Rope = null;
  29.                         Rope = objects.getNearest(ClimbingRope);
  30.                         Rope.doAction("Climb");
  31.                         walking.walkPathMM(toBananaTreeField);
  32.                 }
  33.                 return true;
  34.         }
  35.        
  36.         private boolean walkToBank() {
  37.                
  38.                 walking.walkPathMM(toClimbingRock);
  39.                 EnterCave();
  40.                 walking.walkPathMM(toBankArea);
  41.                 return true;
  42.         }
  43.        
  44.        
  45.         private boolean walk(RSTile dest) {
  46.                 if(calc.distanceTo(walking.getDestination()) < random(4, 6)) {
  47.                 if(!walking.walkTo(dest)) {
  48.                 sleep(600, 900);
  49.                 return true;
  50.                 }
  51.                 }
  52.                 return false;
  53.                 }
  54.        
  55.         private boolean atBank() {
  56.                 if(playerInArea(2448, 5179, 2442, 5175)) {
  57.                 RSObject booth = objects.getNearest(Bank);
  58.                 return calc.tileOnScreen(booth.getLocation());
  59.                 } else {
  60.                 walking.walkTileMM(new RSTile(2445, 5178));
  61.                 return false;
  62.                 }
  63.                 }
  64.        
  65.         private boolean atField() {
  66.                 if(playerInArea(2926, 3172, 2909, 3156)) {
  67.                         RSObject tree =objects.getNearest(BananaTree);
  68.                         return calc.tileOnScreen(tree.getLocation());
  69.                 } else {
  70.                         walking.walkTileMM(new RSTile(2914, 3160));
  71.                         return false;
  72.                 }
  73.         }
  74.        
  75.         private boolean doBank(){
  76.  
  77.               if(!bank.isOpen()){
  78.                     log("Going to open the bank.");
  79.                     RSObject booth = objects.getNearest(Bank);
  80.                     if(calc.tileOnScreen(booth.getLocation())) booth.doAction("Use-quickly");
  81.                     return false;
  82.                  }
  83.                  return false;
  84.         }
  85.        
  86.         private boolean useBank(){
  87.                 if(bank.isOpen()){
  88.                         bank.depositAll();
  89.                         bank.withdraw(Basket, 23);
  90.                         return true;
  91.                 }
  92.                 return false;
  93.         }
  94.        
  95.         private boolean playerInArea(int minX, int minY, int maxX, int maxY) {
  96.                 int x = getMyPlayer().getLocation().getX();
  97.                 int y = getMyPlayer().getLocation().getY();
  98.                 if (x >= minX && x <= maxX && y >= minY && y <= maxY) return true;
  99.                 return false;
  100.                 }
  101.        
  102.         private boolean pickBananas() {
  103.                 if(playerInArea(2926, 3172, 2909, 3156)){
  104.                         RSObject tree = null;
  105.                         try{
  106.                                 tree = objects.getNearest(2073);
  107.                         } catch(Exception e){
  108.                                 log("No Tree's Found");
  109.                                
  110.                         }
  111.                         if(tree!=null){
  112.                                 tree.doAction("Pick");
  113.                                 tree.getLocation();
  114.                                
  115.                         }
  116.                        
  117.                 }
  118.                 return false;
  119.         }
  120.        
  121.         private boolean fillBaskets() {
  122.                 RSObject basket = null;
  123.                 try{
  124.                         basket = objects.getNearest(5376);
  125.                 } catch(Exception e){
  126.                         log("Inventory isn't full!");
  127.                        
  128.                 }
  129.                 if(basket!=null){
  130.                         basket.doAction("Fill");
  131.                         basket.getLocation();
  132.                 }
  133.                 return false;
  134.         }
  135.        
  136.         private boolean EnterCave(){
  137.                 if(playerInArea(2860, 3170, 2853, 3167)){
  138.                         RSObject Rocks = null;
  139.                         try{
  140.                                 Rocks= objects.getNearest(492);
  141.                         } catch(Exception e){
  142.                                 log("Not Close Enough to Climbing Rock");
  143.                                
  144.                         }
  145.                         if(Rocks!=null){
  146.                                 Rocks.doAction("Climb-down");
  147.                         }
  148.                 }
  149.                 walk(cave);
  150.                 RSObject CaveEntrance = null;
  151.                 try{
  152.                         CaveEntrance = objects.getNearest(31284);
  153.                 }catch(Exception e){
  154.                         log("Cave Entrance Isn't Visible");
  155.                 }
  156.                 if(CaveEntrance!=null){
  157.                         CaveEntrance.doAction("Enter");
  158.  
  159.                 }
  160.                 return false;
  161.         }
  162.        
  163.         public int loop() {
  164.                         if(inventory.isFull()){
  165.                                 if(atBank()){
  166.                                         doBank();
  167.                                         useBank();
  168.                                 } else {
  169.                                         walkToBank();
  170.                                 }
  171.                         } else {
  172.                                 if(atField()){
  173.                                         pickBananas();
  174.                                         fillBaskets();
  175.                                 }else{
  176.                                         walkToField();
  177.                                 }
  178.                         }
  179.                        
  180.                 return random(200,400);
  181.         }
  182.        
  183.         public boolean onStart(Map<String, String>args) {
  184.                 return true;
  185.                 }
  186.        
  187.         public void onFinish() {
  188.         }
  189. }