Advertisement
TheBat

BatSmelterAIO

Mar 17th, 2012
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 48.47 KB | None | 0 0
  1. import java.awt.Color;
  2. import java.awt.Component;
  3. import java.awt.Container;
  4. import java.awt.Font;
  5. import java.awt.Graphics;
  6. import java.awt.GridBagConstraints;
  7. import java.awt.GridBagLayout;
  8. import java.awt.Insets;
  9. import java.awt.Point;
  10. import java.awt.Rectangle;
  11. import java.awt.event.ActionEvent;
  12. import java.awt.event.ActionListener;
  13. import java.awt.event.MouseEvent;
  14. import java.awt.event.MouseListener;
  15. import java.awt.image.BufferedImage;
  16. import java.io.File;
  17. import java.io.FileNotFoundException;
  18. import java.io.IOException;
  19. import java.lang.reflect.InvocationTargetException;
  20. import java.net.URL;
  21. import javax.imageio.ImageIO;
  22. import javax.swing.JButton;
  23. import javax.swing.JCheckBox;
  24. import javax.swing.JComboBox;
  25. import javax.swing.JFrame;
  26. import javax.swing.JLabel;
  27. import javax.swing.JPasswordField;
  28. import javax.swing.JTabbedPane;
  29. import javax.swing.JTextField;
  30. import javax.swing.SwingUtilities;
  31. import org.runedream.api.Script;
  32. import org.runedream.api.ScriptManifest;
  33. import org.runedream.api.methods.Bank;
  34. import org.runedream.api.methods.Camera;
  35. import org.runedream.api.methods.Environment;
  36. import org.runedream.api.methods.Game;
  37. import org.runedream.api.methods.Inventory;
  38. import org.runedream.api.methods.Keyboard;
  39. import org.runedream.api.methods.Mouse;
  40. import org.runedream.api.methods.Game.Tab;
  41. import org.runedream.api.util.Log;
  42. import org.runedream.api.util.Random;
  43. import org.runedream.api.util.Timer;
  44. @ScriptManifest(
  45. authors = { "TheBat"},
  46. name = "BatSmelterAIO",
  47. version = 1.5,
  48. description = "Smelts shit in edgeville or Al-Kharid.",
  49. keywords = {},
  50. language = { true, true, true, true })
  51.  
  52. public class BatSmelterAIO extends Script implements MouseListener{
  53. final private static Rectangle VIEWPORT = new Rectangle(4,4,513,335);
  54. final private static Rectangle VIEWPORTS = new Rectangle(4,35,513,304);
  55. final private static Rectangle VIEWPORTR = new Rectangle(234,4,279,335);
  56. final private static Rectangle MINIMAP = new Rectangle(548,6,156,156);
  57. final private static Rectangle MINIMAPL = new Rectangle(548,6,44,156);
  58. final private static Rectangle MINIMAPMR = new Rectangle(655,53,40,39);
  59. final private static Rectangle INVENTORY = new Rectangle(552,209,177,256);
  60.  
  61. //The dtm for the banker
  62. Point[] BANKER1_DTM_PTS = { new Point( 351, 227), new Point( 344, 243), new Point( 339, 248)};
  63. Color[] BANKER1_DTM_RGB = { new Color( 174, 123, 54), new Color( 23, 18, 33), new Color( 132, 106, 74)};
  64. DTM2 dtmBanker1 = new DTM2(BANKER1_DTM_PTS, BANKER1_DTM_RGB);
  65. Point[] BANKER2_DTM_PTS = { new Point( 351, 228), new Point( 346, 244)};
  66. Color[] BANKER2_DTM_RGB = { new Color( 176, 124, 54), new Color( 23, 18, 33)};
  67. DTM2 dtmBanker2 = new DTM2(BANKER2_DTM_PTS, BANKER2_DTM_RGB);
  68. Point[] BANKER3_DTM_PTS = { new Point( 263, 231), new Point( 258, 249)};
  69. Color[] BANKER3_DTM_RGB = { new Color( 164, 116, 51), new Color( 134, 107, 75)};
  70. DTM2 dtmBanker3 = new DTM2(BANKER3_DTM_PTS, BANKER3_DTM_RGB);
  71.  
  72. //The dtm for the Smithy Building
  73. Point[] SMITH1_DTM_PTS = { new Point( 659, 83), new Point( 680, 59), new Point( 683, 78)};
  74. Color[] SMITH1_DTM_RGB = { new Color( 232, 234, 250), new Color( 232, 234, 250), new Color( 232, 234, 250)};
  75. DTM2 dtmSmith1 = new DTM2(SMITH1_DTM_PTS, SMITH1_DTM_RGB);
  76. Point[] SMITH2_DTM_PTS = { new Point( 678, 83), new Point( 658, 60), new Point( 682, 63)};
  77. Color[] SMITH2_DTM_RGB = { new Color( 232, 234, 250), new Color( 232, 234, 250), new Color( 232, 234, 250)};
  78. DTM2 dtmSmith2 = new DTM2(SMITH2_DTM_PTS, SMITH2_DTM_RGB);
  79. Point[] SMITH3_DTM_PTS = { new Point( 670, 83), new Point( 662, 57), new Point( 682, 57)};
  80. Color[] SMITH3_DTM_RGB = { new Color( 231, 237, 235), new Color( 231, 237, 235), new Color( 231, 237, 235)};
  81. DTM2 dtmSmith3 = new DTM2(SMITH3_DTM_PTS, SMITH3_DTM_RGB);
  82. Point[] SMITH4_DTM_PTS = { new Point( 661, 83), new Point( 663, 57), new Point( 675, 57), new Point( 665, 83)};
  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)};
  84. DTM2 dtmSmith4 = new DTM2(SMITH4_DTM_PTS, SMITH4_DTM_RGB);
  85. Point[] SMITH5_DTM_PTS = { new Point( 693, 75), new Point( 675, 49), new Point( 691, 49)};
  86. Color[] SMITH5_DTM_RGB = { new Color( 249, 249, 239), new Color( 249, 249, 239), new Color( 249, 249, 239)};
  87. DTM2 dtmSmith5 = new DTM2(SMITH5_DTM_PTS, SMITH5_DTM_RGB);
  88. Point[] SMITH6_DTM_PTS = { new Point( 687, 83), new Point( 662, 57), new Point( 687, 57)};
  89. Color[] SMITH6_DTM_RGB = { new Color( 249, 249, 239), new Color( 249, 249, 239), new Color( 249, 249, 239)};
  90. DTM2 dtmSmith6 = new DTM2(SMITH6_DTM_PTS, SMITH6_DTM_RGB);
  91. Point[] SMITH7_DTM_PTS = { new Point( 683, 82), new Point( 663, 56), new Point( 677, 55)};
  92. Color[] SMITH7_DTM_RGB = { new Color( 249, 249, 239), new Color( 249, 249, 239), new Color( 249, 249, 239)};
  93. DTM2 dtmSmith7 = new DTM2(SMITH7_DTM_PTS, SMITH7_DTM_RGB);
  94. Point[] SMITH8_DTM_PTS = { new Point( 660, 83), new Point( 661, 58), new Point( 685, 58), new Point( 685, 83)};
  95. Color[] SMITH8_DTM_RGB = { new Color( 236, 232, 237), new Color( 236, 232, 237), new Color( 236, 232, 237), new Color( 236, 232, 237)};
  96. DTM2 dtmSmith8 = new DTM2(SMITH8_DTM_PTS, SMITH8_DTM_RGB);
  97. Point[] SMITH9_DTM_PTS = { new Point( 661, 57), new Point( 685, 56), new Point( 685, 82)};
  98. Color[] SMITH9_DTM_RGB = { new Color( 231, 234, 240), new Color( 231, 234, 240), new Color( 231, 234, 240)};
  99. DTM2 dtmSmith9 = new DTM2(SMITH9_DTM_PTS, SMITH9_DTM_RGB);
  100.  
  101. //The dtm for the furnace symbol
  102. Point[] FURN_SYM_DTM_PTS = { new Point( 687, 81), new Point( 689, 79)};
  103. Color[] FURN_SYM_DTM_RGB = { new Color( 250, 254, 18), new Color( 233, 106, 24)};
  104. DTM2 dtmFurnSym = new DTM2(FURN_SYM_DTM_PTS, FURN_SYM_DTM_RGB);
  105.  
  106. //The dtm for the furnace
  107. Point[] FURN1_DTM_PTS = { new Point( 402, 83), new Point( 405, 83)};
  108. Color[] FURN1_DTM_RGB = { new Color( 162, 34, 24), new Color( 58, 58, 55)};
  109. DTM2 dtmFurn1 = new DTM2(FURN1_DTM_PTS, FURN1_DTM_RGB);
  110. Point[] FURN2_DTM_PTS = { new Point( 430, 103), new Point( 428, 103)};
  111. Color[] FURN2_DTM_RGB = { new Color( 137, 29, 20), new Color( 56, 55, 53)};
  112. DTM2 dtmFurn2 = new DTM2(FURN2_DTM_PTS, FURN2_DTM_RGB);
  113.  
  114. //The dtm for the bank
  115. Point[] BANK1_DTM_PTS = { new Point( 586, 82), new Point( 586, 90), new Point( 586, 92)};
  116. Color[] BANK1_DTM_RGB = { new Color( 53, 100, 20), new Color( 250, 252, 238), new Color( 75, 68, 54)};
  117. DTM2 dtmBank1 = new DTM2(BANK1_DTM_PTS, BANK1_DTM_RGB);
  118. Point[] BANK2_DTM_PTS = { new Point( 594, 92), new Point( 594, 102), new Point( 594, 93)};
  119. Color[] BANK2_DTM_RGB = { new Color( 49, 97, 26), new Color( 233, 250, 236), new Color( 49, 97, 26)};
  120. DTM2 dtmBank2 = new DTM2(BANK2_DTM_PTS, BANK2_DTM_RGB);
  121. Point[] BANK3_DTM_PTS = { new Point( 594, 92), new Point( 594, 103), new Point( 594, 93)};
  122. Color[] BANK3_DTM_RGB = { new Color( 49, 97, 26), new Color( 233, 250, 236), new Color( 49, 97, 26)};
  123. DTM2 dtmBank3 = new DTM2(BANK3_DTM_PTS, BANK3_DTM_RGB);
  124. Point[] BANK4_DTM_PTS = { new Point( 594, 92), new Point( 594, 101), new Point( 594, 93)};
  125. Color[] BANK4_DTM_RGB = { new Color( 49, 97, 26), new Color( 233, 250, 236), new Color( 49, 97, 26)};
  126. DTM2 dtmBank4 = new DTM2(BANK4_DTM_PTS, BANK4_DTM_RGB);
  127.  
  128. //The dtm for the Al-Kharid banker
  129. Point[] AL_BANKER_DTM_PTS = { new Point( 149, 90), new Point( 144, 84)};
  130. Color[] AL_BANKER_DTM_RGB = { new Color( 226, 217, 227), new Color( 107, 103, 102)};
  131. DTM2 dtmAlBanker = new DTM2(AL_BANKER_DTM_PTS, AL_BANKER_DTM_RGB);
  132.  
  133. //The dtm for the Al-Kharid Smithy Building
  134. 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)};
  135. 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)};
  136. DTM2 dtmCactus1 = new DTM2(CACTUS1_DTM_PTS, CACTUS1_DTM_RGB);
  137. Point[] CACTUS2_DTM_PTS = { new Point( 656, 86), new Point( 669, 86), new Point( 669, 88)};
  138. Color[] CACTUS2_DTM_RGB = { new Color( 73, 115, 57), new Color( 48, 99, 25), new Color( 58, 57, 11)};
  139. DTM2 dtmCactus2 = new DTM2(CACTUS2_DTM_PTS, CACTUS2_DTM_RGB);
  140.  
  141. //The dtm for the Al-Kharid furnace
  142. Point[] ALFURN_DTM_PTS = { new Point( 137, 175), new Point( 112, 139), new Point( 178, 139), new Point( 166, 224), new Point( 103, 219)};
  143. 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)};
  144. DTM2 dtmAlFurn1 = new DTM2(ALFURN_DTM_PTS, ALFURN_DTM_RGB);
  145.  
  146. //The dtm for the Al-Kharid bank
  147. Point[] BCACACTUS1_DTM_PTS = { new Point( 593, 99), new Point( 590, 96), new Point( 596, 98), new Point( 593, 104), new Point( 600, 103)};
  148. 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)};
  149. DTM2 dtmBCactus1 = new DTM2(BCACACTUS1_DTM_PTS, BCACACTUS1_DTM_RGB);
  150. Point[] AL_HEDGE_DTM_PTS = { new Point( 619, 136), new Point( 652, 136), new Point( 652, 148), new Point( 619, 148)};
  151. 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)};
  152. DTM2 dtmAlHedge1 = new DTM2(AL_HEDGE_DTM_PTS, AL_HEDGE_DTM_RGB);
  153. Point[] ALDOOR_DTM_PTS = { new Point( 583, 91), new Point( 583, 94)};
  154. Color[] ALDOOR_DTM_RGB = { new Color( 243, 6, 3), new Color( 243, 6, 3)};
  155. DTM2 dtmAlDoor1 = new DTM2(ALDOOR_DTM_PTS, ALDOOR_DTM_RGB);
  156. Point[] AL_BANK1_DTM_PTS = { new Point( 588, 139), new Point( 602, 150), new Point( 597, 137)};
  157. Color[] AL_BANK1_DTM_RGB = { new Color( 242, 238, 244), new Color( 238, 229, 253), new Color( 238, 229, 253)};
  158. DTM2 dtmAlBank1 = new DTM2(AL_BANK1_DTM_PTS, AL_BANK1_DTM_RGB);
  159.  
  160. //dtm for a selected object
  161. Point[] SELECTED_DTM_PTS = { new Point( 572, 255)};
  162. Color[] SELECTED_DTM_RGB = { new Color( 255, 255, 255)};
  163. DTM2 dtmSelected = new DTM2(SELECTED_DTM_PTS, SELECTED_DTM_RGB);
  164.  
  165. //dtm for casting gui
  166. Point[] CAST_DTM_PTS = { new Point( 20, 30), new Point( 499, 30), new Point( 499, 321), new Point( 21, 321)};
  167. Color[] CAST_DTM_RGB = { new Color( 180, 178, 170), new Color( 175, 171, 164), new Color( 175, 171, 164), new Color( 175, 171, 164)};
  168. DTM dtmCast = new DTM(CAST_DTM_PTS, CAST_DTM_RGB);
  169.  
  170. /**
  171. * New bank finding dtms
  172. * Point[] DTM_PTS = { new Point( 581, 91), new Point( 586, 93), new Point( 582, 96)};
  173. * Color[] DTM_RGB = { new Color( 245, 247, 230), new Color( 245, 247, 230), new Color( 245, 247, 230)};
  174. * DTM2 dtm1 = new DTM2(DTM_PTS, DTM_RGB);
  175. *
  176. */
  177.  
  178. //dtm for an iron bar
  179. Point[] BAR_DTM_PTS = { new Point( 579, 218), new Point( 570, 237), new Point( 584, 227)};
  180. Color[] BAR_DTM_RGB = { new Color( 0, 0, 2), new Color( 0, 0, 2), new Color( 84, 81, 81)};
  181. DTM2 dtmBar = new DTM2(BAR_DTM_PTS, BAR_DTM_RGB);
  182.  
  183. Point[] ORE_DTM_PTS = { new Point( 54, 107)};
  184. Color[] ORE_DTM_RGB = new Color [1];
  185. DTM2 oredtm;
  186.  
  187. private static BufferedImage back = null;
  188. private static long TIME = 0, smeltTO = 0;
  189. private boolean showPaint = true, first = true;
  190. private Color temp0 = null, temp1 = null, temp2 = null, ore = new Color(0,0,0);
  191. private int row = 0, col = 0, smelted = 0;
  192. private static String status = "Setup";
  193. private boolean getCol = true;
  194. private GUI gui;
  195. private StaminaChecker stamStam = new StaminaChecker();
  196. protected int smelting = 0;
  197. private Point chkPt = new Point (54,107);
  198. private double exp = 25.2;
  199. protected boolean goldsmith = false;
  200. private String type = "Cannonballs";
  201. private long reTry = 0;
  202. private int smeltedT;
  203. private int trys = 0;
  204. private long TO = 21600000;
  205. private boolean login = false;
  206. private String userName = "";
  207. private String password = "";
  208. public static boolean staminaFull;
  209. private String version = "1.5";
  210. private Rectangle drawR = new Rectangle();
  211. private boolean firstS = true;
  212. private Color[] IRON_DTM_RGB = { Game.getColorAt(582, 219), Game.getColorAt(580, 228), Game.getColorAt(587, 234)};
  213. private int barsTemp = 0;
  214. private boolean logout = false;
  215. private char location = 'A';
  216. private int profit = 0;
  217. private String tStat = "Finding banker";
  218. private boolean showD = false;
  219. private boolean makeJewl = false;
  220. private int jewel = 0;
  221. private int S = 7;
  222. private String typeJ = "";
  223.  
  224. private static int walkmod = 1;
  225.  
  226. public boolean onStart(){
  227. ORE_DTM_RGB [0] = new Color(0,0,0);
  228. oredtm = new DTM2(ORE_DTM_PTS, ORE_DTM_RGB);
  229. try {
  230. back = ImageIO.read(new File("./Storage/BatScripts/backPick.png"));
  231. }catch (FileNotFoundException e) {
  232. }catch (IOException e) {
  233. try {
  234. Log.log("Images not found, retrieving from internet.",Color.RED);
  235. back = ImageIO.read(new URL("http://i1066.photobucket.com/albums/u406/bootsncats/underPaint.png"));
  236. File file = new File("./Storage/BatScripts/backPick.png");
  237. file.getParentFile().mkdirs();
  238. ImageIO.write(back, "png",file);
  239. } catch (IOException ex) {
  240. }
  241. }
  242.  
  243. try {
  244. SwingUtilities.invokeAndWait(new Runnable() {
  245. @Override
  246. public void run() {
  247. gui = new GUI();
  248. gui.setVisible(true);
  249. }
  250. });
  251. } catch (InterruptedException ex) {
  252. } catch (InvocationTargetException ex) {
  253. }
  254. while(gui.OPEN){
  255. Script.sleep(100);
  256. }
  257. switch(smelting){
  258. case 0:
  259. exp = 25.2;
  260. profit = 4*GE.getGuidePrice(2)-GE.getGuidePrice(2353);
  261. break;
  262. case 1:
  263. exp = 6.2;
  264. profit = GE.getGuidePrice(2349)-(GE.getGuidePrice(438) + GE.getGuidePrice(436));
  265. break;
  266. case 2:
  267. exp = 12.5;
  268. profit = GE.getGuidePrice(2351)-GE.getGuidePrice(440);
  269. break;
  270. case 3:
  271. exp = 13.7;
  272. profit = GE.getGuidePrice(2355)-GE.getGuidePrice(442);
  273. break;
  274. case 4:
  275. exp = 17.5;
  276. profit = GE.getGuidePrice(2353)-(GE.getGuidePrice(440)+ 2*GE.getGuidePrice(453));
  277. break;
  278. case 5:
  279. exp = 22.5;
  280. if(goldsmith) exp = 56.2;
  281. profit = GE.getGuidePrice(2357)-GE.getGuidePrice(444);
  282. break;
  283. case 6:
  284. exp = 30 ;
  285. profit = GE.getGuidePrice(2359)-(GE.getGuidePrice(447)+ 4*GE.getGuidePrice(453));
  286. break;
  287. case 7:
  288. exp = 37.5;
  289. profit = GE.getGuidePrice(2361)-(GE.getGuidePrice(449)+ 6*GE.getGuidePrice(453));
  290. break;
  291. case 8:
  292. exp = 50;
  293. profit = GE.getGuidePrice(2363)-(GE.getGuidePrice(451)+ 8*GE.getGuidePrice(453));
  294. break;
  295. }
  296. status = "Finding banker";
  297. TIME = System.currentTimeMillis();
  298. Game.clickCompass();
  299. Script.sleep(200);
  300. Camera.pitchUp(500);
  301. return true;
  302. }
  303. public void onStop(){
  304. if(stamStam.isAlive()){
  305. stamStam.interrupt();
  306. }
  307. if(logout){
  308. Log.log("Logging out.");
  309. Mouse.click(Random.random(748,760),Random.random(4,15));
  310. Script.sleep(Random.random(400,600));
  311. Mouse.click(Random.random(576,708),Random.random(394,418));
  312. }
  313. Log.log("You managed to smelt " + smelted + " items!");
  314. Log.log("Total runtime: " + Timer.getTime(System.currentTimeMillis() - TIME));
  315. Log.log("Thanks for using BatSmelterAIO");
  316. }
  317.  
  318. /*****************************************************/
  319. /*** LOOP ***/
  320. /*****************************************************/
  321. public int loop(){
  322. if(!isLoggedIn()){
  323. if(login){
  324. Log.log("You have been logged out, you are probably Client token errored, Resetting the client.", Color.GREEN);
  325. reset();
  326. }else{
  327. Log.log("You have been logged out, you are probably Client token errored, Shutting down.", Color.RED);
  328. return -1;
  329. }
  330. }
  331. Mouse.setSpeed(Random.random(3,5));
  332. if(!Bank.isOpen()) if(!Game.getOpenTab().equals(Tab.INVENTORY))Game.openTab(Tab.INVENTORY);
  333. if(location == 'A'){
  334. return loopA();
  335. }else if(location == 'B'){
  336. return loopB();
  337. }else{
  338. Log.log("ERROR WITH LOCATION! SOMETHING VERY BAD HAPPEND!");
  339. return -1;
  340. }
  341. }
  342. ///////////////////////
  343. // Loop for Edgeville//
  344. ///////////////////////
  345. public int loopA() {
  346. if(status.equals("Finding banker")){
  347. if(Bank.isOpen()){
  348. status = "Banking";
  349. return 100;
  350. }
  351. if(dtmBanker2.findDTMS(20, VIEWPORTR) || dtmBanker1.findDTMS(20, VIEWPORTR) || dtmBanker3.findDTMS(20, VIEWPORTR)){
  352. int i = Random.random(0,DTM2.dtmLocations.size()-1);
  353. Point bankerPt = new Point((int)DTM2.dtmLocations.get(i).getCenterX(),(int)DTM2.dtmLocations.get(i).getCenterY());
  354. Mouse.click(bankerPt,false);
  355. Script.sleep(100);
  356. String lol = OCR.findString(new Rectangle(bankerPt.x-65,bankerPt.y+30, 130,25), null,true);
  357. if(lol.contains("Bank") || lol.contains("ank") || lol.contains("nk") || lol.contains("Ba")|| lol.contains("Ban")){
  358. Mouse.click(bankerPt.x,bankerPt.y+46);
  359. trys = 0;
  360. int k = 0;
  361. while(!Bank.isOpen() && k <= 30){
  362. Script.sleep(100);
  363. k++;
  364. }
  365. }else {if(trys++ == 8){
  366. trys = 0;
  367. status = "Lost";
  368. tStat = "Finding banker";
  369. }
  370. Mouse.move(Random.random(0,517),Random.random(0,339));
  371.  
  372. }
  373. }else{
  374. if(trys++ >= 3){
  375. if(dtmBanker2.findDTMS(30, VIEWPORT) || dtmBanker1.findDTMS(30, VIEWPORT) || dtmBanker3.findDTMS(30, VIEWPORT)){
  376. int i = Random.random(0,DTM2.dtmLocations.size()-1);
  377. Point bankerPt = new Point((int)DTM2.dtmLocations.get(i).getCenterX(),(int)DTM2.dtmLocations.get(i).getCenterY());
  378. Mouse.click(bankerPt,false);
  379. Script.sleep(100);
  380. String lol = OCR.findString(new Rectangle(bankerPt.x-65,bankerPt.y+30, 130,25), null,true);
  381. if(lol.contains("Bank") || lol.contains("ank") || lol.contains("nk") || lol.contains("Ba")|| lol.contains("Ban")){
  382. Mouse.click(bankerPt.x,bankerPt.y+46);
  383. int k = 0;
  384. while(!Bank.isOpen() && k <= 50){
  385. Script.sleep(100);
  386. k++;
  387. }
  388. }else trys++;
  389. }else if(trys++ >= 8){
  390. trys= 0;
  391. tStat = "Finding banker";
  392. status = "Lost";
  393. return 100;
  394. }
  395. Mouse.move(Random.random(0,517),Random.random(0,339));
  396.  
  397. }
  398. return 100;
  399. }
  400. if(Bank.isOpen()){
  401. status = "Banking";
  402. return 100;
  403. }
  404. return 100;
  405. }
  406. //Lost!
  407. if(status.equals("Lost")){
  408. if(dtmFurnSym.findDTMS(20, MINIMAP)){
  409. int i = Random.random(0,DTM2.dtmLocations.size()-1);
  410. Point symPt = new Point((int)DTM2.dtmLocations.get(i).getCenterX(),(int)DTM2.dtmLocations.get(i).getCenterY());
  411. Mouse.click(symPt.x+Random.random(-7,7),symPt.y+Random.random(-7,7));
  412. Script.sleep(6500);
  413. if(tStat.equals("Finding banker")){
  414. if(dtmBank1.findDTMS(20, MINIMAP) || dtmBank2.findDTMS(20, MINIMAP) || dtmBank3.findDTMS(20, MINIMAP)){
  415. int j = Random.random(0,DTM2.dtmLocations.size()-1);
  416. Point bankPt = new Point((int)DTM2.dtmLocations.get(j).getCenterX(),(int)DTM2.dtmLocations.get(j).getCenterY());
  417. bankPt.y = bankPt.y + 30;
  418. Mouse.click(bankPt);
  419. Script.sleep(6500);
  420. }
  421. }
  422. status = tStat;
  423. return 100;
  424. }
  425. if(trys++ == 6){
  426. Log.log("Completely lost. Might be a random.",Color.RED);
  427. return -1;
  428. }
  429. }
  430. //Banking
  431. if(status.equals("Banking")){
  432. return bank();
  433. }
  434. //Walking to Furnace
  435. if(status.equals("Walking to furnace")){
  436. if(!checkColor(ore,new Point(579,228), 20) /*&&*/){
  437. status = "Finding banker";
  438. return 100;
  439. }
  440. 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)){
  441. int i = Random.random(0,DTM2.dtmLocations.size()-1);
  442. drawR = DTM2.dtmLocations.get(i);
  443. Point smithPt = new Point((int)DTM2.dtmLocations.get(i).getCenterX(),(int)DTM2.dtmLocations.get(i).getCenterY());
  444. if(smithPt.y <= 55){
  445. showD = true;
  446. sleep(100);
  447. Environment.saveScreenshot();
  448. }
  449. Mouse.click(smithPt);
  450. Script.sleep(1000);
  451. showD = false;
  452. drawR = new Rectangle();
  453. Script.sleep(4100);
  454. status = "Finding furnace";
  455. return 100;
  456. }else if(dtmFurnSym.findDTMS(20, MINIMAP)){
  457. int i = Random.random(0,DTM2.dtmLocations.size()-1);
  458. drawR = DTM2.dtmLocations.get(i);
  459. Point symPt = new Point((int)DTM2.dtmLocations.get(i).getCenterX(),(int)DTM2.dtmLocations.get(i).getCenterY());
  460. Mouse.click(symPt.x+Random.random(-2,2),symPt.y+Random.random(-2,2));
  461. Script.sleep(1000);
  462. drawR = new Rectangle();
  463. Script.sleep(4100);
  464. status = "Finding furnace";
  465. return 100;
  466. }
  467. }
  468. //Finding Furnace
  469. if(status.equals("Finding furnace")){
  470. if(makeJewl && S==2){
  471. S = 0;
  472. status = "Walking back";
  473. return 100;
  474. }
  475. if(dtmFurn1.findDTMS(20, VIEWPORT) || dtmFurn2.findDTMS(20, VIEWPORT)){
  476. int i = Random.random(0,DTM2.dtmLocations.size()-1);
  477. Point FurnPt = new Point((int)DTM2.dtmLocations.get(i).getCenterX(),(int)DTM2.dtmLocations.get(i).getCenterY());
  478. if(S==1 && (smelting == 3 || smelting == 5) && !dtmSelected.findDTMS(10,Inventory.getSlotAt(0).getBounds()))Mouse.click(Random.random(567,587),Random.random(219,240));
  479. Mouse.click(FurnPt,false);
  480. Script.sleep(300);
  481. String lol = OCR.findString(new Rectangle(FurnPt.x-100,FurnPt.y+15, 200,25), null,true);
  482. if((lol.contains("Use") || lol.contains("Smelt"))&& lol.contains("Furnace")){
  483. Mouse.click(FurnPt.x,FurnPt.y+33);
  484. }else{
  485. Mouse.move(Random.random(0,765), Random.random(0,502));
  486. if(S==1 && (smelting == 3 || smelting == 5) && dtmSelected.findDTMS(10,Inventory.getSlotAt(0).getBounds()))Mouse.click(Random.random(567,587),Random.random(219,240));
  487. if(trys++ >= 5){
  488. trys= 0;
  489. tStat = "Finding furnace";
  490. status = "Lost";
  491. return 100;
  492. }
  493. }
  494. int k = 0;
  495. while((!Game.getColorAt(319,360).equals(new Color(90,82,69)) || dtmCast.findDTMS(20))&& k <= 30){
  496. Script.sleep(100);
  497. k++;
  498. }
  499. }else{
  500. if(trys++ >= 5){
  501. trys = 0;
  502. tStat = "Finding furnace";
  503. status = "Lost";
  504. }
  505. return 100;
  506. }
  507. if(Game.getColorAt(319,360).equals(new Color(90,82,69))){
  508. first = true;
  509. row = 0;
  510. col = 0;
  511. reTry = System.currentTimeMillis();
  512. smeltedT = smelted;
  513. firstS = true;
  514. status = "Smelting";
  515. Mouse.move(Random.random(233,273),Random.random(405,452));
  516.  
  517. }else if(dtmCast.findDTMS(20)){
  518. switch(jewel){
  519. case 0:
  520. Mouse.click(85,90,false);
  521. break;
  522. case 1:
  523. Mouse.click(170,90,false);
  524. break;
  525. case 2:
  526. Mouse.click(255,100,false);
  527. break;
  528. case 3:
  529. Mouse.click(78,205,false);
  530. break;
  531. case 4:
  532. Mouse.click(335,210,false);
  533. break;
  534. case 5:
  535. Mouse.click(115,105,false);
  536. break;
  537. case 6:
  538. Mouse.click(130,165,false);
  539. break;
  540. case 7:
  541. Mouse.click(130,228,false);
  542. break;
  543. case 8:
  544. Mouse.click(130,290,false);
  545. break;
  546. }
  547. Script.sleep(300);
  548. Mouse.click(Mouse.getLocation().x, Mouse.getLocation().y + 60);
  549. first = true;
  550. row = 0;
  551. col = 0;
  552. reTry = System.currentTimeMillis();
  553. smeltedT = smelted;
  554. firstS = true;
  555. status = "Smelting";
  556. Script.sleep(1000);
  557. }
  558. return 100;
  559. }
  560.  
  561. //Smelting
  562. if(status.equals("Smelting")){
  563. return smelt();
  564. }
  565. if(status.equals("Walking back")){
  566. if(dtmBank1.findDTMS(20, MINIMAPL) || dtmBank2.findDTMS(20, MINIMAPL)){
  567. int i = 0;
  568. Point bankPt = new Point((int)DTM2.dtmLocations.get(i).getCenterX(),(int)DTM2.dtmLocations.get(i).getCenterY());
  569. bankPt.y = bankPt.y + 20;
  570. Mouse.click(bankPt);
  571. Script.sleep(1000);
  572. Script.sleep(5000);
  573. trys = 0;
  574. status = "Finding banker";
  575. return 100;
  576. }else if(trys++ == 6){
  577. trys = 0;
  578. tStat = "Finding banker";
  579. status = "Lost";
  580. }
  581. return 100;
  582. }
  583. return 100;
  584. }
  585. ///////////////////////
  586. // Loop for Al-Kharid//
  587. ///////////////////////
  588. private int loopB() {
  589. if(!stamStam.isAlive()){
  590. stamStam = new StaminaChecker();
  591. stamStam.start();
  592. }
  593. if(StaminaChecker.staminaOff() && !status.equals("Banking") && !status.equals("Finding banker")){
  594. int x = 0;
  595. int y = 0;
  596. Point pfullStam = new Point(721,96);
  597. Mouse.click((x = pfullStam.x+Random.random(-3,5)),(y = pfullStam.y+Random.random(3,25)));
  598. sleep(400,500);
  599. Mouse.click(x, (y + Random.random(21,32)));
  600. sleep(400,500);
  601. walkmod = 1;
  602. }
  603. if(status.equals("Finding banker")){
  604. if(Bank.isOpen()){
  605. status = "Banking";
  606. return 100;
  607. }
  608. if(dtmAlBanker.findDTMS(20, VIEWPORTS)){
  609. int i = Random.random(0,DTM2.dtmLocations.size()-1);
  610. Point bankerPt = new Point((int)DTM2.dtmLocations.get(i).getCenterX(),(int)DTM2.dtmLocations.get(i).getCenterY());
  611. Mouse.click(bankerPt,false);
  612. Script.sleep(100);
  613. String lol = OCR.findString(new Rectangle(bankerPt.x-65,bankerPt.y+30, 130,25), null,true);
  614. if((lol.contains("Bank") || lol.contains("ank") || lol.contains("nk") || lol.contains("Ba")|| lol.contains("Ban")) && !lol.contains("Booth")){
  615. Mouse.click(bankerPt.x,bankerPt.y+46);
  616. trys = 0;
  617. int k = 0;
  618. while(!Bank.isOpen() && k <= 30){
  619. Script.sleep(100);
  620. k++;
  621. }
  622. }else {
  623. if(trys++ == 8){
  624. trys = 0;
  625. tStat = "Finding banker";
  626. status = "Lost";
  627. }
  628. Mouse.move(Random.random(0,517),Random.random(0,339));
  629. }
  630. }
  631. return 100;
  632. }
  633. //Lost!
  634. if(status.equals("Lost")){
  635. if(dtmFurnSym.findDTMS(20, MINIMAP)){
  636. int i = Random.random(0,DTM2.dtmLocations.size()-1);
  637. Point symPt = new Point((int)DTM2.dtmLocations.get(i).getCenterX(),(int)DTM2.dtmLocations.get(i).getCenterY());
  638. Mouse.click(symPt);
  639. for(int j = 0; j <= 65; j++)sleep(100*walkmod);
  640.  
  641. if(tStat.equals("Finding banker")){
  642. if(dtmAlDoor1.findDTMS(20, MINIMAP)){
  643. int j = Random.random(0,DTM2.dtmLocations.size()-1);
  644. Point bankPt = new Point((int)DTM2.dtmLocations.get(j).getCenterX(),(int)DTM2.dtmLocations.get(j).getCenterY());
  645. Mouse.click(bankPt);
  646. for(int k = 0; k <= 65; k++)sleep(100*walkmod);
  647. }
  648. }
  649. status = tStat;
  650. return 100;
  651. }
  652. if(trys++ == 6){
  653. Log.log("Completely lost. Might be a random.",Color.RED);
  654. return -1;
  655. }
  656. }
  657. //Banking
  658. if(status.equals("Banking")){
  659. return bank();
  660. }
  661.  
  662. //Walking to Furnace
  663. if(status.equals("Walking to furnace")){
  664. if(dtmCactus1.findDTMS(20, MINIMAP) || dtmCactus2.findDTMS(20, MINIMAP) ){
  665. int i = Random.random(0,DTM2.dtmLocations.size()-1);
  666. Point cactPt = new Point((int)DTM2.dtmLocations.get(i).getCenterX(),(int)DTM2.dtmLocations.get(i).getCenterY());
  667. cactPt.y -=60;
  668. Mouse.click(cactPt);
  669. for(int j = 0; j <= 34; j++){
  670. sleep(100*walkmod);
  671. }
  672. if(dtmCactus1.findDTMS(20, MINIMAP) || dtmCactus2.findDTMS(20, MINIMAP) ){
  673. i = Random.random(0,DTM2.dtmLocations.size()-1);
  674. cactPt = new Point((int)DTM2.dtmLocations.get(i).getCenterX(),(int)DTM2.dtmLocations.get(i).getCenterY());
  675. cactPt.x -= Random.random(10, 15);
  676. cactPt.y -= 76;
  677. Mouse.click(cactPt);
  678. for(int j = 0; j <= 65; j++){
  679. sleep(100*walkmod);
  680. }
  681. status = "Finding furnace";
  682. }
  683. }
  684. return 100;
  685. }
  686. //Finding Furnace
  687. if(status.equals("Finding furnace")){
  688. if(makeJewl && S==2){
  689. S = 0;
  690. status = "Walking back";
  691. return 100;
  692. }
  693. if(dtmAlFurn1.findDTMS(20, VIEWPORT)){
  694. int i = Random.random(0,DTM2.dtmLocations.size()-1);
  695. Point FurnPt = new Point((int)DTM2.dtmLocations.get(i).getCenterX(),(int)DTM2.dtmLocations.get(i).getCenterY());
  696. if(S++==1 && (smelting == 3 || smelting == 5) && !dtmSelected.findDTMS(10,Inventory.getSlotAt(0).getBounds()))Mouse.click(Random.random(567,587),Random.random(219,240));
  697. Mouse.click(FurnPt,false);
  698. Script.sleep(300);
  699. String lol = OCR.findString(new Rectangle(FurnPt.x-100,FurnPt.y+15, 200,25), null,true);
  700. if((lol.contains("Smelt") || lol.contains("Use"))&& lol.contains("Furnace")){
  701. Mouse.click(FurnPt.x,FurnPt.y+33);
  702. }else{
  703. Mouse.move(Random.random(0,765), Random.random(0,502));
  704. if(S==1 && (smelting == 3 || smelting == 5) && dtmSelected.findDTMS(10,Inventory.getSlotAt(0).getBounds()))Mouse.click(Random.random(567,587),Random.random(219,240));
  705. // if(trys == 3){
  706. // Mouse.click(236,171);
  707. // return 100;
  708. // }
  709. if(trys++ >= 5){
  710. Mouse.click(236,171);
  711. // trys= 0;
  712. // tStat = "Finding furnace";
  713. // status = "Lost";
  714. return 100;
  715. }
  716. }
  717. int k = 0;
  718. while((!Game.getColorAt(319,360).equals(new Color(90,82,69)) || dtmCast.findDTMS(20))&& k <= 30){
  719. Script.sleep(100);
  720. k++;
  721. }
  722. }else{
  723. if(trys++ >= 5){
  724. trys = 0;
  725. tStat = "Finding furnace";
  726. status = "Lost";
  727. }
  728. return 100;
  729. }
  730. if(Game.getColorAt(319,360).equals(new Color(90,82,69))){
  731. first = true;
  732. row = 0;
  733. col = 0;
  734. reTry = System.currentTimeMillis();
  735. smeltedT = smelted;
  736. firstS = true;
  737. status = "Smelting";
  738. Mouse.move(Random.random(233,273),Random.random(405,452));
  739.  
  740. }else if(dtmCast.findDTMS(20)){
  741. switch(jewel){
  742. case 0:
  743. Mouse.click(85,90,false);
  744. break;
  745. case 1:
  746. Mouse.click(170,90,false);
  747. break;
  748. case 2:
  749. Mouse.click(255,100,false);
  750. break;
  751. case 3:
  752. Mouse.click(78,205,false);
  753. break;
  754. case 4:
  755. Mouse.click(335,210,false);
  756. break;
  757. case 5:
  758. Mouse.click(115,105,false);
  759. break;
  760. case 6:
  761. Mouse.click(130,165,false);
  762. break;
  763. case 7:
  764. Mouse.click(130,228,false);
  765. break;
  766. case 8:
  767. Mouse.click(130,290,false);
  768. break;
  769. }
  770. Script.sleep(300);
  771. Mouse.click(Mouse.getLocation().x, Mouse.getLocation().y + 60);
  772. first = true;
  773. row = 0;
  774. col = 0;
  775. reTry = System.currentTimeMillis();
  776. smeltedT = smelted;
  777. firstS = true;
  778. status = "Smelting";
  779. Script.sleep(1000);
  780. }
  781. return 100;
  782. }
  783.  
  784. //Smelting
  785. if(status.equals("Smelting")){
  786. return smelt();
  787. }
  788. if(status.equals("Walking back")){
  789. // if(dtmAlHedge1.findDTMS(20, MINIMAP)){
  790. // int i = Random.random(0,DTM2.dtmLocations.size()-1);
  791. // Point hedgePt = new Point((int)DTM2.dtmLocations.get(i).getCenterX(),(int)DTM2.dtmLocations.get(i).getCenterY());
  792. // Mouse.click(hedgePt);
  793. // Environment.saveScreenshot();
  794. // for(int j = 0; j <= 70; j++){
  795. // sleep(100*walkmod);
  796. // }
  797. // if(dtmAlHedge1.findDTMS(20, MINIMAP)){
  798. // i = Random.random(0,DTM2.dtmLocations.size()-1);
  799. // hedgePt = new Point((int)DTM2.dtmLocations.get(i).getCenterX(),(int)DTM2.dtmLocations.get(i).getCenterY());
  800. // hedgePt.x -= 30;
  801. // Mouse.click(hedgePt);
  802. // Environment.saveScreenshot();
  803. // for(int j = 0; j <= 30; j++){
  804. // sleep(100*walkmod);
  805. // }
  806. Mouse.click(609, 158);
  807. for(int j = 0; j <= 100; j++){
  808. sleep(100*walkmod);
  809. }
  810. status = "Finding banker";
  811. return 100;
  812. // }
  813. // }
  814. }
  815. return 100;
  816. }
  817. /**********************************************************************************/
  818. /*************************** END LOOP *********************************************/
  819. /**********************************************************************************/
  820. private int smelt(){
  821. if(System.currentTimeMillis() - reTry > 20000 && smeltedT == smelted){
  822. status = "Finding furnace";
  823. }
  824. if(first){
  825. if(!makeJewl && !Game.getColorAt(319,360).equals(new Color(90,82,69))){
  826. status = "Finding furnace";
  827. }
  828. if(smelting == 4){
  829. Mouse.click(Random.random(272,315),Random.random(405,450));
  830. }else{
  831. if(!makeJewl || S == 0){
  832. Mouse.click(Random.random(233,273),Random.random(405,450));
  833. }
  834. }
  835. temp0 = Game.getColorAt(583,221);
  836. temp1 = Game.getColorAt(591,225);
  837. temp2 = Game.getColorAt(569,231);
  838. first = false;
  839. smeltTO = System.currentTimeMillis();
  840. }
  841. if(System.currentTimeMillis()- smeltTO > 1200000){
  842. status = "Walking back";
  843. return 100;
  844. }
  845. if(!checkColor(temp0,new Point(583 + (col*42),221 + (row*36)),15)
  846. || !checkColor(temp1,new Point(591 + (col*42),225 + (row*36)),15)
  847. || !checkColor(temp2,new Point(569 + (col*42),231 + (row*36)),15)){
  848. if(smelting != 2){
  849. smelted ++;
  850. smeltedT = smelted;
  851. reTry = System.currentTimeMillis();
  852. col++;
  853. }
  854. switch(smelting){
  855. case 1:
  856. if(col == 4){
  857. col = 0;
  858. row++;
  859. }
  860. if(row == 3){
  861. if(col == 2){
  862. status = "Walking back";
  863. return 100;
  864. }
  865. }
  866.  
  867. break;
  868. case 2:
  869. dtmBar.findDTMS(1, INVENTORY);
  870. if(DTM2.dtmLocations.size()/2 != barsTemp ){
  871. smelted ++;
  872. smeltedT = smelted;
  873. reTry = System.currentTimeMillis();
  874. barsTemp = DTM2.dtmLocations.size()/2;
  875. }
  876. Point[] IRON_DTM_PTS = { new Point( 582, 219), new Point( 580, 228), new Point( 587, 234)};
  877. if(firstS){
  878. IRON_DTM_RGB = new Color [] { Game.getColorAt(582, 219), Game.getColorAt(582, 219), Game.getColorAt(582, 219), Game.getColorAt(582, 219)};
  879. firstS = false;
  880. }
  881. DTM2 dtmIron = new DTM2(IRON_DTM_PTS, IRON_DTM_RGB);
  882. if(!dtmIron.findDTMS(1, INVENTORY)){
  883. status = "Walking back";
  884. return 100;
  885. }
  886. break;
  887. case 4:
  888. if(col == 4){
  889. col = 0;
  890. row++;
  891. }
  892. if(row == 2){
  893. if(col == 1){
  894. status = "Walking back";
  895. return 100;
  896. }
  897. }
  898.  
  899. break;
  900. case 6:
  901. if(col == 4){
  902. col = 0;
  903. row++;
  904. }
  905. if(row == 1){
  906. if(col == 1){
  907. status = "Walking back";
  908. return 100;
  909. }
  910. }
  911.  
  912. break;
  913. case 7:
  914. if(col == 4){
  915. col = 0;
  916. status = "Walking back";
  917. return 100;
  918. }
  919. break;
  920. case 8:
  921. if(col == 3){
  922. col = 0;
  923. status = "Walking back";
  924. return 100;
  925. }
  926. default:
  927. if(col == 4){
  928. col = 0;
  929. row++;
  930. if(row == 7){
  931. if((smelting == 3 || smelting == 5) && makeJewl){
  932. col = 0;
  933. row = 0;
  934. if(S == 1)S = 2;
  935. if(S == 0)S = 1;
  936. status = "Finding furnace";
  937. return 100;
  938. }
  939. status = "Walking back";
  940. return 100;
  941. }
  942. }
  943. return 100;
  944. }
  945.  
  946. }
  947. return 100;
  948. }
  949. private int bank(){
  950. if(Bank.isOpen()){
  951. if(!checkColor(ore, new Point(54, 107), 20) && !getCol){
  952. Log.log("May be out of raw materials, rechecking bank just in case.", Color.RED);
  953. sleep(600,1000);
  954. if(!checkColor(ore, new Point(54, 107), 20) && !getCol){
  955. Log.log("Out of raw material!", Color.RED);
  956. Mouse.click(489,30);
  957. sleep(100,200);
  958. return -1;
  959. }else{
  960. Log.log("Second check came back positive, continuing!", Color.GREEN);
  961. }
  962. }
  963. ore = Game.getColorAt(54, 107);
  964. ORE_DTM_RGB [0] = Game.getColorAt(54, 107);
  965. oredtm = new DTM2(ORE_DTM_PTS, ORE_DTM_RGB);
  966. getCol = false;
  967. Bank.depositAll();
  968. Script.sleep(500,700);
  969.  
  970. switch(smelting){
  971. case 1:
  972. Mouse.move(Random.random(41, 66),Random.random(96, 120));
  973. Script.sleep(500,700);
  974. withdrawX(14);
  975. Script.sleep(2000);
  976. if(!checkColor(ore, chkPt, 30)) Mouse.move(Random.random(41, 66),Random.random(96, 120));
  977. else Mouse.move(Random.random(87, 108),Random.random(96, 120));
  978. Script.sleep(500,700);
  979. withdrawX(14);
  980. break;
  981. case 4:
  982. Mouse.move(Random.random(41, 66),Random.random(96, 120));
  983. Script.sleep(500,700);
  984. withdrawX(9);
  985. Script.sleep(2000);
  986. if(!checkColor(ore, chkPt, 30)) Mouse.move(Random.random(41, 66),Random.random(96, 120));
  987. else Mouse.move(Random.random(87, 108),Random.random(96, 120));
  988. Script.sleep(500,700);
  989. withdrawAll();
  990. break;
  991. case 6:
  992. Mouse.move(Random.random(41, 66),Random.random(96, 120));
  993. Script.sleep(500,700);
  994. withdrawX(5);
  995. Script.sleep(2000);
  996. if(!checkColor(ore, chkPt, 30)) Mouse.move(Random.random(41, 66),Random.random(96, 120));
  997. else Mouse.move(Random.random(87, 108),Random.random(96, 120));
  998. Script.sleep(500,700);
  999. withdrawAll();
  1000. break;
  1001. case 7:
  1002. Mouse.move(Random.random(41, 66),Random.random(96, 120));
  1003. Script.sleep(500,700);
  1004. withdrawX(4);
  1005. Script.sleep(2000);
  1006. if(!checkColor(ore, chkPt, 30)) Mouse.move(Random.random(41, 66),Random.random(96, 120));
  1007. else Mouse.move(Random.random(87, 108),Random.random(96, 120));
  1008. Script.sleep(500,700);
  1009. withdrawAll();
  1010. break;
  1011. case 8:
  1012. Mouse.move(Random.random(41, 66),Random.random(96, 120));
  1013. Script.sleep(500,700);
  1014. withdrawX(3);
  1015. Script.sleep(2000);
  1016. if(!checkColor(ore, chkPt, 30)) Mouse.move(Random.random(41, 66),Random.random(96, 120));
  1017. else Mouse.move(Random.random(87, 108),Random.random(96, 120));
  1018. Script.sleep(500,700);
  1019. withdrawAll();
  1020. break;
  1021. default:
  1022. Mouse.move(Random.random(41, 66),Random.random(96, 120));
  1023. Script.sleep(500,700);
  1024. withdrawAll();
  1025. break;
  1026. }
  1027. sleep(500,700);
  1028. //Close the window.
  1029. Mouse.click(489,30);
  1030. sleep(100,200);
  1031. Mouse.move(Random.random(0,765), Random.random(0,502));
  1032. sleep(400,500);
  1033. }
  1034. if(makeJewl)S = 0;
  1035. status = "Walking to furnace";
  1036. return 100;
  1037. }
  1038. private void reset() {
  1039. Point[] LOGIN_DTM_PTS = { new Point( 318, 256), new Point( 447, 255), new Point( 387, 325)};
  1040. Color[] LOGIN_DTM_RGB = { new Color( 192, 137, 28), new Color( 202, 151, 35), new Color( 80, 128, 202)};
  1041. DTM2 dtmLogin = new DTM2(LOGIN_DTM_PTS, LOGIN_DTM_RGB);
  1042. Point[] LOGGED_DTM_PTS = { new Point( 382, 191), new Point( 364, 227), new Point( 401, 226)};
  1043. Color[] LOGGED_DTM_RGB = { new Color( 241, 213, 108), new Color( 158, 132, 53), new Color( 153, 123, 37)};
  1044. DTM2 dtmLogged1 = new DTM2(LOGGED_DTM_PTS, LOGGED_DTM_RGB);
  1045.  
  1046. Reseter.reset();
  1047. //Log.log("If you would like this feature please PM TheBat.", Color.RED);
  1048.  
  1049. while(!dtmLogin.findDTMS(20)){
  1050. sleep(100);
  1051. }
  1052. sleep(8000);
  1053. Mouse.click(Random.random(280,325), Random.random(165,177));
  1054. sleep(700);
  1055. Keyboard.sendKeys(userName, true, 100);
  1056. sleep(700);
  1057. Keyboard.sendKeys(password, true, 100);
  1058. sleep(12000);
  1059. Mouse.click(Random.random(260,503),Random.random(447,476));
  1060. while(!isLoggedIn()){
  1061. if(dtmLogged1.findDTMS(20)){
  1062. Mouse.click(Random.random(309, 450),Random.random(315, 326));
  1063. sleep(100);
  1064. }
  1065. }
  1066.  
  1067. Game.clickCompass();
  1068. Camera.pitchUp(1000);
  1069. TO += TIME-System.currentTimeMillis();
  1070. status = "Walking back";
  1071. }
  1072. /**
  1073. * Checks if the player is logged in
  1074. * @return boolean
  1075. * - true if logged in.
  1076. * - false if logged out.
  1077. */
  1078. private static boolean isLoggedIn() {
  1079. Point[] DTM_PTS = { new Point( 754, 10), new Point( 758, 6), new Point( 750, 6), new Point( 750, 14), new Point( 758, 14)};
  1080. 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)};
  1081. DTM2 dtmlog = new DTM2(DTM_PTS, DTM_RGB);
  1082. if(!dtmlog.findDTMS(30,new Rectangle(740,6,14,14)))
  1083. return Bank.isOpen();
  1084. else return true;
  1085. }
  1086.  
  1087. private void withdrawX(int i){
  1088. Mouse.click(false);
  1089. sleep(500,700);
  1090. String lol = OCR.findString(new Rectangle(Mouse.getLocation().x-30,Mouse.getLocation().y+65, 140,21), null,true);
  1091. if(lol.contains(" "+i+" ")){
  1092. Mouse.click(Mouse.getLocation().x, (Mouse.getLocation().y + Random.random(73,83)));
  1093. }else{
  1094. Mouse.click(Mouse.getLocation().x, (Mouse.getLocation().y + Random.random(86,100)));
  1095. Script.sleep(1200);
  1096. Keyboard.sendKeys(""+i,true,500,700);
  1097. }
  1098.  
  1099. }
  1100. private void withdrawAll(){
  1101. Mouse.click(false);
  1102. sleep(500,700);
  1103. Mouse.click(Mouse.getLocation().x, (Mouse.getLocation().y + Random.random(102,114)));
  1104. }
  1105. @SuppressWarnings("unused")
  1106. private void withdrawAllB1(){
  1107. Mouse.click(false);
  1108. sleep(500,700);
  1109. Mouse.click(Mouse.getLocation().x, (Mouse.getLocation().y + Random.random(119,131)));
  1110. }
  1111. public void onRepaint(Graphics g){
  1112. if(showD)g.drawString("Time Running: " + Timer.getTime(System.currentTimeMillis() - TIME), 11, 358);
  1113.  
  1114. if(showPaint){
  1115. g.drawImage(back, 5, 343, null);
  1116. g.setColor(Color.BLACK);
  1117. g.setFont(new Font("Salaryman", 1, 14));
  1118. g.drawString("Time Running: " + Timer.getTime(System.currentTimeMillis() - TIME), 11, 358);
  1119. g.drawString("Total Smelted: " + smelted ,11,373);
  1120. try{
  1121. g.drawString("Smelted/Hour: " + (3600000*(long)smelted)/(int)(System.currentTimeMillis() - TIME),11,388);
  1122. g.drawString("Exp./Hour: " + (int)(exp *(3600000*(long)smelted)/(int)(System.currentTimeMillis() - TIME)),11,403);
  1123. g.drawString("Profit/Hour: " + (int)(profit *(3600000*(long)(smelted))/(int)(System.currentTimeMillis() - TIME)),11,418);
  1124. }catch(ArithmeticException e){}
  1125. g.drawString("Status: " + status ,11,433);
  1126. if(makeJewl)g.drawString("Current Setting: " + type + " (" + typeJ + ")",11,448);
  1127. else g.drawString("Current Setting: " + type ,11,448);
  1128. switch(location){
  1129. case 'A':
  1130. g.drawString("Location: Edgeville",11,463);
  1131. break;
  1132. case 'B':
  1133. g.drawString("Location: Al-Kharid" ,11,463);
  1134. break;
  1135. }
  1136. g.setFont(new Font("Salaryman", 1, 25));
  1137. g.drawString("BatSmelterAIO",270,390);
  1138. g.drawString("Version " + version,265,420);
  1139. g.setColor(Color.RED);
  1140. g.drawString("x",500,360);
  1141. }else{
  1142. g.setColor(Color.GREEN);
  1143. g.setFont(new Font("Salaryman", 1, 25));
  1144. g.drawString("o",500,360);
  1145. }
  1146. g.setColor(Color.ORANGE);
  1147. g.drawLine(Mouse.getLocation().x,0,Mouse.getLocation().x,2100);
  1148. g.drawLine(0,Mouse.getLocation().y,2100,Mouse.getLocation().y);
  1149. g.setColor(Color.GREEN);
  1150. g.drawRect(drawR.x,drawR.y,drawR.width,drawR.height);
  1151. }
  1152.  
  1153. /**
  1154. * Returns whether the given point is a certain color.
  1155. * Accounts for the variable colors that runescape produces whenever you log in.
  1156. * @param col
  1157. * - Color to check for.
  1158. * @param p
  1159. * - Point to check at.
  1160. * @return
  1161. */
  1162. private static boolean checkColor(Color col, Point p, int tol){
  1163. if(Math.abs(col.getRed() - Game.getColorAt(p).getRed()) < tol)
  1164. if(Math.abs(col.getGreen() - Game.getColorAt(p).getGreen()) < tol)
  1165. if(Math.abs(col.getBlue() - Game.getColorAt(p).getBlue()) < tol)
  1166. return true;
  1167. return false;
  1168. }
  1169. public void mouseClicked(MouseEvent e) {
  1170. Point pt = e.getPoint();
  1171. if (pt.x >= 499 && pt.x <= 512 && pt.y >= 345 && pt.y <= 360) {
  1172. showPaint = !showPaint;
  1173. }
  1174. }
  1175. public void mouseEntered(MouseEvent arg0) {}
  1176. public void mouseExited(MouseEvent arg0) {}
  1177. public void mousePressed(MouseEvent arg0) {}
  1178. public void mouseReleased(MouseEvent arg0) {}
  1179.  
  1180. @SuppressWarnings("serial")
  1181. class GUI extends JFrame implements ActionListener{
  1182. GridBagConstraints c;
  1183. Container pane1;
  1184. Container pane2;
  1185. Container pane3;
  1186. JTabbedPane tabbedPane = new JTabbedPane();
  1187. public boolean OPEN = true;
  1188. private JButton startB1 = new JButton("Start");
  1189. private JButton startB2 = new JButton("Start");
  1190. private JButton startB3 = new JButton("Start");
  1191. private JLabel smeltL = new JLabel("Smelting Type:", JLabel.LEFT);
  1192. private JLabel goldL = new JLabel("Gold Jewlery:", JLabel.LEFT);
  1193. private JLabel silverL = new JLabel("Silver Jewlery:", JLabel.LEFT);
  1194. private JLabel unL = new JLabel("Username:", JLabel.LEFT);
  1195. private JLabel passL = new JLabel("Password:", JLabel.LEFT);
  1196. private JTextField unT = new JTextField();
  1197. private JPasswordField pT = new JPasswordField();
  1198. private JComboBox<String> smeltCB;
  1199. private JComboBox<String> silverCB;
  1200. private JComboBox<String> goldCB;
  1201. private JComboBox<String> locationCB;
  1202. private JLabel locL = new JLabel("Location:", JLabel.LEFT);
  1203. private JCheckBox goldSmithChkB = new JCheckBox("Use goldsmithing gauntlets", false);
  1204. private JCheckBox JewlChkB = new JCheckBox("Make Jewelry", false);
  1205. private JCheckBox logInChkB = new JCheckBox("Login after Client Token Error", false);
  1206. private JCheckBox logOutChkB = new JCheckBox("Log out on shutdown", false);
  1207. private String [] smelt;
  1208. private String [] locs;
  1209. private String [] gold;
  1210. private String [] silver;
  1211.  
  1212. public GUI(){
  1213. super("BatSmelter " + version);
  1214. tabbedPane = new JTabbedPane();
  1215. pane1 = new Container();
  1216. pane1.setLayout(new GridBagLayout());
  1217. pane2 = new Container();
  1218. pane2.setLayout(new GridBagLayout());
  1219. pane3 = new Container();
  1220. pane3.setLayout(new GridBagLayout());
  1221. c = new GridBagConstraints();
  1222. c.fill = GridBagConstraints.HORIZONTAL;
  1223. c.ipady = c.ipadx = 3;
  1224. c.insets = new Insets(5, 5, 5, 5);
  1225. init();
  1226. build();
  1227. logInChkB.setEnabled(Reseter.setup());
  1228. unL.setEnabled(Reseter.setup());
  1229. unT.setEnabled(Reseter.setup());
  1230. passL.setEnabled(Reseter.setup());
  1231. pT.setEnabled(Reseter.setup());
  1232. this.setLocationRelativeTo(getParent());
  1233. }
  1234. private void build(){
  1235. addToGrid(locL,0,0,1,.25, pane1);
  1236. addToGrid(locationCB,1,0,1,.75, pane1);
  1237. addToGrid(smeltL,0,1,1,.25, pane1);
  1238. addToGrid(smeltCB,1,1,1,.75, pane1);
  1239. addToGrid(goldSmithChkB,0,2,1,.5, pane1);
  1240. addToGrid(JewlChkB,1,2,1,.5, pane1);
  1241. addToGrid(startB1,1,3,1,.5, pane1);
  1242.  
  1243.  
  1244. addToGrid(goldL,0,0,1,.25, pane2);
  1245. addToGrid(goldCB,1,0,1,.75, pane2);
  1246. addToGrid(silverL,0,1,1,.25, pane2);
  1247. addToGrid(silverCB,1,1,1,.75, pane2);
  1248. addToGrid(startB2,1,5,1,.5, pane2);
  1249.  
  1250.  
  1251. addToGrid(logInChkB,1,2,1,.5, pane3);
  1252. addToGrid(unL,0,3,1,.25, pane3);
  1253. addToGrid(unT,1,3,1,.75, pane3);
  1254. addToGrid(passL,0,4,1,.25, pane3);
  1255. addToGrid(pT,1,4,2,.75, pane3);
  1256. addToGrid(logOutChkB,0,5,1,.5, pane3);
  1257. addToGrid(startB3,1,5,1,.5, pane3);
  1258.  
  1259.  
  1260. tabbedPane.addTab("Smelting", pane1);
  1261. tabbedPane.addTab("Jewelry", pane2);
  1262. tabbedPane.addTab("Login", pane3);
  1263. getContentPane().add(tabbedPane);
  1264. pack();
  1265. setVisible(true);
  1266. }
  1267. private void init(){
  1268. startB1.addActionListener(this);
  1269. startB2.addActionListener(this);
  1270. startB3.addActionListener(this);
  1271. smelt = new String []{"Cannonballs", "Bronze", "Iron", "Silver", "Steel", "Gold", "Mithril", "Adamant", "Runite"};
  1272. smeltCB = new JComboBox<String>(smelt);
  1273. smeltCB.setSelectedIndex(0);
  1274. locs = new String []{"Edgeville", "Al-Kharid"};
  1275. locationCB = new JComboBox<String>(locs);
  1276. locationCB.setSelectedIndex(0);
  1277. gold = new String []{"Rings", "Necklaces", "Amulets", "Bracelets"};
  1278. goldCB = new JComboBox<String>(gold);
  1279. goldCB.setSelectedIndex(0);
  1280. silver = new String []{"Holy Symbol", "Sickles", "Tiara", "Unholy Symbol", "Bolts"};
  1281. silverCB = new JComboBox<String>(silver);
  1282. silverCB.setSelectedIndex(0);
  1283. }
  1284. private void addToGrid(Component comp, int gridx, int gridy, int gridwidth,
  1285. double weightx, Container pane) {
  1286. c.gridx = gridx;
  1287. c.gridy = gridy;
  1288. c.gridwidth = gridwidth;
  1289. c.weightx = weightx;
  1290. pane.add(comp, c);
  1291. }
  1292.  
  1293. public void actionPerformed(ActionEvent e) {
  1294. if(locationCB.getSelectedIndex() == 0)location = 'A';
  1295. else location = 'B';
  1296.  
  1297. if(logInChkB.isSelected()){
  1298. userName = unT.getText();
  1299. password = "";
  1300. for(int i = 0; i < pT.getPassword().length; i++){
  1301. password += pT.getPassword()[i];
  1302. pT.getPassword()[i] = '0';
  1303. }
  1304. login = true;
  1305. }
  1306. smelting = smeltCB.getSelectedIndex();
  1307. switch(smelting){
  1308. case 0:
  1309. type = "Cannonballs";
  1310. break;
  1311. case 1:
  1312. type = "Bronze bars";
  1313. break;
  1314. case 2:
  1315. type = "Iron bars";
  1316. break;
  1317. case 3:
  1318. type = "Silver bars";
  1319. break;
  1320. case 4:
  1321. type = "Steel bars";
  1322. break;
  1323. case 5:
  1324. type = "Gold bars";
  1325. break;
  1326. case 6:
  1327. type = "Mithril bars";
  1328. break;
  1329. case 7:
  1330. type = "Adamant bars";
  1331. break;
  1332. case 8:
  1333. type = "Rune bars";
  1334. break;
  1335. }
  1336. if(JewlChkB.isSelected()){
  1337. makeJewl = true;
  1338. S = 0;
  1339. if(smelting == 3){
  1340. jewel = silverCB.getSelectedIndex();
  1341. typeJ = silver[silverCB.getSelectedIndex()];
  1342. }else if(smelting == 5){
  1343. jewel = goldCB.getSelectedIndex() + 5;
  1344. typeJ = gold[goldCB.getSelectedIndex()];
  1345. }
  1346. }
  1347. logout = logOutChkB.isSelected();
  1348. goldsmith = goldSmithChkB.isSelected();
  1349. OPEN = false;
  1350. dispose();
  1351. }
  1352. }
  1353. static class StaminaChecker extends Thread implements Runnable {
  1354. private Point p = new Point(722,104);
  1355. private Color cOn = new Color (235,217,102);
  1356. private Color cOff = new Color (142,97,55);
  1357. private Point pfullStam = new Point(721,96);
  1358. private Color fullStam = new Color (94,86,71);
  1359. private static boolean staminaOff;
  1360. public static boolean staminaOff() {
  1361. return staminaOff;
  1362. }
  1363. public StaminaChecker() {
  1364. this.setPriority(MIN_PRIORITY);
  1365. }
  1366.  
  1367. @Override
  1368. public void run() {
  1369. try{
  1370. while (!Thread.interrupted()) {
  1371. if (!checkColor(cOn, p, 20)){
  1372. staminaOff = true;
  1373. walkmod = 2;
  1374. if(checkColor(fullStam, pfullStam, 20)){
  1375. staminaFull = true;
  1376. }
  1377. }else if (!checkColor(cOff, p, 20)){
  1378. staminaOff = false;
  1379. staminaFull = false;
  1380. walkmod = 1;
  1381. }
  1382. if(Thread.interrupted()) return;
  1383. }
  1384. } finally{}
  1385. }
  1386. }
  1387. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement