Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.Color;
- import java.awt.Graphics;
- import java.awt.Graphics2D;
- import java.awt.Image;
- import java.awt.RenderingHints;
- import org.rsbot.script.Script;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.methods.Skills;
- import org.rsbot.script.wrappers.RSObject;
- import org.rsbot.script.wrappers.RSTile;
- import org.rsbot.script.wrappers.RSArea;
- import java.awt.event.KeyEvent;
- import java.io.IOException;
- import java.net.URL;
- import javax.imageio.ImageIO;
- import javax.swing.JOptionPane;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.script.methods.Game;
- @ScriptManifest(authors = "Maze2234", name = "GateStone Maker", version = 2.52, description = "Creates gatestones within daemonheim for magic experience.")
- public class GateStones extends Script implements PaintListener {
- //Variables_______________________________________________________________________
- private int startExp;
- private int gainedExp;
- private int startLvl;
- private int gainedLvls;
- private int currentLevel;
- private int percentLevel;
- private int mouseSpeed = 1;
- private int[] dungLadderID = {51156, 50604, 51704, 54675};
- private int ExpHour = 0;
- private long startTime;
- private long runTime;
- private long expLevel;
- private boolean checkedSkill = false;
- private final Image gateStone = getImage("http://rs2basic.webs.com/Images/Gatestone%20(Main).PNG");
- //Voids & Booleans________________________________________________________________
- //Locations and Walking
- private boolean outSide(){
- RSArea area = new RSArea(new RSTile(3445, 3718), new RSTile(3472, 3729));
- return area.contains(getMyPlayer().getLocation());
- }
- //Clicking Objects
- private void clickDoor() {
- antiBan();
- if (objects.getNearest(48496) != null) {
- if (!interfaces.get(236).isValid() && !interfaces.get(210).isValid()) {
- if (!interfaces.get(947).isValid() && !interfaces.get(938).isValid()) {
- RSObject dungDoor = objects.getNearest(48496);
- RSTile doorLocation = objects.getNearest(48496).getLocation();
- if (!dungDoor.isOnScreen() && doorLocation != null) {
- walking.walkTileOnScreen(doorLocation);
- camera.turnTo(dungDoor);
- //web.getWeb(getMyPlayer().getLocation(), doorLocation).step();
- sleep(random(1200, 1400));
- }
- if (dungDoor.isOnScreen()) {
- dungDoor.doHover();
- sleep(random(50, 100));
- if (menu.contains("Climb-down")) {
- mouse.click(true);
- sleep(random(1200, 1600));
- }
- }
- }
- }
- }
- }
- private void clickLadder() {
- antiBan();
- if (objects.getNearest(dungLadderID) != null) {
- if (!interfaces.get(236).isValid() && !interfaces.get(211).isValid()) {
- RSObject dungLadder = objects.getNearest(dungLadderID);
- RSTile ladderLocation = objects.getNearest(dungLadderID).getLocation();
- if (!dungLadder.isOnScreen() && ladderLocation != null) {
- walking.walkTileOnScreen(ladderLocation);
- camera.turnTo(dungLadder);
- //web.getWeb(getMyPlayer().getLocation(), ladderLocation).step();
- sleep(random(1200, 1400));
- }
- if (dungLadder.isOnScreen()) {
- dungLadder.doHover();
- sleep(random(50, 100));
- if (menu.contains("Climb-up")) {
- mouse.click(true);
- sleep(random(1500, 1800));
- }
- }
- }
- }
- }
- private void clickStairs() {
- antiBan();
- if (objects.getNearest(50552) != null && getMyPlayer().getAnimation() != 13760) {
- RSObject dungStairs = objects.getNearest(50552);
- RSTile stairLocation = objects.getNearest(50552).getLocation();
- if (!dungStairs.isOnScreen() && stairLocation != null) {
- walking.walkTileOnScreen(stairLocation);
- camera.turnTo(dungStairs);
- //web.getWeb(getMyPlayer().getLocation(), stairLocation).step();
- sleep(random(1200, 1400));
- }
- if (dungStairs.isOnScreen()) {
- dungStairs.doHover();
- sleep(random(50, 100));
- if (menu.contains("Jump-down")) {
- mouse.click(true);
- sleep(random(500, 800));
- }
- }
- }
- }
- //Exploring Interfaces
- private void formParty() {
- antiBan();
- if (interfaces.get(210).getComponent(2).isValid()) {
- mouse.setSpeed(mouseSpeed + random(0, 5));
- interfaces.get(210).getComponent(2).doClick();
- sleep(random(300, 400));
- }
- if (interfaces.get(236).getComponent(1).isValid()) {
- mouse.setSpeed(mouseSpeed + random(0, 5));
- interfaces.get(236).getComponent(1).doClick();
- sleep(random(300, 400));
- }
- }
- private void setDifficulty() {
- antiBan();
- if (interfaces.get(947).getComponent(761).isValid()) {
- mouse.setSpeed(mouseSpeed + random(0, 5));
- interfaces.get(947).getComponent(761).doClick();//change floor (finish)
- sleep(random(200, 400));
- }
- if (interfaces.get(938).getComponent(39).isValid()) {
- mouse.setSpeed(mouseSpeed + random(0, 5));
- interfaces.get(938).getComponent(39).doClick();//change complexity (finish)
- sleep(random(200, 400));
- }
- }
- private void setSize() {
- if (interfaces.get(236).getComponent(1).isValid()) {
- mouse.setSpeed(mouseSpeed + random(0, 5));
- interfaces.get(236).getComponent(1).doClick();//size (small)
- }
- }
- private void makeStones() {
- if (inventory.contains(17489)) {
- antiBan();
- mouse.setSpeed(mouseSpeed + random(0, 3));
- inventory.getItem(17489).doAction("Drop");
- keyboard.pressKey((char) KeyEvent.VK_F4);
- sleep(random(75, 100));
- keyboard.releaseKey((char) KeyEvent.VK_F4);
- mouse.setSpeed(mouseSpeed + random(0, 3));
- interfaces.get(950).getComponent(38).doAction("Quick-cast");//make gatestone
- sleep(random(650, 750));
- keyboard.pressKey((char) KeyEvent.VK_F1);
- sleep(random(75, 100));
- keyboard.releaseKey((char) KeyEvent.VK_F1);
- } else if (!inventory.contains(17489)) {
- keyboard.pressKey((char) KeyEvent.VK_F4);
- sleep(random(75, 100));
- keyboard.releaseKey((char) KeyEvent.VK_F4);
- mouse.setSpeed(mouseSpeed + random(0, 3));
- interfaces.get(950).getComponent(38).doAction("Quick-cast");//make gatestone
- keyboard.pressKey((char) KeyEvent.VK_F1);
- sleep(random(75, 100));
- keyboard.releaseKey((char) KeyEvent.VK_F1);
- sleep(random(650, 750));
- }
- }
- private void leaveDung() {
- clickLadder();
- antiBan();
- if (interfaces.get(211).getComponent(3).isValid()) {
- mouse.setSpeed(mouseSpeed + random(0, 5));
- interfaces.get(211).getComponent(3).doClick();//Leave party (Continue)
- sleep(random(800, 1000));
- }
- if (interfaces.get(236).getComponent(1).isValid()) {
- mouse.setSpeed(mouseSpeed + random(0, 5));
- interfaces.get(236).getComponent(1).doClick();//Leave party (Yes)
- }
- }
- //Other
- @Override
- public boolean onStart(){
- startExp = skills.getCurrentExp(Skills.MAGIC);
- startLvl = skills.getRealLevel(Skills.MAGIC);
- startTime = System.currentTimeMillis();
- log("Welcome to Maze's GateStone maker.");
- Object[] options = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10"};
- mouseSpeed = (int)JOptionPane.showOptionDialog(null, "Choose the mouse speed for the script: \n" + "(1 being the fastest)",
- "GateStones",JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, 1);
- return true;
- }
- @Override
- public void onFinish(){
- log("Thanks for using Maze's Gatestone maker.");
- log("You gained "+ (gainedExp) +" experiance and "+ gainedLvls +" magic levels.");
- env.saveScreenshot(true);
- sleep(500);
- }
- private String formatTime(final long time) {
- final int sec = (int) (time / 1000), h = sec / 3600, m = sec / 60 % 60, s = sec % 60;
- return (h < 10 ? "0" + h : h) + ":" + (m < 10 ? "0" + m : m) + ":"
- + (s < 10 ? "0" + s : s);
- }
- private Image getImage(String url) {
- try {
- return ImageIO.read(new URL(url));
- } catch (IOException e) {
- return null;
- }
- }
- private void antiBan() {
- int antiBan = random(1, 80);
- mouse.setSpeed(mouseSpeed + random(3, 7));
- switch (antiBan) {
- case 3:
- camera.moveRandomly(1000);
- sleep(random(300, 500));
- break;
- case 5:
- camera.setPitch(random(1, 100));
- sleep(random(300, 500));
- break;
- case 7:
- camera.setAngle(random(50, 500));
- sleep(random(300, 500));
- break;
- case 10:
- RSTile turnTo = new RSTile(getMyPlayer().getLocation().getX() + random(-5, 5), getMyPlayer().getLocation().getY() + random(-5, 5), getMyPlayer
- ().getLocation().getZ());
- if (turnTo != null) {
- camera.turnTo(turnTo, random(0, 10));
- sleep(random(300, 500));
- }
- break;
- case 15:
- mouse.moveSlightly();
- sleep(random(50, 300));
- break;
- case 20:
- if (random(1, 8) == 2) {
- mouse.moveOffScreen();
- sleep(random(1000, 10000));
- }
- break;
- case 25:
- if (random(1, 6) == 3) {
- game.openTab(Game.TAB_STATS);
- sleep(random(3000, 5000));
- }
- break;
- case 30:
- if (random(1, 10) == 4) {
- RSTile walkTo = new RSTile(getMyPlayer().getLocation().getX() + random(-5, 5), getMyPlayer().getLocation().getY() + random(1, 5),
- getMyPlayer().getLocation().getZ());
- if (walkTo != null){
- walking.walkTileOnScreen(walkTo);
- sleep(random(1000, 3000));
- }
- }
- break;
- default:
- break;
- }
- }
- //LOOP____________________________________________________________
- @Override
- public int loop() {
- if(game.isLoggedIn() && getMyPlayer().isOnScreen()) {
- //Starting a party
- if(game.getPlane() == 0 && outSide()) {
- clickDoor();
- formParty();
- clickDoor();
- setDifficulty();
- setSize();
- }
- if (!outSide() && game.getPlane() == 0) {
- //Making gatestones
- if (inventory.getCount(true, 16100) >= 3) {
- if(inventory.contains(16845) == true)
- {
- mouse.click(580,265,5,1,false);
- sleep(55,75);
- mouse.click(580,342,5,1,true);
- }
- makeStones();
- }
- //Leaving Dungeon
- if (inventory.getCount(true, 16100) <=2 && inventory.getCount(true, 16100) != -1 || inventory.getCount(true, 16100) == -1) {
- leaveDung();
- }
- }
- if (game.getPlane() == 1) {
- mouse.setSpeed(mouseSpeed + random(0, 6));
- clickStairs();
- }
- }
- return 0;
- }
- //Paint____________________________________________________
- @Override
- public void onRepaint(Graphics g1) {
- if(game.isLoggedIn()) {
- final Graphics2D g2 = (Graphics2D) g1;
- g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
- RenderingHints.VALUE_ANTIALIAS_ON);
- currentLevel = skills.getRealLevel(Skills.MAGIC);
- gainedLvls = skills.getRealLevel(Skills.MAGIC) - startLvl;
- gainedExp = skills.getCurrentExp(Skills.MAGIC) - startExp;
- expLevel = skills.getExpToNextLevel(Skills.MAGIC);
- ExpHour = (int) ((3600000.0 / (double) runTime) * gainedExp);
- runTime = System.currentTimeMillis() - startTime;
- percentLevel = skills.getPercentToNextLevel(Skills.MAGIC);
- g2.setColor(Color.BLUE);
- g2.drawImage(gateStone, 2, 138, null);
- g2.drawString("By: Maze2234", 77, 215);
- g2.setColor(Color.BLACK);
- g2.drawString("Level: " + currentLevel + " (" + gainedLvls + ")", 80, 245);
- if (gainedExp /1000 <= 0) {
- g2.drawString("Gained: " + (gainedExp) + " (" + (ExpHour / 1000) + "K Xp/h)", 57, 260);
- } else if (gainedExp / 1000 >= 1) {
- g2.drawString("Gained: " + (gainedExp) / 1000 + "K " + " (" + (ExpHour / 1000) + "K Xp/h)", 57, 260);
- } else if (gainedExp / 1000000 >= 1) {
- g2.drawString("Gained: " + (gainedExp) / 1000000 + "M (WOW, Post a prog)" + " (" + (ExpHour / 1000) + "K Xp/h)", 57, 260);
- }
- if (expLevel /1000 <= 0) {
- g2.drawString("To Level: " + expLevel, 70, 275);
- } else if (expLevel /1000 >= 1) {
- g2.drawString("To Level: " + expLevel / 1000 + "K", 70, 275);
- } else if (expLevel /1000000 >= 1) {
- g2.drawString("To Level: " + expLevel / 1000000 + "M", 70, 275);
- }
- if(ExpHour != 0 && gainedExp >= 2000){
- float timeTNLhour = 0;
- timeTNLhour = (float) expLevel/(float)ExpHour;
- float timeTNLmin = timeTNLhour*60;
- float timeTNLsec = timeTNLmin*60;
- int estimatedHour = (int) (timeTNLsec/3600);
- float tempminutes = timeTNLsec%3600;
- int estimatedMinutes = (int) (tempminutes/60);
- int estimatedSeconds = (int) (tempminutes%60);
- if (estimatedMinutes < 10 && estimatedSeconds < 10) {
- g2.drawString("Time to Level: " + estimatedHour + ":0" + estimatedMinutes + ":0" + estimatedSeconds, 55, 290);
- } else if (estimatedMinutes > 10 && estimatedSeconds < 10) {
- g2.drawString("Time to Level: " + estimatedHour + ":" + estimatedMinutes + ":0" + estimatedSeconds, 55, 290);
- } else if (estimatedMinutes < 10 && estimatedSeconds > 10) {
- g2.drawString("Time to Level: " + estimatedHour + ":0" + estimatedMinutes + ":" + estimatedSeconds, 55, 290);
- } else {
- g2.drawString("Time to Level: " + estimatedHour + ":" + estimatedMinutes + ":" + estimatedSeconds, 55, 290);
- }
- } else if (ExpHour == 0 || gainedExp <= 5000) {
- g2.drawString("Time to Level: N/A", 62, 290);
- }
- g2.drawString("Run Time: " + formatTime(runTime), 60, 320);
- g2.setColor(Color.BLACK);
- g2.fillRect(65, 330, 100, 4);
- g2.setColor(Color.GREEN);
- g2.fillRect(63, 330, percentLevel, 4);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement