Advertisement
Guest User

Untitled

a guest
Aug 12th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 7.44 KB | None | 0 0
  1. import org.rsbot.script.Script;
  2. import org.rsbot.script.ScriptManifest;
  3. import org.rsbot.script.util.Filter;
  4. import org.rsbot.script.util.Timer;
  5. import org.rsbot.script.wrappers.RSArea;
  6. import org.rsbot.script.wrappers.RSGroundItem;
  7. import org.rsbot.script.wrappers.RSItem;
  8. import org.rsbot.script.wrappers.RSNPC;
  9. import org.rsbot.script.wrappers.RSObject;
  10. import org.rsbot.script.wrappers.RSPath;
  11. import org.rsbot.script.wrappers.RSTile;
  12. import org.rsbot.script.wrappers.RSTilePath;
  13. import org.rsbot.script.methods.Equipment;
  14. import org.rsbot.script.methods.Interfaces;
  15. import org.rsbot.script.methods.Skills;
  16. import org.rsbot.script.methods.Store;
  17.  
  18. @ScriptManifest(name = "Cacti",    
  19.         authors = "Huupderitis",
  20.         keywords = "potato, cacti, a",
  21.         version = 1.0,
  22.         description = "This will RoD to and from potato cacti 2k each :D")
  23.  
  24. public class cacti extends Script {
  25.    
  26.     private final RSTile[] toHole = {new RSTile(3298,3107), new RSTile(3288,3104),new RSTile(3276,3106),
  27.             new RSTile(3265,3109), new RSTile(3255,3103), new RSTile(3239,3104), new RSTile(3229,3109)};
  28.     private final RSTile safety = (new RSTile(3460,9484));
  29.     private final RSTile[] toCactus = {new RSTile(3472,9517), new RSTile(3474,9502),
  30.                                 new RSTile(3467,9489), new RSTile(3460,9484)};
  31.     public int cactus = 3138;
  32.     public int food = 379;
  33.     public int potion = 2446;
  34.     public int ring = 2552;
  35.     public int vial = 229;
  36.        
  37.     private boolean atPass(){
  38.         RSObject gate = objects.getNearest(35543);
  39.         if (gate !=null){
  40.         return true;}
  41.         return false;
  42.     }
  43.     ////need to check this for y = 9000 just in case :/
  44.     private boolean through(){
  45.         if (getMyPlayer().getLocation().getY() <= 3116){
  46.             return true;
  47.         }
  48.         return false;
  49.     }
  50.    
  51.     private boolean atCactus(){
  52.         RSArea area = new RSArea(new RSTile(3459,9472), new RSTile(3472,9492));
  53.         return (area.contains(getMyPlayer().getLocation()));
  54.     }
  55.    
  56.     private boolean inLair(){
  57.         if (getMyPlayer().getLocation().getY() >=8500){
  58.             return true;
  59.         }
  60.         return false;
  61.     }
  62.    
  63.     private boolean atWell(){
  64.         RSObject well = (objects.getNearest(48802));
  65.         if (well !=null){
  66.             if (calc.distanceTo(well) <=5 || well.isOnScreen()){
  67.                 return true;
  68.             }
  69.         }
  70.         return false;
  71.     }
  72.    
  73.     private boolean partOne(){
  74.         RSArea one = new RSArea(new RSTile(3482,9507), new RSTile(3487,9512));
  75.         return(one.contains(getMyPlayer().getLocation()));
  76.     }
  77.    
  78.    
  79.     public void bank(){
  80.         if (objects.getNearest(2693) !=null){
  81.             if (objects.getNearest(2693).isOnScreen()){
  82.                 objects.getNearest(2693).doAction("Open");
  83.                 sleep(1500,2000);
  84.             }
  85.         if (bank.isOpen() && !inventory.contains(cactus)){
  86.             bank.withdraw(food, 10);
  87.             sleep(1200,1500);
  88.             bank.withdraw(potion,2);
  89.             sleep(1200,1500);
  90.         }
  91.         if (bank.isOpen() && inventory.contains(cactus)){
  92.             bank.depositAll();
  93.             sleep(500,1000);
  94.         }
  95.         if (bank.isOpen() && inventory.contains(food) && inventory.getCount(food) == 10 && inventory.contains(potion)){
  96.             bank.close();
  97.             sleep(1000,1500);
  98.         }
  99.         }
  100.     }
  101.     public void bankR(){
  102.         if (objects.getNearest(2693) !=null){
  103.             if (objects.getNearest(2693).isOnScreen()){
  104.                 objects.getNearest(2693).doAction("Open");
  105.                 sleep(1500,2000);
  106.             }
  107.         if (bank.isOpen() && !inventory.contains(cactus)){
  108.             bank.withdraw(food, 10);
  109.             sleep(1200,1500);
  110.             bank.withdraw(potion,2);
  111.             sleep(1200,1500);
  112.             bank.withdraw(ring, 1);
  113.             sleep(1200,1500);
  114.         }
  115.         if (bank.isOpen() && inventory.contains(cactus)){
  116.             bank.depositAll();
  117.             sleep(500,1000);
  118.         }
  119.         if (bank.isOpen() && inventory.contains(food) && inventory.getCount(food) == 10 && inventory.contains(potion) && inventory.contains(ring)){
  120.             inventory.getItem(ring).doAction("Wear");
  121.             sleep(1000,1200);
  122.             bank.close();
  123.            sleep(1000,1500);
  124.         } }
  125.     }
  126.    
  127.     public void doPass(){
  128.         if (atPass() && inventory.contains(food) && inventory.getCount(food)==10 && !through()){
  129.             RSObject pass = (objects.getNearest(35543));
  130.             if (pass !=null && pass.isOnScreen() && !getMyPlayer().isMoving() && !interfaces.get(243).isValid() && !interfaces.get(236).isValid() && !interfaces.get(64).isValid()){
  131.                 pass.doAction("Go-through");
  132.                 sleep(500,1000);}
  133.                 if (interfaces.get(243).isValid()){
  134.                     sleep(400,650);
  135.                     interfaces.getComponent(243, 7).doClick();
  136.                     sleep(200,400);
  137.                 }
  138.                 if (interfaces.get(236).isValid()){
  139.                     sleep(500,650);
  140.                     interfaces.getComponent(236, 1).doClick();
  141.                 sleep(200,400);
  142.                 }
  143.                 if (interfaces.get(64).isValid()){
  144.                     sleep(400,700);
  145.                     interfaces.getComponent(64, 5).doClick();
  146.                 sleep(200,400);
  147.                 }
  148.             } else {
  149.                 RSObject pass = (objects.getNearest(35543));
  150.                 if (pass !=null && !pass.isOnScreen()){
  151.                     camera.turnTo(pass, 0);
  152.                 }
  153.             }
  154.         }
  155.    
  156.    
  157.     public void pick(){
  158.         if (!inventory.isFull() && atCactus()) {
  159.             if (groundItems.getNearest(cactus) !=null){
  160.                 if (groundItems.getNearest(cactus).isOnScreen()){
  161.                     groundItems.getNearest(cactus).doAction("Take");
  162.                     sleep(400,500);
  163.                 }
  164.                 if (!groundItems.getNearest(cactus).isOnScreen()){
  165.                     walking.walkTileMM(groundItems.getNearest(cactus).getLocation(), 2, 2);
  166.                     sleep(500,700);
  167.                 }
  168.             } if (groundItems.getNearest(cactus) == null){
  169.                 walking.walkTileMM(safety);
  170.                 sleep(1000,1300);
  171.             }
  172.         }
  173.         if (inventory.isFull() && atCactus()){
  174.             if (groundItems.getNearest(cactus) == null){
  175.                 walking.walkTileMM(safety);
  176.                 sleep(1000,1300);
  177.             }
  178.             if (inventory.contains(vial)){
  179.                 inventory.dropItem(vial, 1);
  180.                 sleep(500);
  181.             }
  182.             if (inventory.contains(food)){
  183.                 inventory.getItem(food).doAction("Eat");
  184.                 sleep(500,700);
  185.             }
  186.         }
  187.     }
  188.    
  189.     public void teleport(){
  190.         if (atCactus() && !inventory.contains(food)){
  191.             equipment.getItem(Equipment.RING).doAction("Duel Arena");
  192.             sleep(500,1000);
  193.         }
  194.     }
  195.    
  196.        private void smoothWalk (RSTile[] path) {
  197.             for (int i = 0; i < path.length; i++) {
  198.                 RSTile var = path[i];
  199.                 if(calc.distanceTo(var) >= 5){
  200.                     walking.walkTileMM(var,2,3);
  201.                     while(calc.distanceTo(var) >= 5)
  202.                         sleep(random(100,1000));
  203.                 }
  204.             }
  205.         }
  206.  
  207.        
  208.    
  209.     public boolean onStart() {
  210.          
  211.         return true;
  212.     }
  213.    
  214.     @Override
  215.     public int loop() {
  216.         mouse.setSpeed(random(7,8));
  217.         if (getMyPlayer().getHPPercent() < 65){
  218.             inventory.getItem(food).doAction("Eat");
  219.         }
  220.         if (combat.isPoisoned() && combat.getHealth() <=620){
  221.             inventory.getItem(potion).doAction("Drink");
  222.         }
  223.         if (atPass() && inventory.getCount(food) != 10 && !through()){
  224.             if (equipment.getItem(Equipment.RING)==null){
  225.             bankR();}
  226.         } else { if (atPass() && inventory.getCount(food) !=10 && !through()){
  227.             if(equipment.getItem(Equipment.RING) !=null){
  228.         bank();
  229.         }
  230.         }
  231.         }
  232.     if (atPass() && !through() && inventory.contains(food) && inventory.getCount(food) == 10 && inventory.contains(potion) && !bank.isOpen()){
  233.         doPass();
  234.     }
  235.     if (through() && !atWell()){
  236.         smoothWalk(toHole);
  237.     }
  238.     if (atWell()){
  239.         objects.getNearest(48802).doAction("Climb-down");
  240.         sleep(1500,1600);      
  241.     }
  242.         if (partOne() && !atCactus() && inventory.contains(food) ){
  243.             sleep(random(400,500));
  244.             walking.walkTileMM(new RSTile(3485,9501),2,1);
  245.             sleep(500);
  246.         }
  247.         if (getMyPlayer().isMoving() && !atCactus() && inLair()){
  248.             while(getMyPlayer().isMoving()){
  249.                 sleep(random(1500,2000));
  250.             }
  251.         }
  252.         if (atCactus() && inventory.contains(food)){
  253.             pick();
  254.         }
  255.         if (atCactus() && !inventory.contains(food)){
  256.             teleport();
  257.         }
  258.         return (random(300,400));
  259.     }
  260.  
  261.     public void onFinish(){
  262.        
  263.     }
  264.    
  265.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement