Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.BasicStroke;
- import java.awt.Color;
- import java.awt.Font;
- import java.awt.Graphics;
- import java.awt.Graphics2D;
- import java.awt.Polygon;
- import java.awt.RenderingHints;
- import java.awt.event.MouseEvent;
- import java.awt.event.MouseListener;
- import java.awt.event.MouseMotionListener;
- import javax.swing.SwingUtilities;
- import org.rsbot.event.events.MessageEvent;
- import org.rsbot.event.listeners.MessageListener;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.script.Script;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.methods.Skills;
- import org.rsbot.script.task.LoopTask;
- import org.rsbot.script.task.TaskContainer;
- import org.rsbot.script.wrappers.RSArea;
- import org.rsbot.script.wrappers.RSItem;
- import org.rsbot.script.wrappers.RSModel;
- import org.rsbot.script.wrappers.RSObject;
- import org.rsbot.script.wrappers.RSTile;
- @ScriptManifest(name = "Agility Killer", version = 1.0, authors = "Popm4n", keywords =
- "Agility", description = "Get that Agility Cape in No Time.")
- public class AgilityKiller extends Script implements PaintListener, MessageListener,
- MouseListener, MouseMotionListener {
- AntiBan antiban = new AntiBan();
- AgilityGUI scriptGUI;
- Skill agility;
- long startTime;
- int levelsGained;
- String courseName = "";
- boolean failedCourse = false;
- TaskContainer taskContainer = new TaskContainer();
- boolean developerMode = false;
- int failed = 0;
- public boolean showPaint = true;
- int percentageToEat;
- int numberInCourse;
- AgilityCourse course;
- Obstacle currentObstacle;
- Obstacle nextObstacle;
- private Area startOfApeAtollCourse = new Area(new RSTile(2755, 2742), new RSTile
- (2775, 2755), 0);
- private Area underTropicalTree = new Area(new RSTile(2752, 2742), new RSTile(2753,
- 2742), 0);
- private Area beforeMonkeyBars = new Area(new RSTile(2752, 2741), new RSTile(2754,
- 2742), 2);
- private Area afterMonkeyBars = new Area(new RSTile(2747, 2741), new RSTile(2747,
- 2741), 0);
- private Area beforeRopeSwing = new Area(new RSTile(2738, 2725), new RSTile(2752,
- 2741), 0);
- private Area beforeFinishTree = new Area(new RSTile(2755, 2723), new RSTile(2760,
- 2737), 0);
- private RSArea apeAtollArea = new RSArea(2738, 2725, 2775, 2755);
- private Obstacle steppingStone = new Obstacle(new int[]{12568}, true, 3481,
- startOfApeAtollCourse, "Jump-to");
- private Obstacle tropicalTree = new Obstacle(new int[]{12570}, false, 3492,
- underTropicalTree, "Climb");
- private Obstacle monkeyBars = new Obstacle(new int[]{12573}, false, 3484,
- beforeMonkeyBars, "Swing Across");
- private Obstacle skullSlope = new Obstacle(new int[]{12576}, false, 500,
- afterMonkeyBars, "Climb-up");
- private Obstacle ropeSwing = new Obstacle(new int[]{12578}, true, 3488,
- beforeRopeSwing, "Swing");
- private Obstacle finishTree = new Obstacle(new int[]{12618}, false, 500,
- beforeFinishTree, "Climb-down");
- private Obstacle[] apeAtollCourse = {
- steppingStone, tropicalTree, monkeyBars, skullSlope,
- ropeSwing, finishTree
- };
- private AgilityCourse apeAtoll = new AgilityCourse(startOfApeAtollCourse, 6,
- apeAtollCourse, apeAtollArea, new RSTile(-1, -1));
- private Area gnomeStrongholdArea = new Area(new RSTile(2469, 3414), new RSTile(2490,
- 3440), 0);
- private Obstacle logBalance = new Obstacle(new int[]{2295}, true, 9908, new Area(new
- RSTile(2469, 3433), new RSTile(2490, 3440), 0), "Walk-across");
- private Obstacle firstObstacleNet = new Obstacle(new int[]{2285}, false, 828, new
- Area(new RSTile(2469, 3419), new RSTile(2478, 3430), 0), "Climb-over");
- private Obstacle firstTreeBranch = new Obstacle(new int[]{35970}, false, 828, new
- Area(new RSTile(2471, 3422), new RSTile(2476, 3424), 1), "Climb");
- private Obstacle balancingRope = new Obstacle(new int[]{2312}, false, 9908, new
- Area(new RSTile(2472, 3418), new RSTile(2477, 3421), 2), "Walk-on");
- private Obstacle secondTreeBranch = new Obstacle(new int[]{2314}, false, 828, new
- Area(new RSTile(2483, 3418), new RSTile(2488, 3421), 2), "Climb-down");
- private Obstacle secondObstacleNet = new Obstacle(new int[]{2286}, true, 828, new
- Area(new RSTile(2482, 3418), new RSTile(2490, 3425), 0), "Climb-over");
- private Obstacle obstaclePipe = new Obstacle(new int[]{43544, 43543}, false, 10580,
- new Area(new RSTile(2481, 3426), new RSTile(2490, 3435), 0),
- "Squeeze-through");
- private Obstacle[] basicGnomeStrongholdCourse = {
- logBalance, firstObstacleNet, firstTreeBranch, balancingRope,
- secondTreeBranch, secondObstacleNet, obstaclePipe
- };
- private AgilityCourse basicGnomeStronghold = new AgilityCourse
- (logBalance.getAreaToUseObstacle(), 7, basicGnomeStrongholdCourse, gnomeStrongholdArea,
- new
- RSTile(2474, 3437));
- private Obstacle advBranch = new Obstacle(new int[]{43528}, false, 828, new Area(new
- RSTile(2472, 3418), new RSTile(2477, 3421), 2), "Climb-up");
- private Obstacle signPost = new Obstacle(new int[]{43581}, false, -1, new Area(new
- RSTile(2472, 3418), new RSTile(2477, 3421), 3), "Run-across");
- private Obstacle poleSwing = new Obstacle(new int[]{43529, 43547, 43548}, false, -1,
- new Area(new RSTile(2484, 3418), new RSTile(2487, 3421), 3),
- "Swing-to");
- private Obstacle barrierJump = new Obstacle(new int[]{43539}, false, -1, new Area
- (new RSTile(2482, 3432), new RSTile(2488, 3435), 3), "Jump-over");
- private Obstacle[] advGnomeStrongholdCourse = {
- logBalance, firstObstacleNet, firstTreeBranch, advBranch,
- signPost, poleSwing, barrierJump
- };
- private AgilityCourse advGnomeStronghold = new AgilityCourse
- (logBalance.getAreaToUseObstacle(), -1, advGnomeStrongholdCourse, gnomeStrongholdArea,
- new
- RSTile(-1, -1));
- private Area barbOutpostArea = new Area(new RSTile(2529, 3542), new RSTile(2555,
- 3557), 0);
- private Obstacle barbRopeSwing = new Obstacle(new int[]{43526}, true, 751, new Area
- (new RSTile(2543, 3551), new RSTile(2555, 3557), 0), "Swing-on");
- private Obstacle barbLogBalance = new Obstacle(new int[]{43595}, false, 9908, new
- Area(new RSTile(2544, 3542), new RSTile(2555, 3549), 0), "Walk-across");
- private Obstacle barbObstacleNet = new Obstacle(new int[]{20211}, false, 828, new
- Area(new RSTile(2538, 3542), new RSTile(2543, 3549), 0), "Climb-over");
- private Obstacle barbBalancingLedge = new Obstacle(new int[]{2302}, false, 753, new
- Area(new RSTile(2536, 3545), new RSTile(2538, 3547), 1), "Walk-across");
- private Obstacle barbLadder = new Obstacle(new int[]{3205}, false, 827, new Area(new
- RSTile(2532, 3546), new RSTile(2532, 3547), 1), "Climb-down");
- private Obstacle barbFirstCrumblingWall = new Obstacle(new int[]{1948}, true, 4853,
- new Area(new RSTile(2529, 3542), new RSTile(2537, 3556), 0), "Climb-over");
- private Obstacle[] basicBarbOutpostCourse = {
- barbRopeSwing, barbLogBalance, barbObstacleNet,
- barbBalancingLedge, barbLadder, barbFirstCrumblingWall
- };
- private AgilityCourse basicBarbOutpost = new AgilityCourse
- (barbRopeSwing.getAreaToUseObstacle(), 6, basicBarbOutpostCourse, barbOutpostArea, new
- RSTile
- (2755, 2742));
- @Override
- public boolean onStart() {
- try {
- SwingUtilities.invokeAndWait(new Runnable() {
- public void run() {
- scriptGUI = new AgilityGUI();
- scriptGUI.setVisible(true);
- }
- });
- } catch (Exception e) {
- e.printStackTrace();
- }
- while (scriptGUI.isVisible()) {
- sleep(100);
- }
- if (AgilityGUI.courseList.getSelectedItem().toString().equals("Basic Gnome
- Stronghold")) {
- log("Course is Basic Gnome Stronghold");
- course = basicGnomeStronghold;
- courseName = "Basic Gnome Stronghold";
- } else if (AgilityGUI.courseList.getSelectedItem().toString().equals("Basic
- Barbarian Outpost")) {
- course = basicBarbOutpost;
- log("Course is Basic Barbarian Outpost");
- courseName = "Basic Barbarian Outpost";
- } else if (AgilityGUI.courseList.getSelectedItem().toString().equals("Ape
- Atoll")) {
- log("Course is Ape Atoll");
- course = apeAtoll;
- courseName = "Ape Atoll";
- } else if (AgilityGUI.courseList.getSelectedItem().toString().equals("Adv Gnome
- Stronghold")) {
- log("Course is Advanced Gnome Stronghold");
- course = advGnomeStronghold;
- courseName = "Adv Gnome Stronghold";
- }
- if (course == null) {
- log("Course is null, stopping script");
- return false;
- }
- percentageToEat = AgilityGUI.percentageToEat.getValue();
- log("Eating at: " + percentageToEat + "%");
- taskContainer.pool(antiban);
- agility = new Skill(Skills.AGILITY);
- mouse.setSpeed(5);
- startTime = System.currentTimeMillis();
- return true;
- }
- private boolean isHovered(RSModel model) {
- for (Polygon p : model.getTriangles()) {
- if (p.contains(mouse.getLocation())) {
- return true;
- }
- }
- return false;
- }
- public boolean hover(RSObject object) {
- if (object != null) {
- for (Polygon i : object.getModel().getTriangles()) {
- if (i.contains(mouse.getLocation())) {
- return true;
- }
- }
- mouse.move(object.getModel().getPoint());
- sleep(300, 500);
- return true;
- }
- //log("object is null");
- return false;
- }
- private RSItem getFood() {
- for (RSItem i : inventory.getItems()) {
- if (i == null || i.getID() == -1)
- continue;
- if (i.getComponent().getActions() == null || i.getComponent().getActions()
- [0] == null)
- continue;
- if (i.getComponent().getActions()[0].contains("Eat"))
- return i;
- }
- return null;
- }
- private void eatFood() {
- if (getFood() != null) {
- getFood().interact("Eat");
- } else if (getFood() == null) {
- log("Out of food");
- stop();
- }
- }
- private int getHP() {
- return Integer.parseInt(interfaces.getComponent(748, 8).getText().trim());
- }
- private int getHealthPercent() {
- return (int) ((double) (Integer.parseInt(interfaces.get(748).getComponent
- (8).getText()) / 10) / skills.getRealLevel(Skills.CONSTITUTION) * 100);
- }
- private void useObject(String option, int... IDs) {
- RSObject object = objects.getNearest(IDs);
- if (object != null) {
- if (!object.isOnScreen()) {
- mouse.click(calc.tileToMinimap(object.getLocation().randomize(1, 1)),
- true);
- sleep(800, 1000);
- while (players.getMyPlayer().isMoving() && !object.isOnScreen()) {
- sleep(10);
- }
- }
- if (players.getMyPlayer().getAnimation() == -1) {
- if (object.interact(option)) {
- sleep(1500, 2000);
- }
- }
- //sleep(800, 1000);
- while (players.getMyPlayer().isMoving() && players.getMyPlayer
- ().getAnimation() == -1) {
- sleep(30);
- }
- }
- }
- private void useObject(String option, RSTile tile) {
- RSObject object = objects.getTopAt(tile);
- if (object != null) {
- if (!object.isOnScreen()) {
- mouse.click(calc.tileToMinimap(object.getLocation().randomize(1, 1)),
- true);
- sleep(800, 1000);
- while (players.getMyPlayer().isMoving() && !object.isOnScreen()) {
- sleep(10);
- }
- }
- if (players.getMyPlayer().getAnimation() == -1)
- object.interact(option);
- sleep(800, 1000);
- while (players.getMyPlayer().isMoving() && players.getMyPlayer
- ().getAnimation() == -1) {
- sleep(30);
- }
- }
- }
- //SW = 2546, 9948
- //NE = 2555, 9955
- public int loop() {
- try {
- if (getHealthPercent() <= percentageToEat) {
- eatFood();
- }
- while (players.getMyPlayer().isMoving() && players.getMyPlayer
- ().getAnimation() == -1) {
- sleep(100);
- }
- if (course.equals(basicBarbOutpost)) {
- barbCourse();
- }
- else if (course.equals(advGnomeStronghold)) {
- advGnomeCourse();
- }
- else {
- quickFixes();
- if (!players.getMyPlayer().isIdle()) {
- //log("Player is not idle");
- hover(objects.getNearest(nextObstacle.IDs));
- return random(100, 400);
- }
- //log("In loop()");
- findCurrentObstacle(course);
- //log("Found current Obstacle");
- course.runNextObstacle();
- //log("Just ran Obstacle");
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- /*try {
- quickFixes();
- if (getHealthPercent() <= percentageToEat) {
- eatFood();
- }
- if (!players.getMyPlayer().isIdle()) {
- //log("Player is not idle");
- hover(objects.getNearest(nextObstacle.IDs));
- return random(100, 400);
- }
- //log("In loop()");
- findCurrentObstacle(course);
- //log("Found current Obstacle");
- course.runNextObstacle();
- //log("Just ran Obstacle");
- } catch (NullPointerException e) {
- e.printStackTrace();
- }*/
- return 0;
- }
- private void barbCourse() {
- if (new Area(new RSTile(2546, 9948), new RSTile(2555, 9955), 0).contains
- (players.getMyPlayer().getLocation())) {
- //Under Rope Swing
- useObject("Climb-up", 32015);
- } else if (new RSArea(2543, 3549, 2555, 3559).contains(players.getMyPlayer
- ().getLocation()) &&
- game.getPlane() == 0 &&
- !new RSArea(2543, 3542, 2555, 3550).contains(players.getMyPlayer
- ().getLocation())) {
- //Rope Swing
- useObject("Swing-on", 43526);
- } else if (new RSArea(2542, 3546, 2550, 3546).contains(players.getMyPlayer
- ().getLocation())) {
- //On log
- if (random(1, 100) == 50) {
- mouse.moveSlightly();
- }
- sleep(200, 500);
- } else if (new RSArea(2543, 3542, 2555, 3550).contains(players.getMyPlayer
- ().getLocation()) &&
- game.getPlane() == 0) {
- //Log Balance
- useObject("Walk-across", 43595);
- } else if (new RSArea(2533, 3545, 2537, 3547).contains(players.getMyPlayer
- ().getLocation()) &&
- game.getPlane() == 0) {
- //West of obstacle net
- walking.getPath(new RSTile(2540, 3546).randomize(1, 1)).traverse();
- sleep(800, 1000);
- } else if (new RSArea(2533, 3542, 2542, 3549).contains(players.getMyPlayer
- ().getLocation()) &&
- game.getPlane() == 0) {
- //Obstacle Net
- useObject("Climb-over", 20211);
- } else if (new RSArea(2536, 3545, 2538, 3547).contains(players.getMyPlayer
- ().getLocation()) &&
- game.getPlane() == 1) {
- //Balancing Ledge
- useObject("Walk-across", 2302);
- } else if (new RSArea(2532, 3546, 2532, 3547).contains(players.getMyPlayer
- ().getLocation()) &&
- game.getPlane() == 1) {
- //Ladder
- useObject("Climb-down", 3205);
- } else if ((new RSArea(2529, 3542, 2532, 3556).contains(players.getMyPlayer
- ().getLocation()) ||
- new RSArea(2533, 3548, 2537, 3556).contains(players.getMyPlayer
- ().getLocation()) ||
- new RSArea(2538, 3548, 2539, 3551).contains(players.getMyPlayer().getLocation())
- ||
- new RSArea(2538, 3555, 2542, 3556).contains(players.getMyPlayer().getLocation
- ())) &&
- game.getPlane() == 0) {
- //first wall
- useObject("Climb-over", 1948);
- } else if (new RSArea(2538, 3552, 2542, 3554).contains(players.getMyPlayer
- ().getLocation()) &&
- game.getPlane() == 0) {
- //Second wall
- useObject("Climb-over", new RSTile(2542, 3553));
- }
- }
- private void advGnomeCourse() {
- if (new RSArea(new RSTile(2474, 3430), new RSTile(2474, 3435)).contains
- (players.getMyPlayer().getLocation()) &&
- game.getPlane() == 0) {
- //On log
- if (random(1, 100) == 50) {
- mouse.moveSlightly();
- }
- sleep(200, 500);
- }
- if (new RSArea(new RSTile(2469, 3430), new RSTile(2478, 3440)).contains
- (players.getMyPlayer().getLocation()) ||
- new RSArea (new RSTile(2469, 3436), new RSTile(2490, 3440)).contains
- (players.getMyPlayer().getLocation()) &&
- game.getPlane() == 0) {
- //Log Cross
- useObject("Walk-across", 2295);
- }
- if (new RSTile(2470, 3425).equals(players.getMyPlayer().getLocation())) {
- walking.getPath(new RSTile(2474, 3427).randomize(1, 1)).traverse();
- }
- if (new RSArea(new RSTile(2469, 3414), new RSTile(2478, 3429)).contains
- (players.getMyPlayer().getLocation()) &&
- game.getPlane() == 0) {
- //First obstacle net
- useObject("Climb-over", 2285);
- }
- if (new RSArea(new RSTile(2471, 3422), new RSTile(2476, 3424)).contains
- (players.getMyPlayer().getLocation()) &&
- game.getPlane() == 1) {
- //Tree branch
- useObject("Climb", 35970);
- }
- if (new RSArea(new RSTile(2472, 3418), new RSTile(2477, 3421)).contains
- (players.getMyPlayer().getLocation()) &&
- game.getPlane() == 2) {
- //Tree branch to advanced course
- useObject("Climb-up", 43528);
- }
- if (new RSArea(new RSTile(2472, 3418), new RSTile(2477, 3420)).contains
- (players.getMyPlayer().getLocation()) &&
- game.getPlane() == 3) {
- //Signpost run
- useObject("Run-across", 43581);
- }
- if (new RSArea(new RSTile(2484, 3418), new RSTile(2487, 3421)).contains
- (players.getMyPlayer().getLocation()) &&
- game.getPlane() == 3) {
- //Pole swing
- useObject("Swing-to", 43529);
- }
- if (new RSArea(new RSTile(2482, 3432), new RSTile(2488, 3435)).contains
- (players.getMyPlayer().getLocation()) &&
- game.getPlane() == 3) {
- useObject("Jump-over", 43539);
- }
- /*if (new RSTile(2485, 3434).equals(players.getMyPlayer().getLocation())) {
- new RSTile(2485, 3438).randomize(1, 1).clickOnMap();
- sleep(400, 500);
- }*/
- }
- private int quickFixes() {
- //One tile to the left of the first gnome obstacle net
- if (players.getMyPlayer().getLocation().equals(new RSTile(2470, 3425))) {
- walking.walkTileMM(new RSTile(2474, 3427).randomize(1, 1));
- sleep(800, 1000);
- while (players.getMyPlayer().isMoving()) {
- sleep(100);
- }
- }
- //Before Ape Atoll Rope Swing
- if (new Area(new RSTile(2738, 2725), new RSTile(2743, 2741), 0).contains
- (players.getMyPlayer().getLocation()) &&
- game.getPlane() == 0) {
- RSObject ropeSwing = objects.getNearest(12578);
- if (ropeSwing != null) {
- if (!ropeSwing.isOnScreen()) {
- mouse.click(calc.tileToMinimap(new RSTile(2750, 2733).randomize(1,
- 1)), true);
- sleep(800, 1000);
- while (players.getMyPlayer().isMoving()) {
- sleep(100);
- }
- }
- ropeSwing.interact("Swing Rope");
- sleep(800, 1000);
- while (players.getMyPlayer().isMoving()) {
- sleep(100);
- }
- }
- }
- if (course.equals(basicGnomeStronghold) || course.equals(advGnomeStronghold)) {
- if (new RSArea(2476, 3414, 2480, 3430).contains(players.getMyPlayer
- ().getLocation())) {
- walking.getPath(course.startTile).traverse();
- }
- }
- //Before second obstacle net in Gnome Stronghold
- if (new RSArea(new RSTile(2482, 3418), new RSTile(2490, 3425)).contains
- (players.getMyPlayer().getLocation()) &&
- game.getPlane() == 0) {
- RSObject net = objects.getNearest(2286);
- if (net != null) {
- if (!net.isOnScreen()) {
- mouse.click(calc.tileToMinimap( new RSTile(2486,
- 3424).randomize(1, 1)), true);
- sleep(800, 1000);
- while (players.getMyPlayer().isMoving()) {
- sleep(100);
- }
- }
- net.interact("Climb-over");
- sleep(800, 1000);
- while (players.getMyPlayer().isMoving()) {
- sleep(100);
- }
- }
- loop();
- }
- //Under Barb Rope Swing
- //SW = 2546, 9948
- //NE = 2555, 9955
- if (new RSArea(new RSTile(2546, 9948), new RSTile(2555, 9955), 0).contains
- (players.getMyPlayer().getLocation())) {
- RSObject ladder = objects.getNearest(32015);
- if (ladder != null) {
- if (!ladder.isOnScreen()) {
- walking.getPath(ladder.getLocation()).traverse();
- sleep(600, 800);
- while (players.getMyPlayer().isMoving()) {
- sleep(30);
- }
- }
- ladder.interact("Climb-up");
- sleep(600, 800);
- while (players.getMyPlayer().isMoving()) {
- sleep(30);
- }
- }
- quickFixes();
- }
- //West of Gnome obstacle pipes
- if (new Area(new RSTile(2479, 3431), new RSTile(2481, 3433), 0).contains
- (players.getMyPlayer().getLocation())) {
- RSObject pipe = objects.getNearest(obstaclePipe.getIDs());
- if (pipe != null) {
- if (!pipe.isOnScreen()) {
- mouse.click(calc.tileToMinimap(pipe.getLocation()), true);
- sleep(600, 900);
- while (players.getMyPlayer().isMoving()) {
- sleep(30);
- }
- }
- pipe.interact("Squeeze-through");
- sleep(600, 900);
- while (players.getMyPlayer().isMoving()) {
- sleep(30);
- }
- }
- }
- if (new RSArea(new RSTile(2750, 2747), new RSTile(2753, 2757), 0).contains
- (players.getMyPlayer().getLocation()) ||
- new RSArea(new RSTile(2746, 2744), new RSTile(2749, 2746), 0).contains
- (players.getMyPlayer().getLocation())) {
- mouse.click(calc.tileToMinimap(objects.getNearest(steppingStone.getIDs
- ()).getLocation()), true);
- sleep(600, 900);
- }
- if (new RSArea(new RSTile(2764, 2735), new RSTile(2769, 2741)).contains
- (players.getMyPlayer().getLocation()) &&
- game.getPlane() == 0) {
- RSObject stone = objects.getNearest(steppingStone.getIDs());
- if (stone != null) {
- mouse.click(calc.tileToMinimap(stone.getLocation()), true);
- sleep(600, 900);
- while (players.getMyPlayer().isMoving()) {
- sleep(30);
- }
- }
- }
- if (new Area(new RSTile(2550, 3547), new RSTile(2553, 3549), 0).contains
- (players.getMyPlayer().getLocation())) {
- RSObject log = objects.getNearest(barbLogBalance.getIDs());
- if (log != null) {
- if (!log.isOnScreen()) {
- mouse.click(calc.tileToMinimap(log.getLocation()), true);
- sleep(600, 800);
- while (players.getMyPlayer().isMoving()) {
- sleep(30);
- }
- }
- log.interact("Walk-across");
- }
- }
- //Check for area west of barbarian outpost net
- if (new Area(new RSTile(2533, 3545), new RSTile(2537, 3547), 0).contains
- (players.getMyPlayer().getLocation())) {
- mouse.click(calc.tileToMinimap(new RSTile(2540, 3545).randomize(1, 1)),
- true);
- }
- //Check for area between two crumbling walls at barb outpost
- if (new Area(new RSTile(2538, 3552), new RSTile(2542, 3554), 0).contains
- (players.getMyPlayer().getLocation())) {
- RSObject wall = objects.getTopAt(new RSTile(2542, 3553));
- if (wall != null) {
- if (!wall.isOnScreen()) {
- mouse.click(calc.tileToMinimap(wall.getLocation()), true);
- sleep(600, 800);
- }
- wall.interact("Climb-over");
- }
- sleep(800, 1200);
- while (!players.getMyPlayer().isIdle()) {
- sleep(30);
- }
- }
- //
- if (!course.agilityCourseArea.contains(players.getMyPlayer().getLocation())) {
- for (int i = 0; i <= 2; i++) {
- while (!players.getMyPlayer().isIdle()) {
- sleep(300);
- }
- if (!course.agilityCourseArea.contains(players.getMyPlayer
- ().getLocation())) {
- walking.getPath(course.startTile).traverse();
- sleep(500, 600);
- while (players.getMyPlayer().isMoving()) {
- sleep(30);
- }
- if (!course.agilityCourseArea.contains(players.getMyPlayer
- ().getLocation())) {
- log("Not in agility course area, stopping script");
- stop();
- }
- }
- }
- return 0;
- }
- return 0;
- }
- public void messageReceived(MessageEvent e) {
- String s = e.getMessage();
- if (s.contains("You've just advanced an Agility")) {
- levelsGained++;
- }
- }
- private final RenderingHints antialiasing = new RenderingHints(
- RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
- private int timesInSameSpot = 0;
- private int lastX;
- private int lastY;
- public void mouseClicked(MouseEvent e) {
- int x = e.getX();
- int y = e.getY();
- if (x == lastX && y == lastY) {
- timesInSameSpot++;
- } else {
- lastX = x;
- lastY = y;
- timesInSameSpot = 0;
- }
- if (timesInSameSpot >= random(10, 15)) {
- log("Possibly making a disastrous mistake, stopping script");
- stop();
- }
- }
- public void mousePressed(MouseEvent e) {
- }
- public void mouseReleased(MouseEvent e) {
- }
- public void mouseEntered(MouseEvent e) {
- }
- public void mouseExited(MouseEvent e) {
- }
- public void mouseDragged(MouseEvent e) {
- }
- public void mouseMoved(MouseEvent e) {
- }
- public void onPause() {
- antiban.pauseThread();
- }
- public void onResume() {
- antiban.unpauseThread();
- }
- @Override
- public void onFinish() {
- antiban.customStop();
- env.saveScreenshot(true);
- }
- Obstacle findCurrentObstacle(AgilityCourse course) {
- RSTile location = players.getMyPlayer().getLocation();
- for (int i = 0; i <= course.courseMap.length - 1; i++) {
- //log(i);
- if (course.courseMap[i].areaToUseObstacle.contains(location) &&
- game.getPlane() == course.courseMap[i].areaToUseObstacle.getPlane())
- {
- if (i + 1 > course.courseMap.length - 1) {
- nextObstacle = course.courseMap[0];
- } else {
- numberInCourse = i + 2;
- nextObstacle = course.courseMap[i + 1];
- }
- return course.courseMap[i];
- }
- }
- return null;
- }
- class AgilityCourse {
- RSArea agilityCourseArea;
- Area startArea;
- int numberOfObstacles;
- Obstacle[] courseMap;
- RSTile startTile;
- AgilityCourse() {
- super();
- }
- AgilityCourse(Area startArea, int numberOfObstacles, Obstacle[] courseMap,
- RSArea apeAtollArea, RSTile startTile) {
- this.startArea = startArea;
- this.numberOfObstacles = numberOfObstacles;
- this.courseMap = courseMap;
- this.agilityCourseArea = apeAtollArea;
- this.startTile = startTile;
- }
- void runNextObstacle() {
- //log("In runNextObstacle");
- Obstacle o = findCurrentObstacle(course);
- if (o != null) {
- RSObject obstacle;
- obstacle = objects.getNearest(o.IDs);
- if (obstacle != null) {
- //log("Obstacle is not null");
- if (obstacle.isOnScreen()) {
- //log("Obstacle is onScreen");
- obstacle.interact(o.interactText);
- if (random(1, 10) == 1) {
- mouse.move(random(4, 7), random(0, 700), random(0, 500),
- random(80, 300), random(80, 200));
- }
- sleep(900, 1300);
- RSObject nextObstacleGO = objects.getNearest
- (nextObstacle.getIDs());
- RSModel nextObstacleModel = null;
- if (nextObstacleGO != null) {
- nextObstacleModel = nextObstacleGO.getModel();
- }
- while (players.getMyPlayer().isMoving() ||
- !players.getMyPlayer().isIdle()) {
- antiban.canMouse = false;
- if (nextObstacleModel != null && !isHovered
- (nextObstacleModel)) {
- nextObstacleGO.doHover();
- }
- sleep(30);
- }
- antiban.canMouse = false;
- }
- if (!obstacle.isOnScreen()) {
- //log("Obstacle is not on screen" + obstacle.getLocation());
- //walking.getPath(obstacle.getLocation()).traverse();
- mouse.click(calc.tileToMinimap(obstacle.getLocation().randomize
- (1, 1)), true);
- }
- }
- if (obstacle == null) {
- //log("Obstacle is null");
- hover(objects.getNearest(nextObstacle.IDs));
- }
- }
- }
- }
- class Obstacle {
- int[] IDs;
- boolean haveToMove;
- int animation;
- Area areaToUseObstacle;
- String interactText;
- Obstacle(int[] IDs, boolean haveToMove, int animation, Area areaToUseObstacle,
- String interactText) {
- this.IDs = IDs;
- this.haveToMove = haveToMove;
- this.animation = animation;
- this.areaToUseObstacle = areaToUseObstacle;
- this.interactText = interactText;
- }
- Area getAreaToUseObstacle() {
- return this.areaToUseObstacle;
- }
- int[] getIDs() {
- return this.IDs;
- }
- int getAnimation() {
- return this.animation;
- }
- }
- class Skill {
- private final long startime;
- private final int startxp;
- private final int startLevel;
- private final int skillint;
- private final String name;
- public Skill(int skillInt) {
- startime = System.currentTimeMillis();
- startxp = skills.getCurrentExp(skillInt);
- startLevel = skills.getCurrentLevel(skillInt);
- skillint = skillInt;
- name = Skills.SKILL_NAMES[skillint];
- }
- public int xpGained() {
- return skills.getCurrentExp(skillint) - startxp;
- }
- public int levelsGained() {
- return skills.getCurrentLevel(skillint) - startLevel;
- }
- public int xpTL() {
- return skills.getExpToNextLevel(skillint);
- }
- public int percentTL() {
- return skills.getPercentToNextLevel(skillint);
- }
- public int xpPH() {
- return (int) ((xpGained()) * 3600000D / (System.currentTimeMillis() -
- startime));
- }
- public int curLevel() {
- return skills.getCurrentLevel(skillint);
- }
- public int curXP() {
- return skills.getCurrentExp(skillint);
- }
- public String timeToLevel() {
- String TTL = "Calculating..";
- long ttlCalculations;
- if (xpPH() != 0) {
- ttlCalculations = (long) (xpTL() * 3600000D) / xpPH();
- TTL = getTime(ttlCalculations);
- }
- return TTL;
- }
- public String getName() {
- return name;
- }
- public void drawSkill(Graphics2D g, int x, int y) {
- g.drawString(name +
- ": Gained " +
- xpGained() +
- " P/H " +
- xpPH() +
- " | Level " +
- curLevel() +
- " (" +
- levelsGained() +
- ")", x, y);
- }
- private String getTime(long millis) {
- long time = millis / 1000;
- String seconds = Integer.toString((int) (time % 60));
- String minutes = Integer.toString((int) ((time % 3600) / 60));
- String hours = Integer.toString((int) (time / 3600));
- for (int i = 0; i < 2; i++) {
- if (seconds != null && seconds.length() < 2) {
- seconds = "0" + seconds;
- }
- if (minutes.length() < 2) {
- minutes = "0" + minutes;
- }
- if (hours.length() < 2) {
- hours = "0" + hours;
- }
- }
- String returnThis = hours + ":" + minutes + ":" + seconds;
- return hours + ":" + minutes + ":" + seconds;
- }
- }
- class AntiBan extends LoopTask {
- private boolean running = true;
- private boolean paused = false;
- public boolean canMouse = false;
- public int loop() {
- while (running) {
- if (!paused) {
- if (game.isLoggedIn()) {
- int random = random(1, 60);
- switch (random) {
- case 1:
- //Camera.setPitch(random(1, 101));
- camera.setAngle(random(1, 360));
- break;
- case 2:
- case 3:
- case 4:
- if (canMouse)
- mouse.moveOffScreen();
- //Mouse.move(random(4, 7), random(0, 700), random(0,
- 500), random(80, 300), random(80, 200));
- break;
- }
- }
- }
- try {
- sleep(1000, 1200);
- } catch (Exception e) {
- }
- }
- return 0;
- }
- public void customStop() {
- running = false;
- }
- public void customPause(final boolean vPaused) {
- paused = vPaused;
- }
- public void pauseThread() {
- customPause(true);
- }
- public void unpauseThread() {
- customPause(false);
- }
- }
- class Area extends RSArea {
- int plane;
- RSTile sw;
- RSTile ne;
- public Area(RSTile arg0, RSTile arg1, int arg2) {
- super(arg0, arg1, arg2);
- plane = arg2;
- sw = arg0;
- ne = arg1;
- }
- }
- //Paint
- private final Color color1 = new Color(0, 0, 0, 205);
- private final Color color2 = new Color(0, 0, 0);
- private final Color color3 = new Color(0, 0, 0, 218);
- private final Color color4 = new Color(0, 0, 153);
- private final Color color5 = new Color(255, 204, 0);
- private final Color color6 = new Color(0, 0, 0, 225);
- private final BasicStroke stroke1 = new BasicStroke(1);
- private final Font font1 = new Font("Segoe UI", 3, 14);
- private final Font font2 = new Font("Segoe UI", 3, 12);
- private final Font font3 = new Font("Arial", 0, 12);
- public void onRepaint(Graphics g1) {
- Graphics2D g = (Graphics2D)g1;
- g.setColor(color1);
- g.fillRect(238, 344, 258, 114);
- g.setColor(color2);
- g.setStroke(stroke1);
- g.drawRect(238, 344, 258, 114);
- g.setColor(color3);
- g.fillRect(269, 406, 158, 15);
- g.setColor(color2);
- g.drawRect(269, 406, 158, 15);
- g.setColor(color3);
- g.fillRect(269, 374, 85, 16);
- g.setColor(color2);
- g.drawRect(269, 374, 85, 16);
- g.setColor(color3);
- g.fillRect(269, 390, 106, 16);
- g.setColor(color2);
- g.drawRect(269, 390, 106, 16);
- g.setFont(font1);
- g.drawString("v1.0", 455, 366);
- g.setColor(color4);
- g.drawString("v1.0", 453, 365);
- g.setColor(color2);
- g.drawString("Agility Killer", 271, 366);
- g.setColor(color4);
- g.drawString("Agility Killer", 269, 365);
- g.setFont(font2);
- g.setColor(color2);
- g.drawString("By Popm4n", 421, 383);
- g.setColor(color5);
- g.drawString("By Popm4n", 419, 382);
- g.setFont(font3);
- g.setColor(color2);
- g.drawString("Time: " + org.rsbot.script.util.Timer.format
- (System.currentTimeMillis() - startTime), 273, 388);
- g.setColor(color4);
- g.drawString("Time: " + org.rsbot.script.util.Timer.format
- (System.currentTimeMillis() - startTime), 272, 387);
- g.setColor(color2);
- g.drawString("Level: " + skills.getRealLevel(Skills.AGILITY) + " (" +
- levelsGained + ")", 272, 403);
- g.setColor(color4);
- g.drawString("Level: " + skills.getRealLevel(Skills.AGILITY) + " (" +
- levelsGained + ")", 271, 402);
- g.setColor(color6);
- g.fillRect(269, 421, 148, 14);
- g.setColor(color2);
- g.drawRect(269, 421, 148, 14);
- g.drawString("Exp: " + agility.xpGained() + "xp (" + agility.xpPH() + "xp)",
- 272, 418);
- g.setColor(color4);
- g.drawString("Exp: " + agility.xpGained() + "xp (" + agility.xpPH() + "xp)",
- 271, 417);
- g.setColor(color2);
- g.drawString("TNL: " + agility.xpTL() + "xp (" + agility.timeToLevel() + ")",
- 273, 433);
- g.setColor(color6);
- g.fillRect(269, 435, 140, 15);
- g.setColor(color2);
- g.drawRect(269, 435, 140, 15);
- g.setColor(color4);
- g.drawString("TNL: " + agility.xpTL() + "xp (" + agility.timeToLevel() + ")",
- 272, 432);
- g.setColor(color6);
- g.drawString(courseName, 272, 448);
- g.setColor(color4);
- g.drawString(courseName, 271, 447);
- }
- //End Paint
- }
- class AgilityGUI extends javax.swing.JFrame {
- private static final long serialVersionUID = 1L;
- /**
- * Creates new form AgilityGUI
- */
- public AgilityGUI() {
- setLocationRelativeTo(getOwner());
- initComponents();
- }
- /**
- * This method is called from within the constructor to
- * initialize the form.
- * WARNING: Do NOT modify this code. The content of this method is
- * always regenerated by the Form Editor.
- */
- // <editor-fold defaultstate="collapsed" desc="Generated Code">
- private void initComponents() {
- jLabel1 = new javax.swing.JLabel();
- jButton1 = new javax.swing.JButton();
- percentageToEat = new javax.swing.JSlider();
- courseList = new javax.swing.JComboBox();
- jLabel2 = new javax.swing.JLabel();
- setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
- jLabel1.setFont(new java.awt.Font("Ubuntu", 0, 24));
- jLabel1.setText("Agility Killer");
- jButton1.setText("Start Script!");
- jButton1.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jButton1ActionPerformed(evt);
- }
- });
- percentageToEat.setMajorTickSpacing(10);
- percentageToEat.setMinimum(1);
- percentageToEat.setPaintTicks(true);
- courseList.setModel(new javax.swing.DefaultComboBoxModel(new String[]{"Basic
- Gnome Stronghold", "Basic Barbarian Outpost", "Ape Atoll", "Adv Gnome Stronghold"}));
- jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
- jLabel2.setText("Percentage to eat: ");
- javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
- getContentPane().setLayout(layout);
- layout.setHorizontalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(jButton1,
- javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 211,
- Short.MAX_VALUE)
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
- layout.createSequentialGroup()
- .addContainerGap()
- .addComponent(percentageToEat,
- javax.swing.GroupLayout.DEFAULT_SIZE, 187, Short.MAX_VALUE)
- .addContainerGap())
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
- layout.createSequentialGroup()
- .addContainerGap()
- .addComponent(courseList, 0, 187, Short.MAX_VALUE)
- .addContainerGap())
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
- layout.createSequentialGroup()
- .addContainerGap()
- .addComponent(jLabel1,
- javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
- Short.MAX_VALUE)
- .addContainerGap())
- .addGroup(layout.createSequentialGroup()
- .addContainerGap()
- .addComponent(jLabel2)
- .addContainerGap(63, Short.MAX_VALUE))
- );
- layout.setVerticalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addContainerGap()
- .addComponent(jLabel1)
- .addPreferredGap
- (javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(courseList,
- javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
- javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGap(18, 18, 18)
- .addComponent(jLabel2)
- .addPreferredGap
- (javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(percentageToEat,
- javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
- javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGap(12, 12, 12)
- .addComponent(jButton1,
- javax.swing.GroupLayout.DEFAULT_SIZE, 30, Short.MAX_VALUE)
- .addContainerGap())
- );
- pack();
- }// </editor-fold>
- private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
- setVisible(false);
- }
- /**
- * @param args the command line arguments
- */
- public static void main(String args[]) {
- java.awt.EventQueue.invokeLater(new Runnable() {
- public void run() {
- new AgilityGUI().setVisible(true);
- }
- });
- }
- // Variables declaration - do not modify
- public static javax.swing.JComboBox courseList;
- private javax.swing.JButton jButton1;
- private javax.swing.JLabel jLabel1;
- private javax.swing.JLabel jLabel2;
- public static javax.swing.JSlider percentageToEat;
- // End of variables declaration
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement