Advertisement
Guest User

Untitled

a guest
Sep 13th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 9.51 KB | None | 0 0
  1. import java.awt.*;
  2. import java.util.*;
  3. import java.io.*;
  4. import java.awt.event.ActionEvent;
  5. import java.awt.event.ActionListener;
  6. import java.awt.Font;
  7. import java.awt.Graphics;
  8. import java.awt.Graphics2D;
  9. import java.awt.RenderingHints;
  10. import java.awt.Color;
  11.  
  12. import javax.swing.*;
  13. import javax.swing.border.*;
  14.  
  15. import org.rsbot.bot.Bot;
  16. import org.rsbot.script.*;
  17. import org.rsbot.script.Script;
  18. import org.rsbot.script.ScriptManifest;
  19. import org.rsbot.script.methods.Game;
  20. import org.rsbot.event.listeners.PaintListener;
  21. import org.rsbot.script.wrappers.RSComponent;
  22. import org.rsbot.script.wrappers.RSInterface;
  23. import org.rsbot.script.methods.*;
  24. import org.rsbot.event.listeners.*;
  25. import org.rsbot.event.listeners.PaintListener;
  26.  
  27.  
  28. @ScriptManifest(authors = "Beuner", keywords = "", name = "Alch Pro", version = 2.2, description = "Alchs Anything")
  29. public class AlchPro extends Script implements PaintListener {
  30.  
  31.  
  32. public int NatID = 561;
  33. public int StaffID[] = {1387, 1401, 3054, 3053, 1393};
  34.  
  35. public int startExp;
  36. public int gainedExp;
  37. public int startLvl;
  38. public int gainedLvls;
  39. public int ExpHour = 0;
  40. public int xpLevel;
  41. private int currentLevel;
  42. public int castHour = 0;
  43. public int castTotal;
  44. private long startTime;
  45. private long nextLvl;
  46. private long runTime;
  47. private long expLevel;
  48. public long timeLevel;
  49. private int percentLevel;
  50. public int alchLvl;
  51.  
  52. private final Font font1 = new Font("Tahoma", Font.BOLD, 11);
  53. private final Font font2 = new Font("Tahoma", Font.PLAIN, 11);
  54. private final Color color1 = new Color(0, 0, 0, 180);
  55.  
  56. public boolean onStart() {
  57.     startExp = skills.getCurrentExp(skills.MAGIC);
  58.     startLvl = skills.getRealLevel(skills.MAGIC);
  59.     startTime = System.currentTimeMillis();
  60.     inventory.getCount(true, 562);
  61.     log("Alch Pro");
  62.     log("Checking Nature Runes");
  63.     sleep(random(100,250));
  64.     log("Checking Staff");
  65.     if (!inventory.containsOneOf(NatID)) {
  66.     log("No Nature Runes Detected");
  67.             stopScript(true);
  68.     }
  69.     if (!equipment.containsOneOf(StaffID)) {
  70.     log("No Staff Detected");
  71.     stopScript(true);
  72.     }
  73.     log("Taking Picture of Starting Stats");
  74.     mouse.move(random(588, 607), random(173, 193));
  75.     sleep(random(230, 400));
  76.     mouse.click(true);
  77.     sleep(random(100, 230));
  78.     mouse.move(random(556, 603), random(354, 368));
  79.     sleep(random(1000, 2300));
  80.     env.saveScreenshot(true);
  81.     sleep(random(2400, 3700));
  82.     if (game.getCurrentTab() != Game.TAB_MAGIC)     {
  83.         game.openTab(Game.TAB_MAGIC);
  84.         log("Nature Runes Detected!");
  85.         sleep(random(150, 230));
  86.         log("Staff Detected!");
  87.     }
  88.     return true;
  89. }
  90.  
  91.  
  92. public boolean Alch()   {
  93.     sleep(random(275,300));
  94.     mouse.click(true);
  95.     sleep(random(190, 350));
  96.     interfaces.getComponent(192, 59).doClick();
  97.     return true;
  98. }
  99.  
  100.     public void antiBan() {
  101.         int rand = random(1, 100);
  102.         switch (rand) {
  103.         case 1:
  104.             if (random(1, 10) == 1) {
  105.                 log("Checking Inventory");
  106.                 game.openTab(Game.TAB_INVENTORY);
  107.                 if (inventory.getCount(NatID) == 0) {
  108.                 log("No Law Runes Left");
  109.                         stopScript(true);
  110.                 }
  111.                 sleep(random(987, 2356));
  112.                 mouse.move(random(741, 755), random(176, 194));
  113.                 sleep(random(123, 310));
  114.                 mouse.click(true);
  115.                 mouse.move(random(564, 579), random(369, 375));
  116.                 sleep(random(420, 560));
  117.                 mouse.click(true);
  118.                 sleep(random(210, 290));
  119.                 mouse.click(true);
  120.             }
  121.             break;
  122.         case 2:
  123.             if (random(1, 30) == 1) {
  124.                 log("Checking Stats");
  125.                 mouse.move(random(590, 599), random(174, 192));
  126.                 sleep(random(15, 19));
  127.                 mouse.click(true);
  128.                 sleep(random(57, 73));
  129.                 mouse.move(random(556, 603), random(354, 368));
  130.                 sleep(random(3250, 12321));
  131.                 game.openTab(Game.TAB_MAGIC);
  132.                 mouse.move(random(741, 755), random(176, 194));
  133.                 sleep(random(123, 310));
  134.                 mouse.click(true);
  135.                 mouse.move(random(564, 579), random(369, 375));
  136.                 sleep(random(420, 560));
  137.                 mouse.click(true);
  138.                 sleep(random(210, 290));
  139.                 mouse.click(true);
  140.             }
  141.             break;
  142.         case 3:
  143.             if (random(1, 50) == 1) {
  144.                 log("Checking Friends");
  145.                 mouse.move(random(557, 572), random(476, 492));
  146.                 sleep(random(123, 423));
  147.                 mouse.click(true);
  148.                 sleep(random(1368,5398));
  149.                 mouse.move(random(741, 755), random(176, 194));
  150.                 sleep(random(123, 310));
  151.                 mouse.click(true);
  152.                 mouse.move(random(564, 579), random(369, 375));
  153.                 sleep(random(420, 560));
  154.                 mouse.click(true);
  155.                 sleep(random(210, 290));
  156.                 mouse.click(true);
  157.             }
  158.             break;
  159.         case 4:
  160.             if (random(1, 20) == 1) {
  161.                 log("Moving Camera");
  162.                 camera.setAngle(random(98, 278));
  163.             }
  164.             break;
  165.         case 5:
  166.             if (random(1, 35) == 1) {
  167.                 log("AFK");
  168.                 mouse.moveOffScreen();
  169.                 sleep(random(798, 86214));
  170.                 mouse.move(random(741, 755), random(176, 194));
  171.                 sleep(random(123, 310));
  172.                 mouse.click(true);
  173.                 mouse.move(random(564, 579), random(369, 375));
  174.                 sleep(random(420, 560));
  175.                 mouse.click(true);
  176.                 sleep(random(210, 290));
  177.                 mouse.click(true);
  178.             }
  179.         case 6:
  180.             if (random(1, 5) == 1) {
  181.                 if (ExpHour < 55000 && runTime < 1800000 && runTime > 300000) {
  182.                     log("<55k Exp/Hr at <30min Runtime");
  183.                     log("Force Stopping Script");
  184.                     game.openTab(Game.TAB_MAGIC);
  185.                     sleep(random(1000,2300));
  186.                     env.saveScreenshot(true);
  187.                     sleep(random(2000, 2500));
  188.                     stopScript(true);
  189.                 }
  190.                 if (ExpHour > 55000 && runTime < 1800000) {
  191.                     log(">55k Exp/Hr at <30min Runtime");
  192.                     log("Script Resuming");
  193.                 }
  194.                 if (ExpHour < 60000 && runTime > 1800000 && runTime < 3600000) {
  195.                     log("<60k Exp/Hr at <1Hr Runtime");
  196.                     log("Force Stopping Script");
  197.                     game.openTab(Game.TAB_MAGIC);
  198.                     sleep(random(1000,2300));
  199.                     env.saveScreenshot(true);
  200.                     sleep(random(2000, 2500));
  201.                     stopScript(true);
  202.                 }
  203.                 if (ExpHour > 60000 && runTime > 1800000 && runTime < 3600000) {
  204.                     log(">60k Exp/Hr at <1Hr Runtime");
  205.                     log("Script Resuming");
  206.                 }
  207.                 if (ExpHour < 65000 && runTime > 3600000 && runTime < 18000000) {
  208.                     log("<65k Exp/Hr at >1Hr Runtime");
  209.                     log("Force Stopping Script");
  210.                     game.openTab(Game.TAB_MAGIC);
  211.                     sleep(random(1000,2300));
  212.                     env.saveScreenshot(true);
  213.                     sleep(random(2000, 2500));
  214.                     stopScript(true);
  215.                 }
  216.                 if (ExpHour > 65000 && runTime > 3600000 && runTime < 18000000) {
  217.                     log(">65k Exp/Hr at >1Hr Runtime");
  218.                     log("Script Resuming");
  219.                 }
  220.                 if (ExpHour < 67500 && runTime > 18000000) {
  221.                     log("<67.5k Exp/Hr at >5Hr Runtime");
  222.                     log("Force Stopping Script");
  223.                     game.openTab(Game.TAB_MAGIC);
  224.                     sleep(random(1000,2300));
  225.                     env.saveScreenshot(true);
  226.                     sleep(random(2000, 2500));
  227.                     stopScript(true);
  228.                 }
  229.                 if (ExpHour > 67500 && runTime > 18000000) {
  230.                     log(">67.5k Exp/Hr at >5Hr Runtime");
  231.                     log("Script Resuming");
  232.                 }
  233.             }
  234.         case 7:
  235.             if (random(1, 3) == 1) {
  236.                 if (game.getCurrentTab() != Game.TAB_MAGIC)     {
  237.                 game.openTab(Game.TAB_MAGIC);
  238.                 log("Fail-Safe");
  239.                 sleep(random(123, 310));
  240.                 mouse.move(random(564, 579), random(369, 375));
  241.                 sleep(random(420, 560));
  242.                 mouse.click(true);
  243.                 sleep(random(210, 290));
  244.                 mouse.click(true);
  245.                 }
  246.                 if (game.getCurrentTab() != Game.TAB_INVENTORY)     {
  247.                 log("Bypassing Fail-Safe");
  248.                 sleep(random(123, 310));
  249.                 mouse.move(random(564, 579), random(369, 375));
  250.                 sleep(random(420, 560));
  251.                 mouse.click(true);
  252.                 sleep(random(210, 290));
  253.                 mouse.click(true);
  254.                 }
  255.             }
  256.         }
  257.     }
  258. @Override
  259. public int loop() {
  260.     antiBan();
  261.     Alch();
  262.     return random(3, 6);
  263. }
  264.    
  265. public void onFinish() {
  266.     log("Alching Complete");
  267.     game.openTab(Game.TAB_MAGIC);
  268.     sleep(random(1000,2300));
  269.     env.saveScreenshot(true);
  270. }
  271.  
  272.  
  273.     private String formatTime(final long time) {
  274.         final int sec = (int) (time / 1000), h = sec / 3600, m = sec / 60 % 60, s = sec % 60;
  275.         return (h < 10 ? "0" + h : h) + ":" + (m < 10 ? "0" + m : m) + ":"
  276.                 + (s < 10 ? "0" + s : s);
  277.     }
  278.  
  279.     @Override
  280.     public void onRepaint(Graphics g1) {
  281.         final Graphics2D g2 = (Graphics2D) g1;
  282.         g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
  283.                 RenderingHints.VALUE_ANTIALIAS_ON);
  284.        
  285.         g2.setColor(color1);
  286.         g2.fillRect(375, 165, 135, 173);
  287.         g2.setFont(font2);
  288.         currentLevel = skills.getRealLevel(skills.MAGIC);
  289.         gainedLvls = skills.getRealLevel(skills.MAGIC) - startLvl;
  290.         gainedExp = skills.getCurrentExp(skills.MAGIC) - startExp;
  291.         castTotal = (int) (gainedExp / 65);
  292.         expLevel = skills.getExpToNextLevel(skills.MAGIC);
  293.         ExpHour = (int) ((3600000.0 / (double) runTime) * gainedExp);
  294.         runTime = System.currentTimeMillis() - startTime;
  295.         xpLevel = skills.getExpToNextLevel(skills.MAGIC);
  296.         nextLvl = (long) ((double) xpLevel / (double) ExpHour * 3600000);
  297.         alchLvl = (int) (expLevel / 65);
  298.         castHour = (int) (ExpHour / 65);
  299.         percentLevel = skills.getPercentToNextLevel(skills.MAGIC);
  300.         g2.setColor(Color.RED);
  301.         g2.drawString("Alch Pro v2.3 by Beuner", 380, 175);
  302.         g2.setColor(Color.WHITE);
  303.         g2.drawString("Run Time: " + formatTime(runTime), 380, 190);
  304.         g2.drawString("Current level: " + currentLevel, 380, 205);
  305.         g2.drawString("Levels gained: " + gainedLvls, 380, 220);
  306.         g2.drawString("Alchs: " + castTotal, 380, 235);
  307.         g2.drawString("Alchs Per Hours: " + castHour, 380, 250);
  308.         g2.drawString("Alchs to Level: " + alchLvl, 380, 265);
  309.         g2.drawString("Exp gained: " + (gainedExp), 380, 280);
  310.         g2.drawString("Exp Per Hour: " + ExpHour, 380, 295);
  311.         g2.drawString("Exp To Level: " + expLevel, 380, 310);
  312.         g2.drawString("Time to Level: " + formatTime(nextLvl), 380, 325);
  313.         g2.setColor(Color.BLACK);
  314.         g2.fillRect(380, 330, 100, 4);
  315.         g2.setColor(Color.RED);
  316.         g2.fillRect(380, 330, percentLevel, 4);
  317.  
  318.     }
  319. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement