Advertisement
Guest User

Moose's Essence Miner

a guest
Apr 27th, 2013
823
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 21.99 KB | None | 0 0
  1. package scripts;
  2. import org.tribot.api.DynamicClicking;
  3. import org.tribot.api.General;
  4. import org.tribot.api2007.*;
  5. import org.tribot.api2007.GameTab.TABS;
  6. import org.tribot.api2007.types.*;
  7. import org.tribot.script.*;
  8. import org.tribot.script.interfaces.*;
  9. import org.tribot.api.input.*;
  10. import java.awt.Graphics;
  11. import java.awt.Graphics2D;
  12. import java.awt.Image;
  13. import java.awt.Point;
  14. import java.awt.event.ActionEvent;
  15. import java.awt.event.ActionListener;
  16. import java.awt.event.KeyEvent;
  17. import java.io.BufferedReader;
  18. import java.io.IOException;
  19. import java.io.InputStreamReader;
  20. import java.net.URL;
  21. import java.net.URLConnection;
  22. import java.text.DecimalFormat;
  23. import java.util.ArrayList;
  24.  
  25. import javax.imageio.ImageIO;
  26. import javax.swing.*;
  27. import java.awt.*;
  28.  
  29. @ScriptManifest(authors = { "Moose" }, category = "Mining", name = "Moose's essence miner")
  30. public class MooseEssence extends Script implements ActionListener, Painting, Ending {
  31.    
  32.     @Override
  33.     public void run() {
  34.         running = true;
  35.         onStart();
  36.         while(running) {
  37.             try {
  38.             loop();
  39.             }catch(Exception e) {
  40.                 e.printStackTrace();
  41.             }
  42.         }
  43.     }
  44.    
  45.     /**
  46.      * MooseEssence
  47.      * @author Mooselet
  48.      * Free to use and modify as you like.
  49.      * Didn't put many comments because I made the code very easy to understand.
  50.      */
  51.     private boolean running = false;
  52.     private final boolean debug = false;
  53.     private boolean paintEnabled = true;
  54.     private final int ESSENCE_ID = 10074;
  55.     private final int PORTAL_ID = 10075;
  56.     private final int AUBURY_ID = 158;
  57.     private final int RUNE_ESSENCE = 1436;
  58.     private final int PURE_ESSENCE = 7936;
  59.     private final int CLOSED_DOOR_ID = 24381;
  60.     private final int BROKEN_PICK_ID = 466;
  61.     private final RSTile AT_ESSENCE = new RSTile(2910, 4831);
  62.     private final RSTile IN_RUNE_SHOP = new RSTile(3253, 3401);
  63.     private final RSTile IN_BANK = new RSTile(3253, 3420);
  64.     private final RSTile IN_ABYSS = new RSTile(2338, 4747);
  65.     private final int[] MINING_ANIMATIONS = {624, 628, 629, 627, 626, 625};
  66.     private final int[] PICK_HEADS = {480, 482, 484, 486, 488, 490};
  67.     private final int[] PICKAXE_IDS = {1265, 1267, 1269, 1271, 1273, 1275};
  68.     private int essenceMined = 0;
  69.     private Image proggyImage;
  70.     private long startTime = 0;
  71.     private int antiBanFreq = 40;
  72.     private final RSTile IN_THE_MIDDLE = new RSTile(3256, 3408);
  73.     private String emailAddress = null;
  74.     private JFrame jf;
  75.     private int uploadAttempts = 0;
  76.    
  77.     public boolean inMine() {
  78.     return AT_ESSENCE.distanceTo(Player.getPosition()) < 100;
  79.     }
  80.     public boolean inAbyss() {
  81.         return IN_ABYSS.distanceTo(Player.getPosition()) < 2;
  82.     }
  83.     public boolean isLost() {
  84.         return (IN_THE_MIDDLE.distanceTo(Player.getPosition()) > 30 && !inMine() && !inAbyss())/* || Players.getLocal().getHeight() != 0*/; //is getHeight() broken too? Causes this function to return true even when height=0
  85.     }
  86.     public void doDoor() {
  87.     RSObject fagDoor = getNearest(CLOSED_DOOR_ID);
  88.       if(fagDoor != null && !isMoving()) {
  89.           if(fagDoor.getPosition().getX() == 3253 && fagDoor.getPosition().getY() == 3398 && fagDoor.getPosition().distanceTo(Player.getPosition()) < 6) {
  90.           if(fagDoor.isOnScreen()) {
  91.           customLog("Opening door cuz kids r mad");
  92.           fagDoor.click("Open", new Point(-10, 10), new Point(0, -40));
  93.           sleep(300, 700);
  94.           } else {
  95.               customWalkTo(fagDoor.getPosition());
  96.           }
  97.       }
  98.       }
  99.     }
  100.     public void homeTeleport() {
  101.        
  102.         /*
  103.         customLog("We're lost - Home teleport!");
  104.         GameTab.open(TABS.MAGIC);
  105.         sleep(750, 3000);
  106.         Point p = Widgets.get(192).getChild(0).getPoint();
  107.         p.y += 5;
  108.         p.x += 5;
  109.         Mouse.move(p);
  110.         sleep(200, 1000);
  111.         Mouse.click(p);
  112.         sleep(10000, 20000);
  113.         Game.openTab(Tab.INVENTORY);
  114.         */
  115.         //Not really needed anymore but there'll probably eventually be a use.
  116.     }
  117.     public boolean hasPickaxeHead() {
  118.         return Inventory.getCount(PICK_HEADS) > 0;
  119.     }
  120.     public boolean hasPickaxe() {
  121.         if(Inventory.getCount(PICKAXE_IDS) > 0) {
  122.             return true;
  123.         }
  124.         RSItem[] equipment = getEquipment();
  125.         for(int j = 0; j < PICKAXE_IDS.length; j++) {
  126.         for(int i = 0; i < equipment.length; i++) {
  127.             if(equipment[i].getID() == PICKAXE_IDS[j])
  128.                 return true;
  129.         }
  130.         }
  131.         return false;
  132.     }
  133.     public void putPickaxeTogether() {
  134.         if(Inventory.getCount(BROKEN_PICK_ID) < 1) {
  135.             unequipItem(BROKEN_PICK_ID);
  136.         } else {
  137.             RSItem[] brokenPicks = Inventory.find(BROKEN_PICK_ID);
  138.             RSItem brokenPick = null;
  139.             RSItem[] pickaxes = Inventory.find(PICK_HEADS);
  140.             RSItem pickaxe = null;
  141.             if(brokenPicks.length < 1 || pickaxes.length < 1)
  142.                 return;
  143.             brokenPick = brokenPicks[0];
  144.             pickaxe = pickaxes[0];
  145.             brokenPick.click(null);
  146.             pickaxe.click(null);
  147.         }
  148.     }
  149.     public boolean pickupPickHead() {
  150.         customLog("Finding pickaxe head");
  151.         RSGroundItem[] pickHeads = GroundItems.findNearest(PICK_HEADS);
  152.         RSGroundItem pickHead = null;
  153.         if(pickHeads.length < 1) {
  154.             return false;
  155.         }
  156.         pickHead = pickHeads[0];
  157.         if(pickHead != null) {
  158.             if(pickHead.isOnScreen()) {
  159.             pickHead.click("Take");
  160.             } else {
  161.             customWalkTo(pickHead.getPosition());
  162.             }
  163.             return true;
  164.         }
  165.         return false;
  166.     }
  167.     public void attemptAbyssSolve() {
  168.     customLog("In the abyss..");
  169.     int random = General.random(12722, 12725); 
  170.      RSObject appendage = getNearest(random);
  171.      if(appendage == null)
  172.          return;
  173.      if(appendage.isOnScreen()) {
  174.          if(appendage.click("Operate")) {
  175.          sleep(2000, 3000);
  176.          customLog("Guessing on appendage..");
  177.          return;
  178.          } else {
  179.              //Camera.turnToRSTile(appendage.getPosition());
  180.              Camera.turnToTile(appendage.getPosition());
  181.              sleep(300, 750);
  182.              customLog("Turning camera to see appendage");
  183.          }
  184.     }
  185.     }
  186.     public void goDownstairs() {
  187.         if(IN_BANK.distanceTo(Player.getPosition()) < 6)
  188.             return;
  189.         RSObject stairs;
  190.          stairs = getNearest(24353);
  191.          if(stairs == null)
  192.              return;
  193.          if(stairs.isOnScreen()) {
  194.              if(stairs.click("Climb-down")) {
  195.              sleep(2000, 4000);
  196.              customLog("Attempting to go back downstairs");
  197.              return;
  198.              } else {
  199.                  Camera.turnToTile(stairs.getPosition());
  200.                  sleep(300, 750);
  201.                  customLog("Finding stairs..");
  202.              }
  203.         }  
  204.     }
  205.     public boolean isMining() {
  206.     for(int i = 0; i < MINING_ANIMATIONS.length; i++) {
  207.     if(Player.getAnimation() == MINING_ANIMATIONS[i]) {
  208.         return true;
  209.     }
  210.     }
  211.     return false;
  212.     }
  213.    
  214.     @Override
  215.     public void onEnd() {
  216.         println("Moose's essence miner is shutting down- Generating proggy!");
  217.         println("Ran for " + runTime(startTime));
  218.         println("Mined "+essenceMined+" essences");
  219.         //uploadProggy(Account.getWbotUsername(), System.currentTimeMillis() - startTime, essenceMined);
  220.         //Proggys are for another day.
  221.     }
  222.    
  223.     public void uploadProggy(String username, long time, int essence) {
  224.         // Had code to upload proggies here but I don't want to open-source it for obvious reasons.
  225.     }
  226.    
  227.     public RSObject getNearest(int ID) {
  228.         RSObject[] obj = Objects.findNearest(104, ID);
  229.         if(obj.length < 1)
  230.             return null;
  231.         return obj[0];
  232.     }
  233.     public boolean mineEssence() {
  234.      RSObject ess = getNearest(ESSENCE_ID);
  235.      if(ess == null)
  236.          return false;
  237.      if(ess.isOnScreen()) {
  238.             if(isMining()) { //Are we mining?
  239.                 sleep(2000);
  240.                 return true;
  241.             } else if(!isMining()) { //Let's double check if we're mining so we don't doubleclick
  242.                 sleep(1500);
  243.                 if(isMining())
  244.                     return true;
  245.             }
  246.             int fails = 0;
  247.         while(!DynamicClicking.clickRSObject(ess, "Mine Rune Essence") && !isMining()) {
  248.             //sleep(700);
  249.         //while(!ess.click("Mine Rune Essence", new Point(General.random(-100, 100), General.random(-100, 100)), null) && !isMining()) {
  250.             fails++;
  251.             if(fails == 5) {
  252.             customWalkTo(ess.getPosition());
  253.             if(General.random(1, 3) == 3)
  254.             Camera.setCameraRotation(General.random(10, 360));
  255.             fails = 0;
  256.             }
  257.         }
  258.          customLog("Mining");
  259.          sleep(600);
  260.          while(isMoving())
  261.              sleep(1000);
  262.          return true;
  263.      } else {
  264.          if(!inMine())
  265.              customLog("We're not in Kansas anymore todo~!"); //This is bad.
  266.          walkToEssence(); //We're either in a random or in the center of the essence mine
  267.      }
  268.      return false;
  269.     }
  270.     public void walkToEssence() {
  271.     RSObject ess = getNearest(ESSENCE_ID);
  272.     if(ess != null) {
  273.     if(ess.getPosition().distanceTo(Player.getPosition()) < 30 && !isMoving() && !isMining()) {
  274.         customWalkTo(ess.getPosition());
  275.         return;
  276.     }
  277.     }
  278.     RSTile[] t = new RSTile[4];
  279.     t[0] = new RSTile(2919, 4840);
  280.     t[1] = new RSTile(2902, 4841);
  281.     t[2] = new RSTile(2902, 4822);
  282.     t[3] = new RSTile(2919, 4822);
  283.     RSTile nearest = getNearest(t);
  284.     if(nearest.distanceTo(Player.getPosition()) < 30 && !isMoving()) {
  285.         customWalkTo(nearest);
  286.         sleep(500, 1000);
  287.     }
  288.     }
  289.     public static RSTile getNearest(RSTile[] t){
  290.         RSTile nearest = null;
  291.         double distance = 9999999;
  292.         for (RSTile object : t){
  293.                 if (object.distanceTo(Player.getPosition()) < distance){
  294.                         nearest = object;
  295.                         distance = object.distanceTo(Player.getPosition());
  296.                 }
  297.         }
  298.         return nearest;
  299. }
  300.     public boolean isMoving() {
  301.         //if(!Player.isMoving())
  302.         //  return false;
  303.         //return Calculations.distanceTo(Walking.getDestination()) >= 3;
  304.         //Walking.
  305.         return Player.isMoving();
  306.     }
  307.     public boolean usePortal() {
  308.          RSObject portal = getNearest(PORTAL_ID);
  309.          if(portal == null)
  310.              return false;
  311.          if(portal.isOnScreen()) {
  312.              if(DynamicClicking.clickRSObject(portal, "Use")) {
  313.                     int fails = 0;
  314.                      while(portal.isOnScreen() && fails < 11) {
  315.                          sleep(200, 400);
  316.                          fails++;
  317.                      }
  318.                 customLog("Teleported.");
  319.              return true;
  320.              } else if(General.random(0, 10) == 10) {
  321.                   Camera.turnToTile(portal.getPosition());
  322.               }
  323.          } else {
  324.              if(portal.getPosition().distanceTo(Player.getPosition()) < 20 && !isMoving()) {
  325.                  customWalkTo(portal.getPosition());
  326.              }
  327.          }
  328.         return false;
  329.     }
  330.     public boolean inRuneShop() {
  331.         for(int i = 0; i < randomAubury.length; i++) {
  332.             if(Player.getPosition().equals(randomAubury[i]))
  333.                 return true;
  334.         }
  335.         return false;  
  336.     }
  337.     public boolean inBank() {
  338.         if(IN_BANK.distanceTo(Player.getPosition()) < 5)
  339.             return true;
  340.         return false;
  341.     }
  342.  
  343.         public static Image getImage(String url) {
  344.          Image img = null;
  345.          try {
  346.           URL link = new URL(url);
  347.           img = ImageIO.read(link);
  348.          } catch (Exception e) {
  349.          }
  350.          return img;
  351.         }
  352.         public boolean openBank() {
  353.         return General.random(1,2) == 1 ? Banking.openBankBooth() : Banking.openBankBanker();
  354.         }
  355.     public boolean doBank() {
  356.                 int fails = 0;
  357.                 GameTab.open(TABS.INVENTORY);
  358.                 if(!GameTab.getOpen().equals(TABS.INVENTORY))
  359.                 return false;
  360.                 boolean success = false;
  361.                  if (openBank()) {
  362.               sleep(500);
  363.               fails = 0;
  364.               while(isMoving()) {
  365.                   sleep(100);
  366.                   fails++;
  367.                   if(fails == 15)
  368.                       break;
  369.               }
  370.               if(isMoving() || !Banking.isBankScreenOpen())
  371.               return false;
  372.               if(Inventory.getCount(PURE_ESSENCE) > 0) //Do we have pure essence?
  373.               if(Banking.deposit(28, PURE_ESSENCE)) {
  374.                   success = true;
  375.                   //sleep(200, 500);
  376.               }
  377.               if(Inventory.getCount(RUNE_ESSENCE) > 0) //Do we have rune essence?
  378.               if(Banking.deposit(28, RUNE_ESSENCE)) {
  379.                   success = true;
  380.                   //sleep(200, 500);
  381.               }
  382.               if(Inventory.getCount(PURE_ESSENCE + 1) > 0) //Do we have pure essence(noted)?
  383.               if(Banking.deposit(999, PURE_ESSENCE + 1)) {
  384.                   success = true;
  385.                   //sleep(200, 500);
  386.               }
  387.               if(Inventory.getCount(995) > 0) //Do we have $?
  388.               if(Banking.deposit(99999, 995)) {
  389.                   success = true;
  390.                   //sleep(200, 500);
  391.               }
  392.               sleep(500, 600);
  393.               return success;
  394.                  } else {
  395.                         if(!isMoving())
  396.                          customWalkTo(IN_BANK);
  397.                  }
  398.                  return false;
  399.            }
  400.        
  401.     public boolean teleportIntoMine() {
  402.           RSNPC[] AuburyArray = NPCs.find(AUBURY_ID);
  403.           RSNPC Aubury;
  404.           if(AuburyArray.length < 1)
  405.               return false;
  406.           else
  407.           Aubury = AuburyArray[0];
  408.           if(Aubury == null)
  409.               return false;
  410.           if(Aubury.getPosition().distanceTo(Player.getPosition()) > 4)
  411.               return false;
  412.               doDoor();
  413.           if(Aubury.isOnScreen()) {
  414.               if(Aubury.click("Teleport")) {
  415.                   int fails = 0;
  416.               while(IN_RUNE_SHOP.distanceTo(Player.getPosition()) < 10) {
  417.                   sleep(200, 400);
  418.                   fails++;
  419.                   if(fails > 15)
  420.                       break;
  421.               }
  422.               } else if(General.random(0, 10) == 10) {
  423.                   Camera.turnToTile(Aubury.getPosition());
  424.               }
  425.           } else if(Aubury.getPosition().distanceTo(Player.getPosition()) < 8 && !isMoving()) {
  426.               Walking.blindWalkTo(randomAubury[General.random(0, randomAubury.length - 1)]);
  427.           }
  428.          
  429.           return false;
  430.     }
  431.  
  432.     public void loop() throws Exception {
  433.     sleep(100);
  434.     if(isLost()) {
  435.         if(PathFinding.canReach(IN_BANK, false))
  436.             PathFinding.aStarWalk(IN_BANK);
  437.         //homeTeleport();
  438.     }
  439.     if(inAbyss())
  440.         attemptAbyssSolve();
  441.     goDownstairs(); //Failsafe..
  442.     if(inMine() && Inventory.isFull()) {
  443.         if(!usePortal())
  444.             customLog("Searching for portal..");
  445.     }
  446.     if(!inMine() && !inBank() && Inventory.isFull()) {
  447.         if(IN_BANK.distanceTo(Player.getPosition()) < 60 && !isMoving()) {
  448.             doDoor();
  449.             customWalkTo(IN_BANK);
  450.             sleep(400, 600);
  451.         }
  452.         customLog("Walking to the bank");
  453.     } else {
  454.        
  455.         if(!inMine() && !inRuneShop() && !Inventory.isFull()) {
  456.             if(IN_RUNE_SHOP.distanceTo(Player.getPosition()) < 60 && !isMoving()) {
  457.                 doDoor();
  458.                 Walking.blindWalkTo(randomAubury[General.random(0, randomAubury.length - 1)]);
  459.                 sleep(400, 700);
  460.             }
  461.             customLog("Walking to the rune shop");
  462.         }
  463.     }
  464.     if(inBank() && Inventory.isFull()) {
  465.         int essThisRun = Inventory.getCount(PURE_ESSENCE) + Inventory.getCount(RUNE_ESSENCE);
  466.         if(doBank())
  467.         essenceMined += essThisRun;
  468.         customLog("Banking.");
  469.     }
  470.     if(inRuneShop() && !Inventory.isFull()) {
  471.         if(!teleportIntoMine())
  472.             customLog("Teleporting via Aubury..");
  473.     }
  474.     if(isMining()) { //Do antiban as we mine the essence
  475.           antiban();
  476.        }
  477.     if(inMine() && !Inventory.isFull()) {
  478.         if(!hasPickaxe()) {
  479.         if(!hasPickaxeHead()) {
  480.             pickupPickHead();
  481.             sleep(700, 1700);
  482.         } else if(hasPickaxeHead()) {
  483.             putPickaxeTogether();
  484.             sleep(700, 1700);
  485.         } else {
  486.             println("We completely lost our pickaxe.. Sorry.");
  487.         }
  488.         return;
  489.         }
  490.         if(Player.getRSPlayer().isInCombat()) {
  491.             usePortal();
  492.             return;
  493.         }
  494.         if(!mineEssence())
  495.         customLog("Searching for essence deposit..");
  496.     }
  497.     if(!(Login.getLoginState() == Login.STATE.INGAME) || jf != null) {
  498.         customLog("Not logged in");
  499.     }
  500.     }
  501.    
  502.     public boolean onStart() {
  503.         startTime = System.currentTimeMillis();
  504.         proggyImage = getImage("http://i.imgur.com/NBRkT7v.png");
  505.         Mouse.setSpeed(140);
  506.         //initComponents();
  507.        customLog("MooseEssence starting up.. Report bugs on the thread!!");
  508.         return true;
  509.     }
  510.     private Object lastText;
  511.     public void customLog(Object text) { //Prevent spam from the script..
  512.     if(debug)
  513.     println(text);
  514.     lastText = text;
  515.     }
  516.  
  517.     public void customWalkTo(RSTile t) {
  518.         Walking.control_click = true;
  519.         t = new RSTile(t.getX() + General.random(-1, +1), t.getY() + General.random(-1, +1));
  520.         if(t.distanceTo(Player.getPosition()) < 6 && General.random(1, 2) == 1)
  521.         Walking.walkScreenPath(Walking.generateStraightPath(t));
  522.         else
  523.         Walking.walkPath(Walking.generateStraightPath(t));
  524.         sleep(50, 200);
  525.         if(Objects.getAt(t) != null) { //There's an object blocking our path.
  526.             if(General.random(1, 2) == 1)
  527.                 Camera.setCameraRotation(General.random(0, 360));
  528.                 else
  529.                 Camera.setCameraAngle(General.random(0, 100));
  530.         }
  531.         sleep(200, 400);
  532.     }
  533.    
  534.     public void antiban() { //Leeched from Cona's willow script :)
  535.         int random = General.random(1, antiBanFreq * 2);
  536.         String antibanString = null;
  537.         switch (random) {
  538.         case 1:
  539.            antibanString = "Antiban - Camera Pitch";
  540.            Camera.setCameraRotation(General.random(200, 300));
  541.            break;
  542.         case 2:
  543.            antibanString = "Antiban - Camera Angle";
  544.            Camera.setCameraAngle(General.random(10, 360));
  545.            break;
  546.         case 3:
  547.            antibanString = "Antiban - Mouse movement";
  548.            Mouse.move(General.random(1, 200), General.random(1, 200));
  549.            break;
  550.         case 4:
  551.            antibanString = "Antiban - Stat Check";
  552.            Point p = new Point(562 + General.random(0, 162), 216 + General.random(0, 200));
  553.            GameTab.open(TABS.STATS);
  554.            sleep(200, 500);
  555.            Mouse.move(p);
  556.            sleep(1000, 6000);
  557.            GameTab.open(TABS.INVENTORY);
  558.            break;
  559.         case 5:
  560.         antibanString = "Antiban - View player";
  561.         Camera.turnToTile(Player.getPosition());
  562.         break;
  563.         case 6:
  564.         RSPlayer[] players = Players.getAll();
  565.         if(players.length < 1)
  566.             break;
  567.         players[General.random(0, players.length - 1)].hover();
  568.         antibanString = "Viewing another player";
  569.         break;
  570.         case 7:
  571.         GameTab.open(TABS.values()[General.random(0, TABS.values().length - 1)]);
  572.         antibanString = "Opening a random tab";
  573.         break;
  574.         default:
  575.            antibanString = null;
  576.            break;
  577.         }
  578.         if(antibanString != null)
  579.         customLog(antibanString);
  580.      }
  581.     @Override
  582.     public void onPaint(Graphics g1) {
  583.         if(!paintEnabled)
  584.             return;
  585.         Graphics2D g = (Graphics2D)g1;
  586.         if(proggyImage != null) {
  587.         g.drawImage(proggyImage, 6, 344, null);
  588.         if(lastText != null)
  589.         g.drawString(lastText.toString(), 182, 402);
  590.         g.drawString(""+essenceMined+"", 251, 446);
  591.         g.drawString(""+runTime(startTime)+"", 195, 424);
  592.         } else {
  593.         g.drawString("Moose's essence miner", 10, 295);
  594.         if(lastText != null)
  595.         g.drawString("Status: " +lastText.toString(), 10, 310);
  596.         g.drawString("Essences mined: "+essenceMined+"", 10, 320);
  597.         g.drawString("Time running: "+runTime(startTime)+"", 10, 330);         
  598.         }
  599.     }
  600.     public String runTime(long i)
  601.     {
  602.       DecimalFormat nf = new DecimalFormat("00");
  603.       long millis = System.currentTimeMillis() - i;
  604.       long hours = millis / 3600000L;
  605.       millis -= hours * 3600000L;
  606.       long minutes = millis / 60000L;
  607.       millis -= minutes * 60000L;
  608.       long seconds = millis / 1000L;
  609.       return nf.format(hours) + ":" + nf.format(minutes) + ":" + nf.format(seconds);
  610.     }
  611.     private final RSTile[] randomAubury = {
  612.             new RSTile(3255, 3401),
  613.             new RSTile(3254, 3401),
  614.             new RSTile(3253, 3401),
  615.             new RSTile(3252, 3401),
  616.             new RSTile(3252, 3400),
  617.             new RSTile(3253, 3400),
  618.             new RSTile(3252, 3399),
  619.             new RSTile(3253, 3399),
  620.             new RSTile(3254, 3402),
  621.             new RSTile(3253, 3402),
  622.             new RSTile(3252, 3402),
  623.             new RSTile(3252, 3403),
  624.             new RSTile(3253, 3403)
  625.     };
  626.  
  627.     private void initComponents() {
  628.         // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
  629.         // Generated using JFormDesigner Evaluation license
  630.         jf = new JFrame();
  631.         jf.setVisible(true);
  632.         label3 = new JLabel();
  633.         label4 = new JLabel();
  634.         label1 = new JLabel();
  635.         slider1 = new JSlider(1, 10);
  636.         slider1.setInverted(true);
  637.         label2 = new JLabel();
  638.         textField1 = new JTextField();
  639.         radioButton1 = new JRadioButton();
  640.         radioButton2 = new JRadioButton();
  641.         button1 = new JButton();
  642.  
  643.         //======== this ========
  644.         Container contentPane = jf.getContentPane();
  645.         contentPane.setLayout(new GridLayout(10, 1));
  646.  
  647.         //---- label3 ----
  648.         label3.setText("---------- Moose's essence miner settings ----------");
  649.         contentPane.add(label3);
  650.         contentPane.add(label4);
  651.  
  652.         //---- label1 ----
  653.         label1.setText("Antiban Frequency(1-10)");
  654.         contentPane.add(label1);
  655.         contentPane.add(slider1);
  656.  
  657.         //---- label2 ----
  658.         label2.setText("E-mail address(Can be blank):");
  659.         contentPane.add(label2);
  660.         contentPane.add(textField1);
  661.  
  662.         //---- radioButton1 ----
  663.         radioButton1.setText("Send e-mail on script terminate");
  664.         contentPane.add(radioButton1);
  665.  
  666.         //---- radioButton2 ----
  667.         radioButton2.setText("Hide paint");
  668.         contentPane.add(radioButton2);
  669.  
  670.         //---- button1 ----
  671.         button1.setText("Start");
  672.         contentPane.add(button1);
  673.         jf.pack();
  674.         jf.setLocationRelativeTo(jf.getOwner());
  675.         // JFormDesigner - End of component initialization  //GEN-END:initComponents
  676.         button1.addActionListener(this);
  677.     }
  678.    
  679.     public void actionPerformed(ActionEvent e) {
  680.         if(radioButton1.isSelected())
  681.             emailAddress = textField1.getText();
  682.         paintEnabled = !radioButton2.isSelected();
  683.         antiBanFreq = slider1.getValue();
  684.         jf.dispose();
  685.         jf = null;
  686.     }
  687.     private RSItem[] getEquipment(){
  688.         RSInterfaceChild equip = Interfaces.get(387, 28);
  689.         RSItem[] items = null;
  690.         if(equip != null){
  691.             items = equip.getItems();
  692.         }
  693.         return items;
  694.     }
  695.     public boolean unequipItem(int itemID) {
  696.         GameTab.open(TABS.EQUIPMENT);
  697.         RSItem[] items = getEquipment();
  698.         for(RSItem item: items) {
  699.             if(item.getID() == itemID) {
  700.             item.click("Remove");
  701.             return true;
  702.             }
  703.         }
  704.         return false;
  705.     }
  706.     // JFormDesigner - Variables declaration - DO NOT MODIFY  //GEN-BEGIN:variables
  707.     // Generated using JFormDesigner Evaluation license
  708.     private JLabel label3;
  709.     private JLabel label4;
  710.     private JLabel label1;
  711.     private JSlider slider1;
  712.     private JLabel label2;
  713.     private JTextField textField1;
  714.     private JRadioButton radioButton1;
  715.     private JRadioButton radioButton2;
  716.     private JButton button1;
  717. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement