Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 8.63 KB | None | 0 0
  1. import org.rsbot.script.ScriptManifest;
  2. import org.rsbot.script.Script;
  3. import org.rsbot.script.wrappers.RSObject;
  4. import org.rsbot.event.listeners.PaintListener;
  5. import org.rsbot.script.methods.Skills;
  6. import org.rsbot.event.listeners.ServerMessageListener;
  7. import org.rsbot.event.events.ServerMessageEvent;
  8. import java.awt.*;
  9. import javax.imageio.ImageIO;
  10. import java.io.IOException;
  11. import java.net.URL;
  12. import org.rsbot.script.wrappers.RSTile;
  13. import org.rsbot.script.wrappers.RSArea;
  14. import org.rsbot.script.wrappers.RSCharacter;
  15. import org.rsbot.script.methods.Mouse;
  16.  
  17. @ScriptManifest(authors = { "Neverbeen" }, keywords = { "woodcut firemaking" }, name = "Slash N' Burn", version = 2.00, description = "Cuts willows, then burns them!")
  18. public class SlashNBurn extends Script implements PaintListener {
  19.    
  20.     RSTile[] SlashToBurn = { new RSTile(2990,3187), new RSTile(2997,3191), new RSTile(3009, 3191)};
  21.     RSTile[] EndToSlash = { new RSTile(2984,3191), new RSTile(2990,3187)};
  22.     RSTile[] BurnToSlash = { new RSTile(3009, 3191), new RSTile(2997,3191), new RSTile(2990,3187)};
  23.     public boolean Burning = false;
  24.     public boolean Cleaned = false;
  25.     private boolean BurnZone = false;
  26.     private boolean ChopZone = false;
  27.     private boolean EndZone = false;
  28.     public int percent;                                                                                         //declare variables
  29.     public int percent2;
  30.     private int Idle = 0;
  31.     int currentXP2;
  32.     int currentXP;
  33.     int startXP;
  34.     int startXP2;
  35.     int gainedXP;
  36.     int gainedXP2;
  37.     private String status = "Loading...";
  38.     private int WILLOW_TREE[] = {5552, 5551};                                                               //trees
  39.     private int Keepers[] = {1359, 1351, 1349, 1353, 1361, 1357, 1355, 590, 1519};                          //tinderbox and hatchets, and willow logs
  40.     private int Logs = 1519;
  41.     private int Tinderbox = 590;
  42.     public long startTime = System.currentTimeMillis();
  43.     private final Color color1 = new Color(153, 102, 0, 205);
  44.     private final Color color2 = new Color(0, 0, 0, 230);
  45.     private final Color color3 = new Color(51, 204, 0, 205);
  46.     private final Color color4 = new Color(51, 153, 0, 205);
  47.     private final Color color5 = new Color(0, 0, 0);
  48.     private final Color color6 = new Color(255, 153, 0, 205);
  49.     private final Color color7 = new Color(0, 0, 0, 205);
  50.     private final Color color8 = new Color(255, 0, 0, 205);
  51.     private final Color color9 = new Color(153, 0, 0, 205);
  52.     private final Color color10 = new Color(0, 0, 0, 180);
  53.     private final Color color11 = new Color(255, 255, 255);
  54.     private final Color color12 = new Color(255, 0, 0);
  55.     private final BasicStroke stroke1 = new BasicStroke(3);
  56.     private final Font font1 = new Font("Arial", 1, 12);  
  57.     final int startingFire = 733;
  58.  
  59.    
  60.     public boolean onStart(){      
  61.         startXP = skills.getCurrentExp(Skills.WOODCUTTING);
  62.         startXP2 = skills.getCurrentExp(Skills.FIREMAKING);
  63.         log("Script Started..");
  64.         return true;
  65.     }
  66.    
  67.     public void antiban() {                                                                         //antiban
  68.     int b = random(0, 10);
  69.              switch (b) {
  70.              case 1:
  71.                  if (random(0, 10) == 5) {
  72.                      log("[Antiban] move mouse");
  73.                      status = "Antiban";
  74.                      mouse.moveSlightly();
  75.                      sleep(200, 600);
  76.                      mouse.moveRandomly(150, 350);
  77.                  }
  78.                  break;
  79.  
  80.              case 2:
  81.                  if (random(0, 24) == 6) {
  82.                      log("[Antiban] mouse off screen");
  83.                      status = "Antiban";
  84.                      mouse.moveOffScreen();
  85.                      sleep(random(600, random(1200, 2000)));
  86.                  }
  87.                  break;
  88.  
  89.              case 3:
  90.                  if (random(0, 18) == 3) {
  91.                      log("[antiban] Checking Xp.");
  92.                      status = "Antiban";
  93.                      game.openTab(1);
  94.                      skills.doHover(skills.INTERFACE_WOODCUTTING);
  95.                      sleep(random(2100, 3400));
  96.                  }
  97.                  break;
  98.             default:
  99.                  break;
  100.              }
  101.          }                                                                                  // End antiban
  102.          
  103.     public boolean ChopZone(){
  104.     RSArea area = new RSArea(new RSTile(2986,3183), new RSTile(2992,3190));
  105.     return area.contains(getMyPlayer().getLocation());
  106.     }
  107.    
  108.     public boolean BurnZone(){
  109.     RSArea area = new RSArea(new RSTile(3008,3191), new RSTile(3009, 3191));   
  110.     return area.contains(getMyPlayer().getLocation());
  111.     }
  112.    
  113.     public boolean EndZone(){
  114.     RSArea area = new RSArea(new RSTile(2984,3190), new RSTile(2985, 3192));   
  115.     return area.contains(getMyPlayer().getLocation());
  116.     }
  117.    
  118.     public boolean FireLane(){
  119.     RSArea area = new RSArea(new RSTile(2985, 3191), new RSTile(3009, 3191));  
  120.     return area.contains(getMyPlayer().getLocation());
  121.     }  
  122.                                                
  123.        
  124.     public void onRepaint(Graphics g1) {
  125.        
  126.        
  127.         percent = skills.getPercentToNextLevel(Skills.WOODCUTTING);
  128.         percent2 = skills.getPercentToNextLevel(Skills.FIREMAKING);
  129.         currentXP = skills.getCurrentExp(Skills.WOODCUTTING);
  130.         currentXP2 = skills.getCurrentExp(Skills.FIREMAKING);
  131.         gainedXP = currentXP - startXP;
  132.         gainedXP2 = currentXP2 - startXP2;
  133.         long millis = System.currentTimeMillis() - startTime;
  134.         long hours = millis / (1000 * 60 * 60);
  135.         millis -= hours * (1000 * 60 * 60);
  136.         long minutes = millis / (1000 * 60);
  137.         millis -= minutes * (1000 * 60);
  138.         long seconds = millis / 1000;    
  139.         Graphics2D g = (Graphics2D)g1;
  140.         g.setColor(color10);
  141.         g.fillRect(337, 310, 182, 28);
  142.         g.setColor(color2);
  143.         g.setStroke(stroke1);
  144.         g.drawRect(337, 310, 182, 28);
  145.         g.setColor(color3);
  146.         g.fillRect(339, 312, (int) (percent * 178 / 100.0), 11);
  147.         g.setColor(color4);
  148.         g.fillRect(339, 323, (int) (percent * 178 / 100.0), 14);
  149.         g.setFont(font1);
  150.         g.setColor(color11);
  151.         g.drawString("Slash Xp: " + gainedXP, 341, 328);
  152.         g.setColor(color10);
  153.         g.fillRect(337, 282, 182, 26);
  154.         g.setColor(color7);
  155.         g.drawRect(337, 282, 182, 26);
  156.         g.setColor(color8);
  157.         g.fillRect(339, 284, (int) (percent2 * 178 / 100.0), 14);
  158.         g.setColor(color9);
  159.         g.fillRect(339, 298, (int) (percent2 * 178 / 100.0), 9);
  160.         g.setColor(color11);
  161.         g.drawString("Burn Xp: " + gainedXP2, 343, 300);
  162.         g.setColor(color10);
  163.         g.fillRect(337, 252, 181, 28);
  164.         g.setColor(color5);
  165.         g.drawRect(337, 252, 181, 28);
  166.         g.setColor(color11);
  167.         g.drawString("|           " + hours + ":" + minutes + ":" + seconds, 380, 270);
  168.         g.drawString("|", 479, 270);
  169.         g.setColor(color10);
  170.         g.fillRect(337, 230, 180, 21);
  171.         g.setColor(color5);
  172.         g.drawRect(337, 230, 180, 21);
  173.         g.setColor(color11);
  174.         g.drawString("[Nvr] Slash N' Burn", 378, 245);
  175.     }
  176.  
  177.    
  178.                                                                
  179.    
  180.     public int loop(){
  181.     mouse.setSpeed(random(4, 7));
  182.         if(!inventory.isFull()){                                                //if my inventory isnt full
  183.             if(ChopZone()){                                                         //and im in the slashzone
  184.                 if(getMyPlayer().getAnimation() != 867){                        //and im not chopping logs 
  185.                 RSObject tree = objects.getNearest(WILLOW_TREE);                //find the nearest tree
  186.                     if(tree != null){                                  
  187.                     tree.doAction("Chop");                                      //and chop that shit           
  188.                     status = "Chopping";
  189.                     sleep(720, 1232);
  190.                     antiban();
  191.                     }
  192.                 }      
  193.             }
  194.         }
  195.         if(inventory.isFull()){                                         //if my inventory is full
  196.             if(!BurnZone()){                                            //and im not in the burnzone       
  197.                 walking.walkPathMM(SlashToBurn);                                   
  198.                 status = "Walking to BurnZone";
  199.                 antiban();
  200.                 sleep(random(1400, 2200)); 
  201.                 walking.walkPathOnScreen(SlashToBurn);                  //walk to the burnzone
  202.                 sleep(random(1400, 2200)); 
  203.                 }              
  204.             }              
  205.         if(FireLane()){                                                 //if im in the Firelane
  206.             while(getMyPlayer().getAnimation() == startingFire)         //if im lighting a fire
  207.             sleep(50);                                                  //wait
  208.             if(inventory.getItem(Logs) != null){
  209.             inventory.getItem(Tinderbox).doAction("Use");               //if not, light a fire
  210.             status = "Burning";
  211.             sleep(random(336, 630));                                       
  212.                 while (inventory.isItemSelected()) {           
  213.                 inventory.getItem(Logs).doAction("Use");                                                                                       
  214.                     antiban();                         
  215.                     }
  216.                 }else{
  217.                     walking.walkPathMM(BurnToSlash);
  218.                     sleep(random(1400, 2200));
  219.                     }
  220.             }
  221.         if(EndZone()){                                          //if ive entered the endzone
  222.             sleep(random(2200, 2900)); 
  223.             walking.walkPathMM(EndToSlash);                     //walk back to the slash zone              
  224.             status = "Walking to SlashZone";
  225.             antiban();
  226.             sleep(random(2200, 2900));                 
  227.         }
  228.         if(getMyPlayer().getAnimation() == -1){
  229.         Idle++;    
  230.         }
  231.         if(Idle >= 400){
  232.         walking.walkPathMM(BurnToSlash);
  233.         log("Resetting");
  234.         Idle = 0;
  235.         }        
  236.         return random(120, 201);    
  237.     }
  238.     public void onFinish(){
  239.     env.saveScreenshot(true);
  240.     log("Shutting down script...");
  241.     }
  242. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement