- /*Changelog:
- * 1.0 = Basic script
- * 1.2 New paint
- * 1.3 New Paint
- * 1.4 Added features || changed anti ban || added more anti ban || changed description
- * 1.5 New detection system
- * 1.6 New locations added
- * 1.7 New anti-ban system
- */
- import java.awt.*;
- import java.util.*;
- import java.io.*;
- import java.net.*;
- import javax.swing.JOptionPane;
- import javax.swing.JFileChooser;
- import java.awt.event.KeyEvent;
- import org.rsbot.bot.Bot;
- import org.rsbot.script.*;
- import org.rsbot.script.wrappers.*;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.event.listeners.ServerMessageListener;
- import org.rsbot.event.events.ServerMessageEvent;
- import org.rsbot.util.ScreenshotUtil;
- @ScriptManifest(authors = {"Prox32"}, category = "Woodcutting", name = "Prox32Ivy", version = 1.7,
- description = "<html>" +
- "<html><body>" +
- "<center><h2>Prox32 Ivy Chopper 1.7</h2></center>" +
- "This script supports Castle Wars only <br />" +
- "When starting, face the Ivy and the bot will do the rest.<br /><br />" +
- "<font size='3'><b>Note:</b> Try not to get banned</font><br>" +
- "Make sure you've read the forum post. www.mhty.net<br>" +
- "<b> Debug? <input type=\"checkbox\" name=\"debug\" value=\"no\" ><br>" +
- "<b>Antiban value: (Bigger number = less often & smaller = more often) keep it above 12 </b><br>" +
- "<input type=\"text\" name=\"AntiBan\" value=\"1000\"><br>" +
- "<b>Multiplier value: (controls how far the mouse goes)</b><br>" +
- "<input type=\"text\" name=\"Multiplier\" value=\"20\"><br>" +
- "<b>Chopping location:</b> <select name='location'><option>Varrock Palace</option><option>Varrock Wall</option><option>CWars</option></select><br /><br />" +
- "</body></html>")
- public class Prox32Ivy extends Script implements PaintListener,
- ServerMessageListener {
- private final ScriptManifest properties = getClass().getAnnotation(
- ScriptManifest.class);
- //////////////////////////////////////////////
- //////CONTROLS HOW FAR THE MOUSE GOES SEARCHING!
- public int Multiplier = 45;
- /////////CONTROLS HOW OFTEN THE ANTIBAN ACTIVATES
- /////////BIGGER NUMBER = LESS OFTEN. KEEP IT OVER 12
- public int AntibanControl = 1000;
- //////////////////////////////////////////////
- public final boolean CheckUpdate = true;
- //////////////////////////////////////////////
- //////////////////////////////////////////////
- static double version = 1.7;
- boolean Debug = false;
- public int[] BirdNest = {5070, 5071, 5072, 5073, 5074, 5075, 5076, 7413,
- 11966};
- int BirdNests = 0;
- public String useAntiBan;
- public String ivyLocation;
- private int AMOUNT_CHOPPED;
- private int[] IVY_ID = {36411, 23818, 23795};
- private int[] NEST_ID = {5070, 5071, 5072, 5073, 5074, 5075, 5076, 7413, 11966};
- private long lastTry = 0;
- private int tryCount = 0;
- public long waitTimer = System.currentTimeMillis();
- private RSTile lastDoor = null;
- String UpdateMSG = "This shouldn't happen???";
- private String STATE = "Loading.";
- boolean Wait = false;
- public boolean onStart(Map<String, String> args) {
- Multiplier = Integer.parseInt(args.get("Multiplier"));
- AntibanControl = Integer.parseInt(args.get("AntiBan"));
- if (args.get("debug") != null) {
- Debug = true;
- }
- if (CheckUpdate) {
- CheckUpdate();
- if (Debug) {
- log("Version = " + Version);
- }
- if (Version != version) {
- log("The newest version is " + Version);
- if (!Debug) {
- stopAllScripts();
- }
- }
- if (Version == version) {
- log("Your script is up to date =)");
- log("This version is " + Version);
- }
- }
- startTime = System.currentTimeMillis();
- waitTimer = System.currentTimeMillis();
- ivyLocation = args.get("location");;
- return true;
- }
- @Override
- public int getMouseSpeed(){
- return random(6, 8);
- }
- public int gatherNest(){
- RSItemTile birdNest = getGroundItemByID(NEST_ID);
- if (birdNest != null && !isInventoryFull()){
- STATE = "Nest.";
- atTile(birdNest, "Take ");
- wait(random(1000, 1500));
- }
- return 100;
- }
- public void setCamera(){
- final int curZ = Bot.getClient().getCamPosZ();
- if (curZ <= -950 && curZ >= -1050) {
- return;
- } else {
- final char key = (char)(curZ < -1000 ? KeyEvent.VK_DOWN : KeyEvent.VK_UP);
- input.pressKey(key);
- final int finalZ = -1000 + random(-50, 51);
- while(key == (char)KeyEvent.VK_DOWN ? Bot.getClient().getCamPosZ() < finalZ : Bot.getClient().getCamPosZ() > finalZ) {
- wait(random(10, 20));
- }
- input.releaseKey(key);
- }
- }
- public boolean atIvy(final RSObject tree, final String action) {
- try {
- {
- if (ivyLocation.equals("CWars")) {
- RSTile Ivy1 = new RSTile(2425, 3068);
- RSTile Ivy2 = new RSTile(2425, 3069);
- atIvy(Ivy1, Ivy2);
- }
- if (ivyLocation.equals("Varrock Wall")) {
- RSTile ivy3 = new RSTile(3233, 3458);
- RSTile ivy4 = new RSTile(3233, 3459);
- atIvy(ivy3, ivy4);
- }
- if (ivyLocation.equals("Varrock Palace")) {
- RSTile ivy5 = new RSTile(3217, 3498);
- RSTile ivy6 = new RSTile(3217, 3499);
- atIvy(ivy5, ivy6);
- }
- }
- return atMenu(action);
- }catch (final Exception e) {
- log("Small problem...");
- } return false;
- }
- public int loop(){
- gatherNest();
- setCamera();
- RSObject Ivy = getNearestObjectByID(IVY_ID);
- if (Ivy != null && getMyPlayer().getAnimation() != -1){
- STATE = "Chopping.";
- waitTimer = System.currentTimeMillis();
- performHumanAction();
- }
- if ( ivyLocation.equals("Varrock Wall") ){
- RSTile[] varrockWall = { new RSTile(3233, 3461), new RSTile(3233, 3460), new RSTile(3233, 3459), new RSTile(3233, 3457), new RSTile(3233, 3456) };
- if (Ivy != null && distanceTo(Ivy) < 10 && (System.currentTimeMillis() - waitTimer) > random(1850, 1950)) {
- STATE = "Searching";
- setCompass('w');
- atIvy(Ivy, "Chop Ivy");
- wait(random(2000, 2500));
- }
- }
- if ( ivyLocation.equals("Varrock Palace") ){
- RSTile[] varrockPalace = { new RSTile(3219, 3498), new RSTile(3218, 3498), new RSTile(3217, 3498), new RSTile(3216, 3498) };
- if (Ivy != null && distanceTo(Ivy) < 10 && (System.currentTimeMillis() - waitTimer) > random(1850, 1950)) {
- STATE = "Searching";
- setCompass('s');
- atIvy(Ivy, "Chop Ivy");
- wait(random(2000, 2500));
- }
- }
- if ( ivyLocation.equals("CWars") ){
- RSTile[] CWars = {new RSTile(2430, 3068), new RSTile(2429, 3068), new RSTile(2428, 3068), new RSTile(2426, 3068), new RSTile(2425, 3068), new RSTile(2424, 3068), new RSTile(2423, 3068) };
- if (Ivy != null && distanceTo(Ivy) < 10 && (System.currentTimeMillis() - waitTimer) > random(1850, 1950)) {
- STATE = "Searching";
- setCompass('n');
- atIvy(Ivy, "Chop Ivy");
- wait(random(2000, 2500));
- }
- }
- return random(200, 500);
- }
- public void serverMessageRecieved(final ServerMessageEvent arg0) {
- final String serverString = arg0.getMessage();
- if (serverString.toLowerCase().contains("level to use")) {
- log("No axe?");
- logout();
- stopAllScripts();
- }
- if (serverString.toLowerCase().contains("at the ivy")) {
- Wait = true;
- }
- }
- public int startLevel = 0;
- public int startXP = 0;
- public long startTime = System.currentTimeMillis();
- public long time = System.currentTimeMillis();
- int checkTime;
- long lastCheck;
- boolean powerMode = false;
- int randomRun = random(40, 75);
- long avoidedCombat;
- int IvyCount;
- int oldIvyCount;
- int xpPerIvy;
- int startExp = 0;
- int oldExp;
- int countToNext;
- int oldLevels;
- long lastAvgCheck;
- int avgPerHour;
- int Points = 0;
- int StartPoints = 0;
- String PointsString = "LuLWuT?";
- String Status = "Starting.";
- public void onRepaint(Graphics g) {
- if (!isLoggedIn() || isLoginScreen()) {
- return;
- }
- RSInterface Planks = RSInterface.getInterface(766);
- // Ty to AELIN for these
- // local objects:
- int index = STAT_WOODCUTTING;
- int exp = 0;
- int levels;
- long hours = 0, minutes = 0, seconds = 0;
- long time;
- // Has start time been previously set?
- if (startTime == 0) {
- startTime = System.currentTimeMillis();
- }
- // Calculate hours, minutes and seconds.
- time = System.currentTimeMillis() - startTime;
- seconds = time / 1000;
- if (seconds >= 60) {
- minutes = seconds / 60;
- seconds -= minutes * 60;
- }
- if (minutes >= 60) {
- hours = minutes / 60;
- minutes -= hours * 60;
- }
- // Has variables been previously defined?
- if (startLevel == 0 || startExp == 0) {
- // No, so define them now.
- startLevel = skills.getCurrentSkillLevel(STAT_WOODCUTTING);
- startExp = skills.getCurrentSkillExp(STAT_WOODCUTTING);
- oldExp = 0;
- }
- // Calculate catches based on experience changes.
- exp = skills.getCurrentSkillExp(STAT_WOODCUTTING) - startExp;
- if (exp > oldExp) {
- xpPerIvy = exp - oldExp;
- oldExp = exp;
- IvyCount++;
- countToNext = skills.getXPToNextLevel(STAT_WOODCUTTING) / xpPerIvy + 1;
- }
- // Calculate levels gained.
- levels = skills.getCurrentSkillLevel(index) - startLevel;
- if (levels > oldLevels) {
- oldLevels = levels;
- }
- int XP_HOUR = (int) ((exp) * 3600000D / (System.currentTimeMillis() - startTime));
- Color BG = new Color(0, 0, 0, 125);
- Color RED = new Color(255, 0, 0, 255);
- Color BLACK = new Color(0, 0, 0, 255);
- Color BLUE = new Color(0,0,205,255);
- Color YELLOW = new Color(255,255,0,255);
- int GotPoints = Points - StartPoints;
- int type = STAT_WOODCUTTING;
- long millis = System.currentTimeMillis() - startTime;
- millis -= hours * 1000 * 60 * 60;
- millis -= minutes * 1000 * 60;
- int XPChange = skills.getCurrentSkillExp(type) - startXP;
- int Kills = XPChange / 240;
- int KillsToLvl = skills.getXPToNextLevel(type) / 288;
- int LevelChange = skills.getCurrentSkillLevel(type) - startLevel;
- int perNextLvl = skills.getPercentToNextLevel(type);
- int nextLvl = skills.getCurrentSkillLevel(type) + 1;
- /** Title Box **/
- g.setColor(new Color(0, 0, 205));
- g.drawRect(551, 206, 183, 39);
- g.setColor(new Color(100, 149, 237, 162));
- g.fillRect(553, 207, 180, 38);
- /** Main Box OutLine **/
- g.setColor(new Color(0, 0, 205));
- g.drawRect(550, 249, 183, 213);
- g.setColor(new Color(100, 149, 237, 165));
- g.fillRect(552, 251, 180, 210);
- /** Title **/
- g.setFont(new Font("Arial Black", 0, 12));
- g.setColor(new Color(255, 255, 0, 237));
- g.drawString("Prox32Ivy 1.7", 559, 234);
- g.setFont(new Font("Tahoma", Font.BOLD, 12));
- g.setColor(new Color(255, 255, 0));
- g.drawString("Running for: " + hours + "h " + minutes + "m " + seconds + "s", 557, 268);
- g.drawString("XP Gained: " + exp, 557, 286);
- g.drawString("XP Per hour: " + XP_HOUR, 557, 306);
- g.drawString("XP To next lvl: " + skills.getXPToNextLevel(type), 557, 326);
- g.drawString("Levels Gained: " + LevelChange, 557, 346);
- g.drawString("Bird Nests: " + BirdNests, 557, 366);
- g.drawString("Status: " + STATE, 557, 446);
- g.drawString("Progress to next lvl:", 557, 386);
- /** Progress Bar **/
- if (millis != 0) {
- g.setColor(BLUE);
- g.fill3DRect(557, 406, 165, 18, true);
- g.setColor(YELLOW);
- g.fill3DRect(557, 406, perNextLvl * 165 /100, 18, true);
- g.setColor(new Color(0, 0, 0));
- g.drawString(perNextLvl + "% to " + nextLvl, 600, 418);
- }
- if (Debug) {
- g.drawString("Rotation " + getCameraAngle(), 10, 210);
- }
- }
- public void onFinish() {
- ScreenshotUtil.takeScreenshot(true);
- }
- public boolean atIvy(RSTile a, RSTile b) {
- // turnToTile(b);
- if (random(0, 10) < random(2, 4)) {
- setCameraRotation(getCameraAngle() + (random(0, 9) < random(6, 8) ? random(-20, 20)
- : random(-360, 360)));
- }
- if (random(0, 14) < random(0, 2)) {
- setCameraAltitude(random(0, 100));
- }
- // if (tryCount > 100) {
- // log("Problems finding jobboard....");
- // stopAllScripts();
- // }
- if (!tileOnScreen(a) || !tileOnScreen(b) || distanceTo(a) > random(4, 7)) {
- if (tileOnMap(a)) {
- walkTileMM(randomizeTile(a, 3, 3));
- wait(random(750, 1250));
- } else {
- log("Problems finding Ivy tiles.");
- return false;
- }
- } else {
- final ArrayList<RSTile> theObjs = new ArrayList<RSTile>();
- theObjs.add(a);
- theObjs.add(b);
- try {
- final Point[] thePoints = new Point[theObjs.size()];
- for (int c = 0; c < theObjs.size(); c++) {
- thePoints[c] = Calculations.tileToScreen(theObjs.get(c));
- }
- float xTotal = 0;
- float yTotal = 0;
- for (final Point thePoint : thePoints) {
- xTotal += thePoint.getX();
- yTotal += thePoint.getY();
- }
- final Point location = new Point(
- (int) (xTotal / thePoints.length),
- (int) (yTotal / thePoints.length) - random(0, 40)); // -
- // 40
- if (location.x == -1 || location.y == -1) {
- return false;
- }
- if (Math.sqrt(Math.pow((getMouseLocation().getX() - location.getX()), 2) + Math.pow(
- (getMouseLocation().getY() - location.getY()),
- 2)) < random(20, 30)) {
- final ArrayList<String> commands = getMenuItems();
- for (int c = 0; c < commands.size(); c++) {
- if (commands.get(c).contains("Chop Ivy")) {
- if (atMenu("Chop Ivy")) {
- lastTry = 0;
- tryCount = 0;
- return true;
- }
- }
- }
- }
- int ii = 0;
- while (!atMenu("Chop Ivy") && ii < 10) {
- int aa = ii * Multiplier;
- moveMouse(location, aa, 15);
- wait(random(30, 80));
- ii++;
- }
- moveMouse(location, 7, 7);
- if (atMenu("Chop Ivy")) {
- lastTry = 0;
- tryCount = 0;
- return true;
- }
- } catch (final Exception e) {
- return false;
- }
- }
- return false;
- }
- public boolean CheckAnimation() {
- for (int i = 0; i < 5; i++) {
- if (getMyPlayer().getAnimation() != -1) {
- return true;
- }
- wait(random(100, 180));
- }
- return false;
- }
- boolean AntiBanDebug = true;
- private void performHumanAction() {
- int randomNum = random(1, 30);
- int r = random(1,35);
- if (randomNum == 6){
- if (r == 1){
- if (getCurrentTab() != Constants.TAB_STATS){
- openTab(Constants.TAB_STATS);
- moveMouse(random(670, 690), random(400, 410));
- wait(random(1000, 1500));
- }
- }
- if (r == 2){
- openTab(random(1, 14));
- wait(random(5000, 10000));
- }
- if (r == 3){
- int x = input.getX();
- int y = input.getY();
- moveMouse(x + random(-90, 90), y + random(-90, 90));
- wait(random(1000, 1500));
- }
- if (r == 4){
- int x2 = input.getX();
- int y2 = input.getY();
- moveMouse(x2 + random(-90, 90), y2 + random(-90, 90));
- wait(random(1000, 1500));
- }
- if (r == 5){
- int x3 = input.getX();
- int y3 = input.getY();
- moveMouse(x3 + random(-80, 80), y3 + random(-80, 80));
- wait(random(1000, 1500));
- }
- if (r == 6){
- int x3 = input.getX();
- int y3 = input.getY();
- moveMouse(x3 + random(-100, 100), y3 + random(-100, 100));
- wait(random(1000, 1500));
- }
- if (r == 7){
- int x3 = input.getX();
- int y3 = input.getY();
- moveMouse(x3 + random(-100, 100), y3 + random(-80, 80));
- wait(random(1000, 1500));
- }
- if (r == 8){
- setCameraRotation(random(100, 360));
- wait(random(1000, 1500));
- }
- if (r == 9){
- setCameraRotation(random(100, 360));
- wait(random(1000, 1500));
- }
- if (r == 10){
- setCameraRotation(random(100, 360));
- wait(random(1000, 1500));
- }
- }
- }
- double Version = 1.7;
- public boolean CheckUpdate() {
- try {
- URL url = new URL("www.google.com");
- BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
- } catch (Exception e) {
- }
- return false;
- }
- }