Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 16.99 KB | None | 0 0
  1. import java.awt.*;
  2. import org.rsbot.event.listeners.PaintListener;
  3. import org.rsbot.event.events.MessageEvent;
  4. import org.rsbot.event.listeners.MessageListener;
  5. import org.rsbot.script.*;
  6. import org.rsbot.script.wrappers.RSArea;
  7. import org.rsbot.script.wrappers.RSObject;
  8. import org.rsbot.script.wrappers.RSTile;
  9. import org.rsbot.script.methods.Skills;
  10.  
  11.  
  12.  
  13.  
  14. @ScriptManifest(authors = {"JsMxBiCs"}, keywords = {"WoodCutting"}, name = "WillowWc", description = "Cuts Willows at Port-Sarim & Banks.", version = 1)
  15.  
  16. public class WillowWc extends Script implements PaintListener, MessageListener{
  17.    
  18.     private int WillowID[] = {5551, 5552, 5553};
  19.     private int WillowLogID = 1519;
  20.     public int [] kapIDs = {1349, 1351, 1353, 1355, 1357, 1359, 1361, 6739, 13470};
  21.     public final int[] nestIDs = {5070, 5071, 5072, 5073, 5074, 5075, 5076, 7413, 11966};
  22.     private int bankID = 36788;
  23.     private RSTile[] WalkingToBank = { new RSTile(3059, 3253), new RSTile(3047, 3246), new RSTile(3041, 3239), new RSTile(3047, 3235) };
  24.     private RSTile[] WalkingToWillowTrees = { new RSTile(3047, 3236), new RSTile(3042, 3247), new RSTile(3052, 3247), new RSTile(3060, 3253) }; public long startTime = 0;
  25.     public long millis = 0;
  26.     public long hours = 0;
  27.     public long minutes = 0;
  28.     public long seconds = 0;
  29.     public long last = 0;
  30.     private int logsChopped = 0;
  31.     public int expForLog = 67;
  32.     public int logsTNL;
  33.     public int logsHour = 0;
  34.     public int expGained = 0;
  35.     public int expHour = 0;
  36.     public int currLevel;
  37.     public int startLevel;
  38.     public int lvlsGained;
  39.     private int startExp;
  40.     private long secondsTNL;
  41.     private long hoursTNL;
  42.     private long minutesTNL;
  43.    
  44.     @Override
  45.     public boolean onStart() {
  46.     startTime = System.currentTimeMillis();
  47.     startExp = skills.getCurrentExp(skills.WOODCUTTING);
  48.     startLevel = skills.getCurrentLevel(skills.WOODCUTTING);
  49.     return true;
  50.     }      
  51.  
  52.       public void messageReceived(MessageEvent e) {
  53.     String x = e.getMessage().toLowerCase();
  54.     if (x.contains("you raped a log!")){
  55.      logsChopped++;
  56.     }
  57.   }
  58.  
  59.         public void checkRun() {
  60.             if(!walking.isRunEnabled()) {
  61.                 if(walking.getEnergy() < random(66,90)) {
  62.                     walking.rest(random(78,100));
  63.                 } else
  64.                     walking.setRun(true);
  65.             }
  66.         }
  67.    
  68.     public void cutWillows() {
  69.        RSObject willowtree = objects.getNearest(WillowID);
  70.        if (willowtree != null && getMyPlayer().getAnimation() == -1) {
  71.           willowtree.doAction("Chop down");
  72.           sleep(random(800, 1000));
  73.           if (!willowtree.isOnScreen()) {
  74.            camera.turnToTile(willowtree.getLocation());  
  75.           }
  76.        }
  77. }
  78.  
  79.      /*ANTIBAN MADE BY CHKENMUFFIN*\
  80.                  * THANKS FOR USING*\
  81.                  */
  82.                 public void chooserandomAFK(){
  83.                     switch(random(0, 4)) {
  84.             case 0: sleep(random(5000, 9000));
  85.  
  86.             case 1: sleep(random(4000, 10000));
  87.             case 2: sleep(random(5000, 15000));
  88.             case 3: sleep(random(4000, 10000));
  89.                 case 4: log("Not doing AFK");
  90.                     }
  91.                 }
  92.                 public void mouseHandler(){
  93.                       switch(random(0, 5)) {
  94.             case 0: mouse.moveOffScreen();
  95.                 sleep(random(5000, 10000));
  96.  
  97.             case 1: mouse.moveOffScreen();
  98.                     sleep(random(8000, 15000));
  99.  
  100.             case 2: mouse.moveSlightly();
  101.             case 3: mouse.moveSlightly();
  102.                 case 4: log("Not moving mouse");
  103.                 case 5:log("Taking offscreen break 30-60 secs");
  104.                     mouse.moveOffScreen();
  105.                     sleep(random(30000, 60000));
  106.  
  107.                     }
  108.                 }
  109.  
  110.                 public void superAntiMoveMouse(){
  111.     switch(random(0, 10)) {
  112.             case 0: log("Doing superAnti! Wiggling mouse a lot");
  113.                 mouse.setSpeed(random(6, 9));
  114.                 mouse.moveSlightly();
  115.                                 mouse.moveSlightly();
  116.                                                 mouse.moveSlightly();
  117.  
  118.  
  119.             case 1:  log("Doing superAnti! Wiggling mouse ");
  120.                                mouse.setSpeed(random(6, 9));
  121.                 mouse.moveSlightly();
  122.                                 mouse.moveSlightly();
  123.                case 2:  log("Doing superAnti! Wiggling mouse a lot");
  124.                               mouse.setSpeed(random(6, 9));
  125.             mouse.moveSlightly();
  126.                                 mouse.moveSlightly();                mouse.moveSlightly();
  127.                                 mouse.moveSlightly();                 mouse.moveSlightly();
  128.                                 mouse.moveSlightly();
  129.  
  130.     }
  131.                 }
  132.                 public void randomtab(){
  133.                       switch(random(0, 12)) {
  134.  
  135.             case 0: game.openTab(game.TAB_STATS);
  136.                  game.openTab(game.TAB_INVENTORY);
  137.  
  138.             case 1:  game.openTab(game.TAB_INVENTORY);
  139.  
  140.             case 2: game.openTab(game.TAB_CLAN);
  141.                 game.openTab(game.TAB_INVENTORY);
  142.             case 3: game.openTab(game.TAB_FRIENDS);
  143.                                 game.openTab(game.TAB_INVENTORY);
  144.                 case 4: game.openTab(game.TAB_IGNORE);
  145.                                 game.openTab(game.TAB_INVENTORY);
  146.  
  147.             case 5: game.openTab(game.TAB_EQUIPMENT);
  148.                                 game.openTab(game.TAB_INVENTORY);
  149.             case 6: game.openTab(game.TAB_MAGIC);
  150.                                 game.openTab(game.TAB_INVENTORY);
  151.                 case 7: game.openTab(game.TAB_QUESTS);
  152.                                 game.openTab(game.TAB_INVENTORY);
  153.             case 8: game.openTab(game.TAB_ACHIEVEMENTS);
  154.                                 game.openTab(game.TAB_INVENTORY);
  155.  
  156.                           case 9: game.openTab(game.TAB_NOTES);
  157.                                 game.openTab(game.TAB_INVENTORY);
  158.                                             case 10: game.openTab(game.TAB_PRAYER);
  159.                                 game.openTab(game.TAB_INVENTORY);
  160.                case 11: game.openTab(game.TAB_MUSIC);
  161.                                 game.openTab(game.TAB_INVENTORY);
  162.  
  163.  
  164.  
  165.                     }
  166.                 }
  167.                 public void randomXPcheck(){
  168.                     game.openTab(game.TAB_STATS);
  169.                 switch(random(0, 20)) {
  170.                     case 0: skills.doHover(skills.INTERFACE_FISHING);
  171.                 sleep(random(5000, 7000));
  172.                 game.openTab(game.TAB_INVENTORY);
  173.  
  174.                     case 1:
  175.                         skills.doHover(skills.INTERFACE_WOODCUTTING);
  176.                 sleep(random(5000, 7000));
  177.                 game.openTab(game.TAB_INVENTORY);
  178.  
  179.                     case 2:
  180.                         skills.doHover(skills.INTERFACE_ATTACK);
  181.                 sleep(random(5000, 7000));
  182.                 game.openTab(game.TAB_INVENTORY);
  183.  
  184.                     case 3:
  185.                         skills.doHover(skills.INTERFACE_STRENGTH);
  186.                 sleep(random(5000, 7000));
  187.                 game.openTab(game.TAB_INVENTORY);
  188.  
  189.                         case 4:
  190.                         skills.doHover(skills.INTERFACE_COOKING);
  191.                 sleep(random(5000, 7000));
  192.                 game.openTab(game.TAB_INVENTORY);
  193.  
  194.                     case 5:
  195.                         skills.doHover(skills.INTERFACE_RANGE);
  196.                 sleep(random(5000, 7000));
  197.                 game.openTab(game.TAB_INVENTORY);
  198.  
  199.                     case 6:
  200.                         skills.doHover(skills.INTERFACE_FIREMAKING);
  201.                 sleep(random(5000, 7000));
  202.                 game.openTab(game.TAB_INVENTORY);
  203.  
  204.                                                     case 7:
  205.                         skills.doHover(skills.INTERFACE_CONSTRUCTION);
  206.                 sleep(random(5000, 7000));
  207.                 game.openTab(game.TAB_INVENTORY);
  208.                                                     case 8:
  209.                         skills.doHover(skills.INTERFACE_RUNECRAFTING);
  210.                 sleep(random(5000, 7000));
  211.                 game.openTab(game.TAB_INVENTORY);
  212.                                                     case 9:
  213.                         skills.doHover(skills.INTERFACE_SUMMONING);
  214.                 sleep(random(5000, 7000));
  215.                 game.openTab(game.TAB_INVENTORY);
  216.                                                     case 10:
  217.                         skills.doHover(skills.INTERFACE_SLAYER);
  218.                 sleep(random(5000, 7000));
  219.                 game.openTab(game.TAB_INVENTORY);
  220.                                                     case 11:
  221.                         skills.doHover(skills.INTERFACE_CRAFTING);
  222.                 sleep(random(5000, 7000));
  223.                 game.openTab(game.TAB_INVENTORY);
  224.                     case 12:
  225.                         skills.doHover(skills.INTERFACE_FARMING);
  226.                 sleep(random(5000, 7000));
  227.                 game.openTab(game.TAB_INVENTORY);
  228.                                                     case 13:
  229.                         skills.doHover(skills.INTERFACE_AGILITY);
  230.                 sleep(random(5000, 7000));
  231.                 game.openTab(game.TAB_INVENTORY);
  232.                                                     case 14:
  233.                         skills.doHover(skills.INTERFACE_THIEVING);
  234.                 sleep(random(5000, 7000));
  235.                 game.openTab(game.TAB_INVENTORY);
  236.                                                     case 15:
  237.                         skills.doHover(skills.INTERFACE_HUNTER);
  238.                 sleep(random(5000, 7000));
  239.                 game.openTab(game.TAB_INVENTORY);
  240.                                                     case 16:
  241.                         skills.doHover(skills.INTERFACE_MINING);
  242.                 sleep(random(5000, 7000));
  243.                 game.openTab(game.TAB_INVENTORY);
  244.                                                     case 17:
  245.                         skills.doHover(skills.INTERFACE_SMITHING);
  246.                 sleep(random(5000, 7000));
  247.                 game.openTab(game.TAB_INVENTORY);
  248.                                                     case 18:
  249.                         skills.doHover(skills.INTERFACE_MAGIC);
  250.                 sleep(random(5000, 7000));
  251.                 game.openTab(game.TAB_INVENTORY);
  252.  
  253.                                                     case 19:
  254.                         skills.doHover(skills.INTERFACE_FLETCHING);
  255.                 sleep(random(5000, 7000));
  256.                 game.openTab(game.TAB_INVENTORY);
  257.                                                     case 20:
  258.                         skills.doHover(skills.INTERFACE_PRAYER);
  259.                 sleep(random(5000, 7000));
  260.                 game.openTab(game.TAB_INVENTORY);
  261.  
  262.                 }
  263.                 }
  264.  
  265.                  public int antibanlist() {
  266.               switch(random(0, 17)) {
  267.             case 0:
  268.                 chooserandomAFK();
  269.             case 1:
  270.             case 2:
  271.             case 3: chooserandomAFK();
  272.                       case 4:
  273.                            mouse.moveSlightly();
  274.             case 5: chooserandomAFK();
  275.             case 6:
  276.             case 7: mouseHandler();
  277.  
  278.             case 8: superAntiMoveMouse();
  279.             case 9:randomXPcheck();
  280.             case 10: randomtab();
  281.             case 11:
  282.             case 12:randomtab();
  283.             case 13:superAntiMoveMouse();
  284.             break;
  285.             case 14:randomXPcheck();
  286.             case 15:
  287.             case 16:
  288.             case 17:
  289.                   break;
  290.             default:
  291.             break;
  292.             }
  293.                   return 500;
  294.             }
  295.    
  296.     public int loop() {
  297.         try {
  298.             mouse.setSpeed(random(5, 8));
  299.             switch (getState()) {
  300.                 case 1://chopping
  301.                     cutWillows();  
  302.                     if (getMyPlayer().getAnimation() != -1) {
  303.                     }          
  304.                     return random(50, 100);
  305.                    
  306.                 case 2://banking
  307.                     checkRun();
  308.                     walkToBank();
  309.                     sleep(random(1800, 2100));        
  310.                     return random(50, 100);
  311.                    
  312.                 case 3://back to willows
  313.                     checkRun();
  314.                     walkToWillowTrees();
  315.                     sleep(random(2000, 2300));
  316.                     return random(50, 100);
  317.                    
  318.                 case 4: //banking
  319.                     if (objects.getNearest(bankID) != null
  320.                             && !objects.getNearest(bankID).isOnScreen()) {
  321.                         camera.turnToObject(objects.getNearest(bankID), 10);
  322.                     }
  323.                     if (objects.getNearest(bankID).isOnScreen()) {
  324.                         objects.getNearest(bankID).doAction("Deposit");
  325.                         sleep(3000, 3300);
  326.                     }
  327.                     if (bank.getBoxCount() == 28 && interfaces.getComponent(11, 0).isValid()) {
  328.                         sleep(1000, 1200);
  329.                         bank.depositAllExcept(kapIDs);
  330.                         sleep(1500, 1700);
  331.                         bank.close();
  332.                     }
  333.                
  334.                 return random(50, 100);
  335.            
  336.             }
  337.         } catch (NullPointerException e) {
  338.     }
  339.         secondsTNL = (skills.getExpToNextLevel(skills.WOODCUTTING)) / (expHour / 3600);
  340.         hoursTNL = secondsTNL / (60 * 60);
  341.         secondsTNL -= hoursTNL * (60 * 60);
  342.         minutesTNL = secondsTNL / 60;
  343.         secondsTNL -= minutesTNL * 60;
  344.         return 5;
  345.     }
  346.         public int getState() {
  347.         if (atWillows() && !inventory.isFull()) {
  348.             sleep(random(300, 350));
  349.             return 1;
  350.         }
  351.         if (!atBank() && inventory.isFull()) {
  352.             sleep(random(300, 350));
  353.             return 2;
  354.         }
  355.             if (!atWillows() && !inventory.isFull() && !inventory.contains(WillowLogID) && !interfaces.getComponent(11, 0).isValid()) {                
  356.             sleep(random(300, 350));
  357.             return 3;
  358.         }
  359.             if (atBank() && !bank.isDepositOpen()) {
  360.                 sleep(random(300, 350));
  361.                 return 4;
  362.         }
  363.         return -1;
  364.     }
  365.     private boolean walkToWillowTrees() {
  366.         RSTile[] randomizedPath = walking.randomizePath(WalkingToWillowTrees,
  367.         1, 1);
  368.          return walking.walkPathMM(randomizedPath);
  369.     }
  370.     private void walkToBank() {
  371.         RSTile[] randomizedPath = walking.randomizePath(WalkingToBank,
  372.                 1, 1);
  373.         walking.walkPathMM(randomizedPath);
  374.     }
  375.     private boolean atWillows() {
  376.         RSArea area = new RSArea(new RSTile(3056, 3250), new RSTile(3064, 3258));
  377.         return area.contains(getMyPlayer().getLocation());
  378.     }
  379.     private boolean atBank() {
  380.         RSArea area = new RSArea(new RSTile(3042, 3235), new RSTile(3050, 3237));
  381.         return area.contains(getMyPlayer().getLocation());
  382.     }
  383.  
  384.     @Override
  385.     public void onFinish() {
  386.     }
  387.  
  388. //START: Code generated using Enfilade's Easel
  389.     private final Color color1 = new Color(1, 0, 0);
  390.     private final Color color2 = new Color(255, 255, 255);
  391.     private final Color color3 = new Color(0, 0, 0);
  392.     private final Color color4 = new Color(51, 51, 0);
  393.  
  394.     private final BasicStroke stroke1 = new BasicStroke(1);
  395.     private final BasicStroke stroke2 = new BasicStroke(4);
  396.    
  397.     private final Font font1 = new Font("BIRTH OF A HERO", 3, 32);
  398.     private final Font font2 = new Font("RuneScape Chat", 0, 17);
  399.  
  400.     public void onRepaint(Graphics g1) {
  401.         Graphics2D g = (Graphics2D)g1;
  402.         lvlsGained = currLevel - startLevel;
  403.         currLevel = skills.getCurrentLevel(skills.WOODCUTTING);
  404.         expHour = (int) ((expGained) * 3600000D / (System.currentTimeMillis() - startTime));
  405.         logsHour = (int) ((logsChopped) * 3600000D / (System.currentTimeMillis() - startTime));
  406.         millis = System.currentTimeMillis() - startTime;
  407.         hours = millis / (1000 * 60 * 60);
  408.         millis -= hours * (1000 * 60 * 60);
  409.         minutes = millis / (1000 * 60);
  410.         millis -= minutes * (1000 * 60);
  411.         seconds = millis / 1000;
  412.         g.setColor(color2);
  413.         g.fillRoundRect(353, 7, 158, 269, 16, 16);
  414.         g.setColor(color2);
  415.         g.setStroke(stroke1);
  416.         g.drawRoundRect(353, 7, 158, 269, 16, 16);
  417.         g.setColor(color2);
  418.         g.fillRoundRect(5, 344, 493, 113, 16, 16);
  419.         g.setColor(color2);
  420.         g.drawRoundRect(5, 344, 493, 113, 16, 16);
  421.         g.setFont(font1);
  422.         g.setColor(color4);
  423.         g.drawString("JsMxBiCs WoodCutter!", 92, 408);
  424.         g.setColor(color2);
  425.         g.fillRoundRect(5, 459, 98, 14, 16, 16);
  426.         g.setColor(color2);
  427.         g.fillRoundRect(353, 7, 157, 215, 16, 16);
  428.         g.setColor(color2);
  429.         g.setStroke(stroke1);
  430.         g.drawRoundRect(353, 7, 157, 215, 16, 16);
  431.         g.setFont(font2);
  432.         g.setColor(color4);
  433.         g.drawString("Time Running: " + hours +":"+ minutes + ":" + seconds, 355, 46);
  434.         g.drawString("Logs Chopped: " + logsChopped, 355, 75);
  435.         g.drawString("Exp: ", 355, 131);
  436.         g.drawString("Exp/hr: ", 355, 159);
  437.         g.drawString("ExpTNL: " + skills.getExpToNextLevel(skills.WOODCUTTING), 355, 190);
  438.         g.drawString("TimeTNL: ", 355, 104);
  439.         g.drawString("Level: " + currLevel + " (" + lvlsGained + ")", 355, 217);
  440.         g.drawString("Logs/hr: ", 355, 244);
  441.         g.drawString("LogsTNL: " + logsTNL, 356, 270);
  442.         }
  443.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement