Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public final int boothID = 11758;
- private final static int[] oreID = { 11183, 11184, 11185, 11186, 11187, 11188 };
- private static final String Door = null;
- public final int miningAnimation = 624;
- public final int doorID = 2647;
- public int w;
- public int k;
- public int whereShouldIBeWalkingBro = 0; //0 =not walking, 1 = to the door from the mine, 2 = to the bank from the mine
- // 3 = to the door from the bank, 4 = to the mine from the door
- public final RSTile[] pathFromOresToDoor = { new RSTile(2940,3281), new RSTile(2936,3283), new RSTile(2933,3287) };
- 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),
- 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),
- 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),
- new RSTile(3007,3339), new RSTile(3006,3345), new RSTile(3007,3352), new RSTile(3011,3355)};//TODO finish this path
- 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),
- 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),
- 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),
- new RSTile(2938,3301), new RSTile(2935,3297)};
- //TODO finish this path
- public final RSTile[] pathFromDOORTOOres = { new RSTile(2934,3289), new RSTile(2935,3282), new RSTile(2939,3280) };
- public boolean onStart (){
- if(game.isLoggedIn()){
- return true;
- }
- log("You must start this script logged in!");
- return false;
- }
- @Override
- public int loop() {
- if(inventory.isFull()) {
- if(atBank()){
- whereShouldIBeWalkingBro = 0;
- doBank();
- }
- else if(atBank() || whereShouldIBeWalkingBro == 3 || whereShouldIBeWalkingBro == 4){// walk to ores
- if(atBank() || whereShouldIBeWalkingBro == 3)
- walkThePath(pathFromBANKToTheDoor);
- }
- else{
- if(atBeforeDoorFromBank()){ //this is OUTSIDE of the guild
- if(atBeforeDoorFromBank() || whereShouldIBeWalkingBro == 4){
- walkThePath(pathFromDOORTOOres);
- }
- }
- else if(atMine() || whereShouldIBeWalkingBro == 1 || whereShouldIBeWalkingBro == 2) {
- //walk to the bank
- if(atBeforeDoorFromBank() || whereShouldIBeWalkingBro == 2){ //this is OUTSIDE of the guild
- walkThePath(pathFromDoorToBank);
- sleep(333,555);
- }else{
- whereShouldIBeWalkingBro = 1;
- walkThePath(pathFromOresToDoor);
- try{
- RSObject doorBitch = objects.getNearest(doorID);
- if(doorBitch.isOnScreen()){
- doorBitch.interact("Open"); //this might continue to open the door so be aware, needs testing
- sleep(787,1323);
- walkThePath(pathFromDoorToBank);
- whereShouldIBeWalkingBro = 2;
- }
- }catch(Exception e){ sleep(222);}
- sleep(243,656);
- }
- }
- else {
- if(atMine()){
- whereShouldIBeWalkingBro = 0;
- mineOres();
- }else{
- if(atBeforeDoorFromBank()){ //this is OUTSIDE of the guild
- if(atBeforeDoorFromBank() || whereShouldIBeWalkingBro == 4){
- walkThePath(pathFromDOORTOOres);
- }
- }else{
- }
- return random(600,800);}
- }
- }}
- return 0;
- }
- private void mineOres() {
- RSObject rock = objects.getNearest(oreID);
- if(getMyPlayer().getAnimation() != miningAnimation) {
- if (rock != null) {
- if(rock.isOnScreen()){
- rock.interact("Mine");
- sleep(1500,2000);
- }else{
- walking.walkTo(rock.getLocation());
- camera.turnTo(rock.getLocation(), 30);
- rock.interact("Mine");
- sleep(1000,13000);
- }
- }
- }
- }
- public void onFinish(){
- log("Thankyou for using iTzMiner!");
- }
- //checking for bankbooth
- private boolean atBank() {
- whereShouldIBeWalkingBro = 0;
- RSObject bank = objects.getNearest(boothID);
- if(bank != null) {
- if(bank.isOnScreen()) {
- return true;}
- }
- return false;
- }
- private boolean atBeforeDoorFromBank(){
- RSArea area = new RSArea(new RSTile(2932,3298), new RSTile(2935,3291)); //new RSTile(most southwest tile), new RSTile(most northeast tile) //
- return area.contains(getMyPlayer().getLocation());
- }
- //opening bank
- private void doBank() {
- whereShouldIBeWalkingBro = 0;
- if(bank.isOpen()) {
- bank.depositAll();
- sleep (523,845);
- bank.close();
- }else{
- bank.open();}
- }
- //checks for ore
- public boolean atMine() {
- RSObject ore = objects.getNearest(oreID);
- if(ore != null) {
- return true;
- }
- return false;
- }
- private void walkR1() {
- try {
- RSObject door = objects.getNearest(doorID);
- if(door.isOnScreen()){
- door.interact("Open");
- sleep(454,876);
- // webToBank.step();
- }else{
- camera.turnTo(door.getLocation(), 30);
- walking.walkTo(door.getLocation());
- sleep(87,155);
- door.interact("Open");
- sleep(454,876);
- }
- } catch (Exception e) {
- log("No door found, still looking");
- }
- }
- private void walk() {
- try{
- //webToDoor.step();
- RSObject door = objects.getNearest(doorID);
- if(door.isOnScreen()){
- door.interact("Open");
- sleep(454,876);
- }else{
- camera.turnTo(door.getLocation(), 30);
- walking.walkTo(door.getLocation());
- sleep(87,155);
- door.interact("Open");
- sleep(454,876);
- }
- if(Door == null){
- log("No door found, still looking");
- }
- }catch(Exception e) {sleep(234); log("Error: "+e.getMessage()); }
- }
- /*
- *
- * @Author DlolPics(c)
- * Uses: walkThePath(RSTile[]);
- */
- private boolean walkThePath(RSTile[] path){
- w = random(4,6);
- k = random(2,4);
- int b = k;
- int t = w;
- boolean D=false;
- try{
- RSTilePath pathToWalk = walking.newTilePath(path);
- RSTile next = pathToWalk.getNext();
- RSTile start = pathToWalk.getStart();
- if ((walking.getDestination() == null || calc.distanceTo(walking.getDestination()) < t ||calc.distanceBetween(next,walking.getDestination()) > b)) {
- if(!walking.walkTileMM(next)){
- if(walking.walkTileMM(start)){
- sleep(412,565);
- D=true;
- }else{
- walkToTile(walking.getClosestTileOnMap(next));
- sleep(277,562);
- }
- }else{
- sleep(299,565);
- D=true;
- }
- }
- return D;
- }catch(Exception e ){ sleep(554,789); }
- return D;
- }
- /*
- *
- * @Author DlolPics(c)
- * Uses: walkThePath(RSTile[]);
- */
- private boolean walkToTile(RSTile tile){
- int q = k;
- int i = w;
- boolean D = false;
- try{
- if ((walking.getDestination() == null||(calc.distanceTo(walking.getDestination()) < q &&calc.distanceBetween(tile,walking.getDestination()) > i))) {
- if(calc.tileOnScreen(tile)){
- if(walking.walkTileOnScreen(tile))
- D = true;
- }
- else if(calc.tileOnMap(tile)){
- if(walking.walkTileMM(tile))
- D = true;
- }else{
- if(walkToTile(walking.getClosestTileOnMap(tile)))
- D = true;
- }
- sleep(389);
- }
- return D;
- }catch(Exception e){ sleep(554,789); }
- return D;
- }
- //This variable is used for Antialiasing. DO NOT DELETE!
- private final RenderingHints rh = new RenderingHints(
- RenderingHints.KEY_TEXT_ANTIALIASING,
- RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
- @Override
- public void onRepaint(Graphics g) {
- //This paint was made using Enfilade's Paint Maker
- ((Graphics2D)g).setRenderingHints(rh);
- g.setColor(new Color(0, 0, 0, 105));
- g.fillRect(162, 344, 333, 113);
- g.setColor(new Color(0, 0, 0, 192));
- g.drawRect(161, 343, 334, 114);
- g.setColor(new Color(0, 0, 0, 192));
- g.drawRect(160, 342, 335, 115);
- g.setColor(new Color(0, 0, 0, 192));
- g.drawRect(160, 342, 335, 114);
- g.setFont(new Font("Kokila", 0, 20));
- g.setColor(new Color(153, 153, 153));
- g.drawString("Created by iTzw00dzy.", 570, 422);
- g.setFont(new Font("Kokila", 0, 20));
- g.setColor(new Color(153, 153, 153));
- g.drawString("Version 1.0", 602, 441);
- g.setFont(new Font("Courier New", 0, 40));
- g.setColor(new Color(0, 0, 0));
- g.drawString("iTzMiner", 546, 237);
- g.setColor(new Color(204, 204, 204));
- g.drawString("iTzMiner", 546, 240);
- g.setFont(new Font("DaunPenh", 0, 30));
- g.setColor(new Color(0, 0, 0));
- g.drawString("Runtime:", 176, 374);
- g.setFont(new Font("DaunPenh", 0, 30));
- g.setColor(new Color(0, 0, 0));
- g.drawString("Experience gained:", 176, 402);
- g.setFont(new Font("DaunPenh", 0, 30));
- g.setColor(new Color(0, 0, 0));
- g.drawString("Ores mined:", 176, 431);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement