Guest User

Untitled

a guest
Jan 21st, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import org.rsbot.event.listeners.PaintListener;
  2. import org.rsbot.script.Script;
  3. import org.rsbot.script.ScriptManifest;
  4. import org.rsbot.script.wrappers.RSObject;
  5. import org.rsbot.script.methods.Game;
  6. import org.rsbot.script.methods.Game.Tab;
  7. import org.rsbot.script.methods.Skills;
  8. import java.awt.*;
  9.  
  10.  
  11. @ScriptManifest(authors = "Zh3", description = "Cuts Wu", keywords = "woodcutting", name = "ZhChop", version = 1.00)
  12. public class ZhChop extends Script implements PaintListener {
  13.    
  14. @Override
  15.     public boolean onStart() {
  16.         log("Welcome To My First Script! ZhChop");
  17.         return game.isLoggedIn();
  18.     }
  19.     // What it will say when the script is stopped !
  20.     @Override
  21.     public void onFinish() {
  22.         log("Thanks for using my first script! Feedback please(:");
  23.  }
  24.  
  25.     // What it will be chopping or going to !
  26.     private void Chop() {
  27.         final RSObject Tree = objects.getNearest(38616, 38627, 58006);
  28.         if (Tree.isOnScreen() && Tree != null) {
  29.             if (getMyPlayer().getAnimation() == -1) {
  30.                     if (Tree.interact("Chop down")) {
  31.                         sleep(random(1500, 2000));
  32.                         while (players.getMyPlayer().isMoving()
  33.                                 && Tree.isOnScreen() && Tree != null) {
  34.                             sleep(random(200, 800));
  35.                     }
  36.                 }
  37.             }
  38.         }
  39.     }
  40.  
  41.     private void dropAll() {
  42.         inventory.dropAllExcept( 1349, 1351, 1353, 1355, 1357, 1359, 1361, 6739,
  43.                         13470);
  44.     }
  45.  
  46.     public int loop() {
  47.         if (!inventory.isFull()) {
  48.             Chop();
  49.         } else {
  50.             if (inventory.isFull()){
  51.                 dropAll();
  52.             }
  53.         }
  54.         if (getMyPlayer().getAnimation() != -1) {
  55.             antiBan();
  56.         }
  57.         return random(200,800);
  58.     }
  59.     // Antiban methods
  60.     private void antiBan() {
  61.         switch (random(1, 20)) {
  62.           case 1:
  63.               camera.moveRandomly(560);
  64.               break;
  65.           case 3:
  66.               mouse.moveOffScreen();
  67.               sleep(random(1000, 2000));
  68.               break;
  69.           case 4:
  70.               skills.doHover(Skills.INTERFACE_WOODCUTTING);
  71.               sleep(random(100, 700));
  72.                game.openTab(Game.Tab.INVENTORY);
  73.               break;
  74.           case 5:
  75.               skills.doHover(Skills.INTERFACE_MINING);
  76.               sleep(random(200, 500));  
  77.               game.openTab(Game.Tab.INVENTORY);
  78.               break;       
  79.           case 6:
  80.               camera.moveRandomly(400);
  81.               break;
  82.           case 7:
  83.     skills.doHover(Skills.INTERFACE_FIREMAKING);
  84.                 sleep(random(300, 500));
  85.     game.openTab(Game.Tab.INVENTORY);
  86.     break;
  87.           case 8:
  88.               camera.moveRandomly(100);
  89.               break;
  90.           case 9:
  91.     skills.doHover(Skills.INTERFACE_FISHING);
  92.     sleep(random(800, 1000));
  93.     break;
  94.           case 13:
  95.              mouse.moveOffScreen();
  96.              sleep(random(600, 1000)); 
  97.              break;
  98.            case 17:
  99.              mouse.moveSlightly();
  100.              break;
  101.            case 18:
  102.              mouse.moveRandomly(25, 100);
  103.              sleep(random(1000, 1100));
  104.     break;
  105.           case 19:
  106.             camera.setAngle (random(0, 165));
  107.             camera.setPitch(random(100, 500));
  108.     break;
  109.           case 20:
  110.             mouse.moveSlightly();
  111.             break;
  112.  
  113.         }
  114.     }
  115.   //START: Code generated using Enfilade's Easel
  116.     private final Color color1 = new Color(51, 255, 255);
  117.     private final Color color2 = new Color(255, 51, 51);
  118.     private final Color color3 = new Color(0, 0, 0);
  119.     private final Color color4 = new Color(0, 204, 51);
  120.     private final BasicStroke stroke1 = new BasicStroke(1);
  121.     private final Font font1 = new Font("Arial", 0, 9);
  122.     private final Font font2 = new Font("Arial", 1, 15);
  123.     private final Font font3 = new Font("Arial", 1, 12);
  124.     public void onRepaint(Graphics g1) {
  125.                     Graphics2D g = (Graphics2D)g1;
  126.                     g.setColor(color1);
  127.                     g.fillRect(10, 351, 486, 103);
  128.                     g.setColor(color2);
  129.                     g.setStroke(stroke1);
  130.                     g.drawRect(10, 351, 486, 103);
  131.                     g.setFont(font1);
  132.                     g.setColor(color3);
  133.                     g.drawString("Time Running:", 17, 372);
  134.                     g.drawString("Time Till Level:", 15, 396);
  135.                     g.drawString("Exp Gained:", 17, 418);
  136.                     g.drawString("Exp Per Hour:", 13, 440);
  137.                     g.drawString("Profit Gained:", 199, 370);
  138.                     g.drawString("Profit Per Hour:", 199, 388);
  139.                     g.drawString("Logs Cut:", 206, 403);
  140.                     g.drawString("Logs Per Hour:", 201, 420);
  141.                     g.drawString("Logs Till Next Level:", 186, 439);
  142.                     g.setFont(font2);
  143.                     g.drawString("ZhChopper by Zh3", 340, 373);
  144.                     g.setFont(font3);
  145.                     g.drawString("First Script!", 360, 415);
  146.                     g.fillRoundRect(17, 320, 489, 12, 16, 16);
  147.                     g.setColor(color2);
  148.                     g.drawRoundRect(17, 320, 489, 12, 16, 16);
  149.                     g.fillRoundRect(323, 321, 178, 9, 16, 16);
  150.                     g.drawRoundRect(323, 321, 178, 9, 16, 16);
  151.                     g.setColor(color4);
  152.                     g.fillRoundRect(22, 322, 319, 9, 16, 16);
  153.                     g.drawRoundRect(22, 322, 319, 9, 16, 16);
  154.            
  155. }
  156.    
  157.     //END: Code generated using Enfilade's Easel
  158. }
Add Comment
Please, Sign In to add comment