Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.Color;
- import java.awt.Font;
- import java.awt.Graphics;
- import java.awt.Image;
- import java.awt.Point;
- import java.awt.event.MouseEvent;
- import java.awt.event.MouseListener;
- import java.io.IOException;
- import java.net.URL;
- import java.util.List;
- import javax.imageio.ImageIO;
- import org.runedream.api.Script;
- import org.runedream.api.ScriptManifest;
- import org.runedream.api.methods.Bank;
- import org.runedream.api.methods.Camera;
- import org.runedream.api.methods.Game;
- import org.runedream.api.methods.ImageUtil;
- import org.runedream.api.methods.Mouse;
- import org.runedream.api.util.Log;
- import org.runedream.api.util.Random;
- @ScriptManifest(
- authors = { "TheBat"},
- name = "BatFireRunes",
- version = 0.9,
- description = "Crafts Fire Runes.",
- keywords = {},
- language = { true, true, true, true })
- public class BatFireRunes extends Script implements MouseListener{
- //color points for the runecrafting alter symbol
- private static final Color RCSA = new Color(246,183,1);
- private static final Color RCSB = new Color(89,84,84);
- private static final Point distRCS = new Point(2,-5);
- //color points for the mysterious ruins
- private static final Color ChestA = new Color(108,104,104);
- private static final Color ChestB = new Color(98,94,94);
- private static final Color ChestC = new Color(89,86,85);
- private static final Point ChestAB = new Point(-21,-13);
- private static final Point ChestAC = new Point(-18,-35);
- //color points for the bank symbol
- private static final Color tourchesA = new Color(215,121,50);
- private static final Color tourchesB = new Color(212,119,54);
- private static final Point tourchesAB = new Point(-282,-3);
- //color points for the first walking spot
- private static final Color WS1A = new Color(70,53,17);
- private static final Color WS1B = new Color(234,243,243);
- private static final Point distWS1 = new Point(12,0);
- //color points for the second walking spot
- private static final Color WS3A = new Color(74,109,58);
- private static final Color WS3B = new Color(71,53,22);
- private static final Point distWS3 = new Point(-9,3);
- //color points for the mysterious ruins
- private static final Color MystRuinA = new Color(253,126,76);
- private static final Color MystRuinB = new Color(248,124,75);
- private static final Color MystRuinC = new Color(253,126,76);
- private static final Point MystRuinAB = new Point(-30,15);
- private static final Point MystRuinAC = new Point(-8,30);
- //color points for the swords by the banker
- private static final Color SwordsA = new Color(185,183,27);
- private static final Color SwordsB = new Color(178,154,26);
- private static final Color SwordsC = new Color(186,184,27);
- private static final Point SwordsAB = new Point(8,-10);
- private static final Point SwordsAC = new Point(-1,-7);
- //color points for the exit portal
- private static final Color portA = new Color(170,49,28);
- private static final Color portB = new Color(196,49,29);
- private static final Color portC = new Color(175,49,29);
- private static final Point portAB = new Point(-12,-22);
- private static final Point portAC = new Point(-26,-5);
- //Class variables
- private static int RUNS = 0;
- private static double TIME = 0;
- private static Image pic = null;
- private static String status = "";
- private StaminaChecker staminaCheck = new StaminaChecker();
- public static int walkmod = 1;
- public static int levelGained = 0;
- private boolean showPaint = true;
- private Point pt3 = new Point();
- private Point pt4 = new Point();
- private int templvls = levelGained;
- private boolean first = false;
- private LevelUpCheck levelUpCheck = new LevelUpCheck();
- /**
- * Actions to be performed when the script starts up.
- */
- public boolean onStart(){
- try {
- pic = ImageIO.read(new URL("http://i1024.photobucket.com/albums/y308/dudebrosick/Fire_rune_detail.png"));
- } catch (IOException e) {
- }
- Mouse.setSpeed(Random.random(8, 11));
- TIME = System.currentTimeMillis();
- Game.clickCompass();
- Camera.pitchUp(1000);
- if (!Game.getOpenTab().equals("Inventory")) {
- Mouse.click(Random.random(642, 670), Random.random(170, 200)); //returns to inventory tab
- }
- staminaCheck.start();
- status = "Finding bank";
- return true;
- }
- /**
- * The main loop
- */
- public int loop() {
- Mouse.setSpeed(Random.random(6, 9));
- if(status.equals("Crafting runes")){
- levelUpCheck = new LevelUpCheck();
- }
- double timeOut = 0;
- double timeOut1 = 0;
- if(status.equals("Finding bank")){
- timeOut = System.currentTimeMillis();
- while(!bankIsOpen()){
- if(first){
- if(Random.random(0, 10) <= 1){
- status = "Antiban";
- antiban();
- first = false;
- return 1000;
- }
- }
- int trys = 0;
- while((pt3 = findItemThreePoint(SwordsA, SwordsB, SwordsC, SwordsAB, SwordsAC, 20, new Point(3,3), new Point(512,332))).equals(new Point(-1,-1))){
- sleep(600,700);
- if(trys==3){
- int x = Random.random(256,270);
- int y = Random.random(136,150);
- Mouse.click(x,y);
- sleep(500,600);
- if(checkColor(new Color (28,28,28), new Point(x,y), 10)){
- Mouse.click(x,y+ Random.random(21,32));
- }
- trys = 3;
- return 1000;
- }
- trys++;
- if(System.currentTimeMillis() - timeOut > 9000)return 1000;
- }
- timeOut = System.currentTimeMillis();
- while((pt4 = findItemThreePoint(ChestA, ChestB, ChestC, ChestAB, ChestAC, 20, new Point(pt3.x-15,pt3.y), new Point(pt3.x+35,pt3.y+70))).equals(new Point(-1,-1))){
- sleep(walkmod * 800,walkmod * 1000);
- if(System.currentTimeMillis() - timeOut > 9000)return 1000;
- }
- timeOut1 = System.currentTimeMillis();
- if(!bankIsOpen()){
- Mouse.click(pt4.x+10,pt4.y+10);
- sleep(400,500);
- }else
- break;
- if(!bankIsOpen()){
- Mouse.click(pt4.x+10, (pt4.y+10 + Random.random(21,32)));
- sleep(100,200);
- Mouse.move(Random.random(0,765), Random.random(0,502));
- sleep(walkmod * 900,walkmod * 1000);
- }else
- break;
- sleep(2000);
- if(System.currentTimeMillis() - timeOut1 > 9000)return 1000;
- }
- first = true;
- status = "Banking";
- return 1000;
- }
- if(status.equals("Banking")){
- if(bankIsOpen()){
- int x = Random.random(50, 60);
- int y = Random.random(100, 110);
- Bank.depositAll();
- sleep(500,700);
- Mouse.click(x,y);
- sleep(500,700);
- Mouse.click(x, (y + Random.random(103,126)));
- sleep(500,700);
- Mouse.move(489,30);
- if(Mouse.getLocation()!= new Point(489,30)) Mouse.move(489,30);
- sleep(200,300);
- Mouse.click();
- sleep(100,200);
- Mouse.move(Random.random(0,765), Random.random(0,502));
- sleep(400,500);
- }
- status = "Walking to ruins";
- return 1000;
- }
- if(status.equals("Walking to ruins")){
- // walks until it finds the RC symbol
- Point pt4 = new Point();
- timeOut = System.currentTimeMillis();
- while((pt4 = findItemTwoPoint(RCSA, RCSB, distRCS, 4, new Point(522,3), new Point(705,164))).equals(new Point(-1,-1))){
- Mouse.click(Random.random(560,590),Random.random(81,88));
- sleep(walkmod * 1000, walkmod * 1200);
- if(System.currentTimeMillis() - timeOut > walkmod * 36000)return 1000;
- }
- Mouse.click(pt4);
- sleep(100,200);
- Mouse.move(Random.random(0,765), Random.random(0,502));
- sleep(walkmod * 2000);
- Mouse.move(Random.random(0,765), Random.random(0,502));
- //AntiBan
- if(Random.random(0, 10) <= 5)
- Camera.rotateLeft(Random.random(500,1200));
- else
- Camera.rotateRight(Random.random(500,1200));
- Mouse.move(Random.random(0,765), Random.random(0,502));
- sleep(walkmod * 5000);
- Mouse.move(Random.random(0,765), Random.random(0,502));
- sleep(walkmod * 3000);
- Mouse.move(Random.random(0,765), Random.random(0,502));
- sleep(walkmod * 4000);
- Mouse.move(Random.random(0,765), Random.random(0,502));
- status = "Entering ruins";
- return 1000;
- }
- if(status.equals("Entering ruins")){
- //Enters ruins
- int trys = 0;
- Point pt1 = new Point();
- timeOut = System.currentTimeMillis();
- timeOut1 = System.currentTimeMillis();
- while((pt1 = findItemThreePoint(MystRuinA, MystRuinB, MystRuinC, MystRuinAB, MystRuinAC, 4)).equals(new Point(-1,-1))){
- sleep(200,300);
- if(trys == 3){
- Point pn = findItemTwoPoint(RCSA, RCSB, distRCS, 4, new Point(522,3), new Point(705,164));
- Mouse.click(pn.x +2, pn.y);
- if(Random.random(0, 10) <= 5)
- Camera.rotateLeft(Random.random(500,1200));
- else
- Camera.rotateRight(Random.random(500,1200));
- }
- trys++;
- if(System.currentTimeMillis() - timeOut > 9000)return 1000;
- }
- sleep(200,300);
- Mouse.click(pt1);
- sleep(400,500);
- Mouse.click(pt1.x, (pt1.y + Random.random(21,32)));
- sleep(100,200);
- Mouse.move(Random.random(0,765), Random.random(0,502));
- sleep(3000,4000);
- boolean portFound = false;
- for(int i = 0;i < 25;i++){
- if(!(findItemTwoPoint(portA, portB, portAB, 10, new Point(3,3), new Point(512,332)).equals(new Point(-1,-1)))) {
- portFound = true;
- break;
- }
- sleep(2);
- }
- if(portFound)status = "Crafting runes";
- return 1000;
- }
- if(status.equals("Crafting runes")){
- Game.clickCompass();
- Camera.pitchUp(700);
- Mouse.click(658,117);
- //Mouse.click(653, 114);
- sleep(100,200);
- Mouse.move(Random.random(0,765), Random.random(0,502));
- sleep(walkmod * 4000,walkmod * 4200);
- Point pt = new Point (336,199);
- timeOut = System.currentTimeMillis();
- while((pt = findItemTwoPoint(tourchesA, tourchesB, tourchesAB, 20, new Point(3,3), new Point(512,332))).equals(new Point(-1,-1))){
- if(System.currentTimeMillis() - timeOut > walkmod * 36000)return 1000;
- }
- pt = new Point (pt.x,pt.y+20);
- Mouse.click(pt);
- sleep(400,500);
- levelUpCheck.start();
- Mouse.click(pt.x,pt.y + Random.random(21,32));
- sleep(100,200);
- Mouse.move(Random.random(0,765), Random.random(0,502));
- sleep(3000);
- status = "Exiting ruins";
- return 1000;
- }
- if(status.equals("Exiting ruins")){
- Mouse.click(Random.random(587,609), Random.random(55,72));
- sleep(walkmod * 4500);
- Point pt2 = new Point();
- while((pt2 = findItemThreePoint(portA, portB, portC, portAB, portAC, 4)).equals(new Point(-1,-1))){
- }
- sleep(200,300);
- Mouse.click(pt2);
- sleep(400,500);
- Mouse.click(pt2.x, (pt2.y + Random.random(21,32)));
- sleep(100,200);
- Mouse.move(Random.random(0,765), Random.random(0,502));
- sleep(4000);
- try{
- levelUpCheck.interrupt();
- }catch(IllegalThreadStateException e){}
- //Antiban => checks levels if you get a lvl up.
- if(templvls < levelGained){
- status = "Checking new Abilities";
- Mouse.click(Random.random(590, 604),Random.random(177, 196));
- sleep(300,500);
- int x = Random.random(560, 600);
- int y = Random.random(385, 397);
- Mouse.click(x,y);
- sleep(300,500);
- Mouse.click(x,y + Random.random(21,32));
- sleep(400,500);
- Mouse.click(Random.random(216, 715),Random.random(128, 435));
- sleep(600,1000);
- Mouse.scroll(Random.random(7,12), false);
- sleep(100,200);
- Mouse.move(Random.random(0,765), Random.random(0,502));
- sleep(1000,2000);
- Mouse.move(Random.random(0,765), Random.random(0,502));
- sleep(100,200);
- Mouse.move(Random.random(0,765), Random.random(0,502));
- sleep(3000,5000);
- Mouse.click(Random.random(740, 743),Random.random(20, 24));
- sleep(300,500);
- Mouse.click(Random.random(642, 670), Random.random(170, 200)); //returns to inventory tab
- }
- boolean ruins = false;
- for(int i = 0;i < 25;i++){
- if(!(findItemTwoPoint(MystRuinA, MystRuinB, MystRuinAB, 4, new Point(3,3), new Point(512,332)).equals(new Point(-1,-1)))) {
- ruins = true;
- break;
- }
- sleep(2);
- }
- if(ruins)status = "Walking back";
- return 1000;
- }
- if(status.equals("Walking back")){
- Point lp = findItemTwoPoint(WS1A, WS1B, distWS1, 5, new Point(522,3), new Point(705,164));
- Mouse.click(lp.x+2,lp.y);
- sleep(100,200);
- Mouse.move(Random.random(0,765), Random.random(0,502));
- sleep(walkmod * 3000);
- sleep(100,200);
- Mouse.move(Random.random(0,765), Random.random(0,502));
- sleep(walkmod * 2000);
- sleep(100,200);
- Mouse.move(Random.random(0,765), Random.random(0,502));
- sleep(walkmod * 5000);
- sleep(100,200);
- Mouse.move(Random.random(0,765), Random.random(0,502));
- sleep(walkmod * 3000);
- Point pt5 = findItemTwoPoint(WS3A, WS3B, distWS3, 5, new Point(522,3), new Point(705,164));
- Mouse.click(pt5.x+Random.random(10, 35),pt5.y-Random.random(5, 7));
- sleep(300,400);
- Mouse.move(Random.random(0,765), Random.random(0,502));
- sleep(walkmod * 6500);
- int i = 0;
- while(i<13){
- Mouse.click(670,87);
- sleep(walkmod * 1000, walkmod * 1100);
- i++;
- }
- sleep(3000);
- RUNS++;
- status = "Finding bank";
- }
- return 1000;
- }
- /**
- * Performs actions that are "human-like"
- */
- private void antiban() {
- if(!bankIsOpen()){
- if(Random.random(0, 10) <= 5){
- status = "Checking stats";
- if(!bankIsOpen()){
- Mouse.click(Random.random(590, 604),Random.random(177, 196));
- sleep(300,500);
- }
- int x = Random.random(556, 729);
- int y = Random.random(214, 428);
- if(!bankIsOpen()){
- Mouse.click(x,y);
- sleep(300,500);
- }
- if(!bankIsOpen()){
- Mouse.click(x,y + Random.random(21,32));
- sleep(400,500);
- }
- if(!bankIsOpen()){
- Mouse.click(Random.random(216, 715),Random.random(128, 435));
- sleep(600,1000);
- }
- if(!bankIsOpen()){
- Mouse.scroll(Random.random(7,12), false);
- sleep(3000,5000);
- }
- if(!bankIsOpen()){
- Mouse.click(Random.random(740, 743),Random.random(20, 24));
- sleep(300,500);
- }
- }else if(Random.random(0, 10) > 5){
- status = "Checking Friends";
- if(!bankIsOpen()){
- Mouse.click(Random.random(558, 575),Random.random(473, 498));
- sleep(300,500);
- }
- int x = Random.random(556, 729);
- int y = Random.random(214, 428);
- if(!bankIsOpen()){
- Mouse.move(x,y);
- sleep(1000,1500);
- }
- }
- Mouse.click(Random.random(642, 670), Random.random(170, 200));
- }
- status = "Finding bank";
- }
- /**
- * The actions performed when the script stops.
- */
- public void onStop(){
- staminaCheck.interrupt();
- Log.log("Thanks for using BatFireRunes!");
- Log.log("Total runtime of: " + getTime(System.currentTimeMillis() - TIME));
- Log.log("You completed " + RUNS + " runs.");
- }
- /**
- * The paint.
- */
- public void onRepaint(Graphics g){
- if(showPaint){
- g.setColor(new Color(203,186,153));
- g.fillRect(7,345,505,128);
- g.setColor(Color.BLACK);
- g.drawString("Time Running : " + getTime(System.currentTimeMillis() - TIME), 11, 360);
- g.drawString("Total Runs: " + RUNS ,11,380);
- g.drawString("Runs/Hour: " + (int)((double)(RUNS*3600000)/(System.currentTimeMillis() - TIME)),11,400);
- g.drawString("Levels Gained: " + levelGained ,11,420);
- g.drawString("Status: " + status ,11,440);
- if(!staminaCheck.staminaOff()){
- g.setColor(Color.GREEN);
- g.drawString("Running", 11,460);
- }else {
- g.setColor(Color.RED);
- g.drawString("Walking", 11,460);
- walkmod = 2;
- }
- g.setColor(Color.BLACK);
- g.setFont(new Font("Salaryman", 1, 25));
- g.drawImage(pic, 270, 370, null, null);
- g.drawString("Version Beta 0.9",220,380);
- g.drawString("BatFireRunes",230,440);
- g.setColor(Color.RED);
- g.drawString("x",500,360);
- }else{
- g.setColor(Color.GREEN);
- g.setFont(new Font("Salaryman", 1, 25));
- g.drawString("o",500,360);
- }
- g.setColor(Color.RED);
- g.drawLine(Mouse.getLocation().x,0,Mouse.getLocation().x,2100);
- g.drawLine(0,Mouse.getLocation().y,2100,Mouse.getLocation().y);
- }
- /**
- * This is a time display method from jaanu22
- *
- * @param millis
- * - Give it the current counter time in milliseconds.
- * @return
- * - Returns the time in a more readable format
- */
- private static String getTime(double millis){
- double 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.length() < 2)
- {
- seconds = "0" + seconds;
- }
- if (minutes.length() < 2)
- {
- minutes = "0" + minutes;
- }
- if (hours.length() < 2)
- {
- hours = "0" + hours;
- }
- }
- return hours + ":" + minutes + ":" + seconds;
- }
- /**
- * Checks if the bank is open.
- *
- * @return boolean
- * - true if the bank is open
- * - false if the bank is open
- */
- private boolean bankIsOpen() {
- sleep(200,300);
- if(checkColor(new Color(242,170,62), new Point(198,30), 20) && checkColor(new Color(130,77,30), new Point(374,313), 20))return true;
- else return false;
- }
- /**
- * Logs you out.
- */
- private void logOut(){
- Mouse.click(Random.random(758,784),Random.random(4,15));
- sleep(Random.random(500,700));
- Mouse.click(Random.random(576,708),Random.random(355,372));
- sleep(Random.random(500,700));
- }
- /**
- * Return the center point between two points of color, indicating where the desire object is.
- * Returns (-1,-1) if the point is not found.
- *
- * @param col1
- * - The color value of a point on object.
- * @param col2
- * - The color value of a point on object.
- * @param p
- * - the distance x and y between the two points of color.
- * @return
- */
- private Point findItemTwoPoint(Color col1, Color col2, Point p, int tolerance){
- Point out = new Point(0,0);
- List<Point> test1 = ImageUtil.getPointsWithColor(Game.getImage(), col1,.05);
- List<Point> test2 = ImageUtil.getPointsWithColor(Game.getImage(), col2,.05);
- boolean breakable = false;
- boolean pointFound = false;
- for(int i = 0;i < test1.size();i++){
- for(int j = 0;j < test2.size();j++){
- if(Math.abs(test1.get(i).x - test2.get(j).x - p.x) < tolerance){
- if(Math.abs(test1.get(i).y - test2.get(j).y - p.y) < tolerance){
- out = new Point((int)((test1.get(i).x + test2.get(j).x)/2),
- (int)((test1.get(i).y + test2.get(j).y)/2));
- pointFound = true;
- breakable = true;
- break;
- }
- }
- }
- if(breakable)break;
- }
- if(pointFound)return out;
- else return new Point(-1,-1);
- }
- /**
- * This works with bounds
- * Return the center point between two points of color, indicating where the desire object is.
- * Returns (-1,-1) if the point is not found.
- *
- *
- * @param col1
- * - The color value of a point on object.
- * @param col2
- * - The color value of a point on object.
- * @param p
- * - the distance x and y between the two points of color.
- * @param TL
- * - The top left bound
- * @param BR
- * - The bottom right bound
- * @return
- */
- private Point findItemTwoPoint(Color col1, Color col2, Point p, int tolerance, Point TL, Point BR){
- Point out = new Point(0,0);
- List<Point> test1 = ImageUtil.getPointsWithColor(Game.getImage(), col1,.05);
- List<Point> test2 = ImageUtil.getPointsWithColor(Game.getImage(), col2,.05);
- boolean breakable = false;
- boolean pointFound = false;
- for(int i = 0;i < test1.size();i++){
- if((test1.get(i).x > TL.x) && (test1.get(i).y > TL.y)){
- if((test1.get(i).x < BR.x) && (test1.get(i).y < BR.y)){
- for(int j = 0;j < test2.size();j++){
- if((test2.get(j).x > TL.x) && (test2.get(j).y > TL.y)){
- if((test2.get(j).x < BR.x) && (test2.get(j).y < BR.y)){
- if(Math.abs(test1.get(i).x - test2.get(j).x - p.x) < tolerance){
- if(Math.abs(test1.get(i).y - test2.get(j).y - p.y) < tolerance){
- out = new Point((int)((test1.get(i).x + test2.get(j).x)/2),
- (int)((test1.get(i).y + test2.get(j).y)/2));
- pointFound = true;
- breakable = true;
- break;
- }
- }
- }
- }
- }
- }
- }
- if(breakable)break;
- }
- if(pointFound)return out;
- else return new Point(-1,-1);
- }
- /**
- * This works with bounds
- * Return the center point of a triangle, indicating where the desire object is.
- * Returns (-1,-1) if the point is not found.
- *
- * @param col1
- * - The color of the first point
- * @param col2
- * - The color of the second point
- * @param col3
- * - The color of the third point
- * @param p1
- * - The distance between point 1 and point 2
- * @param p2
- * - The distance between point 1 and point 3
- * @param tolerance
- * - The distance tolerance in pixels
- *
- * @return Point the point
- */
- private Point findItemThreePoint(Color col1, Color col2, Color col3, Point p1, Point p2, int tolerance){
- Point out = new Point();
- Point pt2 = new Point();
- Point pt1 = findItemTwoPoint(col1,col2, p1, tolerance);
- if(!pt1.equals(new Point (-1,-1))){
- pt2 = findItemTwoPoint(col1,col3, p2, tolerance);
- if(!pt2.equals(new Point (-1,-1))){
- out = new Point((int)((pt1.x + pt2.x)/2),
- (int)((pt1.y + pt2.y)/2));
- }else return new Point (-1,-1);
- }else return new Point (-1,-1);
- return out;
- }
- /**
- * This works with bounds
- * Return the center point of a triangle, indicating where the desire object is.
- * Returns (-1,-1) if the point is not found.
- *
- * @param col1
- * - The color of the first point
- * @param col2
- * - The color of the second point
- * @param col3
- * - The color of the third point
- * @param p1
- * - The distance between point 1 and point 2
- * @param p2
- * - The distance between point 1 and point 3
- * @param tolerance
- * - The distance tolerance in pixels
- * @param TL
- * - The top left corner of the bounds
- * @param BR
- * - The bottom right corner of the bounds
- *
- * @return Point the point
- */
- private Point findItemThreePoint(Color col1, Color col2, Color col3, Point p1, Point p2, int tolerance, Point TL, Point BR){
- Point out = new Point();
- Point pt2 = new Point();
- Point pt1 = findItemTwoPoint(col1,col2, p1, tolerance, TL, BR);
- if(!pt1.equals(new Point (-1,-1))){
- pt2 = findItemTwoPoint(col1,col3, p2, tolerance,TL, BR);
- if(!pt2.equals(new Point (-1,-1))){
- out = new Point((int)((pt1.x + pt2.x)/2),
- (int)((pt1.y + pt2.y)/2));
- }else return new Point (-1,-1);
- }else return new Point (-1,-1);
- return out;
- }
- /**
- * Returns whether the given point is a certain color.
- * Accounts for the variable colors that runescape produces whenever you log in.
- * @param col
- * - Color to check for.
- * @param p
- * - Point to check at.
- * @return
- */
- private boolean checkColor(Color col, Point p, int tol){
- if(Math.abs(col.getRed() - Game.getColorAt(p).getRed()) < tol)
- if(Math.abs(col.getGreen() - Game.getColorAt(p).getGreen()) < tol)
- if(Math.abs(col.getBlue() - Game.getColorAt(p).getBlue()) < tol)
- return true;
- return false;
- }
- /**
- * Mouse listener
- */
- public void mouseClicked(MouseEvent e) {
- Point pt = e.getPoint();
- if (pt.x >= 499 && pt.x <= 512 && pt.y >= 345 && pt.y <= 360) {
- showPaint = !showPaint;
- }
- }
- public void mouseEntered(MouseEvent arg0) {}
- public void mouseExited(MouseEvent arg0) {}
- public void mousePressed(MouseEvent arg0) {}
- public void mouseReleased(MouseEvent arg0) {}
- }//Ends BatFireRune class.
- class StaminaChecker extends Thread implements Runnable {
- private Point p = new Point(722,104);
- private Color cOn = new Color (235,217,102);
- private Color cOff = new Color (142,97,55);
- private Point pfullStam = new Point(721,96);
- private Color fullStam = new Color (94,86,71);
- private boolean staminaOff;
- public boolean staminaOff() {
- return this.staminaOff;
- }
- public StaminaChecker() {
- this.setPriority(MIN_PRIORITY);
- }
- @Override
- public void run() {
- try{
- while (!Thread.interrupted()) {
- if (!checkColor(cOn, p, 20)){
- staminaOff = true;
- BatFireRunes.walkmod = 2;
- if(checkColor(fullStam, pfullStam, 20)){
- int x = 0;
- int y = 0;
- BatFireRunes.sleep(600);
- Mouse.click((x = pfullStam.x+Random.random(-3,5)),(y = pfullStam.y+Random.random(3,25)));
- try {
- sleep(400,500);
- } catch (InterruptedException e) {
- }
- Mouse.click(x, (y + Random.random(21,32)));
- BatFireRunes.walkmod = 1;
- }
- }else if (!checkColor(cOff, p, 20)){
- staminaOff = false;
- BatFireRunes.walkmod = 1;
- }
- if(Thread.interrupted()) return;
- }
- } finally{}
- }
- /**
- * Returns whether the given point is a certain color.
- * Accounts for the variable colors that runescape produces whenever you log in.
- * @param col
- * - Color to check for.
- * @param p
- * - Point to check at.
- * @return
- */
- private boolean checkColor(Color col, Point p, int tol){
- if(Math.abs(col.getRed() - Game.getColorAt(p).getRed()) < tol)
- if(Math.abs(col.getGreen() - Game.getColorAt(p).getGreen()) < tol)
- if(Math.abs(col.getBlue() - Game.getColorAt(p).getBlue()) < tol)
- return true;
- return false;
- }
- }
- class LevelUpCheck extends Thread implements Runnable {
- private Point ptB = new Point(271,92);
- private Color ptBC = new Color (5,4,4);
- public LevelUpCheck() {
- this.setPriority(MIN_PRIORITY);
- }
- @Override
- public void run() {
- try{
- while (!Thread.interrupted()) {
- if(checkColor(ptBC, ptB, 10)){
- BatFireRunes.levelGained++;
- return;
- }
- if(Thread.interrupted()) return;
- }
- } finally{}
- }
- /**
- * Returns whether the given point is a certain color.
- * Accounts for the variable colors that runescape produces whenever you log in.
- * @param col
- * - Color to check for.
- * @param p
- * - Point to check at.
- * @return
- */
- private boolean checkColor(Color col, Point p, int tol){
- if(Math.abs(col.getRed() - Game.getColorAt(p).getRed()) < tol)
- if(Math.abs(col.getGreen() - Game.getColorAt(p).getGreen()) < tol)
- if(Math.abs(col.getBlue() - Game.getColorAt(p).getBlue()) < tol)
- return true;
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement