Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- eat();
- startRunning(runEnergy);
- switch(getState()) {
- case rope:
- doRope();
- return 50;
- case log:
- doLog();
- return 50;
- case net:
- doNet();
- return 50;
- case ledge:
- doLedge();
- return 50;
- case ladder:
- doLadder();
- return 50;
- case wall:
- doWall();
- return 50;
- case error:
- return -1;
- }
- return 50;
- }
- //*******************************************************//
- // OTHER METHODS
- //*******************************************************//
- public void antiban() {
- antibanca = random(0,5);
- if (antibanca == 1) {
- int angle = camera.getAngle() + random(-90, 90);
- if (angle < 0) {
- angle = random(0, 10);
- }
- if (angle > 359) {
- angle = random(0, 10);
- }
- camera.setAngle(angle);
- return;
- }
- if (antibanca == 2) {
- status = "AntiBan(2)";
- camera.setCompass('n');
- sleep(200,300);
- return;
- }
- if (antibanca == 3) {
- status = "AntiBan(3)";
- camera.setCompass('s');
- sleep(200,400);
- return;
- }
- if (antibanca == 4) {
- status = "AntiBan(4)";
- mouse.move(random(50, 700), random(50, 450), 2, 2);
- sleep(200,300);
- return;
- }
- if (antibanca == 5) {
- status = "AntiBan(5)";
- mouse.moveSlightly();
- sleep(50,100);
- return;
- }
- }
- private void doRope() {
- status = "Swinging on rope...";
- final RSTile rope = new RSTile(2551 + random(0, 2), 3553);
- final RSTile ladder = new RSTile(2547, 9951);
- final RSTile walkHere = new RSTile(2551, 3554);
- if (playerInArea(2555, 9955, 2546, 9948)) {
- if (camera.getAngle() < 75 || camera.getAngle() > 110) {
- camera.setAngle(random(75, 110));
- sleep(random(100, 200));
- return;
- }
- if (onTile(ladder, "Ladder", "Climb-up", 0.4, 0.5, 40))
- log.info("Fell off of the rope.");
- sleep(random(3000, 3500));
- return;
- }
- if (!playerInArea(2554, 3555, 2549, 3554)) {
- walkTile(walkHere);
- sleep(random(50, 1500));
- camera.setAngle(random(200, 500));
- sleep(random(100, 200));
- return;
- }
- antiban();
- if (onTile(rope, "Ropeswing", "Swing-on", 0.5, 0, 450))
- sleep(random(500, 1000));
- mouse.move(random(50, 700), random(50, 450), 2, 2);
- sleep(random(1600, 1800));
- while(players.getMyPlayer().getAnimation() == 751 || players.getMyPlayer().isMoving())
- sleep(100);
- return;
- }
- private void doLog() {
- status = "Crossing log...";
- final RSTile log = new RSTile(2550, 3546);
- if (onTile(log, "Log balance", "Walk-across", 0.5, 0.4, 0))
- sleep(random(100, 200));
- camera.setAngle(random(1, 360));
- sleep(random(100, 300));
- mouse.move(random(50, 700), random(50, 450), 2, 2);
- sleep(random(200, 700));
- mouse.move(random(50, 700), random(50, 450), 2, 2);
- sleep(random(1300, 1600));
- while(players.getMyPlayer().isMoving() || playerInArea(2550, 3546, 2542, 3546))
- sleep(100);
- return;
- }
- private void doNet() {
- status = "Climbing up net...";
- final RSTile net = new RSTile(2538, 3546);
- final RSTile walkHere = new RSTile(2539, 3545);
- if (game.getPlane() == 0 && calc.distanceTo(new RSTile(2535, 3546)) <= 3) {
- camera.setCompass('w');
- walkTile(walkHere);
- sleep(random(500, 750));
- while(players.getMyPlayer().isMoving())
- sleep(100);
- return;
- }
- if (onTile(net, "Obstacle net", "Climb-over", random(0.51, 0.61), 0, 200))
- sleep(random(2000, 2700));
- antiban();
- while(players.getMyPlayer().getAnimation() == 828 || players.getMyPlayer().isMoving())
- sleep(100);
- return;}
- private void doLedge() {
- status = "Walking on ledge...";
- final RSTile ledge = new RSTile(2535, 3547);
- if (onTile(ledge, "Balancing ledge", "Walk-across", 0.5, 0.75, 0))
- sleep(random(200, 700));
- mouse.move(random(50, 700), random(50, 450), 2, 2);
- sleep(random(1400, 2000));
- while(players.getMyPlayer().isMoving() || (playerInArea(2535, 3547, 2532, 3547) && game.getPlane() == 1))
- sleep(100);
- return;
- }
- private void doLadder() {
- status = "Climbing ladder...";
- final RSTile ladder = new RSTile(2532, 3545);
- if (onTile(ladder, "Ladder", "Climb-down", 0.5, 0.6, 0))
- sleep(random(50, 200));
- camera.setAngle(random(1, 50));
- mouse.move(random(50, 700), random(50, 450), 2, 2);
- sleep(random(1000, 1400));
- while(players.getMyPlayer().isMoving() || players.getMyPlayer().getAnimation() == 827)
- sleep(100);
- return;
- }
- private void doWall() {
- status = "Climbing over wall...";
- if (players.getMyPlayer().isMoving())
- return;
- final RSTile wall1 = new RSTile(2537, 3553);
- final RSTile wall2 = new RSTile(2542, 3553);
- final RSTile walkHere = new RSTile(2536, 3553);
- if (!calc.tileOnScreen(wall1)) {
- camera.setCompass('e');
- //walkTile(walkHere);
- sleep(random(200, 300));
- return;
- }
- if (playerInArea(2542, 3554, 2538, 3553)) {
- if (onTile(wall2, "Crumbling wall", "Climb-over", 0.9, 0.5, 5))
- sleep(random(500, 1500));
- while(players.getMyPlayer().isMoving() || players.getMyPlayer().getAnimation() == 4853)
- sleep(100);
- return;
- }
- if (onTile(wall1, "Crumbling wall", "Climb-over", 0.9, 0.5, 5))
- sleep(random(200, 600));
- mouse.move(random(50, 700), random(50, 450), 2, 2);
- sleep(random(1000, 1100));
- while(players.getMyPlayer().isMoving() || players.getMyPlayer().getAnimation() == 4853)
- sleep(100);
- return;
- }
- private void startRunning(final int energy) {
- if (walking.getEnergy() >= energy && !walking.isRunEnabled()) {
- runEnergy = random(40, 95);
- walking.setRun(true);
- sleep(random(500, 750));
- }
- }
- private boolean playerInArea(int maxX, int maxY, int minX, int minY) {
- int x = players.getMyPlayer().getLocation().getX();
- int y = players.getMyPlayer().getLocation().getY();
- if (x >= minX && x <= maxX && y >= minY && y <= maxY)
- {
- return true;
- }
- return false;
- }
- public boolean eat() {
- status = "Eating...";
- int getHP = combat.getLifePoints();
- int RealHP = skills.getRealLevel(3) * 10;
- if (inventory.containsOneOf(food)) {
- if (getHP <= random(RealHP / 2.0, RealHP / 2.5)) {
- inventory.getItem(food).doAction("Eat");
- sleep(500, 1000);
- }
- }
- return false;
- }
- public boolean onTile(RSTile tile, String search, String action, double dx, double dy, int height) {
- if (!tile.isValid()) {
- return false;
- }
- Point checkScreen = null;
- checkScreen = calc.tileToScreen(tile, dx, dy, height);
- if (!calc.pointOnScreen(checkScreen)) {
- walkTile(tile);
- sleep(random(340, 1310));
- }
- try {
- Point screenLoc = null;
- for (int i = 0; i < 30; i++) {
- screenLoc = calc.tileToScreen(tile, dx, dy, height);
- if (!calc.pointOnScreen(screenLoc)) {
- return false;
- }
- if(menu.getItems().toString().toLowerCase().contains(search.toLowerCase())) {
- break;
- }
- if (mouse.getLocation().equals(screenLoc)) {
- break;
- }
- mouse.move(screenLoc);
- }
- screenLoc = calc.tileToScreen(tile, height);
- if (menu.getItems().length <= 1) {
- return false;
- }
- sleep(random(100, 200));
- if (menu.getItems().toString().toLowerCase().contains(action.toLowerCase())) {
- mouse.click(true);
- return true;
- } else {
- return menu.doAction(action);
- }
- } catch (Exception e) {
- e.printStackTrace();
- return false;
- }
- }
- private void walkTile(final RSTile tile) {
- if (!(calc.distanceTo(walking.getDestination()) <= random(4, 7))) {
- if (players.getMyPlayer().isMoving())
- return;
- }
- Point screen = calc.tileToScreen(tile);
- if (calc.pointOnScreen(screen)) {
- if (players.getMyPlayer().isMoving())
- return;
- mouse.move(screen, random(-3, 4), random(-3, 4));
- walking.walkTileOnScreen(tile);
- sleep(random(500, 750));
- return;
- } else {
- walking.walkTileMM(tile);
- sleep(random(500, 750));
- return;
- }
- }
- //*******************************************************//
- // ON FINISH
- //*******************************************************//
- public void onFinish() {
- }
- //*******************************************************//
- // PAINT SCREEN
- //*******************************************************//
- public void drawMouse(final Graphics g) {
- if (normal != null) {
- final double mouseX = mouse.getLocation().getX() - 8,
- mouseY = mouse.getLocation().getY() - 8;
- final double mousePressX = mouse.getPressLocation().getX() - 8,
- mousePressY = mouse.getPressLocation().getY() - 8;
- if (System.currentTimeMillis() - mouse.getPressTime() < 400) {
- g.drawImage(clicked, (int) mousePressX, (int) mousePressY, null);
- }
- g.drawImage(normal, (int) mouseX, (int) mouseY, null);
- }
- }
- public void drawStringShadow(final String text, final int x, final int y, final Graphics g) {
- g.setColor(Color.BLACK);
- g.drawString(text, x + 1, y + 1);
- g.setColor(Color.WHITE);
- g.drawString(text, x, y);
- }
- public void onRepaint(Graphics g) {
- long runTime = 0;
- long seconds = 0;
- long minutes = 0;
- long hours = 0;
- int laps = 0;
- int percent = 0;
- int currentXP = 0;
- int currentLVL = 0;
- int gainedXP = 0;
- int gainedLVL = 0;
- int lapsPerHour = 0;
- int expPerHour = 0;
- final double courseXP = 139.5;
- runTime = System.currentTimeMillis() - scriptStartTime;
- seconds = runTime / 1000;
- if ( seconds >= 60 ) {
- minutes = seconds / 60;
- seconds -= (minutes * 60);
- }
- if ( minutes >= 60 ) {
- hours = minutes / 60;
- minutes -= (hours * 60);
- }
- percent = skills.getPercentToNextLevel(Skills.AGILITY);
- currentXP = skills.getCurrentExp(Skills.AGILITY);
- currentLVL = skills.getCurrentLevel(Skills.AGILITY);
- gainedXP = currentXP - startXP;
- gainedLVL = currentLVL - startLvl;
- laps = (int) (gainedXP / courseXP);
- lapsPerHour = (int) ((3600000.0 / (double) runTime) * laps);
- expPerHour = (int) (3600000.0 / (double) runTime * gainedXP);
- drawMouse(g);
- drawStringShadow("Run Time: " + hours + ":" + minutes + ":" + seconds, 10, 40, g);
- drawStringShadow("Status: " + status, 10, 60, g);
- drawStringShadow("Total Laps: " + laps + " ( " + lapsPerHour + "/hr )", 10, 80, g);
- drawStringShadow("Current Lvl: " + currentLVL + " ( + " + gainedLVL + " )", 10, 100, g);
- drawStringShadow("Exp Gained: " + gainedXP + " ( " + expPerHour + "/hr )", 10, 120, g);
- drawStringShadow("Exp To Next Level: " + skills.getExpToNextLevel(Skills.AGILITY), 10, 140, g);
- try {
- if (expPerHour > 0) {
- long sTNL = (skills.getExpToNextLevel(Skills.AGILITY)) / (expPerHour / 3600);
- long hTNL = sTNL / (60 * 60);
- sTNL -= hTNL * (60 * 60);
- long mTNL = sTNL / 60;
- sTNL -= mTNL * 60;
- drawStringShadow("Level in: " + hTNL + ":" + mTNL + ":" + sTNL + " ( " + percent + "% )", 10, 160, g);
- } else {
- drawStringShadow("Level in: 0:0:0 ( " + percent + "% )", 10, 160, g);
- }
- } catch(Exception e) {
- drawStringShadow("Level in: -1:-1:-1 ( " + percent + "% )", 10, 160, g);
- }
- }
- }
Add Comment
Please, Sign In to add comment