Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.     public final int boothID = 11758;
  3.     private final static int[] oreID = { 11183, 11184, 11185, 11186, 11187, 11188 };
  4.     private static final String Door = null;
  5.     public final int miningAnimation = 624;
  6.     public final int doorID = 2647;
  7.     public int w;
  8.     public int k;
  9.     public int whereShouldIBeWalkingBro = 0; //0 =not walking, 1 = to the door from the mine, 2 = to the bank from the mine
  10.                                             // 3 = to the door from the bank, 4 = to the mine from the door
  11.    
  12.     public final RSTile[] pathFromOresToDoor = { new RSTile(2940,3281), new RSTile(2936,3283), new RSTile(2933,3287) };
  13.    
  14.     public final RSTile[] pathFromDoorToBank = { new RSTile(2935,3297), new RSTile(2938,3301), new RSTile(2943,3302), new RSTile(2947,3300), new RSTile(2951,3298), new RSTile(2965,3295),  
  15.             new RSTile(2965,3295), new RSTile(2974,3290), new RSTile(2980,3290), new RSTile(2984,3294), new RSTile(2988,3296), new RSTile(2993,3294), new RSTile(2998,3294),
  16.             new RSTile(3003,3298), new RSTile(3004,3303), new RSTile(3005,3309), new RSTile(3006,3315), new RSTile(3007,3321), new RSTile(3005,3328), new RSTile(3007,3333),
  17.             new RSTile(3007,3339), new RSTile(3006,3345), new RSTile(3007,3352), new RSTile(3011,3355)};//TODO finish this path
  18.    
  19.     public final RSTile[] pathFromBANKToTheDoor = { new RSTile(3011,3355), new RSTile(3007,3352), new RSTile(3006,3345), new RSTile(3007,3339), new RSTile(3007,3333), new RSTile(3005,3328),
  20.             new RSTile(3007,3321), new RSTile(3006,3315), new RSTile(3005,3309), new RSTile(3004,3303), new RSTile(3003,3298), new RSTile(2998,3294), new RSTile(2993,3294), new RSTile(2988,3296),
  21.             new RSTile(2984,3294), new RSTile(2980,3290), new RSTile(2974,3290), new RSTile(2965,3295), new RSTile(2965,3295), new RSTile(2951,3298), new RSTile(2947,3300), new RSTile(2943,3302),
  22.             new RSTile(2938,3301), new RSTile(2935,3297)};
  23.     //TODO finish this path
  24.     public final RSTile[] pathFromDOORTOOres = { new RSTile(2934,3289), new RSTile(2935,3282), new RSTile(2939,3280) };
  25.    
  26.  
  27.   public boolean onStart (){
  28.     if(game.isLoggedIn()){
  29.         return true;
  30.     }
  31.     log("You must start this script logged in!");
  32.       return false;
  33.   }
  34.   @Override
  35.   public int loop() {
  36.     if(inventory.isFull()) {
  37.       if(atBank()){
  38.           whereShouldIBeWalkingBro = 0;
  39.           doBank();
  40.       }
  41.       else if(atBank() || whereShouldIBeWalkingBro == 3 || whereShouldIBeWalkingBro == 4){// walk to ores
  42.         if(atBank() || whereShouldIBeWalkingBro == 3)
  43.                 walkThePath(pathFromBANKToTheDoor);
  44.       }
  45.       else{
  46.                   if(atBeforeDoorFromBank()){ //this is OUTSIDE of the guild
  47.           if(atBeforeDoorFromBank() || whereShouldIBeWalkingBro == 4){
  48.               walkThePath(pathFromDOORTOOres);
  49.       }
  50.          
  51.       }
  52.       else if(atMine() || whereShouldIBeWalkingBro == 1 || whereShouldIBeWalkingBro == 2) {
  53.       //walk to the bank
  54.         if(atBeforeDoorFromBank() || whereShouldIBeWalkingBro == 2){ //this is OUTSIDE of the guild
  55.             walkThePath(pathFromDoorToBank);
  56.             sleep(333,555);
  57.         }else{
  58.             whereShouldIBeWalkingBro = 1;
  59.             walkThePath(pathFromOresToDoor);
  60.             try{
  61.                 RSObject doorBitch = objects.getNearest(doorID);
  62.                 if(doorBitch.isOnScreen()){
  63.                     doorBitch.interact("Open"); //this might continue to open the door so be aware, needs testing
  64.                     sleep(787,1323);
  65.                     walkThePath(pathFromDoorToBank);
  66.                     whereShouldIBeWalkingBro = 2;
  67.                 }
  68.             }catch(Exception e){ sleep(222);}
  69.             sleep(243,656);
  70.         }
  71.      
  72.     }
  73.     else {
  74.       if(atMine()){
  75.           whereShouldIBeWalkingBro = 0;
  76.           mineOres();
  77.          
  78.       }else{
  79.                 if(atBeforeDoorFromBank()){ //this is OUTSIDE of the guild
  80.               if(atBeforeDoorFromBank() || whereShouldIBeWalkingBro == 4){
  81.                   walkThePath(pathFromDOORTOOres);
  82.               }
  83.           }else{
  84.          
  85.           }
  86.        
  87.     return random(600,800);}
  88.     }
  89.       }}
  90.     return 0;
  91.      
  92.   }
  93.    private void mineOres() {
  94.          RSObject rock = objects.getNearest(oreID);
  95.          if(getMyPlayer().getAnimation() != miningAnimation) {
  96.              if (rock != null) {
  97.                  if(rock.isOnScreen()){
  98.                      rock.interact("Mine");
  99.                      sleep(1500,2000);
  100.                  }else{
  101.                      walking.walkTo(rock.getLocation());
  102.                      camera.turnTo(rock.getLocation(), 30);
  103.                      rock.interact("Mine");
  104.                      sleep(1000,13000);
  105.                  }
  106.              }
  107.          }
  108.  }
  109.    
  110.   public void  onFinish(){
  111.     log("Thankyou for using iTzMiner!");
  112.   }
  113.      
  114.   //checking for bankbooth
  115.   private boolean atBank() {
  116.       whereShouldIBeWalkingBro = 0;
  117.     RSObject bank = objects.getNearest(boothID);
  118.        if(bank != null) {
  119.     if(bank.isOnScreen()) {
  120.       return true;}
  121.    
  122.  
  123.     }
  124.  
  125.     return false;
  126.  
  127. }
  128.  
  129.     private boolean  atBeforeDoorFromBank(){
  130.         RSArea area = new RSArea(new RSTile(2932,3298), new RSTile(2935,3291)); //new RSTile(most southwest tile), new RSTile(most northeast tile) //
  131.         return area.contains(getMyPlayer().getLocation());
  132.     }
  133.    
  134.     //opening bank
  135.     private void doBank() {
  136.         whereShouldIBeWalkingBro = 0;
  137.          if(bank.isOpen()) {
  138.         bank.depositAll();
  139.         sleep (523,845);
  140.         bank.close();
  141.          }else{
  142.             bank.open();}
  143.       }
  144.    
  145.  
  146.     //checks for ore
  147.   public boolean atMine() {
  148.     RSObject ore = objects.getNearest(oreID);
  149.         if(ore != null) {
  150.           return true;
  151.         }
  152.         return false;
  153.   }
  154.  
  155.   private void walkR1() {
  156.      
  157. try {
  158. RSObject door = objects.getNearest(doorID);
  159. if(door.isOnScreen()){
  160.         door.interact("Open");
  161.         sleep(454,876);
  162.        
  163.        // webToBank.step();
  164. }else{
  165.         camera.turnTo(door.getLocation(), 30);
  166.         walking.walkTo(door.getLocation());
  167.         sleep(87,155);
  168.         door.interact("Open");
  169.         sleep(454,876);
  170. }
  171. } catch (Exception e) {
  172. log("No door found, still looking");
  173. }
  174. }
  175.  
  176. private void walk() {
  177.     try{
  178.     //webToDoor.step();
  179. RSObject door = objects.getNearest(doorID);
  180. if(door.isOnScreen()){
  181.   door.interact("Open");
  182.   sleep(454,876);
  183. }else{
  184.   camera.turnTo(door.getLocation(), 30);
  185.   walking.walkTo(door.getLocation());
  186.   sleep(87,155);
  187.   door.interact("Open");
  188.   sleep(454,876);
  189. }
  190.   if(Door == null){
  191.       log("No door found, still looking");
  192.   }
  193.     }catch(Exception e) {sleep(234); log("Error: "+e.getMessage()); }
  194.    
  195. }
  196. /*
  197.  *
  198.  * @Author DlolPics(c)
  199.  *  Uses: walkThePath(RSTile[]);
  200.  */
  201. private boolean walkThePath(RSTile[] path){
  202.     w = random(4,6);
  203.     k = random(2,4);
  204.     int b = k;
  205.     int t = w;
  206.     boolean D=false;
  207.     try{
  208.         RSTilePath pathToWalk = walking.newTilePath(path);
  209.         RSTile next = pathToWalk.getNext();
  210.         RSTile start = pathToWalk.getStart();
  211.         if ((walking.getDestination() == null || calc.distanceTo(walking.getDestination()) < t ||calc.distanceBetween(next,walking.getDestination()) > b)) {
  212.             if(!walking.walkTileMM(next)){
  213.                 if(walking.walkTileMM(start)){
  214.                     sleep(412,565);
  215.                     D=true;
  216.                 }else{
  217.                     walkToTile(walking.getClosestTileOnMap(next));
  218.                     sleep(277,562);
  219.                 }
  220.             }else{
  221.                 sleep(299,565);
  222.                 D=true;
  223.             }
  224.         }
  225.         return D;
  226.     }catch(Exception e ){ sleep(554,789); }
  227.     return D;
  228. }
  229. /*
  230.  *
  231.  * @Author DlolPics(c)
  232.  *  Uses: walkThePath(RSTile[]);
  233.  */
  234. private boolean walkToTile(RSTile tile){
  235.     int q = k;
  236.     int i = w;
  237.     boolean D = false;
  238.     try{
  239.         if ((walking.getDestination() == null||(calc.distanceTo(walking.getDestination()) < q &&calc.distanceBetween(tile,walking.getDestination()) > i))) {
  240.             if(calc.tileOnScreen(tile)){
  241.                 if(walking.walkTileOnScreen(tile))
  242.                     D = true;
  243.             }
  244.             else if(calc.tileOnMap(tile)){
  245.                 if(walking.walkTileMM(tile))
  246.                     D = true;
  247.             }else{
  248.                 if(walkToTile(walking.getClosestTileOnMap(tile)))
  249.                     D = true;
  250.             }
  251.             sleep(389);
  252.         }
  253.     return D;
  254.     }catch(Exception e){ sleep(554,789); }
  255.     return D;
  256. }
  257.         //This variable is used for Antialiasing. DO NOT DELETE!
  258.         private final RenderingHints rh = new RenderingHints(
  259.             RenderingHints.KEY_TEXT_ANTIALIASING,
  260.             RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
  261. @Override
  262.         public void onRepaint(Graphics g) {
  263.             //This paint was made using Enfilade's Paint Maker
  264.             ((Graphics2D)g).setRenderingHints(rh);
  265.             g.setColor(new Color(0, 0, 0, 105));
  266.             g.fillRect(162, 344, 333, 113);
  267.             g.setColor(new Color(0, 0, 0, 192));
  268.             g.drawRect(161, 343, 334, 114);
  269.             g.setColor(new Color(0, 0, 0, 192));
  270.             g.drawRect(160, 342, 335, 115);
  271.             g.setColor(new Color(0, 0, 0, 192));
  272.             g.drawRect(160, 342, 335, 114);
  273.             g.setFont(new Font("Kokila", 0, 20));
  274.             g.setColor(new Color(153, 153, 153));
  275.             g.drawString("Created by iTzw00dzy.", 570, 422);
  276.             g.setFont(new Font("Kokila", 0, 20));
  277.             g.setColor(new Color(153, 153, 153));
  278.             g.drawString("Version 1.0", 602, 441);
  279.             g.setFont(new Font("Courier New", 0, 40));
  280.             g.setColor(new Color(0, 0, 0));
  281.             g.drawString("iTzMiner", 546, 237);
  282.             g.setColor(new Color(204, 204, 204));
  283.             g.drawString("iTzMiner", 546, 240);
  284.             g.setFont(new Font("DaunPenh", 0, 30));
  285.             g.setColor(new Color(0, 0, 0));
  286.             g.drawString("Runtime:", 176, 374);
  287.             g.setFont(new Font("DaunPenh", 0, 30));
  288.             g.setColor(new Color(0, 0, 0));
  289.             g.drawString("Experience gained:", 176, 402);
  290.             g.setFont(new Font("DaunPenh", 0, 30));
  291.             g.setColor(new Color(0, 0, 0));
  292.             g.drawString("Ores mined:", 176, 431);
  293.         }
  294. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement