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.KeyEvent;
- 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 java.util.LinkedList;
- import java.util.List;
- 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.tribot.bot.ClientContext;
- import org.tribot.interfaces.Paintable;
- import org.tribot.script.Script;
- import org.tribot.script.ScriptManifest;
- import org.tribot.script.methods.Banking;
- import org.tribot.script.methods.Colour;
- import org.tribot.script.methods.General;
- import org.tribot.script.methods.Timing;
- @ScriptManifest(
- authors = { "TheBat"},
- name = "BatSmelterAIO",
- version = 1.0,
- description = "Smelts shit in edgeville or Al-Kharid.",
- category = "Smithing")
- public class BatSmelterAIO extends Script implements MouseListener, Paintable{
- 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)};
- DTM2 dtmCast = new DTM2(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 = { Colour.getColour(582, 219), Colour.getColour(580, 228), Colour.getColour(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 OCR ocr = new OCR();
- 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 {
- println("Images not found, retrieving from internet.");
- 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){
- 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();
- General.clickMouse(new Point(543,26),1);
- sleep(200);
- ClientContext.get().client.getKeyboardHandler().sendPressEvent((char)KeyEvent.VK_UP);
- sleep(300);
- ClientContext.get().client.getKeyboardHandler().sendReleaseEvent((char)KeyEvent.VK_UP);
- return true;
- }
- public void onStop(){
- if(stamStam.isAlive()){
- stamStam.interrupt();
- }
- if(logout){
- println("Logging out.");
- General.clickMouse(new Point(General.random(748,760),General.random(4,15)), 1);
- sleep(General.random(400,600));
- General.clickMouse(new Point(General.random(576,708),General.random(394,418)),1);
- }
- println("You managed to smelt " + smelted + " items!");
- println("Total runtime: " + Timing.msToString(System.currentTimeMillis() - TIME));
- println("Thanks for using BatSmelterAIO");
- }
- @Override
- public void run() {
- if(onStart())while(!Thread.interrupted()&&(loop() > 0));
- onStop();
- }
- /*****************************************************/
- /*** LOOP ***/
- /*****************************************************/
- public int loop(){
- if(!isLoggedIn()){
- println("You have been logged out, you are probably Client token errored, Shutting down.");
- return -1;
- }
- General.setMouseSpeed(General.random(3,5));
- if(!Banking.isBankScreenOpen()) if(!getOpenTab().equals(Tab.INVENTORY))openTab(Tab.INVENTORY);
- if(location == 'A'){
- return loopA();
- }else if(location == 'B'){
- return loopB();
- }else{
- println("ERROR WITH LOCATION! SOMETHING VERY BAD HAPPEND!");
- return -1;
- }
- }
- ///////////////////////
- // Loop for Edgeville//
- ///////////////////////
- public int loopA() {
- if(status.equals("Finding banker")){
- if(Banking.isBankScreenOpen()){
- status = "Banking";
- return 100;
- }
- if(dtmBanker2.findDTMS(20, VIEWPORTR) || dtmBanker1.findDTMS(20, VIEWPORTR) || dtmBanker3.findDTMS(20, VIEWPORTR)){
- int i = General.random(0,DTM2.dtmLocations.size()-1);
- Point bankerPt = new Point((int)DTM2.dtmLocations.get(i).getCenterX(),(int)DTM2.dtmLocations.get(i).getCenterY());
- General.clickMouse(bankerPt,-1);
- sleep(100);
- String lol = ocr.findString(new Rectangle(bankerPt.x-65,bankerPt.y+30, 130,25), null,true,false);
- if(lol.contains("Bank") || lol.contains("ank") || lol.contains("nk") || lol.contains("Ba")|| lol.contains("Ban")){
- General.clickMouse(new Point(bankerPt.x,bankerPt.y+46),1);
- trys = 0;
- int k = 0;
- while(!Banking.isBankScreenOpen() && k <= 30){
- sleep(100);
- k++;
- }
- }else {if(trys++ == 8){
- trys = 0;
- status = "Lost";
- tStat = "Finding banker";
- }
- General.moveMouse(new Point(General.random(0,517),General.random(0,339)));
- }
- }else{
- if(trys++ >= 3){
- if(dtmBanker2.findDTMS(30, VIEWPORT) || dtmBanker1.findDTMS(30, VIEWPORT) || dtmBanker3.findDTMS(30, VIEWPORT)){
- int i = General.random(0,DTM2.dtmLocations.size()-1);
- Point bankerPt = new Point((int)DTM2.dtmLocations.get(i).getCenterX(),(int)DTM2.dtmLocations.get(i).getCenterY());
- General.clickMouse(bankerPt,2);
- sleep(100);
- String lol = ocr.findString(new Rectangle(bankerPt.x-65,bankerPt.y+30, 130,25), null,true,false);
- if(lol.contains("Bank") || lol.contains("ank") || lol.contains("nk") || lol.contains("Ba")|| lol.contains("Ban")){
- General.clickMouse(new Point(bankerPt.x,bankerPt.y+46),1);
- int k = 0;
- while(!Banking.isBankScreenOpen() && k <= 50){
- sleep(100);
- k++;
- }
- }else trys++;
- }else if(trys++ >= 8){
- trys= 0;
- tStat = "Finding banker";
- status = "Lost";
- return 100;
- }
- General.moveMouse(new Point(General.random(0,517),General.random(0,339)));
- }
- return 100;
- }
- if(Banking.isBankScreenOpen()){
- status = "Banking";
- return 100;
- }
- return 100;
- }
- //Lost!
- if(status.equals("Lost")){
- if(dtmFurnSym.findDTMS(20, MINIMAP)){
- int i = General.random(0,DTM2.dtmLocations.size()-1);
- Point symPt = new Point((int)DTM2.dtmLocations.get(i).getCenterX(),(int)DTM2.dtmLocations.get(i).getCenterY());
- General.clickMouse(new Point(symPt.x+General.random(-7,7),symPt.y+General.random(-7,7)),1);
- sleep(6500);
- if(tStat.equals("Finding banker")){
- if(dtmBank1.findDTMS(20, MINIMAP) || dtmBank2.findDTMS(20, MINIMAP) || dtmBank3.findDTMS(20, MINIMAP)){
- int j = General.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;
- General.clickMouse(bankPt,1);
- sleep(6500);
- }
- }
- status = tStat;
- return 100;
- }
- if(trys++ == 6){
- println("Completely lost. Might be a random.");
- 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 = General.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);
- }
- General.clickMouse(smithPt,1);
- sleep(1000);
- showD = false;
- drawR = new Rectangle();
- sleep(4100);
- status = "Finding furnace";
- return 100;
- }else if(dtmFurnSym.findDTMS(20, MINIMAP)){
- int i = General.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());
- General.clickMouse(new Point(symPt.x+General.random(-2,2),symPt.y+General.random(-2,2)),1);
- sleep(1000);
- drawR = new Rectangle();
- 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 = General.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,new Rectangle(561, 212, 36, 32).getBounds()))General.clickMouse(new Point(General.random(567,587),General.random(219,240)),1);
- General.clickMouse(FurnPt,2);
- sleep(300);
- String lol = ocr.findString(new Rectangle(FurnPt.x-100,FurnPt.y+15, 200,25), null,true,false);
- if((lol.contains("Use") || lol.contains("Smelt"))&& lol.contains("Furnace")){
- General.clickMouse(new Point(FurnPt.x,FurnPt.y+33),1);
- }else{
- General.moveMouse(new Point(General.random(0,765), General.random(0,502)));
- if(S==1 && (smelting == 3 || smelting == 5) && dtmSelected.findDTMS(10,new Rectangle(561, 212, 36, 32).getBounds()))General.clickMouse(new Point(General.random(567,587),General.random(219,240)),1);
- if(trys++ >= 5){
- trys= 0;
- tStat = "Finding furnace";
- status = "Lost";
- return 100;
- }
- }
- int k = 0;
- while((!Colour.getColour(319,360).equals(new Color(90,82,69)) || dtmCast.findDTMS(20))&& k <= 30){
- sleep(100);
- k++;
- }
- }else{
- if(trys++ >= 5){
- trys = 0;
- tStat = "Finding furnace";
- status = "Lost";
- }
- return 100;
- }
- if(Colour.getColour(319,360).equals(new Color(90,82,69))){
- first = true;
- row = 0;
- col = 0;
- reTry = System.currentTimeMillis();
- smeltedT = smelted;
- firstS = true;
- status = "Smelting";
- General.moveMouse(new Point(General.random(233,273),General.random(405,452)));
- }else if(dtmCast.findDTMS(20)){
- switch(jewel){
- case 0:
- General.clickMouse(new Point(85,90),2);
- break;
- case 1:
- General.clickMouse(new Point(170,90),2);
- break;
- case 2:
- General.clickMouse(new Point(255,100),2);
- break;
- case 3:
- General.clickMouse(new Point(78,205),2);
- break;
- case 4:
- General.clickMouse(new Point(335,210),2);
- break;
- case 5:
- General.clickMouse(new Point(115,105),2);
- break;
- case 6:
- General.clickMouse(new Point(130,165),2);
- break;
- case 7:
- General.clickMouse(new Point(130,228),2);
- break;
- case 8:
- General.clickMouse(new Point(130,290),2);
- break;
- }
- sleep(300);
- General.clickMouse(new Point(General.getMousePos().x, General.getMousePos().y + 60),1);
- first = true;
- row = 0;
- col = 0;
- reTry = System.currentTimeMillis();
- smeltedT = smelted;
- firstS = true;
- status = "Smelting";
- 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;
- General.clickMouse(bankPt,1);
- sleep(1000);
- 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);
- General.clickMouse(new Point((x = pfullStam.x+General.random(-3,5)),(y = pfullStam.y+General.random(3,25))),1);
- sleep(400,500);
- General.clickMouse(new Point(x, (y + General.random(21,32))),1);
- sleep(400,500);
- walkmod = 1;
- }
- if(status.equals("Finding banker")){
- if(Banking.isBankScreenOpen()){
- status = "Banking";
- return 100;
- }
- if(dtmAlBanker.findDTMS(20, VIEWPORTS)){
- int i = General.random(0,DTM2.dtmLocations.size()-1);
- Point bankerPt = new Point((int)DTM2.dtmLocations.get(i).getCenterX(),(int)DTM2.dtmLocations.get(i).getCenterY());
- General.clickMouse(bankerPt,2);
- sleep(100);
- String lol = ocr.findString(new Rectangle(bankerPt.x-65,bankerPt.y+30, 130,25), null,true,false);
- if((lol.contains("Bank") || lol.contains("ank") || lol.contains("nk") || lol.contains("Ba")|| lol.contains("Ban")) && !lol.contains("Booth")){
- General.clickMouse(new Point(bankerPt.x,bankerPt.y+46),1);
- trys = 0;
- int k = 0;
- while(!Banking.isBankScreenOpen() && k <= 30){
- sleep(100);
- k++;
- }
- }else {
- if(trys++ == 8){
- trys = 0;
- tStat = "Finding banker";
- status = "Lost";
- }
- General.moveMouse(new Point(General.random(0,517),General.random(0,339)));
- }
- }
- return 100;
- }
- //Lost!
- if(status.equals("Lost")){
- if(dtmFurnSym.findDTMS(20, MINIMAP)){
- int i = General.random(0,DTM2.dtmLocations.size()-1);
- Point symPt = new Point((int)DTM2.dtmLocations.get(i).getCenterX(),(int)DTM2.dtmLocations.get(i).getCenterY());
- General.clickMouse(symPt,1);
- for(int j = 0; j <= 65; j++)sleep(100*walkmod);
- if(tStat.equals("Finding banker")){
- if(dtmAlDoor1.findDTMS(20, MINIMAP)){
- int j = General.random(0,DTM2.dtmLocations.size()-1);
- Point bankPt = new Point((int)DTM2.dtmLocations.get(j).getCenterX(),(int)DTM2.dtmLocations.get(j).getCenterY());
- General.clickMouse(bankPt,1);
- for(int k = 0; k <= 65; k++)sleep(100*walkmod);
- }
- }
- status = tStat;
- return 100;
- }
- if(trys++ == 6){
- println("Completely lost. Might be a random.");
- 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 = General.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;
- General.clickMouse(cactPt,1);
- for(int j = 0; j <= 34; j++){
- sleep(100*walkmod);
- }
- if(dtmCactus1.findDTMS(20, MINIMAP) || dtmCactus2.findDTMS(20, MINIMAP) ){
- i = General.random(0,DTM2.dtmLocations.size()-1);
- cactPt = new Point((int)DTM2.dtmLocations.get(i).getCenterX(),(int)DTM2.dtmLocations.get(i).getCenterY());
- cactPt.x -= General.random(10, 15);
- cactPt.y -= 76;
- General.clickMouse(cactPt,1);
- 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 = General.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,new Rectangle(561, 212, 36, 32).getBounds()))General.clickMouse(new Point(General.random(567,587),General.random(219,240)),1);
- General.clickMouse(new Point(FurnPt),2);
- sleep(300);
- String lol = ocr.findString(new Rectangle(FurnPt.x-100,FurnPt.y+15, 200,25), null,true,false);
- if((lol.contains("Smelt") || lol.contains("Use"))&& lol.contains("Furnace")){
- General.clickMouse(new Point(FurnPt.x,FurnPt.y+33),1);
- }else{
- General.moveMouse(new Point(General.random(0,765), General.random(0,502)));
- if(S==1 && (smelting == 3 || smelting == 5) && dtmSelected.findDTMS(10,new Rectangle(561, 212, 36, 32).getBounds()))General.clickMouse(new Point(General.random(567,587),General.random(219,240)),1);
- // if(trys == 3){
- // General.clickMouse(236,171);
- // return 100;
- // }
- if(trys++ >= 5){
- General.clickMouse(new Point(236,171),1);
- // trys= 0;
- // tStat = "Finding furnace";
- // status = "Lost";
- return 100;
- }
- }
- int k = 0;
- while((!Colour.getColour(319,360).equals(new Color(90,82,69)) || dtmCast.findDTMS(20))&& k <= 30){
- sleep(100);
- k++;
- }
- }else{
- if(trys++ >= 5){
- trys = 0;
- tStat = "Finding furnace";
- status = "Lost";
- }
- return 100;
- }
- if(Colour.getColour(319,360).equals(new Color(90,82,69))){
- first = true;
- row = 0;
- col = 0;
- reTry = System.currentTimeMillis();
- smeltedT = smelted;
- firstS = true;
- status = "Smelting";
- General.moveMouse(new Point(General.random(233,273),General.random(405,452)));
- }else if(dtmCast.findDTMS(20)){
- switch(jewel){
- case 0:
- General.clickMouse(new Point(85,90),2);
- break;
- case 1:
- General.clickMouse(new Point(170,90),2);
- break;
- case 2:
- General.clickMouse(new Point(255,100),2);
- break;
- case 3:
- General.clickMouse(new Point(78,205),2);
- break;
- case 4:
- General.clickMouse(new Point(335,210),2);
- break;
- case 5:
- General.clickMouse(new Point(115,105),2);
- break;
- case 6:
- General.clickMouse(new Point(130,165),2);
- break;
- case 7:
- General.clickMouse(new Point(130,228),2);
- break;
- case 8:
- General.clickMouse(new Point(130,290),2);
- break;
- }
- sleep(300);
- General.clickMouse(new Point(General.getMousePos().x, General.getMousePos().y + 60),1);
- first = true;
- row = 0;
- col = 0;
- reTry = System.currentTimeMillis();
- smeltedT = smelted;
- firstS = true;
- status = "Smelting";
- sleep(1000);
- }
- return 100;
- }
- //Smelting
- if(status.equals("Smelting")){
- return smelt();
- }
- if(status.equals("Walking back")){
- // if(dtmAlHedge1.findDTMS(20, MINIMAP)){
- // int i = General.random(0,DTM2.dtmLocations.size()-1);
- // Point hedgePt = new Point((int)DTM2.dtmLocations.get(i).getCenterX(),(int)DTM2.dtmLocations.get(i).getCenterY());
- // General.clickMouse(hedgePt);
- // Environment.saveScreenshot();
- // for(int j = 0; j <= 70; j++){
- // sleep(100*walkmod);
- // }
- // if(dtmAlHedge1.findDTMS(20, MINIMAP)){
- // i = General.random(0,DTM2.dtmLocations.size()-1);
- // hedgePt = new Point((int)DTM2.dtmLocations.get(i).getCenterX(),(int)DTM2.dtmLocations.get(i).getCenterY());
- // hedgePt.x -= 30;
- // General.clickMouse(hedgePt);
- // Environment.saveScreenshot();
- // for(int j = 0; j <= 30; j++){
- // sleep(100*walkmod);
- // }
- General.clickMouse(new Point(609, 158),1);
- for(int j = 0; j <= 100; j++){
- sleep(100*walkmod);
- }
- status = "Finding banker";
- return 100;
- // }
- // }
- }
- return 100;
- }
- /**********************************************************************************/
- /*************************** END LOOP *********************************************/
- /**********************************************************************************/
- /**
- * Opens a given tab.
- * @param tab The tab to open.
- */
- public void openTab(final Tab tab) {
- tab.open();
- }
- /**
- * Gets the open tab.
- * @return The open tab.
- */
- public Tab getOpenTab() {
- for (final Tab tab : Tab.values()) {
- if (tab.isOpen()) {
- return tab;
- }
- }
- return null;
- }
- private int smelt(){
- if(System.currentTimeMillis() - reTry > 20000 && smeltedT == smelted){
- status = "Finding furnace";
- }
- if(first){
- if(!makeJewl && !Colour.getColour(319,360).equals(new Color(90,82,69))){
- status = "Finding furnace";
- }
- if(smelting == 4){
- General.clickMouse(new Point(General.random(272,315),General.random(405,450)),1);
- }else{
- if(!makeJewl || S == 0){
- General.clickMouse(new Point(General.random(233,273),General.random(405,450)),1);
- }
- }
- temp0 = Colour.getColour(583,221);
- temp1 = Colour.getColour(591,225);
- temp2 = Colour.getColour(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 [] { Colour.getColour(582, 219), Colour.getColour(582, 219), Colour.getColour(582, 219), Colour.getColour(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(Banking.isBankScreenOpen()){
- if(!checkColor(ore, new Point(54, 107), 20) && !getCol){
- println("May be out of raw materials, rechecking bank just in case.");
- sleep(600,1000);
- if(!checkColor(ore, new Point(54, 107), 20) && !getCol){
- println("Out of raw material!");
- General.clickMouse(new Point(489,30), 1);
- sleep(100,200);
- return -1;
- }else{
- println("Second check came back positive, continuing!");
- }
- }
- ore = Colour.getColour(54, 107);
- ORE_DTM_RGB [0] = Colour.getColour(54, 107);
- oredtm = new DTM2(ORE_DTM_PTS, ORE_DTM_RGB);
- getCol = false;
- Banking.depositAll();
- sleep(500,700);
- switch(smelting){
- case 1:
- General.moveMouse(new Point(General.random(41, 66),General.random(96, 120)));
- sleep(500,700);
- withdrawX(14);
- sleep(2000);
- if(!checkColor(ore, chkPt, 30)) General.moveMouse(new Point(General.random(41, 66),General.random(96, 120)));
- else General.moveMouse(new Point(General.random(87, 108),General.random(96, 120)));
- sleep(500,700);
- withdrawX(14);
- break;
- case 4:
- General.moveMouse(new Point(General.random(41, 66),General.random(96, 120)));
- sleep(500,700);
- withdrawX(9);
- sleep(2000);
- if(!checkColor(ore, chkPt, 30)) General.moveMouse(new Point(General.random(41, 66),General.random(96, 120)));
- else General.moveMouse(new Point(General.random(87, 108),General.random(96, 120)));
- sleep(500,700);
- withdrawAll();
- break;
- case 6:
- General.moveMouse(new Point(General.random(41, 66),General.random(96, 120)));
- sleep(500,700);
- withdrawX(5);
- sleep(2000);
- if(!checkColor(ore, chkPt, 30)) General.moveMouse(new Point(General.random(41, 66),General.random(96, 120)));
- else General.moveMouse(new Point(General.random(87, 108),General.random(96, 120)));
- sleep(500,700);
- withdrawAll();
- break;
- case 7:
- General.moveMouse(new Point(General.random(41, 66),General.random(96, 120)));
- sleep(500,700);
- withdrawX(4);
- sleep(2000);
- if(!checkColor(ore, chkPt, 30)) General.moveMouse(new Point(General.random(41, 66),General.random(96, 120)));
- else General.moveMouse(new Point(General.random(87, 108),General.random(96, 120)));
- sleep(500,700);
- withdrawAll();
- break;
- case 8:
- General.moveMouse(new Point(General.random(41, 66),General.random(96, 120)));
- sleep(500,700);
- withdrawX(3);
- sleep(2000);
- if(!checkColor(ore, chkPt, 30)) General.moveMouse(new Point(General.random(41, 66),General.random(96, 120)));
- else General.moveMouse(new Point(General.random(87, 108),General.random(96, 120)));
- sleep(500,700);
- withdrawAll();
- break;
- default:
- General.moveMouse(new Point(General.random(41, 66),General.random(96, 120)));
- sleep(500,700);
- withdrawAll();
- break;
- }
- sleep(500,700);
- //Close the window.
- General.clickMouse(new Point(489,30),1);
- sleep(100,200);
- General.moveMouse(new Point(General.random(0,765), General.random(0,502)));
- sleep(400,500);
- }
- if(makeJewl)S = 0;
- status = "Walking to furnace";
- return 100;
- }
- /**
- * 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 Banking.isBankScreenOpen();
- else return true;
- }
- private void withdrawX(int i){
- General.clickMouse(General.getMousePos(),2);
- sleep(500,700);
- String lol = ocr.findString(new Rectangle(General.getMousePos().x-30,General.getMousePos().y+65, 140,21), null,true,false);
- if(lol.contains(" "+i+" ")){
- General.clickMouse(new Point(General.getMousePos().x, (General.getMousePos().y + General.random(73,83))),1);
- }else{
- General.clickMouse(new Point(General.getMousePos().x, (General.getMousePos().y + General.random(86,100))),1);
- sleep(1200);
- ClientContext.get().client.getKeyboardHandler().typeSend(""+i);
- }
- }
- private void withdrawAll(){
- General.clickMouse(General.getMousePos(),2);
- sleep(500,700);
- General.clickMouse(new Point(General.getMousePos().x, (General.getMousePos().y + General.random(102,114))),1);
- }
- @SuppressWarnings("unused")
- private void withdrawAllB1(){
- General.clickMouse(General.getMousePos(),-1);
- sleep(500,700);
- General.clickMouse(new Point(General.getMousePos().x, (General.getMousePos().y + General.random(119,131))),1);
- }
- public void paint(Graphics g){
- if(showD)g.drawString("Time Running: " + Timing.msToString(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: " + Timing.msToString(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(General.getMousePos().x,0,General.getMousePos().x,2100);
- g.drawLine(0,General.getMousePos().y,2100,General.getMousePos().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() - Colour.getColour(p).getRed()) < tol)
- if(Math.abs(col.getGreen() - Colour.getColour(p).getGreen()) < tol)
- if(Math.abs(col.getBlue() - Colour.getColour(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 smeltCB;
- private JComboBox silverCB;
- private JComboBox goldCB;
- private JComboBox 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();
- 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(smelt);
- smeltCB.setSelectedIndex(0);
- locs = new String []{"Edgeville", "Al-Kharid"};
- locationCB = new JComboBox(locs);
- locationCB.setSelectedIndex(0);
- gold = new String []{"Rings", "Necklaces", "Amulets", "Bracelets"};
- goldCB = new JComboBox(gold);
- goldCB.setSelectedIndex(0);
- silver = new String []{"Holy Symbol", "Sickles", "Tiara", "Unholy Symbol", "Bolts"};
- silverCB = new JComboBox(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{}
- }
- }
- /**
- * Game tab enumeration.
- */
- public enum Tab {
- COMBAT(0, new Rectangle(522, 170, 30, 33)),
- TASKS(1, new Rectangle(552, 170, 30, 33)),
- SKILLS(2, new Rectangle(582, 170, 30, 33)),
- QUESTS(3, new Rectangle(612, 170, 30, 33)),
- INVENTORY(4, new Rectangle(642, 170, 30, 33)),
- EQUIPMENT(5, new Rectangle(672, 170, 30, 33)),
- PRAYER(6, new Rectangle(702, 170, 30, 33)),
- MAGIC(7, new Rectangle(732, 170, 30, 33)),
- FRIEND_LIST(8, new Rectangle(552, 468, 30, 33)),
- FRIENDS_CHAT(9, new Rectangle(582, 468, 30, 33)),
- CLAN_CHAT(10, new Rectangle(612, 468, 30, 33)),
- OPTIONS(11, new Rectangle(642, 467, 30, 33)),
- EMOTES(12, new Rectangle(672, 468, 30, 33)),
- MUSIC(13, new Rectangle(702, 467, 30, 33)),
- NOTES(14, new Rectangle(732, 467, 30, 33));
- private final int index;
- private final Rectangle bounds;
- public static final Color TAB_OPEN = new Color(254, 239, 114);
- private Tab(final int index, final Rectangle bounds) {
- this.index = index;
- this.bounds = bounds;
- }
- /**
- * Gets the tab index.
- * @return The tab's index.
- */
- public int getIndex() {
- return index;
- }
- /**
- * Gets the tab bounds.
- * @return The tab's bounds.
- */
- public Rectangle getBounds() {
- return bounds;
- }
- /**
- * Gets the tab's center point.
- * @return The tab's center.
- */
- public Point getCenter() {
- return new Point(bounds.x + (int) (bounds.width / 2), bounds.y + (int) (bounds.height / 2));
- }
- /**
- * Gets the tab's color array.
- * @return The colors of the tab.
- */
- public Color[] getColors() {
- final List<Color> colors = new LinkedList<Color>();
- for (int x = bounds.x; x < bounds.x + bounds.width; x++) {
- for (int y = bounds.y; y < bounds.y + bounds.height; y++) {
- final Point p = new Point(x, y);
- colors.add(Colour.getColour(p));
- }
- }
- return colors.toArray(new Color[colors.size()]);
- }
- /**
- * Checks if the tab is open.
- * @return <tt>true</tt> if open; otherwise <tt>false</tt>.
- */
- public boolean isOpen() {
- for (final Color color : getColors()) {
- if (color.equals(TAB_OPEN)) {
- return true;
- }
- }
- return false;
- }
- /**
- * Opens the tab.
- */
- public void open() {
- if (!isOpen()) {
- General.clickMouse(getCenter(), 1, 6, 6);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement