Guest User

Untitled

a guest
Jan 19th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 14.02 KB | None | 0 0
  1. import java.awt.event.MouseEvent;
  2. import java.awt.event.MouseListener;
  3. import org.rsbot.script.wrappers.RSComponent;
  4. import java.awt.*;
  5. import java.awt.image.BufferedImage;
  6. import org.rsbot.event.events.MessageEvent;
  7. import org.rsbot.event.listeners.MessageListener;
  8. import org.rsbot.event.listeners.PaintListener;
  9. import org.rsbot.script.*;
  10. import org.rsbot.script.methods.Game;
  11. import org.rsbot.script.methods.Magic;
  12. import org.rsbot.script.methods.Skills;
  13. import org.rsbot.script.wrappers.*;
  14.  
  15. @ScriptManifest(authors = { "vADmn" }, keywords = { "hunter kit, magic, lunar" }, name = "vHuntKitPro", description = "A bot that makes hunter kits gaining 150k+ xp/ph", version = 1.1)
  16. public class VHKPro extends Script implements MessageListener, PaintListener, MouseListener {
  17.         public int[] chest = { 42192, 4483 };
  18.         public int astral = 9075;
  19.         public int astralprice = 106;
  20.         public int hunterkit = 11159;
  21.         public boolean useBank = false;
  22.         public String Status;
  23.         BufferedImage normal = null;
  24.         BufferedImage clicked = null;
  25.         int startExp;
  26.         int xpGained = 0;
  27.         int spellCasted = 0;
  28.         public int EstCast;
  29.         public int startLevel;
  30.         public int lvlsGained;
  31.         public int expPerCast = 70;
  32.         public int castsTNL;
  33.         private int percentTNL;
  34.         public int expHour = 0;
  35.         public int currLevel;
  36.         public long startTime = 0;
  37.         public long millis = 0;
  38.         public long hours = 0;
  39.         public long minutes = 0;
  40.         public long seconds = 0;
  41.         public long last = 0;
  42.         public boolean showPaint = true;
  43.         private final Color color1 = new Color(0, 0, 0, 186);
  44.         private final Color color2 = new Color(255, 0, 0);
  45.         private final Color color3 = new Color(255, 255, 255);
  46.         private final BasicStroke stroke1 = new BasicStroke(1);
  47.         private final BasicStroke stroke2 = new BasicStroke(2);
  48.         private final Font font1 = new Font("Arial", 1, 18);
  49.         private final Font font2 = new Font("Arial", 1, 11);
  50.  
  51.         @Override
  52.         public boolean onStart() {
  53.                 Status = "Starting vHunterKitPro...";
  54.                 startExp = skills.getCurrentExp(Skills.MAGIC);
  55.                 startLevel = skills.getCurrentLevel(Skills.MAGIC);
  56.                 startTime = System.currentTimeMillis();
  57.                 mouse.setSpeed(random(5, 6));
  58.                 log("vHunterKitPro Started");
  59.                 sleep(random(50, 90));
  60.                 return true;
  61.         }
  62.  
  63.         @Override
  64.         public void mouseClicked(MouseEvent e) {
  65.                 RSComponent inter = interfaces.get(137).getComponent(0);
  66.                 if (inter.getArea().contains(e.getPoint())) {
  67.                         if (showPaint) {
  68.                                 showPaint = !showPaint;
  69.                         } else {
  70.                                 showPaint = true;
  71.                         }
  72.                 }
  73.         }
  74.         public int cast() {
  75.                 if (game.getCurrentTab() != Game.TAB_MAGIC) {
  76.                         game.openTab(Game.TAB_MAGIC);
  77.                 } else {
  78.                         magic.castSpell(Magic.SPELL_HUNTER_KIT);
  79.                 }
  80.                 return random(10, 65);
  81.         }
  82.         public int bank() {
  83.                 antiBanB();
  84.                 RSObject Bank = objects.getNearest(chest);
  85.                 if (!bank.isOpen()) {
  86.                         mouse.setSpeed(random(5, 7));
  87.                         Bank.doClick();
  88.                         sleep(random(800, 1200));
  89.                 } else if (bank.isOpen()) {
  90.                         mouse.setSpeed(random(5, 7));
  91.                         bank.depositAllExcept(astral);
  92.                         sleep(random(450, 820));
  93.                         bank.close();
  94.                         useBank = false;
  95.                         antiBanB();
  96.                 }
  97.                 return random(200, 400);
  98.         }
  99.         private void antiBanA() {
  100.                 Status = "Anti-Ban(1)";
  101.                 int r = random(0, 110);
  102.                 switch (r) {
  103.                 case 27:
  104.                         mouse.moveRandomly(2, 7);
  105.                         sleep(random(20, 80));
  106.                 case 12:
  107.                         sleep(random(50, 80));
  108.                         break;
  109.                 case 88:
  110.                         sleep(random(350, 2780));
  111.                         mouse.moveRandomly(2, 6);
  112.                         break;
  113.                 case 61:
  114.                         sleep(random(1150, 3380));
  115.                         mouse.moveRandomly(2, 5);
  116.                         break;
  117.                 case 19:
  118.                         mouse.setSpeed(random(4, 6));
  119.                         sleep(random(3200, 4650));
  120.                         mouse.moveRandomly(3, 7);
  121.                         break;
  122.                 case 51:
  123.                         mouse.setSpeed(random(4, 6));
  124.                         sleep(random(50,270));
  125.                         break;
  126.                 case 93:
  127.                         sleep(random(80, 180));
  128.                         break;
  129.                 case 15:
  130.                         mouse.moveRandomly(3, 7);
  131.                         sleep(random(30, 150));
  132.                 }
  133.         }
  134.  
  135.         public void antiBanB() {
  136.                 Status = "Anti-Ban(2)";
  137.                 int y = random(0, 100);
  138.                 switch (y) {
  139.                 case 84:
  140.                         mouse.moveOffScreen();
  141.                         sleep(random(5000, 15400));
  142.                         mouse.moveRandomly(random(450, 800));
  143.                         break;
  144.                 case 78:
  145.                         mouse.moveOffScreen();
  146.                         sleep(random(4000, 14400));
  147.                         break;
  148.                 case 32:
  149.                         mouse.moveRandomly(random(500, 1100));
  150.                         sleep(random(1150, 2390));
  151.                         break;
  152.                 case 15:
  153.                         sleep(random(800, 1200));
  154.                         mouse.moveRandomly(10, 50);
  155.                         sleep(random(30, 50));
  156.                         mouse.setSpeed(random(4, 5));
  157.                         skills.doHover(Skills.INTERFACE_MAGIC);
  158.                         sleep(random(4000, 8700));
  159.                         mouse.moveSlightly();
  160.                         sleep(random(30, 90));
  161.                         break;
  162.                 case 57:
  163.                         sleep(random(310, 410));
  164.                         break;
  165.                 case 25:
  166.                         mouse.setSpeed(random(4, 7));
  167.                         break;
  168.                 case 31:
  169.                         mouse.setSpeed(random(4, 5));
  170.                         mouse.moveSlightly();
  171.                         mouse.moveSlightly();
  172.                         mouse.setSpeed(random(5, 7));
  173.                         sleep(random(50,90));
  174.                         break;
  175.                 case 68:
  176.                         sleep(random(150, 380));
  177.                         break;
  178.                 case 40:
  179.                         sleep(random(50, 80));
  180.                         mouse.moveRandomly(random(1500, 2100));
  181.                         sleep(random(50, 90));
  182.                         skills.doHover(Skills.INTERFACE_MAGIC);
  183.                         sleep(random(2000, 3000));
  184.                         mouse.moveSlightly();
  185.                         sleep(random(30, 90));
  186.                         break;
  187.                 case 74:
  188.                         sleep(random(100, 150));
  189.                         break;
  190.                 case 36:
  191.                         mouse.moveSlightly();
  192.                         sleep(random(30, 50));
  193.                         skills.doHover(Skills.INTERFACE_MAGIC);
  194.                         sleep(random(6000, 9000));
  195.                         mouse.moveSlightly();
  196.                         sleep(random(20, 120));
  197.                         break;
  198.                 case 96:
  199.                         mouse.moveSlightly();
  200.                         mouse.setSpeed(random(4, 6));
  201.                         sleep(random(380, 570));
  202.                         break;
  203.                 case 100:
  204.                         sleep(random(30, 50));
  205.                         skills.doHover(Skills.INTERFACE_MAGIC);
  206.                         sleep(random(6000, 9000));
  207.                         mouse.moveSlightly();
  208.                         sleep(random(100, 150));
  209.                         break;
  210.                 }
  211.         }
  212.         @Override
  213.         public int loop() {
  214.                 Status = "Casting";
  215.                 antiBanA();
  216.         if (useBank)
  217.                 return bank();
  218.         return cast();
  219. }
  220.  
  221.         @Override
  222.         public void messageReceived(MessageEvent e) {
  223.                 String message = e.getMessage();
  224.                 if (message
  225.                                 .matches("You need at least one free inventory space to cast this spell.")) {
  226.                         Status = "Banking";
  227.                         useBank = true;
  228.                 }
  229.                 if (message.contains("enough astral runes")) {
  230.                         env.saveScreenshot(true);
  231.                         stopScript();
  232.                         log("Run out of astral runes, shutting down.");
  233.                 }
  234.                 if (message.contains("You've just advanced a")) {
  235.                         env.saveScreenshot(true);
  236.                         log("Level up, screenshotting...");
  237.                 }
  238.         }
  239.         @Override
  240.         public void onFinish() {
  241.                 log("Thank you for using vHuntKitPro.");
  242.                 env.saveScreenshot(true);
  243.         }
  244.         @Override
  245.         public void mouseEntered(MouseEvent e) {
  246.                 // TODO Auto-generated method stub
  247.  
  248.         }
  249.  
  250.         @Override
  251.         public void mouseExited(MouseEvent e) {
  252.                 // TODO Auto-generated method stub
  253.  
  254.         }
  255.  
  256.         @Override
  257.         public void mousePressed(MouseEvent e) {
  258.                 // TODO Auto-generated method stub
  259.  
  260.         }
  261.  
  262.         @Override
  263.         public void mouseReleased(MouseEvent e) {
  264.                 // TODO Auto-generated method stub
  265.  
  266.         }
  267.         // END: Paint Code generated using Enfilade's Easel, design and modification by vadmn
  268.         @Override
  269.         public void onRepaint(Graphics g1) {
  270.                 Graphics2D g = (Graphics2D) g1;
  271.                 castsTNL = skills.getExpToNextLevel(Skills.MAGIC) / expPerCast;
  272.                 currLevel = skills.getCurrentLevel(Skills.MAGIC);
  273.                 lvlsGained = currLevel - startLevel;
  274.                 millis = System.currentTimeMillis() - startTime;
  275.                 hours = millis / (1000 * 60 * 60);
  276.                 millis -= hours * (1000 * 60 * 60);
  277.                 minutes = millis / (1000 * 60);
  278.                 millis -= minutes * (1000 * 60);
  279.                 seconds = millis / 1000;
  280.                 EstCast = skills.getExpToNextLevel(Skills.MAGIC) / 65;
  281.                 expHour = (int) ((xpGained) * 3600000D / (System.currentTimeMillis() - startTime));
  282.                 percentTNL = skills.getPercentToNextLevel(Skills.MAGIC);
  283.                 xpGained = skills.getCurrentExp(Skills.MAGIC) - startExp;
  284.                 spellCasted = xpGained / 70;
  285.                 final int percentBar = (int) (skills
  286.                                 .getPercentToNextLevel(Skills.MAGIC) * 5.1);
  287.                 g.setColor(color2);
  288.                 g.fillRect(1, 318, percentBar, 18);
  289.                 g.setColor(color1);
  290.                 g.drawRect(1, 318, percentBar, 18);
  291.                 g.setColor(color1);
  292.                 if(showPaint){
  293.                         g.fillRoundRect(1, 338, 517, 140, 0, 16);
  294.                         g.setColor(color2);
  295.                         g.setStroke(stroke1);
  296.                         g.drawRoundRect(1, 338, 517, 140, 0, 16);
  297.                         g.setColor(color1);
  298.                         g.fillRoundRect(350, 4, 165, 21, 16, 16);
  299.                         g.setColor(color2);
  300.                         g.setStroke(stroke2);
  301.                         g.drawRoundRect(350, 4, 165, 21, 16, 16);
  302.                         g.setColor(color1);
  303.                         g.fillRoundRect(350, 52, 165, 21, 16, 16);
  304.                         g.setColor(color2);
  305.                         g.drawRoundRect(350, 52, 165, 21, 16, 16);
  306.                         g.setColor(color1);
  307.                         g.fillRoundRect(350, 28, 165, 21, 16, 16);
  308.                         g.setColor(color2);
  309.                         g.drawRoundRect(350, 28, 165, 21, 16, 16);
  310.                         g.setFont(font1);
  311.                         g.setColor(color3);
  312.                         g.drawString("vHunterKit Pro v1.1", 13, 360);
  313.                         g.setFont(font2);
  314.                         g.drawString("XP/ph: " + expHour, 13, 386);
  315.                         g.drawString("Percent/tnl: " + percentTNL, 13, 412);
  316.                         g.drawString("By vADmn", 191, 373);
  317.                         g.drawString("XP/tnl: " + skills.getExpToNextLevel(Skills.MAGIC), 13,
  318.                                         399);
  319.                         g.drawString("Spells Casted: " + spellCasted, 13, 425);
  320.                         g.drawString("Time Running: "+ hours +"h"+ minutes + "m" + seconds + "s", 363, 20);
  321.                         g.drawString("Status: " + Status, 363, 44);
  322.                         g.drawString("Location: Soul Wars", 363, 68);
  323.                         g.drawString("Casts/tnl: " + castsTNL, 13, 438);
  324.                         g.drawString("XP Gained: " + xpGained, 13, 451);
  325.                         g.drawString("Profit Loss: "+ "-" +astralprice*2*spellCasted, 165, 387);
  326.                         g.drawString("Levels Gained: " + lvlsGained, 165, 399);
  327.                 } else {
  328.                         g.setFont(font2);
  329.                         g.setColor(color1);
  330.                         g.drawString("vHunterKit Pro v1.1", 392, 470);
  331.  
  332.                 }
  333.         }
  334. }
  335. // END: Paint Code generated using Enfilade's Easel, design and modification by vadmn
Add Comment
Please, Sign In to add comment