Advertisement
Rudie221

MultiChopper V1.1!

Mar 30th, 2012
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 28.18 KB | None | 0 0
  1. import java.awt.*;
  2. import java.awt.event.*;
  3. import java.io.IOException;
  4. import java.net.URL;
  5. import java.util.LinkedList;
  6.  
  7. import javax.imageio.ImageIO;
  8. import javax.swing.*;
  9.  
  10. import com.rarebot.event.events.MessageEvent;
  11. import com.rarebot.event.listeners.MessageListener;
  12. import com.rarebot.event.listeners.PaintListener;
  13. import com.rarebot.script.Script;
  14. import com.rarebot.script.ScriptManifest;
  15. import com.rarebot.script.methods.Game.Tab;
  16. import com.rarebot.script.methods.Skills;
  17. import com.rarebot.script.wrappers.RSComponent;
  18. import com.rarebot.script.wrappers.RSGroundItem;
  19. import com.rarebot.script.wrappers.RSNPC;
  20. import com.rarebot.script.wrappers.RSObject;
  21. import com.rarebot.script.wrappers.RSTile;
  22. import com.rarebot.script.wrappers.RSWeb;
  23.  
  24. @ScriptManifest(
  25.         authors = {"Rudie"},
  26.         version = 1.1,
  27.         keywords = ("chopper, woodcutting, wc, worldchopper, rudie"),
  28.         description = "Chops and banks logs at different locations more info is in the thread",
  29.         name = "MultiChopper"
  30. )
  31. public class MultiChopper extends Script implements PaintListener, MessageListener, MouseListener {
  32.    
  33.     RSTile Fallytile = new RSTile(3013, 3356, 0);
  34.     RSTile Draynortile = new RSTile(3092, 3243, 0);
  35.     RSTile DraynorChoptile = new RSTile(3086, 3233, 0);
  36.     RSTile GEtile = new RSTile(3180, 3501, 0);
  37.     RSTile GEChoptile = new RSTile(3215, 3502, 0);
  38.     RSTile Camtile = new RSTile(2726, 3491, 0);
  39.     RSTile CamChoptile = new RSTile(2727, 3500, 0);
  40.     RSTile Cattile = new RSTile(2808, 3440, 0);
  41.     RSTile CatChoptile = new RSTile(2767, 3430, 0);
  42.     RSTile FallyChoptile = new RSTile(3045, 3322, 0);
  43.     RSTile RimmyChoptile = new RSTile(2970, 3193, 0);
  44.    
  45.     private final static int[] yew_ID = {38755, 1309};
  46.     private final static int[] maple_ID = {1307};
  47.     private final static int[] oak_ID = {38731};
  48.     private final static int[] regular_ID = {38784, 38785, 38786, 38787, 1278, 1276};
  49.     private final static int[] ivy_ID = {46324, 46322, 46318, 46322, 46320};
  50.     private final static int[] willow_ID = {38616, 38627, 58006, 2210};
  51.     private final static int[] hatchetID = {1349, 1351, 1353, 1355, 1357, 1359, 1361, 6739};
  52.     private final static int[] boothID = {11758, 2012, 2019, 25808, 2213};
  53.     private final static int[] bnpcID = {3293};
  54.    
  55.     private static final int yew_LOG = 1515;
  56.     private static final int maple_LOG = 1517;
  57.     private static final int oak_LOG = 1521;
  58.     private static final int regular_LOG = 1511;
  59.     private static final int willow_LOG = 1519;
  60.    
  61.     private int[] logsToChop;
  62.     public int logID = 0;
  63.    
  64.     long startTime;
  65.     private String Status = "Loading...";
  66.    
  67.    private static final Color MOUSE_COLOR = new Color(255, 0, 0),
  68.     MOUSE_BORDER_COLOR = new Color(255, 0, 0),
  69.     MOUSE_CENTER_COLOR = new Color(0, 0, 0);
  70.     private boolean pressed = false;
  71.          
  72.    int expGained = 0;
  73.    int startExp = 0;
  74.    int logsChopped = 0;
  75.    int nestsFound = 0;
  76.    int gainedLvl = 0;
  77.    public boolean showPaint = true ;
  78.    Point p;
  79.    Point p2;
  80.    private final LinkedList<MousePathPoint> mousePath = new LinkedList<MousePathPoint>();
  81.    
  82.     MultiChopperGUI g;
  83.    
  84.     private boolean guiWait = true;
  85.     public boolean powerchop = false;
  86.     public boolean fallytile = false;
  87.     public boolean fallybanktile = false;
  88.     public boolean rimmytile = false;
  89.     public boolean draynortile = false;
  90.     public boolean getile = false;
  91.     public boolean camtile = false;
  92.     public boolean cattile = false;
  93.    
  94.     public boolean onStart() {
  95.         startTime = System.currentTimeMillis();
  96.         mouse.setSpeed(random(3, 5));
  97.         startExp = skills.getCurrentExp(Skills.WOODCUTTING);
  98.         log(new Color (30, 144, 255), "Welcome to MultiChopper V 1.0!");
  99.         log(Color.RED, "PLEASE READ:");
  100.         log(new Color (30, 144, 255), "Please check the thread every day for new updates.");
  101.         log(new Color (30, 144, 255), "V 1.1 has been released 30-3-2012.");
  102.         log(new Color (30, 144, 255), "MultiChopper ®   © 2012 ");
  103.         log(Color.RED, "Happy botting!");
  104.        
  105.         try {
  106.             SwingUtilities.invokeAndWait(new Runnable() {
  107.  
  108.                 public void run() {
  109.                     g = new MultiChopperGUI();
  110.                     g.setVisible(true);
  111.                 }
  112.             });
  113.         } catch (Throwable e) {
  114.             log("Fail.");
  115.         }
  116.        
  117.         while(guiWait) sleep(500);
  118.        
  119.         return true;
  120.     }
  121.  
  122.     @Override
  123.     public int loop() {
  124.         if(inventory.isFull() && powerchop == true) {
  125.             inventory.dropAllExcept(hatchetID);
  126.             Status = "Dropping logs.";
  127.         } else if(inventory.isFull() && powerchop == false) {
  128.             if(atBank() || atNPCBank()) {
  129.                 doBank();
  130.                 doNPCBank();
  131.                 } else {
  132.                 toFally();
  133.                 toDraynor();
  134.                 toGE();
  135.                 toCam();
  136.                 toCat();
  137.                 AntiBanCamera();
  138.             }
  139.     } else if(atTree()) {
  140.             chopLogs();
  141.             AntiBan();
  142.             AntiBanCamera();
  143.         } else if(ifNestOnGround()) {
  144.             pickNest();
  145.         } else {
  146.             toFallyChop();
  147.             toRimmyChop();
  148.             toDraynorChop();
  149.             toGEChop();
  150.             toCamChop();
  151.             toCatChop();
  152.             AntiBanCamera();
  153.         }
  154.         return random(600, 800);
  155.     }
  156.    
  157.    
  158.     private boolean atTree() {
  159.         RSObject tree = objects.getNearest(logsToChop);
  160.         if(tree != null) {
  161.             if(tree.isOnScreen()) {
  162.                 return true;
  163.             }
  164.         }
  165.         return false;
  166. }
  167.    
  168.     private void chopLogs() {
  169.         RSObject tree = objects.getNearest(logsToChop);
  170.         if (tree != null && getMyPlayer().getAnimation() == -1) {
  171.             tree.interact("Chop");
  172.             Status = "Cutting tree.";
  173.         }
  174.     }
  175.    
  176.     private void toFally() {
  177.         if (inventory.isFull() && fallybanktile == true) {
  178.             RSWeb walkWeb = web.getWeb(Fallytile);
  179.             if (walkWeb != null && !walkWeb.finished()) {
  180.                 walkWeb.step();
  181.                 Status = "Walking to bank.";
  182.             } else if (walkWeb == null) {
  183.                 walkWeb = web.getWeb(Fallytile);
  184.             }} }  
  185.    
  186.     private void toFallyChop() {
  187.         if (!inventory.isFull() && fallytile == true) {
  188.             RSWeb walkWeb = web.getWeb(FallyChoptile);
  189.             if (walkWeb != null && !walkWeb.finished()) {
  190.                 walkWeb.step();
  191.                 Status = "Walking to tree(s).";
  192.             } else if (walkWeb == null) {
  193.                 walkWeb = web.getWeb(FallyChoptile);
  194.             }} }  
  195.    
  196.     private void toDraynor() {
  197.         if (inventory.isFull() && draynortile == true) {
  198.             RSWeb walkWeb = web.getWeb(Draynortile);
  199.             if (walkWeb != null && !walkWeb.finished()) {
  200.                 walkWeb.step();
  201.                 Status = "Walking to bank.";
  202.             } else if (walkWeb == null) {
  203.                 walkWeb = web.getWeb(Draynortile);
  204.             }} }  
  205.    
  206.     private void toDraynorChop() {
  207.         if (!inventory.isFull() && draynortile == true) {
  208.             RSWeb walkWeb = web.getWeb(DraynorChoptile);
  209.             if (walkWeb != null && !walkWeb.finished()) {
  210.                 walkWeb.step();
  211.                 Status = "Walking to tree(s).";
  212.             } else if (walkWeb == null) {
  213.                 walkWeb = web.getWeb(DraynorChoptile);
  214.             }} }  
  215.    
  216.     private void toGE() {
  217.         if (inventory.isFull() && getile == true) {
  218.             RSWeb walkWeb = web.getWeb(GEtile);
  219.             if (walkWeb != null && !walkWeb.finished()) {
  220.                 walkWeb.step();
  221.                 Status = "Walking to bank.";
  222.             } else if (walkWeb == null) {
  223.                 walkWeb = web.getWeb(GEtile);
  224.             }} }  
  225.    
  226.     private void toGEChop() {
  227.         if (!inventory.isFull() && getile == true) {
  228.             RSWeb walkWeb = web.getWeb(GEChoptile);
  229.             if (walkWeb != null && !walkWeb.finished()) {
  230.                 walkWeb.step();
  231.                 Status = "Walking to tree(s).";
  232.             } else if (walkWeb == null) {
  233.                 walkWeb = web.getWeb(GEChoptile);
  234.             }} }
  235.    
  236.     private void toCam() {
  237.         if (inventory.isFull() && camtile == true) {
  238.             RSWeb walkWeb = web.getWeb(Camtile);
  239.             if (walkWeb != null && !walkWeb.finished()) {
  240.                 walkWeb.step();
  241.                 Status = "Walking to bank.";
  242.             } else if (walkWeb == null) {
  243.                 walkWeb = web.getWeb(Camtile);
  244.             }} }  
  245.    
  246.     private void toCamChop() {
  247.         if (!inventory.isFull() && camtile == true) {
  248.             RSWeb walkWeb = web.getWeb(CamChoptile);
  249.             if (walkWeb != null && !walkWeb.finished()) {
  250.                 walkWeb.step();
  251.                 Status = "Walking to tree(s).";
  252.             } else if (walkWeb == null) {
  253.                 walkWeb = web.getWeb(CamChoptile);
  254.             }} }
  255.    
  256.     private void toCat() {
  257.         if (inventory.isFull() && cattile == true) {
  258.             RSWeb walkWeb = web.getWeb(Cattile);
  259.             if (walkWeb != null && !walkWeb.finished()) {
  260.                 walkWeb.step();
  261.                 Status = "Walking to bank.";
  262.             } else if (walkWeb == null) {
  263.                 walkWeb = web.getWeb(Cattile);
  264.             }} }  
  265.    
  266.     private void toCatChop() {
  267.         if (!inventory.isFull() && cattile == true) {
  268.             RSWeb walkWeb = web.getWeb(CatChoptile);
  269.             if (walkWeb != null && !walkWeb.finished()) {
  270.                 walkWeb.step();
  271.                 Status = "Walking to tree(s).";
  272.             } else if (walkWeb == null) {
  273.                 walkWeb = web.getWeb(CatChoptile);
  274.             }} }
  275.    
  276.     private void toRimmyChop() {
  277.         if (!inventory.isFull() && rimmytile == true) {
  278.             RSWeb walkWeb = web.getWeb(RimmyChoptile);
  279.             if (walkWeb != null && !walkWeb.finished()) {
  280.                 walkWeb.step();
  281.                 Status = "Walking to tree(s).";
  282.             } else if (walkWeb == null) {
  283.                 walkWeb = web.getWeb(RimmyChoptile);
  284.             }} }
  285.    
  286.     private void doBank() {
  287.         if(bank.isOpen()) {
  288.             bank.depositAllExcept(hatchetID);
  289.             Status = "Banking.";
  290.             sleep(800, 1200);
  291.         } else {
  292.             bank.open();
  293.             Status = "Banking.";
  294.             sleep(1800, 2200);
  295.         }
  296.     }
  297.    
  298.     private boolean atBank() {
  299.         RSObject bank = objects.getNearest(boothID);
  300.         if(bank != null) {
  301.             if(bank.isOnScreen()) {
  302.                 return true;
  303.             }
  304.         }
  305.         return false;
  306.     }
  307.    
  308.     private void pickNest() {
  309.         RSGroundItem nest = groundItems.getNearest(boothID);
  310.             nest.interact("Take");
  311.             Status = "Picking up nest.";
  312.     }
  313.    
  314.     private boolean ifNestOnGround() {
  315.         RSGroundItem nest = groundItems.getNearest(boothID);
  316.         if(nest != null) {
  317.             if(nest.isOnScreen()) {
  318.                 return true;
  319.             }
  320.         }
  321.         return false;
  322.     }
  323.    
  324.     private void doNPCBank() {
  325.         if(bank.isOpen()) {
  326.             bank.depositAllExcept(hatchetID);
  327.             Status = "Banking.";
  328.             sleep(800, 1200);
  329.         } else {
  330.             bank.open();
  331.             Status = "Banking.";
  332.             sleep(1800, 2200);
  333.         }
  334.     }
  335.    
  336.     private boolean atNPCBank() {
  337.         RSNPC bank = npcs.getNearest(bnpcID);
  338.         if(bank != null) {
  339.             if(bank.isOnScreen()) {
  340.                 return true;
  341.             }
  342.         }
  343.         return false;
  344.     }
  345.    
  346.    
  347.    
  348.     public void onFinish() {
  349.         log(new Color (30, 144, 255), "Ty for using MultiChopper by Rudie.");
  350.         env.saveScreenshot(true);
  351.     }
  352.    
  353.     public void mouseClicked(MouseEvent e) {
  354.         RSComponent inter = interfaces.get(137).getComponent(176);
  355.         if (inter.getArea().contains(e.getPoint())) {
  356.             showPaint = !showPaint;
  357.         }
  358.     }
  359.    
  360.     private void drawMouse(Graphics g) {
  361.         ((Graphics2D) g).setRenderingHints(new RenderingHints(
  362.                 RenderingHints.KEY_ANTIALIASING,
  363.                 RenderingHints.VALUE_ANTIALIAS_ON));
  364.         Point p = mouse.getLocation();
  365.         Graphics2D spinG = (Graphics2D) g.create();
  366.         Graphics2D spinGRev = (Graphics2D) g.create();
  367.         Graphics2D spinG2 = (Graphics2D) g.create();
  368.         spinG.setColor(MOUSE_BORDER_COLOR);
  369.         spinGRev.setColor(MOUSE_COLOR);
  370.         spinG.rotate(System.currentTimeMillis() % 2000d / 2000d * (360d) * 2
  371.                 * Math.PI / 180.0, p.x, p.y);
  372.         spinGRev.rotate(System.currentTimeMillis() % 2000d / 2000d * (-360d)
  373.                 * 2 * Math.PI / 180.0, p.x, p.y);
  374.         final int outerSize = 20;
  375.         final int innerSize = 12;
  376.         spinG.setStroke(new BasicStroke(1.0f, BasicStroke.CAP_ROUND,
  377.                 BasicStroke.JOIN_ROUND));
  378.         spinGRev.setStroke(new BasicStroke(1.0f, BasicStroke.CAP_ROUND,
  379.                 BasicStroke.JOIN_ROUND));
  380.         spinG.drawArc(p.x - (outerSize / 2), p.y - (outerSize / 2), outerSize,
  381.                 outerSize, 100, 75);
  382.         spinG.drawArc(p.x - (outerSize / 2), p.y - (outerSize / 2), outerSize,
  383.                 outerSize, -100, 75);
  384.         spinGRev.drawArc(p.x - (innerSize / 2), p.y - (innerSize / 2),
  385.                 innerSize, innerSize, 100, 75);
  386.         spinGRev.drawArc(p.x - (innerSize / 2), p.y - (innerSize / 2),
  387.                 innerSize, innerSize, -100, 75);
  388.         g.setColor(MOUSE_CENTER_COLOR);
  389.         g.fillOval(p.x, p.y, 2, 2);
  390.         spinG2.setColor(MOUSE_CENTER_COLOR);
  391.         spinG2.rotate(System.currentTimeMillis() % 2000d / 2000d * 360d
  392.                 * Math.PI / 180.0, p.x, p.y);
  393.         spinG2.setStroke(new BasicStroke(1.0f, BasicStroke.CAP_ROUND,
  394.                 BasicStroke.JOIN_ROUND));
  395.         spinG2.drawLine(p.x - 5, p.y, p.x + 5, p.y);
  396.         spinG2.drawLine(p.x, p.y - 5, p.x, p.y + 5);
  397.     }
  398.    
  399.     @SuppressWarnings("serial")
  400.     private class MousePathPoint extends Point { // credits to Enfilade
  401.         private int toColor(double d) {
  402.             return Math.min(255, Math.max(0, (int) d));
  403.         }
  404.  
  405.         private long finishTime;
  406.         private double lastingTime;
  407.  
  408.         public MousePathPoint(int x, int y, int lastingTime) {
  409.             super(x, y);
  410.             this.lastingTime = lastingTime;
  411.             finishTime = System.currentTimeMillis() + lastingTime;
  412.         }
  413.  
  414.         public boolean isUp() {
  415.             return System.currentTimeMillis() > finishTime;
  416.         }
  417.  
  418.         public Color getColor() {
  419.             return new Color(
  420.                     0,
  421.                     0,
  422.                     0,
  423.                     toColor(256 * ((finishTime - System.currentTimeMillis()) / lastingTime)));
  424.         }
  425.     }
  426.  
  427. private final RenderingHints antialiasing = new RenderingHints(
  428.             RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
  429.    
  430.    
  431.     ////////////
  432.     ///Paint///
  433.     //////////
  434.     private Image getImage(String url) {
  435.         try {
  436.             return ImageIO.read(new URL(url));
  437.         } catch(IOException e) {
  438.             return null;
  439.         }
  440.     }
  441.  
  442.     private final Color color1 = new Color(51, 51, 51);
  443.     private final Color color2 = new Color(255, 0, 0);
  444.     private final Color color3 = new Color(255, 255, 255);
  445.     private final Color color4 = new Color(0, 0, 0);
  446.  
  447.     private final BasicStroke stroke1 = new BasicStroke(1);
  448.  
  449.     private final Font font1 = new Font("Comic Sans MS", 2, 15);
  450.     private final Font font2 = new Font("Comic Sans MS", 0, 32);
  451.     private final Font font3 = new Font("Arial", 3, 15);
  452.     private final Font font4 = new Font("Arial", 0, 13);
  453.  
  454.     private final Image img1 = getImage("http://images1.wikia.nocookie.net/__cb20111205044534/runescape/images/thumb/e/e9/Willow_pyre_logs_detail.png/100px-Willow_pyre_logs_detail.png");
  455.     private final Image logo = getImage("http://i43.tinypic.com/1zcfoy1.png");
  456.    
  457.     @Override
  458.     public void onRepaint(Graphics g) {
  459.         drawModel(g, objects.getNearest(logsToChop), Color.RED, "Tree", Color.WHITE);
  460.         drawModel(g, objects.getNearest(boothID), Color.BLUE, "Bank Booth", Color.WHITE);
  461.        
  462.        
  463.  
  464.        
  465. expGained = skills.getCurrentExp(Skills.WOODCUTTING) - startExp;
  466.        
  467.         long millis = System.currentTimeMillis() - startTime;
  468.         long hours = millis / (1000 * 60 * 60);
  469.         millis -= hours * (1000 * 60 * 60);
  470.         long minutes = millis / (1000 * 60);
  471.         millis -= minutes * (1000 * 60);
  472.         long seconds = millis / 1000;
  473.        
  474.         float xpsec = 0;
  475.         if((minutes > 0 || hours > 0 || seconds > 0)&& expGained > 0) {
  476.             xpsec = ((float) expGained)/(float)(seconds + (minutes*60) + (hours*60*60));
  477.         }
  478.         float xpmin = xpsec * 60;
  479.         float xphour = xpmin * 60;
  480.        
  481.         float oresec = 0;
  482.         if((minutes > 0 || hours > 0 || seconds > 0)&& logsChopped > 0) {
  483.             oresec = ((float) logsChopped)/(float)(seconds + (minutes*60) + (hours*60*60));
  484.         }
  485.         float oremin = oresec * 60;
  486.         float orehour = oremin * 60;
  487.            
  488.         Graphics2D g1 = (Graphics2D)g;
  489.         g1.setColor(color4);
  490.         g1.fillRect(396, 459, 98, 12);
  491.         g1.setColor(color2);
  492.         g1.drawRect(396, 459, 98, 12);
  493.         g1.setColor(color3);
  494.         g1.setFont(font4);
  495.         g1.drawString("Hide/Show Paint.", 396, 470);
  496.         drawMouse(g1);
  497.        
  498.         Point p = mouse.getLocation();
  499.         while (!mousePath.isEmpty() && mousePath.peek().isUp())
  500.             mousePath.remove();
  501.         Point clientCursor = mouse.getLocation();
  502.         MousePathPoint mpp = new MousePathPoint(clientCursor.x,
  503.                 clientCursor.y, 3000);
  504.         if (mousePath.isEmpty() || !mousePath.getLast().equals(mpp))
  505.             mousePath.add(mpp);
  506.         MousePathPoint lastPoint = null;
  507.         for (MousePathPoint a : mousePath) {
  508.             if (lastPoint != null) {
  509.                 g1.setColor(a.getColor());
  510.                 g1.drawLine(a.x, a.y, lastPoint.x, lastPoint.y);
  511.             }
  512.             lastPoint = a;
  513.         }
  514.     g1.fillRect(p.x - 5, p.y, 12, 2);
  515.     g1.fillRect(p.x, p.y - 5, 2, 12);
  516.         if(showPaint){
  517.         g1.setColor(color1);
  518.         g1.fillRoundRect(8, 345, 488, 112, 16, 16);
  519.         g1.setColor(color2);
  520.         g1.setStroke(stroke1);
  521.         g1.drawRoundRect(8, 345, 488, 112, 16, 16);
  522.         g1.drawLine(7, 362, 494, 362);
  523.         g1.drawImage(img1, 375, 360, null);
  524.         g1.setFont(font1);
  525.         g1.setColor(color3);
  526.         g1.setFont(font2);
  527.         g1.setColor(color2);
  528.         g1.drawImage(logo, -60, 210, null);
  529.         g1.setFont(font3);
  530.         g1.setColor(color3);
  531.         g1.drawString("Status: " + Status, 12, 361);
  532.         g1.drawString("RunTime: "  + hours + ":" + minutes + ":" + seconds, 17, 390);
  533.         g1.drawString("Current Lvl: " + skills.getCurrentLevel(Skills.WOODCUTTING), 17, 405);
  534.         g1.drawString("Lvl's Gained: " + gainedLvl, 17, 420);
  535.         g1.drawString("XP/TNL: " + skills.getExpToNextLevel(Skills.WOODCUTTING), 17, 435);
  536.         g1.drawString("Logs Chopped: " + logsChopped, 250, 390);
  537.         g1.drawString("Logs/H: " + (int) orehour, 250, 405);
  538.         g1.setColor(color4);
  539.         g1.fillRect(8, 459, 98, 12);
  540.         g1.setColor(color2);
  541.         g1.drawRect(8, 459, 98, 12);
  542.         g1.setColor(color4);
  543.         g1.fillRect(396, 459, 98, 12);
  544.         g1.setColor(color2);
  545.         g1.drawRect(396, 459, 98, 12);
  546.         g1.setColor(color3);
  547.         g1.drawString("XP/H: " + (int) xphour, 250, 435);
  548.         g1.drawString("Nests Found: " + nestsFound, 250, 450);
  549.         g1.drawString("%/TNL: " + skills.getPercentToNextLevel(Skills.WOODCUTTING) + "%", 17, 450);
  550.         g1.drawString("XP Gained: " + expGained, 250, 420);
  551.         g1.setFont(font4);
  552.         g1.drawString("Hide/Show Paint.", 396, 470);
  553.     }
  554.     }
  555.  
  556.     public void drawModel(Graphics g, RSObject o, Color c, String s, Color tc)  {
  557.         if(o != null) {
  558.             Polygon[] model = o.getModel().getTriangles();
  559.                     Point point = calc.tileToScreen(o.getLocation());
  560.             for(Polygon p : model)  {
  561.                 g.setColor(c);
  562.                 g.fillPolygon(p);
  563.                             g.setColor(c.darker());
  564.                 g.drawPolygon(p);
  565.             }
  566.  
  567.             g.setColor(tc);
  568.             g.drawString(s, point.x - 75, point.y - 35);
  569.             }
  570.             }
  571.             public RSTile[] reversePath(RSTile[] other) {
  572.                     RSTile[] t = new RSTile[other.length];
  573.                     for (int i = 0; i < t.length; i++) {
  574.                             t[i] = other[other.length - i - 1];
  575.                     }
  576.                     return t;
  577.             }
  578.            
  579.             @Override
  580.             public void mouseEntered(MouseEvent e) {
  581.                 // TODO Auto-generated method stub
  582.                
  583.             }
  584.  
  585.             @Override
  586.             public void mouseExited(MouseEvent e) {
  587.                 // TODO Auto-generated method stub
  588.                
  589.             }
  590.  
  591.             @Override
  592.             public void mousePressed(MouseEvent e) {
  593.                 // TODO Auto-generated method stub
  594.                
  595.             }
  596.  
  597.             @Override
  598.             public void mouseReleased(MouseEvent e) {
  599.                 // TODO Auto-generated method stub
  600.                
  601.             }
  602.  
  603.  
  604.         @Override
  605.     public void messageReceived(MessageEvent e) {
  606.         String txt = e.getMessage().toLowerCase();
  607.         if(txt.contains("get some") || txt.contains("chop away some"))  {
  608.             logsChopped++;
  609.         }
  610.         if(txt.contains("nest falls")) {
  611.             nestsFound++;
  612.         }
  613.         if(txt.contains("woodcutting level")) {
  614.             gainedLvl++;
  615.         }
  616.     }
  617.        
  618.         //////////////
  619.         ///AntiBan///
  620.         ////////////
  621.       @SuppressWarnings("deprecation")
  622.     private void AntiBan() {
  623.             int randomProd = random(1, 60);
  624.             if (randomProd == 1) {
  625.               int randomMore = random(1, 5);
  626.               if (randomMore == 1) {
  627.                 if (game.getCurrentTab() != 2) {
  628.                   game.openTab(Tab.STATS);
  629.                   Status = "Checking WC XP + Level.";
  630.                   sleep(350, 500);
  631.                   skills.doHover(Skills.WOODCUTTING);
  632.                   sleep(2000, 3500);
  633.                 } else {
  634.                   mouse.move(random(678, 728), random(213, 232));
  635.                   sleep(2000, 3500);
  636.                 }
  637.               } else {
  638.                 sleep(1200, 2500);
  639.               }
  640.             }
  641.             if (randomProd == 2 || randomProd == 3 || randomProd == 4) {
  642.               sleep(1000, 2500);
  643.             }
  644.             if (randomProd >= 52) {
  645.               mouse.moveRandomly(65, 350);
  646.             } else
  647.               sleep(10, 30);
  648.           }
  649.  
  650.           private void AntiBanCamera() {
  651.             int randomNum = random(1, 50);
  652.             if (randomNum == 1 || randomNum == 2 || randomNum == 3) {
  653.               camera.moveRandomly(random(2000, 3300));
  654.             }
  655.             if (randomNum == 4 || randomNum == 5) {
  656.               camera.setAngle(random(10, 40));
  657.             }
  658.             if (randomNum == 6) {
  659.               camera.setPitch(random(40, 68));
  660.             }
  661.             if (randomNum == 7) {
  662.               camera.setPitch(random(20, 45));
  663.             }
  664.             if (randomNum == 8) {
  665.               camera.setPitch(random(68, 90));
  666.             } else
  667.               sleep(50, 70);
  668.           }
  669.    
  670.       class MultiChopperGUI extends JFrame {
  671.             /**
  672.          *
  673.          */
  674.         private static final long serialVersionUID = 1L;
  675.             public MultiChopperGUI() {
  676.                 initComponents();
  677.             }
  678.            
  679.         private void StartActionPerformed(ActionEvent e) {
  680.             String chosen = Tree.getSelectedItem().toString();
  681.             if(chosen.equals("Yew")) {
  682.                 logID = yew_LOG;
  683.                 logsToChop = yew_ID;
  684.             } else if(chosen.equals("Oak")) {
  685.                 logID = oak_LOG;
  686.                 logsToChop = oak_ID;
  687.             } else if(chosen.equals("Regular")) {
  688.                 logID = regular_LOG;
  689.                 logsToChop = regular_ID;
  690.             } else if(chosen.equals("Ivy")) {
  691.                 logsToChop = ivy_ID;
  692.             } else if(chosen.equals("Willow")) {
  693.                 logID = willow_LOG;
  694.                 logsToChop = willow_ID;
  695.             } else if(chosen.equals("Maple")) {
  696.                 logID = maple_LOG;
  697.                 logsToChop = maple_ID;
  698.                 }
  699.             guiWait = false;
  700.             g.dispose();
  701.         }
  702.  
  703.         private void ExitActionPerformed(ActionEvent e) {
  704.             stopScript(true);
  705.         }
  706.  
  707.         private void checkBox1ActionPerformed(ActionEvent e) {
  708.             powerchop = true;
  709.         }
  710.        
  711.  
  712.         private void LocationActionPerformed(ActionEvent e) {
  713.             String chosen = Location.getSelectedItem().toString();
  714.             if(chosen.equals("Falador. S")) {
  715.                 fallytile = true;
  716.                 fallybanktile = true;
  717.             } else if(chosen.equals("Rimmington")) {
  718.                 rimmytile = true;
  719.                 fallybanktile = true;
  720.             } else if(chosen.equals("Draynor Village")) {
  721.                 draynortile = true;
  722.             } else if(chosen.equals("Varrock Palace. N")) {
  723.                 getile = true;
  724.             } else if(chosen.equals("Varrock Palace N")) {
  725.                 Tree.setSelectedItem("Ivy");
  726.                 Tree.disable();
  727.                 getile = true;
  728.             } else if(chosen.equals("Varrock Palace W")) {
  729.                 Tree.setSelectedItem("Ivy");
  730.                 Tree.disable();
  731.             } else if(chosen.equals("Camelot")) {
  732.                 camtile = true;
  733.                 Tree.setSelectedItem("Maple");
  734.                 Tree.disable();
  735.             } else if(chosen.equals("Catherby")) {
  736.                 cattile = true;
  737.             } else if(chosen.equals("Falador S")) {
  738.                 fallytile = true;
  739.                 Tree.setSelectedItem("Ivy");
  740.                 Tree.disable();
  741.             } else if(chosen.equals("Yanille")) {
  742.                 Tree.setSelectedItem("Ivy");
  743.                 Tree.disable();
  744.             } else if(chosen.equals("Castle Wars")) {
  745.                 Tree.setSelectedItem("Ivy");
  746.                 Tree.disable();
  747.             }
  748.         }
  749.  
  750.         private void initComponents() {
  751.             // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
  752.             // Generated using JFormDesigner Evaluation license - Rudie Visser
  753.             Location = new JComboBox();
  754.             label1 = new JLabel();
  755.             label2 = new JLabel();
  756.             Tree = new JComboBox();
  757.             Start = new JButton();
  758.             Exit = new JButton();
  759.             label3 = new JLabel();
  760.             label4 = new JLabel();
  761.             checkBox1 = new JCheckBox();
  762.  
  763.             //======== this ========
  764.             setTitle("MultiChopper GUI");
  765.             Container contentPane = getContentPane();
  766.  
  767.             //---- Location ----
  768.             Location.setModel(new DefaultComboBoxModel(new String[] {
  769.                 "Falador. S",
  770.                 "Rimmington",
  771.                 "Varrock Palace. N",
  772.                 "Draynor Village",
  773.                 "Catherby",
  774.                 "Camelot",
  775.                 "Ivy:",
  776.                 "Yanille",
  777.                 "Castle Wars",
  778.                 "Falador S",
  779.                 "Varrock Palace N",
  780.                 "Varrock Palace W",
  781.             }));
  782.             Location.addActionListener(new ActionListener() {
  783.                 @Override
  784.                 public void actionPerformed(ActionEvent e) {
  785.                     LocationActionPerformed(e);
  786.                 }
  787.             });
  788.  
  789.             //---- label1 ----
  790.             label1.setText("Choose Location:");
  791.  
  792.             //---- label2 ----
  793.             label2.setText("Choose Tree:");
  794.  
  795.             //---- Tree ----
  796.             Tree.setModel(new DefaultComboBoxModel(new String[] {
  797.                 "Ivy",
  798.                 "Yew",
  799.                 "Maple",
  800.                 "Willow",
  801.                 "Oak",
  802.                 "Regular"
  803.             }));
  804.  
  805.             //---- Start ----
  806.             Start.setText("Start");
  807.             Start.addActionListener(new ActionListener() {
  808.                 @Override
  809.                 public void actionPerformed(ActionEvent e) {
  810.                     StartActionPerformed(e);
  811.                 }
  812.             });
  813.  
  814.             //---- Exit ----
  815.             Exit.setText("Exit");
  816.             Exit.addActionListener(new ActionListener() {
  817.                 @Override
  818.                 public void actionPerformed(ActionEvent e) {
  819.                     ExitActionPerformed(e);
  820.                 }
  821.             });
  822.  
  823.             //---- label3 ----
  824.             label3.setText("Or");
  825.  
  826.             //---- label4 ----
  827.             label4.setText("MultiChopper");
  828.             label4.setFont(new Font("Tekton Pro Ext", Font.PLAIN, 36));
  829.             label4.setForeground(Color.red);
  830.  
  831.             //---- checkBox1 ----
  832.             checkBox1.setText("Powerchop?");
  833.             checkBox1.addActionListener(new ActionListener() {
  834.                 @Override
  835.                 public void actionPerformed(ActionEvent e) {
  836.                     checkBox1ActionPerformed(e);
  837.                 }
  838.             });
  839.  
  840.             GroupLayout contentPaneLayout = new GroupLayout(contentPane);
  841.             contentPane.setLayout(contentPaneLayout);
  842.             contentPaneLayout.setHorizontalGroup(
  843.                 contentPaneLayout.createParallelGroup()
  844.                     .addGroup(GroupLayout.Alignment.TRAILING, contentPaneLayout.createSequentialGroup()
  845.                         .addContainerGap(132, Short.MAX_VALUE)
  846.                         .addComponent(label1)
  847.                         .addGap(129, 129, 129))
  848.                     .addGroup(GroupLayout.Alignment.TRAILING, contentPaneLayout.createSequentialGroup()
  849.                         .addGap(87, 87, 87)
  850.                         .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.TRAILING)
  851.                             .addComponent(Tree, GroupLayout.Alignment.LEADING, 0, 175, Short.MAX_VALUE)
  852.                             .addComponent(Location, GroupLayout.Alignment.LEADING, 0, 175, Short.MAX_VALUE))
  853.                         .addGap(82, 82, 82))
  854.                     .addGroup(GroupLayout.Alignment.TRAILING, contentPaneLayout.createSequentialGroup()
  855.                         .addContainerGap(148, Short.MAX_VALUE)
  856.                         .addComponent(label2)
  857.                         .addGap(131, 131, 131))
  858.                     .addGroup(contentPaneLayout.createSequentialGroup()
  859.                         .addContainerGap()
  860.                         .addComponent(Start, GroupLayout.PREFERRED_SIZE, 145, GroupLayout.PREFERRED_SIZE)
  861.                         .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 12, Short.MAX_VALUE)
  862.                         .addComponent(label3)
  863.                         .addGap(18, 18, 18)
  864.                         .addComponent(Exit, GroupLayout.PREFERRED_SIZE, 137, GroupLayout.PREFERRED_SIZE)
  865.                         .addContainerGap())
  866.                     .addGroup(GroupLayout.Alignment.TRAILING, contentPaneLayout.createSequentialGroup()
  867.                         .addContainerGap(49, Short.MAX_VALUE)
  868.                         .addComponent(label4)
  869.                         .addGap(37, 37, 37))
  870.                     .addGroup(contentPaneLayout.createSequentialGroup()
  871.                         .addGap(131, 131, 131)
  872.                         .addComponent(checkBox1)
  873.                         .addContainerGap(130, Short.MAX_VALUE))
  874.             );
  875.             contentPaneLayout.setVerticalGroup(
  876.                 contentPaneLayout.createParallelGroup()
  877.                     .addGroup(GroupLayout.Alignment.TRAILING, contentPaneLayout.createSequentialGroup()
  878.                         .addContainerGap()
  879.                         .addComponent(label4)
  880.                         .addGap(18, 18, 18)
  881.                         .addComponent(label1)
  882.                         .addGap(18, 18, 18)
  883.                         .addComponent(Location, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)
  884.                         .addGap(18, 18, 18)
  885.                         .addComponent(label2)
  886.                         .addGap(18, 18, 18)
  887.                         .addComponent(Tree, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
  888.                         .addGap(18, 18, 18)
  889.                         .addComponent(checkBox1)
  890.                         .addGap(7, 7, 7)
  891.                         .addGroup(contentPaneLayout.createParallelGroup()
  892.                             .addGroup(contentPaneLayout.createSequentialGroup()
  893.                                 .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
  894.                                     .addComponent(Exit, GroupLayout.DEFAULT_SIZE, 54, Short.MAX_VALUE)
  895.                                     .addComponent(label3))
  896.                                 .addGap(33, 33, 33))
  897.                             .addComponent(Start, GroupLayout.PREFERRED_SIZE, 46, GroupLayout.PREFERRED_SIZE))
  898.                         .addContainerGap())
  899.             );
  900.             pack();
  901.             setLocationRelativeTo(getOwner());
  902.             // JFormDesigner - End of component initialization  //GEN-END:initComponents
  903.         }
  904.  
  905.         // JFormDesigner - Variables declaration - DO NOT MODIFY  //GEN-BEGIN:variables
  906.         // Generated using JFormDesigner Evaluation license - Rudie Visser
  907.         private JComboBox Location;
  908.         private JLabel label1;
  909.         private JLabel label2;
  910.         private JComboBox Tree;
  911.         private JButton Start;
  912.         private JButton Exit;
  913.         private JLabel label3;
  914.         private JLabel label4;
  915.         private JCheckBox checkBox1;
  916.         // JFormDesigner - End of variables declaration  //GEN-END:variables
  917.     }
  918. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement