Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.Color;
- import java.awt.Component;
- import java.awt.Container;
- import java.awt.Font;
- import java.awt.Graphics;
- import java.awt.GridBagConstraints;
- import java.awt.GridBagLayout;
- import java.awt.Insets;
- import java.awt.Point;
- import java.awt.Rectangle;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import java.awt.event.MouseEvent;
- import java.awt.event.MouseListener;
- import java.awt.image.BufferedImage;
- import java.io.File;
- import java.io.FileNotFoundException;
- import java.io.IOException;
- import java.lang.reflect.InvocationTargetException;
- import java.net.URL;
- import javax.imageio.ImageIO;
- import javax.swing.JButton;
- import javax.swing.JCheckBox;
- import javax.swing.JComboBox;
- import javax.swing.JFrame;
- import javax.swing.JLabel;
- import javax.swing.JPasswordField;
- import javax.swing.JTabbedPane;
- import javax.swing.JTextField;
- import javax.swing.SwingUtilities;
- 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.Environment;
- import org.runedream.api.methods.Game;
- import org.runedream.api.methods.Inventory;
- import org.runedream.api.methods.Keyboard;
- import org.runedream.api.methods.Mouse;
- import org.runedream.api.methods.Game.Tab;
- import org.runedream.api.util.Log;
- import org.runedream.api.util.Random;
- import org.runedream.api.util.Timer;
- @ScriptManifest(
- authors = { "TheBat"},
- name = "BatSmelterAIO",
- version = 1.5,
- description = "Smelts shit in edgeville or Al-Kharid.",
- keywords = {},
- language = { true, true, true, true })
- public class BatSmelterAIO extends Script implements MouseListener{
- final private static Rectangle VIEWPORT = new Rectangle(4,4,513,335);
- final private static Rectangle VIEWPORTS = new Rectangle(4,35,513,304);
- final private static Rectangle VIEWPORTR = new Rectangle(234,4,279,335);
- final private static Rectangle MINIMAP = new Rectangle(548,6,156,156);
- final private static Rectangle MINIMAPL = new Rectangle(548,6,44,156);
- final private static Rectangle MINIMAPMR = new Rectangle(655,53,40,39);
- final private static Rectangle INVENTORY = new Rectangle(552,209,177,256);
- //The dtm for the banker
- Point[] BANKER1_DTM_PTS = { new Point( 351, 227), new Point( 344, 243), new Point( 339, 248)};
- Color[] BANKER1_DTM_RGB = { new Color( 174, 123, 54), new Color( 23, 18, 33), new Color( 132, 106, 74)};
- DTM2 dtmBanker1 = new DTM2(BANKER1_DTM_PTS, BANKER1_DTM_RGB);
- Point[] BANKER2_DTM_PTS = { new Point( 351, 228), new Point( 346, 244)};
- Color[] BANKER2_DTM_RGB = { new Color( 176, 124, 54), new Color( 23, 18, 33)};
- DTM2 dtmBanker2 = new DTM2(BANKER2_DTM_PTS, BANKER2_DTM_RGB);
- Point[] BANKER3_DTM_PTS = { new Point( 263, 231), new Point( 258, 249)};
- Color[] BANKER3_DTM_RGB = { new Color( 164, 116, 51), new Color( 134, 107, 75)};
- DTM2 dtmBanker3 = new DTM2(BANKER3_DTM_PTS, BANKER3_DTM_RGB);
- //The dtm for the Smithy Building
- Point[] SMITH1_DTM_PTS = { new Point( 659, 83), new Point( 680, 59), new Point( 683, 78)};
- Color[] SMITH1_DTM_RGB = { new Color( 232, 234, 250), new Color( 232, 234, 250), new Color( 232, 234, 250)};
- DTM2 dtmSmith1 = new DTM2(SMITH1_DTM_PTS, SMITH1_DTM_RGB);
- Point[] SMITH2_DTM_PTS = { new Point( 678, 83), new Point( 658, 60), new Point( 682, 63)};
- Color[] SMITH2_DTM_RGB = { new Color( 232, 234, 250), new Color( 232, 234, 250), new Color( 232, 234, 250)};
- DTM2 dtmSmith2 = new DTM2(SMITH2_DTM_PTS, SMITH2_DTM_RGB);
- Point[] SMITH3_DTM_PTS = { new Point( 670, 83), new Point( 662, 57), new Point( 682, 57)};
- Color[] SMITH3_DTM_RGB = { new Color( 231, 237, 235), new Color( 231, 237, 235), new Color( 231, 237, 235)};
- DTM2 dtmSmith3 = new DTM2(SMITH3_DTM_PTS, SMITH3_DTM_RGB);
- Point[] SMITH4_DTM_PTS = { new Point( 661, 83), new Point( 663, 57), new Point( 675, 57), new Point( 665, 83)};
- Color[] SMITH4_DTM_RGB = { new Color( 231, 237, 235), new Color( 231, 237, 235), new Color( 231, 237, 235), new Color( 231, 237, 235)};
- DTM2 dtmSmith4 = new DTM2(SMITH4_DTM_PTS, SMITH4_DTM_RGB);
- Point[] SMITH5_DTM_PTS = { new Point( 693, 75), new Point( 675, 49), new Point( 691, 49)};
- Color[] SMITH5_DTM_RGB = { new Color( 249, 249, 239), new Color( 249, 249, 239), new Color( 249, 249, 239)};
- DTM2 dtmSmith5 = new DTM2(SMITH5_DTM_PTS, SMITH5_DTM_RGB);
- Point[] SMITH6_DTM_PTS = { new Point( 687, 83), new Point( 662, 57), new Point( 687, 57)};
- Color[] SMITH6_DTM_RGB = { new Color( 249, 249, 239), new Color( 249, 249, 239), new Color( 249, 249, 239)};
- DTM2 dtmSmith6 = new DTM2(SMITH6_DTM_PTS, SMITH6_DTM_RGB);
- Point[] SMITH7_DTM_PTS = { new Point( 683, 82), new Point( 663, 56), new Point( 677, 55)};
- Color[] SMITH7_DTM_RGB = { new Color( 249, 249, 239), new Color( 249, 249, 239), new Color( 249, 249, 239)};
- DTM2 dtmSmith7 = new DTM2(SMITH7_DTM_PTS, SMITH7_DTM_RGB);
- Point[] SMITH8_DTM_PTS = { new Point( 660, 83), new Point( 661, 58), new Point( 685, 58), new Point( 685, 83)};
- Color[] SMITH8_DTM_RGB = { new Color( 236, 232, 237), new Color( 236, 232, 237), new Color( 236, 232, 237), new Color( 236, 232, 237)};
- DTM2 dtmSmith8 = new DTM2(SMITH8_DTM_PTS, SMITH8_DTM_RGB);
- Point[] SMITH9_DTM_PTS = { new Point( 661, 57), new Point( 685, 56), new Point( 685, 82)};
- Color[] SMITH9_DTM_RGB = { new Color( 231, 234, 240), new Color( 231, 234, 240), new Color( 231, 234, 240)};
- DTM2 dtmSmith9 = new DTM2(SMITH9_DTM_PTS, SMITH9_DTM_RGB);
- //The dtm for the furnace symbol
- Point[] FURN_SYM_DTM_PTS = { new Point( 687, 81), new Point( 689, 79)};
- Color[] FURN_SYM_DTM_RGB = { new Color( 250, 254, 18), new Color( 233, 106, 24)};
- DTM2 dtmFurnSym = new DTM2(FURN_SYM_DTM_PTS, FURN_SYM_DTM_RGB);
- //The dtm for the furnace
- Point[] FURN1_DTM_PTS = { new Point( 402, 83), new Point( 405, 83)};
- Color[] FURN1_DTM_RGB = { new Color( 162, 34, 24), new Color( 58, 58, 55)};
- DTM2 dtmFurn1 = new DTM2(FURN1_DTM_PTS, FURN1_DTM_RGB);
- Point[] FURN2_DTM_PTS = { new Point( 430, 103), new Point( 428, 103)};
- Color[] FURN2_DTM_RGB = { new Color( 137, 29, 20), new Color( 56, 55, 53)};
- DTM2 dtmFurn2 = new DTM2(FURN2_DTM_PTS, FURN2_DTM_RGB);
- //The dtm for the bank
- Point[] BANK1_DTM_PTS = { new Point( 586, 82), new Point( 586, 90), new Point( 586, 92)};
- Color[] BANK1_DTM_RGB = { new Color( 53, 100, 20), new Color( 250, 252, 238), new Color( 75, 68, 54)};
- DTM2 dtmBank1 = new DTM2(BANK1_DTM_PTS, BANK1_DTM_RGB);
- Point[] BANK2_DTM_PTS = { new Point( 594, 92), new Point( 594, 102), new Point( 594, 93)};
- Color[] BANK2_DTM_RGB = { new Color( 49, 97, 26), new Color( 233, 250, 236), new Color( 49, 97, 26)};
- DTM2 dtmBank2 = new DTM2(BANK2_DTM_PTS, BANK2_DTM_RGB);
- Point[] BANK3_DTM_PTS = { new Point( 594, 92), new Point( 594, 103), new Point( 594, 93)};
- Color[] BANK3_DTM_RGB = { new Color( 49, 97, 26), new Color( 233, 250, 236), new Color( 49, 97, 26)};
- DTM2 dtmBank3 = new DTM2(BANK3_DTM_PTS, BANK3_DTM_RGB);
- Point[] BANK4_DTM_PTS = { new Point( 594, 92), new Point( 594, 101), new Point( 594, 93)};
- Color[] BANK4_DTM_RGB = { new Color( 49, 97, 26), new Color( 233, 250, 236), new Color( 49, 97, 26)};
- DTM2 dtmBank4 = new DTM2(BANK4_DTM_PTS, BANK4_DTM_RGB);
- //The dtm for the Al-Kharid banker
- Point[] AL_BANKER_DTM_PTS = { new Point( 149, 90), new Point( 144, 84)};
- Color[] AL_BANKER_DTM_RGB = { new Color( 226, 217, 227), new Color( 107, 103, 102)};
- DTM2 dtmAlBanker = new DTM2(AL_BANKER_DTM_PTS, AL_BANKER_DTM_RGB);
- //The dtm for the Al-Kharid Smithy Building
- Point[] CACTUS1_DTM_PTS = { new Point( 665, 90), new Point( 665, 87), new Point( 661, 89), new Point( 666, 94), new Point( 669, 88), new Point( 671, 90)};
- Color[] CACTUS1_DTM_RGB = { new Color( 73, 115, 57), new Color( 73, 115, 57), new Color( 73, 115, 57), new Color( 73, 115, 57), new Color( 73, 115, 57), new Color( 58, 57, 11)};
- DTM2 dtmCactus1 = new DTM2(CACTUS1_DTM_PTS, CACTUS1_DTM_RGB);
- Point[] CACTUS2_DTM_PTS = { new Point( 656, 86), new Point( 669, 86), new Point( 669, 88)};
- Color[] CACTUS2_DTM_RGB = { new Color( 73, 115, 57), new Color( 48, 99, 25), new Color( 58, 57, 11)};
- DTM2 dtmCactus2 = new DTM2(CACTUS2_DTM_PTS, CACTUS2_DTM_RGB);
- //The dtm for the Al-Kharid furnace
- Point[] ALFURN_DTM_PTS = { new Point( 137, 175), new Point( 112, 139), new Point( 178, 139), new Point( 166, 224), new Point( 103, 219)};
- Color[] ALFURN_DTM_RGB = { new Color( 54, 52, 52), new Color( 62, 60, 59), new Color( 43, 41, 41), new Color( 49, 47, 47), new Color( 65, 62, 62)};
- DTM2 dtmAlFurn1 = new DTM2(ALFURN_DTM_PTS, ALFURN_DTM_RGB);
- //The dtm for the Al-Kharid bank
- Point[] BCACACTUS1_DTM_PTS = { new Point( 593, 99), new Point( 590, 96), new Point( 596, 98), new Point( 593, 104), new Point( 600, 103)};
- Color[] BCACACTUS1_DTM_RGB = { new Color( 72, 116, 56), new Color( 63, 100, 30), new Color( 63, 100, 30), new Color( 72, 116, 56), new Color( 63, 100, 30)};
- DTM2 dtmBCactus1 = new DTM2(BCACACTUS1_DTM_PTS, BCACACTUS1_DTM_RGB);
- Point[] AL_HEDGE_DTM_PTS = { new Point( 619, 136), new Point( 652, 136), new Point( 652, 148), new Point( 619, 148)};
- Color[] AL_HEDGE_DTM_RGB = { new Color( 251, 251, 245), new Color( 67, 99, 28), new Color( 51, 99, 22), new Color( 251, 251, 245)};
- DTM2 dtmAlHedge1 = new DTM2(AL_HEDGE_DTM_PTS, AL_HEDGE_DTM_RGB);
- Point[] ALDOOR_DTM_PTS = { new Point( 583, 91), new Point( 583, 94)};
- Color[] ALDOOR_DTM_RGB = { new Color( 243, 6, 3), new Color( 243, 6, 3)};
- DTM2 dtmAlDoor1 = new DTM2(ALDOOR_DTM_PTS, ALDOOR_DTM_RGB);
- Point[] AL_BANK1_DTM_PTS = { new Point( 588, 139), new Point( 602, 150), new Point( 597, 137)};
- Color[] AL_BANK1_DTM_RGB = { new Color( 242, 238, 244), new Color( 238, 229, 253), new Color( 238, 229, 253)};
- DTM2 dtmAlBank1 = new DTM2(AL_BANK1_DTM_PTS, AL_BANK1_DTM_RGB);
- //dtm for a selected object
- Point[] SELECTED_DTM_PTS = { new Point( 572, 255)};
- Color[] SELECTED_DTM_RGB = { new Color( 255, 255, 255)};
- DTM2 dtmSelected = new DTM2(SELECTED_DTM_PTS, SELECTED_DTM_RGB);
- //dtm for casting gui
- Point[] CAST_DTM_PTS = { new Point( 20, 30), new Point( 499, 30), new Point( 499, 321), new Point( 21, 321)};
- Color[] CAST_DTM_RGB = { new Color( 180, 178, 170), new Color( 175, 171, 164), new Color( 175, 171, 164), new Color( 175, 171, 164)};
- DTM dtmCast = new DTM(CAST_DTM_PTS, CAST_DTM_RGB);
- /**
- * New bank finding dtms
- * Point[] DTM_PTS = { new Point( 581, 91), new Point( 586, 93), new Point( 582, 96)};
- * Color[] DTM_RGB = { new Color( 245, 247, 230), new Color( 245, 247, 230), new Color( 245, 247, 230)};
- * DTM2 dtm1 = new DTM2(DTM_PTS, DTM_RGB);
- *
- */
- //dtm for an iron bar
- Point[] BAR_DTM_PTS = { new Point( 579, 218), new Point( 570, 237), new Point( 584, 227)};
- Color[] BAR_DTM_RGB = { new Color( 0, 0, 2), new Color( 0, 0, 2), new Color( 84, 81, 81)};
- DTM2 dtmBar = new DTM2(BAR_DTM_PTS, BAR_DTM_RGB);
- Point[] ORE_DTM_PTS = { new Point( 54, 107)};
- Color[] ORE_DTM_RGB = new Color [1];
- DTM2 oredtm;
- private static BufferedImage back = null;
- private static long TIME = 0, smeltTO = 0;
- private boolean showPaint = true, first = true;
- private Color temp0 = null, temp1 = null, temp2 = null, ore = new Color(0,0,0);
- private int row = 0, col = 0, smelted = 0;
- private static String status = "Setup";
- private boolean getCol = true;
- private GUI gui;
- private StaminaChecker stamStam = new StaminaChecker();
- protected int smelting = 0;
- private Point chkPt = new Point (54,107);
- private double exp = 25.2;
- protected boolean goldsmith = false;
- private String type = "Cannonballs";
- private long reTry = 0;
- private int smeltedT;
- private int trys = 0;
- private long TO = 21600000;
- private boolean login = false;
- private String userName = "";
- private String password = "";
- public static boolean staminaFull;
- private String version = "1.5";
- private Rectangle drawR = new Rectangle();
- private boolean firstS = true;
- private Color[] IRON_DTM_RGB = { Game.getColorAt(582, 219), Game.getColorAt(580, 228), Game.getColorAt(587, 234)};
- private int barsTemp = 0;
- private boolean logout = false;
- private char location = 'A';
- private int profit = 0;
- private String tStat = "Finding banker";
- private boolean showD = false;
- private boolean makeJewl = false;
- private int jewel = 0;
- private int S = 7;
- private String typeJ = "";
- private static int walkmod = 1;
- public boolean onStart(){
- ORE_DTM_RGB [0] = new Color(0,0,0);
- oredtm = new DTM2(ORE_DTM_PTS, ORE_DTM_RGB);
- try {
- back = ImageIO.read(new File("./Storage/BatScripts/backPick.png"));
- }catch (FileNotFoundException e) {
- }catch (IOException e) {
- try {
- Log.log("Images not found, retrieving from internet.",Color.RED);
- back = ImageIO.read(new URL("http://i1066.photobucket.com/albums/u406/bootsncats/underPaint.png"));
- File file = new File("./Storage/BatScripts/backPick.png");
- file.getParentFile().mkdirs();
- ImageIO.write(back, "png",file);
- } catch (IOException ex) {
- }
- }
- try {
- SwingUtilities.invokeAndWait(new Runnable() {
- @Override
- public void run() {
- gui = new GUI();
- gui.setVisible(true);
- }
- });
- } catch (InterruptedException ex) {
- } catch (InvocationTargetException ex) {
- }
- while(gui.OPEN){
- Script.sleep(100);
- }
- switch(smelting){
- case 0:
- exp = 25.2;
- profit = 4*GE.getGuidePrice(2)-GE.getGuidePrice(2353);
- break;
- case 1:
- exp = 6.2;
- profit = GE.getGuidePrice(2349)-(GE.getGuidePrice(438) + GE.getGuidePrice(436));
- break;
- case 2:
- exp = 12.5;
- profit = GE.getGuidePrice(2351)-GE.getGuidePrice(440);
- break;
- case 3:
- exp = 13.7;
- profit = GE.getGuidePrice(2355)-GE.getGuidePrice(442);
- break;
- case 4:
- exp = 17.5;
- profit = GE.getGuidePrice(2353)-(GE.getGuidePrice(440)+ 2*GE.getGuidePrice(453));
- break;
- case 5:
- exp = 22.5;
- if(goldsmith) exp = 56.2;
- profit = GE.getGuidePrice(2357)-GE.getGuidePrice(444);
- break;
- case 6:
- exp = 30 ;
- profit = GE.getGuidePrice(2359)-(GE.getGuidePrice(447)+ 4*GE.getGuidePrice(453));
- break;
- case 7:
- exp = 37.5;
- profit = GE.getGuidePrice(2361)-(GE.getGuidePrice(449)+ 6*GE.getGuidePrice(453));
- break;
- case 8:
- exp = 50;
- profit = GE.getGuidePrice(2363)-(GE.getGuidePrice(451)+ 8*GE.getGuidePrice(453));
- break;
- }
- status = "Finding banker";
- TIME = System.currentTimeMillis();
- Game.clickCompass();
- Script.sleep(200);
- Camera.pitchUp(500);
- return true;
- }
- public void onStop(){
- if(stamStam.isAlive()){
- stamStam.interrupt();
- }
- if(logout){
- Log.log("Logging out.");
- Mouse.click(Random.random(748,760),Random.random(4,15));
- Script.sleep(Random.random(400,600));
- Mouse.click(Random.random(576,708),Random.random(394,418));
- }
- Log.log("You managed to smelt " + smelted + " items!");
- Log.log("Total runtime: " + Timer.getTime(System.currentTimeMillis() - TIME));
- Log.log("Thanks for using BatSmelterAIO");
- }
- /*****************************************************/
- /*** LOOP ***/
- /*****************************************************/
- public int loop(){
- if(!isLoggedIn()){
- if(login){
- Log.log("You have been logged out, you are probably Client token errored, Resetting the client.", Color.GREEN);
- reset();
- }else{
- Log.log("You have been logged out, you are probably Client token errored, Shutting down.", Color.RED);
- return -1;
- }
- }
- Mouse.setSpeed(Random.random(3,5));
- if(!Bank.isOpen()) if(!Game.getOpenTab().equals(Tab.INVENTORY))Game.openTab(Tab.INVENTORY);
- if(location == 'A'){
- return loopA();
- }else if(location == 'B'){
- return loopB();
- }else{
- Log.log("ERROR WITH LOCATION! SOMETHING VERY BAD HAPPEND!");
- return -1;
- }
- }
- ///////////////////////
- // Loop for Edgeville//
- ///////////////////////
- public int loopA() {
- if(status.equals("Finding banker")){
- if(Bank.isOpen()){
- status = "Banking";
- return 100;
- }
- if(dtmBanker2.findDTMS(20, VIEWPORTR) || dtmBanker1.findDTMS(20, VIEWPORTR) || dtmBanker3.findDTMS(20, VIEWPORTR)){
- int i = Random.random(0,DTM2.dtmLocations.size()-1);
- Point bankerPt = new Point((int)DTM2.dtmLocations.get(i).getCenterX(),(int)DTM2.dtmLocations.get(i).getCenterY());
- Mouse.click(bankerPt,false);
- Script.sleep(100);
- String lol = OCR.findString(new Rectangle(bankerPt.x-65,bankerPt.y+30, 130,25), null,true);
- if(lol.contains("Bank") || lol.contains("ank") || lol.contains("nk") || lol.contains("Ba")|| lol.contains("Ban")){
- Mouse.click(bankerPt.x,bankerPt.y+46);
- trys = 0;
- int k = 0;
- while(!Bank.isOpen() && k <= 30){
- Script.sleep(100);
- k++;
- }
- }else {if(trys++ == 8){
- trys = 0;
- status = "Lost";
- tStat = "Finding banker";
- }
- Mouse.move(Random.random(0,517),Random.random(0,339));
- }
- }else{
- if(trys++ >= 3){
- if(dtmBanker2.findDTMS(30, VIEWPORT) || dtmBanker1.findDTMS(30, VIEWPORT) || dtmBanker3.findDTMS(30, VIEWPORT)){
- int i = Random.random(0,DTM2.dtmLocations.size()-1);
- Point bankerPt = new Point((int)DTM2.dtmLocations.get(i).getCenterX(),(int)DTM2.dtmLocations.get(i).getCenterY());
- Mouse.click(bankerPt,false);
- Script.sleep(100);
- String lol = OCR.findString(new Rectangle(bankerPt.x-65,bankerPt.y+30, 130,25), null,true);
- if(lol.contains("Bank") || lol.contains("ank") || lol.contains("nk") || lol.contains("Ba")|| lol.contains("Ban")){
- Mouse.click(bankerPt.x,bankerPt.y+46);
- int k = 0;
- while(!Bank.isOpen() && k <= 50){
- Script.sleep(100);
- k++;
- }
- }else trys++;
- }else if(trys++ >= 8){
- trys= 0;
- tStat = "Finding banker";
- status = "Lost";
- return 100;
- }
- Mouse.move(Random.random(0,517),Random.random(0,339));
- }
- return 100;
- }
- if(Bank.isOpen()){
- status = "Banking";
- return 100;
- }
- return 100;
- }
- //Lost!
- if(status.equals("Lost")){
- if(dtmFurnSym.findDTMS(20, MINIMAP)){
- int i = Random.random(0,DTM2.dtmLocations.size()-1);
- Point symPt = new Point((int)DTM2.dtmLocations.get(i).getCenterX(),(int)DTM2.dtmLocations.get(i).getCenterY());
- Mouse.click(symPt.x+Random.random(-7,7),symPt.y+Random.random(-7,7));
- Script.sleep(6500);
- if(tStat.equals("Finding banker")){
- if(dtmBank1.findDTMS(20, MINIMAP) || dtmBank2.findDTMS(20, MINIMAP) || dtmBank3.findDTMS(20, MINIMAP)){
- int j = Random.random(0,DTM2.dtmLocations.size()-1);
- Point bankPt = new Point((int)DTM2.dtmLocations.get(j).getCenterX(),(int)DTM2.dtmLocations.get(j).getCenterY());
- bankPt.y = bankPt.y + 30;
- Mouse.click(bankPt);
- Script.sleep(6500);
- }
- }
- status = tStat;
- return 100;
- }
- if(trys++ == 6){
- Log.log("Completely lost. Might be a random.",Color.RED);
- return -1;
- }
- }
- //Banking
- if(status.equals("Banking")){
- return bank();
- }
- //Walking to Furnace
- if(status.equals("Walking to furnace")){
- if(!checkColor(ore,new Point(579,228), 20) /*&&*/){
- status = "Finding banker";
- return 100;
- }
- if(dtmSmith1.findDTMS(20, MINIMAPMR) || dtmSmith2.findDTMS(20, MINIMAPMR)|| dtmSmith3.findDTMS(20, MINIMAPMR)|| dtmSmith4.findDTMS(20, MINIMAPMR)|| dtmSmith6.findDTMS(20, MINIMAPMR)|| dtmSmith7.findDTMS(20, MINIMAPMR)|| dtmSmith8.findDTMS(20, MINIMAPMR) || dtmSmith9.findDTMS(20, MINIMAPMR)|| dtmSmith5.findDTMS(20, MINIMAPMR)){
- int i = Random.random(0,DTM2.dtmLocations.size()-1);
- drawR = DTM2.dtmLocations.get(i);
- Point smithPt = new Point((int)DTM2.dtmLocations.get(i).getCenterX(),(int)DTM2.dtmLocations.get(i).getCenterY());
- if(smithPt.y <= 55){
- showD = true;
- sleep(100);
- Environment.saveScreenshot();
- }
- Mouse.click(smithPt);
- Script.sleep(1000);
- showD = false;
- drawR = new Rectangle();
- Script.sleep(4100);
- status = "Finding furnace";
- return 100;
- }else if(dtmFurnSym.findDTMS(20, MINIMAP)){
- int i = Random.random(0,DTM2.dtmLocations.size()-1);
- drawR = DTM2.dtmLocations.get(i);
- Point symPt = new Point((int)DTM2.dtmLocations.get(i).getCenterX(),(int)DTM2.dtmLocations.get(i).getCenterY());
- Mouse.click(symPt.x+Random.random(-2,2),symPt.y+Random.random(-2,2));
- Script.sleep(1000);
- drawR = new Rectangle();
- Script.sleep(4100);
- status = "Finding furnace";
- return 100;
- }
- }
- //Finding Furnace
- if(status.equals("Finding furnace")){
- if(makeJewl && S==2){
- S = 0;
- status = "Walking back";
- return 100;
- }
- if(dtmFurn1.findDTMS(20, VIEWPORT) || dtmFurn2.findDTMS(20, VIEWPORT)){
- int i = Random.random(0,DTM2.dtmLocations.size()-1);
- Point FurnPt = new Point((int)DTM2.dtmLocations.get(i).getCenterX(),(int)DTM2.dtmLocations.get(i).getCenterY());
- if(S==1 && (smelting == 3 || smelting == 5) && !dtmSelected.findDTMS(10,Inventory.getSlotAt(0).getBounds()))Mouse.click(Random.random(567,587),Random.random(219,240));
- Mouse.click(FurnPt,false);
- Script.sleep(300);
- String lol = OCR.findString(new Rectangle(FurnPt.x-100,FurnPt.y+15, 200,25), null,true);
- if((lol.contains("Use") || lol.contains("Smelt"))&& lol.contains("Furnace")){
- Mouse.click(FurnPt.x,FurnPt.y+33);
- }else{
- Mouse.move(Random.random(0,765), Random.random(0,502));
- if(S==1 && (smelting == 3 || smelting == 5) && dtmSelected.findDTMS(10,Inventory.getSlotAt(0).getBounds()))Mouse.click(Random.random(567,587),Random.random(219,240));
- if(trys++ >= 5){
- trys= 0;
- tStat = "Finding furnace";
- status = "Lost";
- return 100;
- }
- }
- int k = 0;
- while((!Game.getColorAt(319,360).equals(new Color(90,82,69)) || dtmCast.findDTMS(20))&& k <= 30){
- Script.sleep(100);
- k++;
- }
- }else{
- if(trys++ >= 5){
- trys = 0;
- tStat = "Finding furnace";
- status = "Lost";
- }
- return 100;
- }
- if(Game.getColorAt(319,360).equals(new Color(90,82,69))){
- first = true;
- row = 0;
- col = 0;
- reTry = System.currentTimeMillis();
- smeltedT = smelted;
- firstS = true;
- status = "Smelting";
- Mouse.move(Random.random(233,273),Random.random(405,452));
- }else if(dtmCast.findDTMS(20)){
- switch(jewel){
- case 0:
- Mouse.click(85,90,false);
- break;
- case 1:
- Mouse.click(170,90,false);
- break;
- case 2:
- Mouse.click(255,100,false);
- break;
- case 3:
- Mouse.click(78,205,false);
- break;
- case 4:
- Mouse.click(335,210,false);
- break;
- case 5:
- Mouse.click(115,105,false);
- break;
- case 6:
- Mouse.click(130,165,false);
- break;
- case 7:
- Mouse.click(130,228,false);
- break;
- case 8:
- Mouse.click(130,290,false);
- break;
- }
- Script.sleep(300);
- Mouse.click(Mouse.getLocation().x, Mouse.getLocation().y + 60);
- first = true;
- row = 0;
- col = 0;
- reTry = System.currentTimeMillis();
- smeltedT = smelted;
- firstS = true;
- status = "Smelting";
- Script.sleep(1000);
- }
- return 100;
- }
- //Smelting
- if(status.equals("Smelting")){
- return smelt();
- }
- if(status.equals("Walking back")){
- if(dtmBank1.findDTMS(20, MINIMAPL) || dtmBank2.findDTMS(20, MINIMAPL)){
- int i = 0;
- Point bankPt = new Point((int)DTM2.dtmLocations.get(i).getCenterX(),(int)DTM2.dtmLocations.get(i).getCenterY());
- bankPt.y = bankPt.y + 20;
- Mouse.click(bankPt);
- Script.sleep(1000);
- Script.sleep(5000);
- trys = 0;
- status = "Finding banker";
- return 100;
- }else if(trys++ == 6){
- trys = 0;
- tStat = "Finding banker";
- status = "Lost";
- }
- return 100;
- }
- return 100;
- }
- ///////////////////////
- // Loop for Al-Kharid//
- ///////////////////////
- private int loopB() {
- if(!stamStam.isAlive()){
- stamStam = new StaminaChecker();
- stamStam.start();
- }
- if(StaminaChecker.staminaOff() && !status.equals("Banking") && !status.equals("Finding banker")){
- int x = 0;
- int y = 0;
- Point pfullStam = new Point(721,96);
- Mouse.click((x = pfullStam.x+Random.random(-3,5)),(y = pfullStam.y+Random.random(3,25)));
- sleep(400,500);
- Mouse.click(x, (y + Random.random(21,32)));
- sleep(400,500);
- walkmod = 1;
- }
- if(status.equals("Finding banker")){
- if(Bank.isOpen()){
- status = "Banking";
- return 100;
- }
- if(dtmAlBanker.findDTMS(20, VIEWPORTS)){
- int i = Random.random(0,DTM2.dtmLocations.size()-1);
- Point bankerPt = new Point((int)DTM2.dtmLocations.get(i).getCenterX(),(int)DTM2.dtmLocations.get(i).getCenterY());
- Mouse.click(bankerPt,false);
- Script.sleep(100);
- String lol = OCR.findString(new Rectangle(bankerPt.x-65,bankerPt.y+30, 130,25), null,true);
- if((lol.contains("Bank") || lol.contains("ank") || lol.contains("nk") || lol.contains("Ba")|| lol.contains("Ban")) && !lol.contains("Booth")){
- Mouse.click(bankerPt.x,bankerPt.y+46);
- trys = 0;
- int k = 0;
- while(!Bank.isOpen() && k <= 30){
- Script.sleep(100);
- k++;
- }
- }else {
- if(trys++ == 8){
- trys = 0;
- tStat = "Finding banker";
- status = "Lost";
- }
- Mouse.move(Random.random(0,517),Random.random(0,339));
- }
- }
- return 100;
- }
- //Lost!
- if(status.equals("Lost")){
- if(dtmFurnSym.findDTMS(20, MINIMAP)){
- int i = Random.random(0,DTM2.dtmLocations.size()-1);
- Point symPt = new Point((int)DTM2.dtmLocations.get(i).getCenterX(),(int)DTM2.dtmLocations.get(i).getCenterY());
- Mouse.click(symPt);
- for(int j = 0; j <= 65; j++)sleep(100*walkmod);
- if(tStat.equals("Finding banker")){
- if(dtmAlDoor1.findDTMS(20, MINIMAP)){
- int j = Random.random(0,DTM2.dtmLocations.size()-1);
- Point bankPt = new Point((int)DTM2.dtmLocations.get(j).getCenterX(),(int)DTM2.dtmLocations.get(j).getCenterY());
- Mouse.click(bankPt);
- for(int k = 0; k <= 65; k++)sleep(100*walkmod);
- }
- }
- status = tStat;
- return 100;
- }
- if(trys++ == 6){
- Log.log("Completely lost. Might be a random.",Color.RED);
- return -1;
- }
- }
- //Banking
- if(status.equals("Banking")){
- return bank();
- }
- //Walking to Furnace
- if(status.equals("Walking to furnace")){
- if(dtmCactus1.findDTMS(20, MINIMAP) || dtmCactus2.findDTMS(20, MINIMAP) ){
- int i = Random.random(0,DTM2.dtmLocations.size()-1);
- Point cactPt = new Point((int)DTM2.dtmLocations.get(i).getCenterX(),(int)DTM2.dtmLocations.get(i).getCenterY());
- cactPt.y -=60;
- Mouse.click(cactPt);
- for(int j = 0; j <= 34; j++){
- sleep(100*walkmod);
- }
- if(dtmCactus1.findDTMS(20, MINIMAP) || dtmCactus2.findDTMS(20, MINIMAP) ){
- i = Random.random(0,DTM2.dtmLocations.size()-1);
- cactPt = new Point((int)DTM2.dtmLocations.get(i).getCenterX(),(int)DTM2.dtmLocations.get(i).getCenterY());
- cactPt.x -= Random.random(10, 15);
- cactPt.y -= 76;
- Mouse.click(cactPt);
- for(int j = 0; j <= 65; j++){
- sleep(100*walkmod);
- }
- status = "Finding furnace";
- }
- }
- return 100;
- }
- //Finding Furnace
- if(status.equals("Finding furnace")){
- if(makeJewl && S==2){
- S = 0;
- status = "Walking back";
- return 100;
- }
- if(dtmAlFurn1.findDTMS(20, VIEWPORT)){
- int i = Random.random(0,DTM2.dtmLocations.size()-1);
- Point FurnPt = new Point((int)DTM2.dtmLocations.get(i).getCenterX(),(int)DTM2.dtmLocations.get(i).getCenterY());
- if(S++==1 && (smelting == 3 || smelting == 5) && !dtmSelected.findDTMS(10,Inventory.getSlotAt(0).getBounds()))Mouse.click(Random.random(567,587),Random.random(219,240));
- Mouse.click(FurnPt,false);
- Script.sleep(300);
- String lol = OCR.findString(new Rectangle(FurnPt.x-100,FurnPt.y+15, 200,25), null,true);
- if((lol.contains("Smelt") || lol.contains("Use"))&& lol.contains("Furnace")){
- Mouse.click(FurnPt.x,FurnPt.y+33);
- }else{
- Mouse.move(Random.random(0,765), Random.random(0,502));
- if(S==1 && (smelting == 3 || smelting == 5) && dtmSelected.findDTMS(10,Inventory.getSlotAt(0).getBounds()))Mouse.click(Random.random(567,587),Random.random(219,240));
- // if(trys == 3){
- // Mouse.click(236,171);
- // return 100;
- // }
- if(trys++ >= 5){
- Mouse.click(236,171);
- // trys= 0;
- // tStat = "Finding furnace";
- // status = "Lost";
- return 100;
- }
- }
- int k = 0;
- while((!Game.getColorAt(319,360).equals(new Color(90,82,69)) || dtmCast.findDTMS(20))&& k <= 30){
- Script.sleep(100);
- k++;
- }
- }else{
- if(trys++ >= 5){
- trys = 0;
- tStat = "Finding furnace";
- status = "Lost";
- }
- return 100;
- }
- if(Game.getColorAt(319,360).equals(new Color(90,82,69))){
- first = true;
- row = 0;
- col = 0;
- reTry = System.currentTimeMillis();
- smeltedT = smelted;
- firstS = true;
- status = "Smelting";
- Mouse.move(Random.random(233,273),Random.random(405,452));
- }else if(dtmCast.findDTMS(20)){
- switch(jewel){
- case 0:
- Mouse.click(85,90,false);
- break;
- case 1:
- Mouse.click(170,90,false);
- break;
- case 2:
- Mouse.click(255,100,false);
- break;
- case 3:
- Mouse.click(78,205,false);
- break;
- case 4:
- Mouse.click(335,210,false);
- break;
- case 5:
- Mouse.click(115,105,false);
- break;
- case 6:
- Mouse.click(130,165,false);
- break;
- case 7:
- Mouse.click(130,228,false);
- break;
- case 8:
- Mouse.click(130,290,false);
- break;
- }
- Script.sleep(300);
- Mouse.click(Mouse.getLocation().x, Mouse.getLocation().y + 60);
- first = true;
- row = 0;
- col = 0;
- reTry = System.currentTimeMillis();
- smeltedT = smelted;
- firstS = true;
- status = "Smelting";
- Script.sleep(1000);
- }
- return 100;
- }
- //Smelting
- if(status.equals("Smelting")){
- return smelt();
- }
- if(status.equals("Walking back")){
- // if(dtmAlHedge1.findDTMS(20, MINIMAP)){
- // int i = Random.random(0,DTM2.dtmLocations.size()-1);
- // Point hedgePt = new Point((int)DTM2.dtmLocations.get(i).getCenterX(),(int)DTM2.dtmLocations.get(i).getCenterY());
- // Mouse.click(hedgePt);
- // Environment.saveScreenshot();
- // for(int j = 0; j <= 70; j++){
- // sleep(100*walkmod);
- // }
- // if(dtmAlHedge1.findDTMS(20, MINIMAP)){
- // i = Random.random(0,DTM2.dtmLocations.size()-1);
- // hedgePt = new Point((int)DTM2.dtmLocations.get(i).getCenterX(),(int)DTM2.dtmLocations.get(i).getCenterY());
- // hedgePt.x -= 30;
- // Mouse.click(hedgePt);
- // Environment.saveScreenshot();
- // for(int j = 0; j <= 30; j++){
- // sleep(100*walkmod);
- // }
- Mouse.click(609, 158);
- for(int j = 0; j <= 100; j++){
- sleep(100*walkmod);
- }
- status = "Finding banker";
- return 100;
- // }
- // }
- }
- return 100;
- }
- /**********************************************************************************/
- /*************************** END LOOP *********************************************/
- /**********************************************************************************/
- private int smelt(){
- if(System.currentTimeMillis() - reTry > 20000 && smeltedT == smelted){
- status = "Finding furnace";
- }
- if(first){
- if(!makeJewl && !Game.getColorAt(319,360).equals(new Color(90,82,69))){
- status = "Finding furnace";
- }
- if(smelting == 4){
- Mouse.click(Random.random(272,315),Random.random(405,450));
- }else{
- if(!makeJewl || S == 0){
- Mouse.click(Random.random(233,273),Random.random(405,450));
- }
- }
- temp0 = Game.getColorAt(583,221);
- temp1 = Game.getColorAt(591,225);
- temp2 = Game.getColorAt(569,231);
- first = false;
- smeltTO = System.currentTimeMillis();
- }
- if(System.currentTimeMillis()- smeltTO > 1200000){
- status = "Walking back";
- return 100;
- }
- if(!checkColor(temp0,new Point(583 + (col*42),221 + (row*36)),15)
- || !checkColor(temp1,new Point(591 + (col*42),225 + (row*36)),15)
- || !checkColor(temp2,new Point(569 + (col*42),231 + (row*36)),15)){
- if(smelting != 2){
- smelted ++;
- smeltedT = smelted;
- reTry = System.currentTimeMillis();
- col++;
- }
- switch(smelting){
- case 1:
- if(col == 4){
- col = 0;
- row++;
- }
- if(row == 3){
- if(col == 2){
- status = "Walking back";
- return 100;
- }
- }
- break;
- case 2:
- dtmBar.findDTMS(1, INVENTORY);
- if(DTM2.dtmLocations.size()/2 != barsTemp ){
- smelted ++;
- smeltedT = smelted;
- reTry = System.currentTimeMillis();
- barsTemp = DTM2.dtmLocations.size()/2;
- }
- Point[] IRON_DTM_PTS = { new Point( 582, 219), new Point( 580, 228), new Point( 587, 234)};
- if(firstS){
- IRON_DTM_RGB = new Color [] { Game.getColorAt(582, 219), Game.getColorAt(582, 219), Game.getColorAt(582, 219), Game.getColorAt(582, 219)};
- firstS = false;
- }
- DTM2 dtmIron = new DTM2(IRON_DTM_PTS, IRON_DTM_RGB);
- if(!dtmIron.findDTMS(1, INVENTORY)){
- status = "Walking back";
- return 100;
- }
- break;
- case 4:
- if(col == 4){
- col = 0;
- row++;
- }
- if(row == 2){
- if(col == 1){
- status = "Walking back";
- return 100;
- }
- }
- break;
- case 6:
- if(col == 4){
- col = 0;
- row++;
- }
- if(row == 1){
- if(col == 1){
- status = "Walking back";
- return 100;
- }
- }
- break;
- case 7:
- if(col == 4){
- col = 0;
- status = "Walking back";
- return 100;
- }
- break;
- case 8:
- if(col == 3){
- col = 0;
- status = "Walking back";
- return 100;
- }
- default:
- if(col == 4){
- col = 0;
- row++;
- if(row == 7){
- if((smelting == 3 || smelting == 5) && makeJewl){
- col = 0;
- row = 0;
- if(S == 1)S = 2;
- if(S == 0)S = 1;
- status = "Finding furnace";
- return 100;
- }
- status = "Walking back";
- return 100;
- }
- }
- return 100;
- }
- }
- return 100;
- }
- private int bank(){
- if(Bank.isOpen()){
- if(!checkColor(ore, new Point(54, 107), 20) && !getCol){
- Log.log("May be out of raw materials, rechecking bank just in case.", Color.RED);
- sleep(600,1000);
- if(!checkColor(ore, new Point(54, 107), 20) && !getCol){
- Log.log("Out of raw material!", Color.RED);
- Mouse.click(489,30);
- sleep(100,200);
- return -1;
- }else{
- Log.log("Second check came back positive, continuing!", Color.GREEN);
- }
- }
- ore = Game.getColorAt(54, 107);
- ORE_DTM_RGB [0] = Game.getColorAt(54, 107);
- oredtm = new DTM2(ORE_DTM_PTS, ORE_DTM_RGB);
- getCol = false;
- Bank.depositAll();
- Script.sleep(500,700);
- switch(smelting){
- case 1:
- Mouse.move(Random.random(41, 66),Random.random(96, 120));
- Script.sleep(500,700);
- withdrawX(14);
- Script.sleep(2000);
- if(!checkColor(ore, chkPt, 30)) Mouse.move(Random.random(41, 66),Random.random(96, 120));
- else Mouse.move(Random.random(87, 108),Random.random(96, 120));
- Script.sleep(500,700);
- withdrawX(14);
- break;
- case 4:
- Mouse.move(Random.random(41, 66),Random.random(96, 120));
- Script.sleep(500,700);
- withdrawX(9);
- Script.sleep(2000);
- if(!checkColor(ore, chkPt, 30)) Mouse.move(Random.random(41, 66),Random.random(96, 120));
- else Mouse.move(Random.random(87, 108),Random.random(96, 120));
- Script.sleep(500,700);
- withdrawAll();
- break;
- case 6:
- Mouse.move(Random.random(41, 66),Random.random(96, 120));
- Script.sleep(500,700);
- withdrawX(5);
- Script.sleep(2000);
- if(!checkColor(ore, chkPt, 30)) Mouse.move(Random.random(41, 66),Random.random(96, 120));
- else Mouse.move(Random.random(87, 108),Random.random(96, 120));
- Script.sleep(500,700);
- withdrawAll();
- break;
- case 7:
- Mouse.move(Random.random(41, 66),Random.random(96, 120));
- Script.sleep(500,700);
- withdrawX(4);
- Script.sleep(2000);
- if(!checkColor(ore, chkPt, 30)) Mouse.move(Random.random(41, 66),Random.random(96, 120));
- else Mouse.move(Random.random(87, 108),Random.random(96, 120));
- Script.sleep(500,700);
- withdrawAll();
- break;
- case 8:
- Mouse.move(Random.random(41, 66),Random.random(96, 120));
- Script.sleep(500,700);
- withdrawX(3);
- Script.sleep(2000);
- if(!checkColor(ore, chkPt, 30)) Mouse.move(Random.random(41, 66),Random.random(96, 120));
- else Mouse.move(Random.random(87, 108),Random.random(96, 120));
- Script.sleep(500,700);
- withdrawAll();
- break;
- default:
- Mouse.move(Random.random(41, 66),Random.random(96, 120));
- Script.sleep(500,700);
- withdrawAll();
- break;
- }
- sleep(500,700);
- //Close the window.
- Mouse.click(489,30);
- sleep(100,200);
- Mouse.move(Random.random(0,765), Random.random(0,502));
- sleep(400,500);
- }
- if(makeJewl)S = 0;
- status = "Walking to furnace";
- return 100;
- }
- private void reset() {
- Point[] LOGIN_DTM_PTS = { new Point( 318, 256), new Point( 447, 255), new Point( 387, 325)};
- Color[] LOGIN_DTM_RGB = { new Color( 192, 137, 28), new Color( 202, 151, 35), new Color( 80, 128, 202)};
- DTM2 dtmLogin = new DTM2(LOGIN_DTM_PTS, LOGIN_DTM_RGB);
- Point[] LOGGED_DTM_PTS = { new Point( 382, 191), new Point( 364, 227), new Point( 401, 226)};
- Color[] LOGGED_DTM_RGB = { new Color( 241, 213, 108), new Color( 158, 132, 53), new Color( 153, 123, 37)};
- DTM2 dtmLogged1 = new DTM2(LOGGED_DTM_PTS, LOGGED_DTM_RGB);
- Reseter.reset();
- //Log.log("If you would like this feature please PM TheBat.", Color.RED);
- while(!dtmLogin.findDTMS(20)){
- sleep(100);
- }
- sleep(8000);
- Mouse.click(Random.random(280,325), Random.random(165,177));
- sleep(700);
- Keyboard.sendKeys(userName, true, 100);
- sleep(700);
- Keyboard.sendKeys(password, true, 100);
- sleep(12000);
- Mouse.click(Random.random(260,503),Random.random(447,476));
- while(!isLoggedIn()){
- if(dtmLogged1.findDTMS(20)){
- Mouse.click(Random.random(309, 450),Random.random(315, 326));
- sleep(100);
- }
- }
- Game.clickCompass();
- Camera.pitchUp(1000);
- TO += TIME-System.currentTimeMillis();
- status = "Walking back";
- }
- /**
- * Checks if the player is logged in
- * @return boolean
- * - true if logged in.
- * - false if logged out.
- */
- private static boolean isLoggedIn() {
- Point[] DTM_PTS = { new Point( 754, 10), new Point( 758, 6), new Point( 750, 6), new Point( 750, 14), new Point( 758, 14)};
- Color[] DTM_RGB = { new Color( 115, 98, 55), new Color( 153, 131, 84), new Color( 162, 146, 104), new Color( 115, 98, 55), new Color( 104, 88, 46)};
- DTM2 dtmlog = new DTM2(DTM_PTS, DTM_RGB);
- if(!dtmlog.findDTMS(30,new Rectangle(740,6,14,14)))
- return Bank.isOpen();
- else return true;
- }
- private void withdrawX(int i){
- Mouse.click(false);
- sleep(500,700);
- String lol = OCR.findString(new Rectangle(Mouse.getLocation().x-30,Mouse.getLocation().y+65, 140,21), null,true);
- if(lol.contains(" "+i+" ")){
- Mouse.click(Mouse.getLocation().x, (Mouse.getLocation().y + Random.random(73,83)));
- }else{
- Mouse.click(Mouse.getLocation().x, (Mouse.getLocation().y + Random.random(86,100)));
- Script.sleep(1200);
- Keyboard.sendKeys(""+i,true,500,700);
- }
- }
- private void withdrawAll(){
- Mouse.click(false);
- sleep(500,700);
- Mouse.click(Mouse.getLocation().x, (Mouse.getLocation().y + Random.random(102,114)));
- }
- @SuppressWarnings("unused")
- private void withdrawAllB1(){
- Mouse.click(false);
- sleep(500,700);
- Mouse.click(Mouse.getLocation().x, (Mouse.getLocation().y + Random.random(119,131)));
- }
- public void onRepaint(Graphics g){
- if(showD)g.drawString("Time Running: " + Timer.getTime(System.currentTimeMillis() - TIME), 11, 358);
- if(showPaint){
- g.drawImage(back, 5, 343, null);
- g.setColor(Color.BLACK);
- g.setFont(new Font("Salaryman", 1, 14));
- g.drawString("Time Running: " + Timer.getTime(System.currentTimeMillis() - TIME), 11, 358);
- g.drawString("Total Smelted: " + smelted ,11,373);
- try{
- g.drawString("Smelted/Hour: " + (3600000*(long)smelted)/(int)(System.currentTimeMillis() - TIME),11,388);
- g.drawString("Exp./Hour: " + (int)(exp *(3600000*(long)smelted)/(int)(System.currentTimeMillis() - TIME)),11,403);
- g.drawString("Profit/Hour: " + (int)(profit *(3600000*(long)(smelted))/(int)(System.currentTimeMillis() - TIME)),11,418);
- }catch(ArithmeticException e){}
- g.drawString("Status: " + status ,11,433);
- if(makeJewl)g.drawString("Current Setting: " + type + " (" + typeJ + ")",11,448);
- else g.drawString("Current Setting: " + type ,11,448);
- switch(location){
- case 'A':
- g.drawString("Location: Edgeville",11,463);
- break;
- case 'B':
- g.drawString("Location: Al-Kharid" ,11,463);
- break;
- }
- g.setFont(new Font("Salaryman", 1, 25));
- g.drawString("BatSmelterAIO",270,390);
- g.drawString("Version " + version,265,420);
- 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.ORANGE);
- g.drawLine(Mouse.getLocation().x,0,Mouse.getLocation().x,2100);
- g.drawLine(0,Mouse.getLocation().y,2100,Mouse.getLocation().y);
- g.setColor(Color.GREEN);
- g.drawRect(drawR.x,drawR.y,drawR.width,drawR.height);
- }
- /**
- * 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 static 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;
- }
- 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) {}
- @SuppressWarnings("serial")
- class GUI extends JFrame implements ActionListener{
- GridBagConstraints c;
- Container pane1;
- Container pane2;
- Container pane3;
- JTabbedPane tabbedPane = new JTabbedPane();
- public boolean OPEN = true;
- private JButton startB1 = new JButton("Start");
- private JButton startB2 = new JButton("Start");
- private JButton startB3 = new JButton("Start");
- private JLabel smeltL = new JLabel("Smelting Type:", JLabel.LEFT);
- private JLabel goldL = new JLabel("Gold Jewlery:", JLabel.LEFT);
- private JLabel silverL = new JLabel("Silver Jewlery:", JLabel.LEFT);
- private JLabel unL = new JLabel("Username:", JLabel.LEFT);
- private JLabel passL = new JLabel("Password:", JLabel.LEFT);
- private JTextField unT = new JTextField();
- private JPasswordField pT = new JPasswordField();
- private JComboBox<String> smeltCB;
- private JComboBox<String> silverCB;
- private JComboBox<String> goldCB;
- private JComboBox<String> locationCB;
- private JLabel locL = new JLabel("Location:", JLabel.LEFT);
- private JCheckBox goldSmithChkB = new JCheckBox("Use goldsmithing gauntlets", false);
- private JCheckBox JewlChkB = new JCheckBox("Make Jewelry", false);
- private JCheckBox logInChkB = new JCheckBox("Login after Client Token Error", false);
- private JCheckBox logOutChkB = new JCheckBox("Log out on shutdown", false);
- private String [] smelt;
- private String [] locs;
- private String [] gold;
- private String [] silver;
- public GUI(){
- super("BatSmelter " + version);
- tabbedPane = new JTabbedPane();
- pane1 = new Container();
- pane1.setLayout(new GridBagLayout());
- pane2 = new Container();
- pane2.setLayout(new GridBagLayout());
- pane3 = new Container();
- pane3.setLayout(new GridBagLayout());
- c = new GridBagConstraints();
- c.fill = GridBagConstraints.HORIZONTAL;
- c.ipady = c.ipadx = 3;
- c.insets = new Insets(5, 5, 5, 5);
- init();
- build();
- logInChkB.setEnabled(Reseter.setup());
- unL.setEnabled(Reseter.setup());
- unT.setEnabled(Reseter.setup());
- passL.setEnabled(Reseter.setup());
- pT.setEnabled(Reseter.setup());
- this.setLocationRelativeTo(getParent());
- }
- private void build(){
- addToGrid(locL,0,0,1,.25, pane1);
- addToGrid(locationCB,1,0,1,.75, pane1);
- addToGrid(smeltL,0,1,1,.25, pane1);
- addToGrid(smeltCB,1,1,1,.75, pane1);
- addToGrid(goldSmithChkB,0,2,1,.5, pane1);
- addToGrid(JewlChkB,1,2,1,.5, pane1);
- addToGrid(startB1,1,3,1,.5, pane1);
- addToGrid(goldL,0,0,1,.25, pane2);
- addToGrid(goldCB,1,0,1,.75, pane2);
- addToGrid(silverL,0,1,1,.25, pane2);
- addToGrid(silverCB,1,1,1,.75, pane2);
- addToGrid(startB2,1,5,1,.5, pane2);
- addToGrid(logInChkB,1,2,1,.5, pane3);
- addToGrid(unL,0,3,1,.25, pane3);
- addToGrid(unT,1,3,1,.75, pane3);
- addToGrid(passL,0,4,1,.25, pane3);
- addToGrid(pT,1,4,2,.75, pane3);
- addToGrid(logOutChkB,0,5,1,.5, pane3);
- addToGrid(startB3,1,5,1,.5, pane3);
- tabbedPane.addTab("Smelting", pane1);
- tabbedPane.addTab("Jewelry", pane2);
- tabbedPane.addTab("Login", pane3);
- getContentPane().add(tabbedPane);
- pack();
- setVisible(true);
- }
- private void init(){
- startB1.addActionListener(this);
- startB2.addActionListener(this);
- startB3.addActionListener(this);
- smelt = new String []{"Cannonballs", "Bronze", "Iron", "Silver", "Steel", "Gold", "Mithril", "Adamant", "Runite"};
- smeltCB = new JComboBox<String>(smelt);
- smeltCB.setSelectedIndex(0);
- locs = new String []{"Edgeville", "Al-Kharid"};
- locationCB = new JComboBox<String>(locs);
- locationCB.setSelectedIndex(0);
- gold = new String []{"Rings", "Necklaces", "Amulets", "Bracelets"};
- goldCB = new JComboBox<String>(gold);
- goldCB.setSelectedIndex(0);
- silver = new String []{"Holy Symbol", "Sickles", "Tiara", "Unholy Symbol", "Bolts"};
- silverCB = new JComboBox<String>(silver);
- silverCB.setSelectedIndex(0);
- }
- private void addToGrid(Component comp, int gridx, int gridy, int gridwidth,
- double weightx, Container pane) {
- c.gridx = gridx;
- c.gridy = gridy;
- c.gridwidth = gridwidth;
- c.weightx = weightx;
- pane.add(comp, c);
- }
- public void actionPerformed(ActionEvent e) {
- if(locationCB.getSelectedIndex() == 0)location = 'A';
- else location = 'B';
- if(logInChkB.isSelected()){
- userName = unT.getText();
- password = "";
- for(int i = 0; i < pT.getPassword().length; i++){
- password += pT.getPassword()[i];
- pT.getPassword()[i] = '0';
- }
- login = true;
- }
- smelting = smeltCB.getSelectedIndex();
- switch(smelting){
- case 0:
- type = "Cannonballs";
- break;
- case 1:
- type = "Bronze bars";
- break;
- case 2:
- type = "Iron bars";
- break;
- case 3:
- type = "Silver bars";
- break;
- case 4:
- type = "Steel bars";
- break;
- case 5:
- type = "Gold bars";
- break;
- case 6:
- type = "Mithril bars";
- break;
- case 7:
- type = "Adamant bars";
- break;
- case 8:
- type = "Rune bars";
- break;
- }
- if(JewlChkB.isSelected()){
- makeJewl = true;
- S = 0;
- if(smelting == 3){
- jewel = silverCB.getSelectedIndex();
- typeJ = silver[silverCB.getSelectedIndex()];
- }else if(smelting == 5){
- jewel = goldCB.getSelectedIndex() + 5;
- typeJ = gold[goldCB.getSelectedIndex()];
- }
- }
- logout = logOutChkB.isSelected();
- goldsmith = goldSmithChkB.isSelected();
- OPEN = false;
- dispose();
- }
- }
- static 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 static boolean staminaOff;
- public static boolean staminaOff() {
- return staminaOff;
- }
- public StaminaChecker() {
- this.setPriority(MIN_PRIORITY);
- }
- @Override
- public void run() {
- try{
- while (!Thread.interrupted()) {
- if (!checkColor(cOn, p, 20)){
- staminaOff = true;
- walkmod = 2;
- if(checkColor(fullStam, pfullStam, 20)){
- staminaFull = true;
- }
- }else if (!checkColor(cOff, p, 20)){
- staminaOff = false;
- staminaFull = false;
- walkmod = 1;
- }
- if(Thread.interrupted()) return;
- }
- } finally{}
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement