Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * RsTra, iBlink, Nissan Nut.
- * 1.0 01/22/12 First user-made script for RuneDream
- * 1.1 01/23/12 Script sets itself up now
- * 1.2 01/24/12 Improved coordinate choosing
- * 2.0 02/17/12 Added user input for alching coordinates
- * 2.1 03/29/12 Added much more antiban and 2 failsafes
- */
- import java.awt.*;
- import java.awt.event.MouseEvent;
- import java.awt.event.MouseListener;
- import java.awt.image.BufferedImage;
- import java.io.IOException;
- import java.net.MalformedURLException;
- import java.net.URL;
- import javax.imageio.ImageIO;
- import org.runedream.api.Script;
- import org.runedream.api.ScriptManifest;
- import org.runedream.api.methods.*;
- import org.runedream.api.util.Log;
- import org.runedream.api.util.Random;
- @ScriptManifest(
- authors = { "Nissan Nut" },
- name = "Alcher",
- version = 2.1,
- description = "Simple Alcher Script",
- keywords = { "magic", "jbot", "alcher", "Nissan Nut"},
- language = { true, true, true, true })
- public class Alcher extends Script implements MouseListener{
- public long millis = 0;
- public long hours = 0;
- public long minutes = 0;
- public long seconds = 0;
- private long startTime = 0;
- private final Color silver = new Color(215, 215, 215);
- private final Color red = new Color(238, 255, 0);
- private final Color gray = new Color(52, 52, 52);
- private final Color green = new Color(156, 255, 0);
- private final BasicStroke stroke1 = new BasicStroke(1);
- private final Font font1 = new Font("Arial", 0, 9);
- private final Font font2 = new Font("Arial", 1, 10);
- private int xpGained = 0, alch = 0, alchHour = 0, xpHour = 0, FS1 = 0, FS2 = 0;
- private Point Alch, Item, p1, p2;
- private boolean SELECT1, SELECT2;
- BufferedImage normal = null;
- BufferedImage clicked = null;
- public boolean onStart(){
- startTime = System.currentTimeMillis();
- Inventory.open();
- FS2 = Inventory.getCount();
- Log.log("Inventory " + FS2 + "/28 full.");
- Mouse.click(Random.random(734, 759), Random.random(172, 201));
- /* Custom Courser */
- Log.log("Loading Custom Cursor...", red);
- try {
- final URL cursorURL = new URL(
- "http://www.upload.ee/image/2086209/n.png");
- final URL cursor80URL = new URL(
- "http://www.upload.ee/image/2086208/c.png");
- normal = ImageIO.read(cursorURL);
- clicked = ImageIO.read(cursor80URL);
- } catch (MalformedURLException e) {
- Log.log("Unable to buffer cursor.");
- } catch (IOException e) {
- Log.log("Unable to open cursor image.");
- }
- /* Alch Coordinates Setup */
- SELECT1 = true;
- Log.log("Please click in the middle of the high alch button.");
- while(SELECT1){
- Script.sleep(1000);
- }
- Mouse.click(p1);
- Log.log("Please click in the middle of the item you wish to alch.");
- SELECT2 = true;
- while(SELECT2){
- Script.sleep(1000);
- }
- Mouse.click(p2);
- Script.sleep(1500, 1700);
- alch++;
- return true;
- }
- @Override
- public int loop() {
- Mouse.setSpeed(Random.random(4, 7));
- Alch = new Point(p1.x + Random.random(-7, 7), p1.y + Random.random(-7, 7));
- Item = new Point(p2.x + Random.random(-10, 10), p2.y + Random.random(-10, 10));
- Mouse.click(Alch);
- Script.sleep(210, 320);
- Mouse.click(Item);
- alch++;
- Script.sleep(1510, 1720);
- /* Failsafe */
- if (Inventory.isOpen()){
- FS1++;
- alch--;
- }else{
- FS1 = 0;
- }
- if (FS1 == 3){
- Mouse.click(Random.random(734, 759), Random.random(172, 201));
- Log.log("Failsafe 1: Lag/Misclick", red);
- }
- if (Inventory.isOpen() && Inventory.getCount() < FS2){
- Log.log("Failsafe 2: Out of runes/items, Script Stopped", green);
- return - 1;
- }
- antiban();
- return (Random.random(100, 200));
- }
- private boolean PointInRect(Point POINT, Rectangle RECT) {
- if (POINT.x >= RECT.x && POINT.x <= (RECT.x + RECT.width) && POINT.y >= RECT.y && POINT.y <= (RECT.y + RECT.height)) {
- return true;
- }
- return false;
- }// Credits to iBlink, he wrote this.
- @Override
- public void onRepaint(Graphics g1) {
- Graphics2D g = (Graphics2D) g1;
- millis = System.currentTimeMillis() - startTime;
- hours = millis / (1000 * 60 * 60);
- millis -= hours * (1000 * 60 * 60);
- minutes = millis / (1000 * 60);
- millis -= minutes * (1000 * 60);
- seconds = millis / 1000;
- xpGained = (int) (alch*65);
- if (1200 < ((alch) * 3600000D / (System.currentTimeMillis() - startTime))){
- alchHour = 1200;
- }else{
- alchHour = (int) ((alch) * 3600000D / (System.currentTimeMillis() - startTime));
- }
- xpHour = (int) (alchHour*65);
- if (SELECT1){
- g.setColor(silver);
- g.fillRect(551, 181, 181, 12);
- g.setColor(red);
- g.setStroke(stroke1);
- g.drawRect(551, 181, 181, 12);
- g.setFont(font1);
- g.setColor(gray);
- g.drawString("Click in the middle of the high alch button.", 553, 192);
- }else if (SELECT2){
- g.setColor(silver);
- g.fillRect(551, 181, 181, 12);
- g.setColor(red);
- g.setStroke(stroke1);
- g.drawRect(551, 181, 181, 12);
- g.setFont(font1);
- g.setColor(gray);
- g.drawString("Click in the middle of item to alch.", 571, 192);
- }
- g.setColor(green);
- g.fillRoundRect(7, 260, 118, 71, 16, 16);
- g.setColor(gray);
- g.setStroke(stroke1);
- g.drawRoundRect(7, 260, 118, 71, 16, 16);
- g.setFont(font2);
- g.drawString("Alcher by Nissan Nut", 12, 270);
- g.setFont(font2);
- g.drawString("Runtime: " + hours +":"+ minutes + ":" + seconds, 12, 282);
- g.drawString("Alchs: " + alch + "±", 12, 294);
- g.drawString("Alchs/Hour: " + alchHour, 12, 306);
- g.drawString("XP Gained: " + xpGained + "±", 12, 318);
- g.drawString("XP/Hour: " + xpHour, 12, 330);
- if (normal != null) {
- final int xPos = Mouse.getLocation().x;
- final int yPos = Mouse.getLocation().y;
- final int xPos2 = Mouse.getPressLocation().x;
- final int yPos2 = Mouse.getPressLocation().y;
- final long mpt = System.currentTimeMillis()
- - Mouse.getPressTime();
- if (Mouse.getPressTime() == -1 || mpt >= 1000) {
- g.drawImage(normal, xPos - 8, yPos - 8, null);
- }
- if (mpt < 1000) {
- g.drawImage(clicked, xPos2 - 8, yPos2 - 8, null);
- g.drawImage(normal, xPos - 8, yPos - 8, null);
- }
- }//Credits to RsTra from powerbot.
- }
- private void antiban() {
- switch (Random.random(1, 200)){
- case 1:
- Mouse.moveOffScreen();
- Script.sleep(1000, 5000);
- if (Random.random(1, 3) == 1)
- Script.sleep(1000, 12000);
- Log.log("Antiban: 1");
- break;
- case 2:
- Mouse.moveSlightly();
- Log.log("Antiban: 2");
- break;
- case 3:
- Camera.pitchDown(Random.random(0, 400));
- Camera.pitchUp(Random.random(0, 500));
- Log.log("Antiban: 3");
- break;
- case 4:
- Inventory.open();
- Script.sleep(100, 500);
- Mouse.moveSlightly();
- Script.sleep(1000, 5000);
- Mouse.click(Random.random(734, 759), Random.random(170, 203));//Magic tab
- Script.sleep(100, 500);
- Log.log("Antiban: 4");
- break;
- case 5:
- Script.sleep(1000, 5000);
- Log.log("Antiban: 5");
- break;
- case 6:
- Mouse.click(Random.random(582, 612), Random.random(170, 203));//Skills tab
- Script.sleep(100, 500);
- Mouse.move(Random.random(545, 737), Random.random(206, 466));
- Script.sleep(1000, 5000);
- Mouse.click(Random.random(734, 759), Random.random(170, 203));//Magic tab
- Log.log("Antiban: 6");
- break;
- case 7:
- Mouse.click(Random.random(582, 612), Random.random(170, 203));//Skills tab
- Script.sleep(100, 500);
- Mouse.move(Random.random(545, 737), Random.random(206, 466));
- Script.sleep(1000, 5000);
- Mouse.moveSlightly();
- Script.sleep(1000, 5000);
- Mouse.click(Random.random(734, 759), Random.random(170, 203));//Magic tab
- Script.sleep(100, 500);
- Log.log("Antiban: 7");
- break;
- case 8:
- for (int i=0; i<Random.random(1, 4); i++){
- if (Random.random(1, 10) == 1)
- Camera.rotateLeft(Random.random(100, 1000));
- if (Random.random(1, 10) == 1)
- Camera.rotateRight(Random.random(100, 1000));
- if (Random.random(1, 10) == 1)
- Camera.pitchDown(Random.random(100, 1000));
- if (Random.random(1, 10) == 1)
- Camera.pitchUp(Random.random(100, 1000));
- if (Random.random(1, 100) == 1)
- Game.clickCompass();
- }
- Log.log("Antiban: 8");
- break;
- case 9:
- Mouse.moveSlightly();
- Script.sleep(1000, 5000);
- Mouse.moveSlightly();
- Log.log("Antiban: 9");
- break;
- case 10:
- Mouse.click(Random.random(522, 761), Random.random(170, 203));//Random tab
- Script.sleep(100, 800);
- Mouse.move(Random.random(545, 737), Random.random(206, 466));
- Script.sleep(1000, 4000);
- Mouse.click(Random.random(734, 759), Random.random(170, 203));//Magic tab
- Script.sleep(0, 200);
- Log.log("Antiban: 10");
- break;
- case 11:
- Script.sleep(0, 300);
- Log.log("Antiban: 11");
- break;
- case 12:
- Script.sleep(0, 1000);
- Mouse.moveSlightly();
- Log.log("Antiban: 12");
- break;
- }
- }
- @Override
- public void onStop(){
- Log.log("Runtime: " + hours +":"+ minutes + ":" + seconds);
- Log.log("Alchs: "+ alch + "±");
- Log.log("Alchs/Hour: "+ alchHour);
- Log.log("XP Gained: "+ xpGained + "±");
- Log.log("XP/Hour: "+ xpHour);
- }
- @Override
- public void mouseClicked(MouseEvent e) {
- if (PointInRect(e.getPoint(), Inventory.BOUNDS) && SELECT1) {
- p1 = e.getPoint();
- SELECT1 = false;
- Log.log("Selected Alch location");
- }
- if (PointInRect(e.getPoint(), Inventory.BOUNDS) && SELECT2) {
- p2 = e.getPoint();
- SELECT2 = false;
- Log.log("Selected Item location");
- }
- }
- public void mouseEntered(MouseEvent e) {}
- public void mouseExited(MouseEvent e) {}
- public void mousePressed(MouseEvent e) {}
- public void mouseReleased(MouseEvent e) {}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement