Advertisement
Guest User

Powerbot Runite Miner v1.6

a guest
Aug 4th, 2012
838
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 86.12 KB | None | 0 0
  1. import java.awt.BasicStroke;
  2. import java.awt.Color;
  3. import java.awt.Container;
  4. import java.awt.Desktop;
  5. import java.awt.Dimension;
  6. import java.awt.Font;
  7. import java.awt.Graphics;
  8. import java.awt.Graphics2D;
  9. import java.awt.Insets;
  10. import java.awt.Point;
  11. import java.awt.Polygon;
  12. import java.awt.Rectangle;
  13. import java.io.BufferedReader;
  14. import java.io.File;
  15. import java.io.FileInputStream;
  16. import java.io.FileNotFoundException;
  17. import java.io.FileOutputStream;
  18. import java.io.IOException;
  19. import java.io.InputStreamReader;
  20. import java.net.URI;
  21. import java.net.URISyntaxException;
  22. import java.net.URL;
  23. import java.util.Properties;
  24.  
  25. import org.powerbot.concurrent.Task;
  26. import org.powerbot.concurrent.strategy.Condition;
  27. import org.powerbot.concurrent.strategy.Strategy;
  28. import org.powerbot.game.api.ActiveScript;
  29. import org.powerbot.game.api.Manifest;
  30. import org.powerbot.game.api.methods.Calculations;
  31. import org.powerbot.game.api.methods.Environment;
  32. import org.powerbot.game.api.methods.Game;
  33. import org.powerbot.game.api.methods.Settings;
  34. import org.powerbot.game.api.methods.Tabs;
  35. import org.powerbot.game.api.methods.Walking;
  36. import org.powerbot.game.api.methods.Widgets;
  37. import org.powerbot.game.api.methods.input.Mouse;
  38. import org.powerbot.game.api.methods.interactive.NPCs;
  39. import org.powerbot.game.api.methods.interactive.Players;
  40. import org.powerbot.game.api.methods.node.Menu;
  41. import org.powerbot.game.api.methods.node.SceneEntities;
  42. import org.powerbot.game.api.methods.tab.Inventory;
  43. import org.powerbot.game.api.methods.tab.Skills;
  44. import org.powerbot.game.api.methods.widget.Camera;
  45. import org.powerbot.game.api.methods.widget.Lobby;
  46. import org.powerbot.game.api.util.Filter;
  47. import org.powerbot.game.api.util.Random;
  48. import org.powerbot.game.api.util.Time;
  49. import org.powerbot.game.api.util.Timer;
  50. import org.powerbot.game.api.wrappers.Area;
  51. import org.powerbot.game.api.wrappers.Locatable;
  52. import org.powerbot.game.api.wrappers.Tile;
  53. import org.powerbot.game.api.wrappers.interactive.NPC;
  54. import org.powerbot.game.api.wrappers.interactive.Player;
  55. import org.powerbot.game.api.wrappers.node.Item;
  56. import org.powerbot.game.api.wrappers.node.SceneObject;
  57. import org.powerbot.game.api.wrappers.widget.WidgetChild;
  58. import org.powerbot.game.bot.event.MessageEvent;
  59. import org.powerbot.game.bot.event.listener.MessageListener;
  60. import org.powerbot.game.bot.event.listener.PaintListener;
  61.  
  62. import java.awt.event.*;
  63.  
  64. import javax.swing.*;
  65. import javax.swing.border.*;
  66. import javax.swing.event.ChangeEvent;
  67. import javax.swing.event.ChangeListener;
  68.  
  69.  
  70.  
  71. @Manifest(name = "Runite Miner", description = "Mines Runite, Mithril, and Adamantite in the resource dungeon || World Hops || Banks", version = 1.6, website = "http://www.powerbot.org/community/topic/679105-runite-miner-world-hops-banks-resource-dungeon/", authors = {"Hogrog"})
  72. public class RuniteMiner extends ActiveScript implements PaintListener, MessageListener {
  73.  
  74. int[] pin = {-1, -1, -1, -1};
  75. long ReturnTime[] = new long[139];
  76. long RespawnTime[] = new long[15];
  77. int CurrentWorldNum = 0;
  78. int CurrentWorldPop = 0;
  79. boolean CheckedCurrentWorldForOres = false;
  80. Timer RockTimer = new Timer(3000);
  81. String CurrentTask = "";
  82. boolean debug = false;
  83. WorldSelect WS = new WorldSelect();
  84. String verstionMessage = "";
  85. float currentVerstion = 1.6f;
  86. float latestVerstion = 0f;
  87. long startTime = 0;
  88. public int RestAnim[] = {5732, 11786, 5713};
  89. int RuniteRockID[] = {33078, 33079};
  90. int MithRockID[] = {32440, 32439, 32438};
  91. int AddeRockID[] = {32437, 32436, 32435};
  92. int EmptyRock[] = {33401, 33400, 33402, 33401};
  93. int RuniteOrePrice = 0;
  94. int MithOrePrice = 0;
  95. int AddOrePrice = 0;
  96. int PickaxeID[] = {1271, 1265, 15259, 1267, 1273, 1275, 1269};
  97. int RuniteOreCount = 0;
  98. int MithOreCount = 0;
  99. int AddOreCount = 0;
  100. int dungExitDoorID = 52866;
  101. int dunEntDoorID = 52856;
  102. int exitLadderID = 6226;
  103. int entLadderID = 2113;
  104. int bankBoothID = 11758;
  105. int runPerCent = 0;
  106. int RuniteOreID = 451;
  107. int MithOreID = 447;
  108. int AddOreID = 449;
  109. int setting1801 = 0;
  110. int setWorld = 0;
  111. int craftingLVL = 0;
  112. int topGemToDrop = 0;
  113. Tile LastClicked = new Tile(0,0,0);
  114. Tile NextClicked = new Tile(1,1,1);
  115. boolean mineRunite = true;
  116. boolean mineMith = false;
  117. boolean mineAdd = false;
  118. boolean memb = false;
  119. boolean useFreeWorlds = true;
  120. boolean highRisk = false;
  121. boolean worldHop = true;
  122. boolean skillWorlds = false;
  123. boolean politeMode = true;
  124. boolean clickLess = false;
  125. boolean gettingPop = false;
  126. boolean rockPrediction = false;
  127. boolean RockStatusCatch[] = new boolean[15];
  128. boolean cutGems = false;
  129. Timer mouseHoverTimer = new Timer(1000);
  130. Timer respawnTimer = new Timer(500);
  131. JFrame gui = new RuniteMinerGUI();
  132. SceneObject LastRockClicked = null;
  133. SceneObject CurrentRock = null;
  134. SceneObject NextRock = null;
  135.  
  136.  
  137. Area area_top = new Area(new Tile[] { new Tile(3004, 3367, 0), new Tile(3005, 3327, 0), new Tile(3037, 3327, 0),
  138. new Tile(3035, 3367, 0) });
  139.  
  140. Area area_mine = new Area( new Tile[] { new Tile(1062,4509,0), new Tile(1062,4521,0), new Tile(1049,4521,0),
  141. new Tile(1049,4509,0)
  142. });
  143.  
  144. Tile[] Path_bank = new Tile[] { new Tile(3020, 3339, 0), new Tile(3022, 3337, 0), new Tile(3027, 3337, 0),
  145. new Tile(3029, 3340, 0), new Tile(3029, 3345, 0), new Tile(3027, 3349, 0),
  146. new Tile(3023, 3353, 0), new Tile(3022, 3356, 0), new Tile(3020, 3358, 0),
  147. new Tile(3015, 3359, 0), new Tile(3013, 3357, 0), new Tile(3013, 3354, 0) };
  148.  
  149. private final Color color1 = new Color(60, 60, 60, 170);
  150. private final Color color2 = new Color(0, 255, 0);
  151. private final BasicStroke stroke1 = new BasicStroke(1);
  152. private final Font font1 = new Font("Arial", 1, 18);
  153. private final Font font2 = new Font("Arial", 1, 9);
  154. private final Font font3 = new Font("Arial", 1, 11);
  155. public MouseTrail trail = new MouseTrail();
  156.  
  157. public int testworld = 33;
  158.  
  159. @Override
  160. public void onRepaint(Graphics g) {
  161.  
  162. g.setColor(Color.black);
  163. Rectangle username = Widgets.get(137, 53).getBoundingRectangle();
  164. g.fillRect(username.x, username.y, username.width, username.height);
  165. //g.fillRect(8, 457, 100, 16);
  166. //g.fillRect(235, 80, 50, 120);
  167. //g.fillRect(115, 76, 560, 16);
  168. trail.add(Mouse.getLocation());
  169. trail.draw(g);
  170. long millis = System.currentTimeMillis() - startTime;
  171. long hours = millis / (1000 * 60 * 60);
  172. millis -= hours * (1000 * 60 * 60);
  173. long minutes = millis /(1000 *60);
  174. millis -= minutes * (1000 * 60);
  175. long seconds = millis / 1000;
  176.  
  177. int oreCount = RuniteOreCount + MithOreCount + AddOreCount;
  178. int profit = (RuniteOreCount * RuniteOrePrice) + (MithOreCount * MithOrePrice) + (AddOreCount * AddOrePrice);
  179.  
  180. int orePerHour = 0;
  181. float oresec = 0;
  182. if ((minutes > 0 || hours > 0 || seconds > 0) && oreCount > 0) {
  183. oresec = ((float) oreCount)/(float)(seconds + (minutes*60) + (hours*60*60));
  184. }
  185. float oremin = oresec * 60;
  186. orePerHour = Math.round(oremin * 60);
  187.  
  188. int profitPerHour = 0;
  189. float profitsec = 0;
  190. if ((minutes > 0 || hours > 0 || seconds > 0) && profit > 0) {
  191. profitsec = ((float) profit)/(float)(seconds + (minutes*60) + (hours*60*60));
  192. }
  193. float profitmin = profitsec * 60;
  194. profitPerHour = Math.round(profitmin * 60);
  195.  
  196. Graphics2D g2d = (Graphics2D)g;
  197.  
  198.  
  199. g2d.setColor(new Color(0, 255, 0, 60));
  200. if (CurrentRock != null && isTileOnScreen(CurrentRock.getLocation())){
  201. g2d.fillPolygon(CurrentRock.getLocation().getBounds()[0]);
  202. }
  203. g2d.setColor(new Color(255, 127, 39, 60));
  204. if (NextRock != null && isTileOnScreen(NextRock.getLocation())){
  205. g2d.fillPolygon(NextRock.getLocation().getBounds()[0]);
  206. }
  207.  
  208.  
  209.  
  210. g2d.setColor(color1);
  211. g2d.fillRoundRect(328, 15, 184, 225, 16, 16);
  212. g2d.setColor(color2);
  213. g2d.setStroke(stroke1);
  214. g2d.drawRoundRect(328, 15, 184, 225, 16, 16);
  215. g2d.setFont(font1);
  216. g2d.drawString("Runite Miner", 370, 48);
  217. g2d.setFont(font2);
  218. g2d.drawString("Made By Hogrog v" + currentVerstion, 380, 60);
  219. g2d.setFont(font3);
  220. g2d.drawString("Runtime: " + hours + ":" + minutes + ":" + seconds, 340, 90);
  221. g2d.drawString("Mining: " + (mineRunite ? "Runite," : "") + (mineAdd ? "Addy," : "") + (mineMith ? "Mith" : ""), 340, 110);
  222. g2d.drawString("Ores mined: " + oreCount, 340, 130);
  223. g2d.drawString("Ores p/h: " + orePerHour, 340, 150);
  224. g2d.drawString("Profit Made: " + profit, 340, 170);
  225. g2d.drawString("Profit p/h: " + profitPerHour, 340, 190);
  226. g2d.drawString("Runite Price: " + RuniteOrePrice, 340, 210);
  227. g2d.drawString("Current Task: " + CurrentTask, 340, 230);
  228. //g2d.drawString("Crafting LVL: " + Skills.getLevel(Skills.CRAFTING), 340, 250);
  229. //g2d.drawString("Current World Pop: " + CurrentWorldPop, 340, 250);
  230.  
  231. int count = 0;
  232.  
  233. g2d.setColor(Color.CYAN);
  234. count = 0;
  235. int world = 0;
  236. for (long t : ReturnTime){
  237. if (t != 0 && world != 0){
  238. g2d.drawString("World: " + world + " Return In: "+ Time.format(t - System.currentTimeMillis()), 20, 50 + (20 * count));
  239. count += 1;
  240. }
  241. world += 1;
  242. }
  243.  
  244. if (debug) {
  245.  
  246. if (WS.isAtLobby()){
  247. int worldID = WS.WorldToID(50);
  248. WidgetChild w = Widgets.get(910,77).getChildren()[worldID];
  249. WidgetChild s = Widgets.get(910, 86).getChildren()[1];
  250. WidgetChild worldBox = Widgets.get(910, 62);
  251. int worldPos = w.getRelativeY();
  252. int worldScrollPos = (int)((worldPos) / 8.4) + 16;
  253. int scrollPos = s.getRelativeY();
  254. g2d.drawLine(0, worldScrollPos + worldBox.getAbsoluteY(), Game.getDimensions().width, worldScrollPos + worldBox.getAbsoluteY());
  255. g2d.drawLine(0,scrollPos + worldBox.getAbsoluteY(),Game.getDimensions().width,scrollPos + worldBox.getAbsoluteY());
  256. Point worldPt = new Point(Random.nextInt(100, w.getWidth()/2),(w.getAbsoluteY() + Random.nextInt(1, w.getHeight() - 3)));
  257. g2d.fillOval(worldPt.x, worldPt.y, 3, 3);
  258. g2d.drawString("World On Screen: " + worldBox.getBoundingRectangle().contains(worldPt), 340, 250);
  259. }
  260.  
  261. g2d.setColor(Color.red);
  262. count = 0;
  263. for (long l : RespawnTime){
  264. Point p = Rocks.values()[count].getLocation().getCentralPoint();
  265. g2d.drawString(l == 0 ? "0" : (formatTime(l - System.currentTimeMillis())), p.x, p.y + 10);
  266. count++;
  267. }
  268.  
  269. g2d.drawString("bank open: "+ String.valueOf((isBankOpen())),340, 240);
  270. final SceneObject rock = getRock();
  271. final SceneObject nextRock = getNextRock();
  272. if (rock != null) {
  273.  
  274. g2d.drawString(
  275. "faceing rock: "
  276. + String.valueOf(faceingTile(Players.getLocal(), rock.getLocation())),
  277. 340, 260);
  278. Tile t = rock.getLocation();
  279. Tile PlayerTile = Players.getLocal().getLocation();
  280. int rot = Players.getLocal().getOrientation();
  281. int dx = PlayerTile.getX() - t.getX();
  282. int dy = PlayerTile.getY() - t.getY();
  283. g2d.drawString("rotaion: " + rot, 340, 300);
  284. g2d.drawString("dx: " + dx, 340, 320);
  285. g2d.drawString("dy: " + dy, 340, 340);
  286. g2d.setColor(new Color(0, 255, 0, 60));
  287. for (Polygon p : rock.getBounds()) {
  288. g2d.drawPolygon(p);
  289. }
  290. }
  291. g2d.setColor(new Color(255, 127, 39, 60));
  292. if (nextRock != null){
  293. for (Polygon p : nextRock.getBounds()) {
  294. g2d.drawPolygon(p);
  295. }
  296. }
  297. g2d.setColor(color2);
  298. g2d.drawString("moveing: " + String.valueOf((isPlayerMoveing())),
  299. 340, 280);
  300. g2d.drawString("Current Task: " + CurrentTask, 340, 360);
  301. //g2d.drawString("Model Cache: " + org.powerbot.game.client.ModelCapture.modelCache.size(), 340, 380);
  302. g2d.drawString("Favourited Worlds: " + String.valueOf(WS.areFavouritWorldsSelected()), 340, 400);
  303. g.setColor(Color.RED);
  304. for (SceneObject r : SceneEntities.getLoaded()){
  305. if (compaireID(r.getId() ,RuniteRockID)){
  306. g2d.drawString(String.valueOf(RockInuse(r)), r.getCentralPoint().x, r.getCentralPoint().y - 10);
  307. }else if (compaireID(r.getId() ,AddeRockID)){
  308. g2d.drawString(String.valueOf(RockInuse(r)), r.getCentralPoint().x, r.getCentralPoint().y - 10);
  309. }else if (compaireID(r.getId() ,MithRockID)){
  310. g2d.drawString(String.valueOf(RockInuse(r)), r.getCentralPoint().x, r.getCentralPoint().y - 10);
  311. }
  312. }
  313. }
  314.  
  315.  
  316.  
  317. Point p = new Point(Mouse.getX(),Mouse.getY());
  318. g.setColor(Color.RED);
  319.  
  320. g.drawLine(0, p.y, 800, p.y);
  321. g.drawLine(p.x, 0, p.x, 800);
  322. g.setColor(Color.BLUE);
  323. g.drawOval(p.x-5,p.y-5,10,10);
  324.  
  325. g.setColor(color2);
  326. for (Tile t : Path_bank) {
  327. if (onMap(t)){
  328. Point po = Calculations.worldToMap(t.getX(), t.getY());
  329. g.drawOval(po.x, po.y, 2, 2);
  330. }
  331. }
  332.  
  333. }
  334.  
  335. @Override
  336. protected void setup() {
  337. gui.setVisible(true);
  338. LookupPrices lookupprices = new LookupPrices();
  339. submit(lookupprices);
  340. }
  341.  
  342. private class UpdateWorldPop extends Strategy implements Task {
  343. public boolean validate() {
  344. return CurrentWorldPop == 0 && worldHop == false;
  345. }
  346.  
  347. public void run() {
  348. CurrentTask = "Getting World Pop";
  349. if (WS.isLoggedIn()){
  350. if (Tabs.getCurrent() != Tabs.FRIENDS){
  351. Tabs.FRIENDS.open();
  352. String cWorld = Widgets.get(550, 18).getText();
  353. setWorld = Integer.parseInt(cWorld.replaceAll("[^0-9]", ""));
  354. log.info(cWorld.replaceAll("[^0-9]", ""));
  355. }
  356. if (setWorld != 0){
  357. WS.exitToLobby();
  358. }
  359.  
  360. }
  361. if (setWorld == 0){
  362. loginToRndWorld();
  363. } else if (WS.isAtLobby() && !WS.loginErrorVisible() && !WS.isLoggingIn()) {
  364. if (WS.ValidateEmailMessageVisible()) {
  365. WS.SkipValidateEmailMessage();
  366. }
  367. if (!WS.worldSelectTabSelected()) {
  368. WS.showSelectWorldTab();
  369. }
  370. if (WS.worldSelectTabSelected()) {
  371. int world = setWorld;
  372. boolean correctWorld = WS.selectWorld(world, true);
  373. if (!correctWorld) {
  374. correctWorld = WS.selectWorld(world, false);
  375. }
  376. if (correctWorld) {
  377. CurrentWorldNum = WS.getCurrentWorld();
  378. CurrentWorldPop = WS.getWorldPopulation(world);
  379. if (WS.playGame()){
  380. }
  381. int count = 0;
  382. do {
  383. if (Widgets.get(906, 119).validate() && Widgets.get(906, 119).visible()) {
  384. if (highRisk){
  385. Widgets.get(906,118).click(true);
  386. }else {
  387. Widgets.get(906,117).click(true);
  388. break;
  389. }
  390. }
  391. Time.sleep(Random.nextInt(900, 1100));
  392. count += 1;
  393. } while ((count < 60)
  394. && (Game.getClientState() == 9
  395. || Game.getClientState() == 7 || WS
  396. .isLoggingIn())
  397. && !Widgets.get(906, 115).isOnScreen()
  398. && !WS.loginErrorVisible());
  399. RockTimer.reset();
  400. }
  401. }
  402. }
  403. }
  404.  
  405. }
  406.  
  407. private class DropGems extends Strategy implements Task {
  408. Item dropItem = null;
  409. public boolean validate() {
  410. for (final Item item : Inventory.getItems()) {
  411. for (int x = 0; x <= Gems.values().length -1; x ++){
  412. if ((item.getId() == Gems.values()[x].getCutID()) && Gems.values()[x].getRank() <= topGemToDrop){
  413. dropItem = item;
  414. return true;
  415. } else if (item.getId() == Gems.values()[x].ID && cutGems && Gems.values()[x].getLVL() > craftingLVL && Gems.values()[x].getRank() <= topGemToDrop){
  416. dropItem = item;
  417. return true;
  418. }else if (!cutGems && item.getId() == Gems.values()[x].ID && Gems.values()[x].getRank() <= topGemToDrop){
  419. dropItem = item;
  420. return true;
  421. }
  422. }
  423. }
  424. return false;
  425. }
  426.  
  427. public void run() {
  428. CurrentTask = "Hover Mouse";
  429. if (dropItem != null){
  430. dropItem.getWidgetChild().interact("Drop");
  431. Time.sleep(100, 300);
  432. }
  433. }
  434. }
  435.  
  436. private class CutGems extends Strategy implements Task {
  437. public boolean validate() {
  438. return cutGems && Inventory.getCount(Gems.SAPPHIRE.getAllIDs()) >= 1;
  439. }
  440.  
  441. public void run() {
  442. CurrentTask = "Cut Gems";
  443. if (craftingLVL == 0){
  444. craftingLVL = Skills.getLevel(Skills.CRAFTING);
  445. }else {
  446. for (final Item item : Inventory.getItems()) {
  447. for (int x = 0; x <= Gems.values().length -1; x ++){
  448. if (item.getId() == Gems.values()[x].getID() && Gems.values()[x].getLVL() <= craftingLVL){
  449. if (Players.getLocal().getAnimation() == 889){
  450. Time.sleep(500, 1000);
  451. }else{
  452. item.getWidgetChild().interact("Craft");
  453. Time.sleep(400, 600);
  454. if (Widgets.get(905, 14).validate() && Widgets.get(905, 14).visible()){
  455. Widgets.get(905, 14).click(true);
  456. Time.sleep(400, 600);
  457.  
  458. }
  459. }
  460.  
  461. }
  462. }
  463. }
  464. }
  465. }
  466. }
  467.  
  468. private class RockChanged extends Strategy implements Task {
  469. public boolean validate() {
  470. return setting1801 != Settings.get(1801)
  471. || (Players.getLoaded().length > 1 && respawnTimer
  472. .isRunning() == false);
  473. }
  474.  
  475. public void run() {
  476. CurrentTask = "Rock Changed";
  477. setting1801 = Settings.get(1801);
  478. UpdateRockCatch();
  479. }
  480.  
  481. }
  482.  
  483. public void UpdateRockCatch() {
  484. if (area_mine.contains(Players.getLocal().getLocation())){
  485. boolean RockStatusCatchNew[] = new boolean[15];
  486. int count = 0;
  487. for (Rocks r : Rocks.values()) {
  488. try {
  489. if (count < Rocks.values().length) {
  490. RockStatusCatchNew[count] = (SceneEntities.getAt(
  491. r.getLocation()).getId() == r.getDownID() ? false
  492. : true);
  493. // log.info(String.valueOf(RockStatusCatchNew[count]) +
  494. // count + " " + r.getType().toString());
  495. count++;
  496. }
  497.  
  498. } catch (Exception ex) {
  499. log.info(ex.getMessage());
  500. log.info("Exception");
  501. }
  502.  
  503. }
  504. count = 0;
  505. for (boolean b : RockStatusCatchNew) {
  506. if (count < Rocks.values().length) {
  507. try {
  508. if (b != RockStatusCatch[count]) {
  509.  
  510. if (b == true) {
  511. RespawnTime[count] = 0;
  512. } else {
  513. if (Rocks.values()[count].getType() == Rock.MITH) {
  514. RespawnTime[count] = (long) (((4f - ((CurrentWorldPop) / 1000f)) * 60f * 1000f)
  515. + System.currentTimeMillis());
  516. } else if (Rocks.values()[count].getType() == Rock.ADDY) {
  517. RespawnTime[count] = (long) ((8f - ((CurrentWorldPop) / 500f)) * 60f * 1000f)
  518. + System.currentTimeMillis();
  519. } else if (Rocks.values()[count].getType() == Rock.RUNE) {
  520. RespawnTime[count] = (long) ((1500f - ((3f * CurrentWorldPop) / 8f)) * 1000f)
  521. + System.currentTimeMillis();
  522. }
  523. }
  524. }
  525. } catch (Exception ex) {
  526. ex.printStackTrace();
  527. log.info("Exception");
  528. }
  529. }
  530. RockStatusCatch[count] = b;
  531. count++;
  532. }
  533. respawnTimer.reset();
  534. }
  535. }
  536.  
  537. public boolean isTileOnScreen(Tile tile) {
  538. return Calculations.isOnScreen(new Tile(tile.getX() + 1, tile.getY() + 1, tile.getPlane()).getCentralPoint())
  539. && Calculations.isOnScreen(new Tile(tile.getX() - 1 , tile.getY() + 1, tile.getPlane()).getCentralPoint())
  540. && Calculations.isOnScreen(new Tile(tile.getX() - 1, tile.getY() - 1, tile.getPlane()).getCentralPoint())
  541. && Calculations.isOnScreen(new Tile(tile.getX() + 1, tile.getY() - 1, tile.getPlane()).getCentralPoint());
  542. }
  543.  
  544. private boolean isPlayerMoveing(){
  545. return Players.getLocal().getPassiveAnimation() == 824 || Players.getLocal().getPassiveAnimation() == 819;
  546. }
  547.  
  548. private class MouseHover extends Strategy implements Task {
  549. public boolean validate() {
  550. return !mouseHoverTimer.isRunning() && Inventory.getCount() != 28 && WS.isLoggedIn() && Players.getLocal().getAnimation() == 624;
  551. }
  552.  
  553. public void run() {
  554. CurrentTask = "Hover Mouse";
  555. SceneObject NextRock = getNextRock();
  556. if (NextRock != null && !NextRock.isOnScreen()){
  557. Locatable l = (NextRock.getLocation());
  558. Camera.turnTo(l);
  559. Point RockPt = Calculations.worldToMap(NextRock.getLocation().getX(), NextRock.getLocation().getY());
  560. if (!Mouse.getLocation().equals(RockPt)){
  561. Mouse.move(RockPt);
  562. }
  563.  
  564. } else if (NextRock != null && !NextRock.contains(Mouse.getLocation())){
  565. Mouse.move(NextRock.getCentralPoint(), 10, 10);
  566. }
  567. mouseHoverTimer.reset();
  568. }
  569.  
  570. }
  571.  
  572. private class CloseMayMadness extends Strategy implements Task {
  573. public boolean validate() {
  574. return WS.isLoggedIn() && Widgets.get(1272, 24).validate();
  575. }
  576.  
  577. public void run() {
  578. CurrentTask = "Close May Ad";
  579. if (Widgets.get(1272, 24).validate()) {
  580. Widgets.get(1272, 24).click(true);
  581. Time.sleep(300,500);
  582. }
  583. }
  584.  
  585. }
  586.  
  587. private class ClearLastClickTile extends Strategy implements Task {
  588. public boolean validate() {
  589. return !LastClicked.equals(new Tile(0,0,0)) && WS.isLoggedIn() && !isPlayerMoveing();
  590. }
  591.  
  592. public void run() {
  593. CurrentTask = "Reset Last Clicked Tile";
  594. LastClicked = new Tile(0,0,0);
  595.  
  596. }
  597.  
  598. }
  599.  
  600. private class RunIntoMine extends Strategy implements Task {
  601. public boolean validate() {
  602. return Inventory.getCount() != 28 && WS.isLoggedIn() && Players.getLocal().getLocation().equals(new Tile(1053,4521,0));
  603. }
  604.  
  605. public void run() {
  606. CurrentTask = "Run into mine";
  607. new Tile(1055,4514,0).clickOnMap();
  608.  
  609. }
  610.  
  611. }
  612.  
  613. private class InventorySelect extends Strategy implements Task {
  614. public boolean validate() {
  615. return WS.isLoggedIn() && Tabs.getCurrent() != Tabs.INVENTORY;
  616. }
  617.  
  618. public void run() {
  619. CurrentTask = "Select Inventory";
  620. if (Widgets.get(548, 93).validate() && Tabs.getCurrent() != Tabs.INVENTORY){
  621. Widgets.get(548, 93).click(true);
  622. Time.sleep(Random.nextInt(100, 300));
  623. }
  624. }
  625.  
  626. }
  627.  
  628. private class CloseLoginError extends Strategy implements Task {
  629. public boolean validate() {
  630. return WS.isAtLobby() && WS.loginErrorVisible();
  631. }
  632.  
  633. public void run() {
  634. CurrentTask = "Close login error message";
  635. WS.closeLogonErrorMessage();
  636. }
  637.  
  638. }
  639.  
  640. private class Resting extends Strategy implements Task {
  641. public boolean validate() {
  642. if (Inventory.getCount() < 28 && !worldHop) {
  643. if (SceneEntities.getNearest(dungExitDoorID) != null && Walking.getEnergy() <= 60) {
  644. Tile next = nextSpawnLocation();
  645. if (next == null ? true : Calculations.distanceTo(next) <= 1){
  646. final SceneObject rock = getRock();
  647. if (rock == null) {
  648. if (Players.getLocal().getAnimation() != RestAnim[0]) {
  649. if (Players.getLocal().getAnimation() != RestAnim[1]) {
  650. if (Players.getLocal().getAnimation() != RestAnim[2]) {
  651. return true;
  652. }
  653. }
  654. }
  655. }
  656. }
  657. }}
  658. return false;
  659. }
  660.  
  661. public void run() {
  662. CurrentTask = "Resting";
  663. WidgetChild runChild = Widgets.get(548).getChild(168);
  664. if (runChild.validate()) {
  665. runChild.click(false);
  666. if (Menu.contains("Rest")) {
  667. Menu.select("Rest");
  668. Time.sleep(Random.nextInt(1000, 1500));
  669. } else {
  670. Mouse.move(Random.nextInt(1,500), Random.nextInt(1,500));
  671. }
  672. }
  673. }
  674.  
  675. }
  676.  
  677. private boolean faceingTile (Player P, Tile t){
  678. Tile PlayerTile = P.getLocation();
  679. int rot = P.getOrientation();
  680. int dx = PlayerTile.getX() - t.getX();
  681. int dy = PlayerTile.getY() - t.getY();
  682. if (dy == -1 && dx == -1){
  683. return rot == 45;
  684. }else if (dy == 1 && dx == 1){
  685. return rot == 225;
  686. }else if (dy == -1 && dx == 1){
  687. return rot == 135;
  688. }else if (dy == 1 && dx == -1){
  689. return rot == 315;
  690. }else if (dy == -1 && dx == 0) {
  691. return rot == 90;
  692. }else if (dx == -1 && dy == 0){
  693. return rot == 0;
  694. }else if (dy == 1 && dx == 0) {
  695. return rot == 270;
  696. }else if (dx == 1 && dy == 0){
  697. return rot == 180;
  698. }
  699. return false;
  700. }
  701.  
  702. private class LookupPrices extends Strategy implements Task {
  703. public boolean validate() {
  704. return true;
  705. }
  706.  
  707. public void run() {
  708. CurrentTask = "Lookup Prices";
  709. RuniteOrePrice = lookup(RuniteOreID);
  710. MithOrePrice = lookup(MithOreID);
  711. AddOrePrice = lookup(AddOreID);
  712. }
  713.  
  714. }
  715. private boolean RockInuse(SceneObject Rock){
  716. for (Player P : Players.getLoaded()){
  717. if (!P.equals(Players.getLocal()) && P.getAnimation() == 624 && faceingTile(P, Rock.getLocation())){
  718. return true;
  719. }
  720. }
  721. return false;
  722. }
  723.  
  724. private SceneObject getRock(){
  725.  
  726. UpdateRockCatch();
  727.  
  728. SceneObject RuniteRock = SceneEntities.getNearest(new Filter<SceneObject>(){
  729. @Override
  730. public boolean accept(SceneObject ob) {
  731. if (politeMode){
  732. return compaireID(ob.getId() ,RuniteRockID) && (!RockInuse(ob) || faceingTile(Players.getLocal(), ob.getLocation()));
  733. } else {
  734. return compaireID(ob.getId() ,RuniteRockID);
  735. }
  736. }
  737.  
  738. });
  739. if (politeMode && RuniteRock == null){
  740. RuniteRock = SceneEntities.getNearest(RuniteRockID);
  741. }
  742. if (RuniteRock != null && mineRunite && area_mine.contains(RuniteRock.getLocation())){
  743. CurrentRock = RuniteRock;
  744. return RuniteRock;
  745. }
  746.  
  747. SceneObject AddRock = SceneEntities.getNearest(new Filter<SceneObject>(){
  748. @Override
  749. public boolean accept(SceneObject ob) {
  750. if (politeMode){
  751. return compaireID(ob.getId() ,AddeRockID) && (!RockInuse(ob) || faceingTile(Players.getLocal(), ob.getLocation()));
  752. } else {
  753. return compaireID(ob.getId() ,AddeRockID);
  754. }
  755. }
  756.  
  757. });
  758. if (politeMode && AddRock == null){
  759. AddRock = SceneEntities.getNearest(AddeRockID);
  760. }
  761. if (AddRock != null && mineAdd && area_mine.contains(AddRock.getLocation())){
  762. CurrentRock = AddRock;
  763. return AddRock;
  764. }
  765. SceneObject MithRock = SceneEntities.getNearest(new Filter<SceneObject>(){
  766. @Override
  767. public boolean accept(SceneObject ob) {
  768. if (politeMode){
  769. return compaireID(ob.getId() ,MithRockID) && (!RockInuse(ob) || faceingTile(Players.getLocal(), ob.getLocation()));
  770. } else {
  771. return compaireID(ob.getId() ,MithRockID);
  772. }
  773. }
  774.  
  775. });
  776. if (politeMode && MithRock == null){
  777. MithRock = SceneEntities.getNearest(MithRockID);
  778. }
  779. if (MithRock != null && mineMith && area_mine.contains(MithRock.getLocation())){
  780. CurrentRock = MithRock;
  781. return MithRock;
  782. }
  783. CurrentRock = null;
  784. return null;
  785. }
  786.  
  787. private boolean compaireID(int id, int... IDs){
  788. for (int ID : IDs){
  789. if (ID == id){
  790. return true;
  791. }
  792. }
  793. return false;
  794. }
  795.  
  796. private SceneObject getNextRock(){
  797. final SceneObject CurrentRock = getRock();
  798. if (CurrentRock != null){
  799. SceneObject RuniteRock = SceneEntities.getNearest(new Filter<SceneObject>(){
  800. @Override
  801. public boolean accept(SceneObject ob) {
  802. if (politeMode){
  803. return compaireID(ob.getId() ,RuniteRockID) && !RockInuse(ob) && !ob.getLocation().equals(CurrentRock.getLocation());
  804. } else {
  805. return compaireID(ob.getId() ,RuniteRockID) && !ob.getLocation().equals(CurrentRock.getLocation());
  806. }
  807. }
  808.  
  809. });
  810. if (politeMode && RuniteRock == null){
  811. RuniteRock = SceneEntities.getNearest(new Filter<SceneObject>(){
  812. @Override
  813. public boolean accept(SceneObject ob) {
  814. return compaireID(ob.getId() ,RuniteRockID) && !ob.getLocation().equals(CurrentRock.getLocation());
  815. }
  816. });
  817. }
  818. if (RuniteRock != null && mineRunite && area_mine.contains(RuniteRock.getLocation())){
  819. NextRock = RuniteRock;
  820. return RuniteRock;
  821. }
  822.  
  823. SceneObject AddRock = SceneEntities.getNearest(new Filter<SceneObject>(){
  824. @Override
  825. public boolean accept(SceneObject ob) {
  826. if (politeMode){
  827. return compaireID(ob.getId() ,AddeRockID) && !RockInuse(ob) && !ob.getLocation().equals(CurrentRock.getLocation());
  828. } else {
  829. return compaireID(ob.getId() ,AddeRockID) && !ob.getLocation().equals(CurrentRock.getLocation());
  830. }
  831. }
  832.  
  833. });
  834. if (politeMode && AddRock == null){
  835. AddRock = SceneEntities.getNearest(new Filter<SceneObject>(){
  836. @Override
  837. public boolean accept(SceneObject ob) {
  838. return compaireID(ob.getId() ,AddeRockID) && !ob.getLocation().equals(CurrentRock.getLocation());
  839. }
  840. });
  841. }
  842. if (AddRock != null && mineAdd && area_mine.contains(AddRock.getLocation())){
  843. NextRock = AddRock;
  844. return AddRock;
  845. }
  846. SceneObject MithRock = SceneEntities.getNearest(new Filter<SceneObject>(){
  847. @Override
  848. public boolean accept(SceneObject ob) {
  849. if (politeMode){
  850. return compaireID(ob.getId() ,MithRockID) && !RockInuse(ob) && !ob.getLocation().equals(CurrentRock.getLocation());
  851. } else {
  852. return compaireID(ob.getId() ,MithRockID) && !ob.getLocation().equals(CurrentRock.getLocation());
  853. }
  854. }
  855.  
  856. });
  857. if (politeMode && MithRock == null){
  858. MithRock = SceneEntities.getNearest(new Filter<SceneObject>(){
  859. @Override
  860. public boolean accept(SceneObject ob) {
  861. return compaireID(ob.getId() ,MithRockID) && !ob.getLocation().equals(CurrentRock.getLocation());
  862. }
  863. });
  864. }
  865. if (MithRock != null && mineMith && area_mine.contains(MithRock.getLocation())){
  866. NextRock = MithRock;
  867. return MithRock;
  868. }
  869. NextRock = null;
  870. return null;
  871. } else {
  872. NextRock = null;
  873. return null;
  874. }
  875. }
  876.  
  877. private class CamerSetPitch extends Strategy implements Task {
  878. public boolean validate() {
  879. return Camera.getPitch() < 85 && WS.isLoggedIn();
  880. }
  881.  
  882. public void run() {
  883. CurrentTask = "Set camera pitch";
  884. Camera.setPitch(true);
  885. }
  886.  
  887. }
  888.  
  889.  
  890. private class ActivateRun extends Strategy implements Task {
  891. public boolean validate() {
  892. return WS.isLoggedIn() && Walking.getEnergy() >= runPerCent && !Walking.isRunEnabled();
  893. }
  894.  
  895. public void run() {
  896. CurrentTask = "Activate run";
  897. if (!Walking.isRunEnabled()){
  898. Walking.setRun(true);
  899. runPerCent = Random.nextInt(60, 80);
  900. }
  901. }
  902.  
  903. }
  904.  
  905. private class Antiban extends Strategy implements Task {
  906. public boolean validate() {
  907. return Game.isLoggedIn() && Game.getClientState() == 11;
  908. }
  909.  
  910. public void run() {
  911. switch (Random.nextInt(0, 1000)) {
  912. case 0:
  913. CurrentTask = "Antiban";
  914. Camera.setAngle(Random.nextInt(14,304));
  915. break;
  916. case 1:
  917. CurrentTask = "Antiban";
  918. Camera.setAngle(Random.nextInt(90,124));
  919. break;
  920. case 2:
  921. CurrentTask = "Antiban";
  922. Camera.setAngle('N');
  923. break;
  924. case 3:
  925. CurrentTask = "Antiban";
  926. Mouse.move(Random.nextInt(1,500), Random.nextInt(1,500));
  927. break;
  928. }
  929. }
  930. }
  931.  
  932. private class EnterDung implements Task, Condition {
  933.  
  934. @Override
  935. public void run() {
  936. CurrentTask = "Enter Dung";
  937. final SceneObject door = SceneEntities.getNearest(dunEntDoorID);
  938. if (door != null && door.isOnScreen() && Players.getLocal().getAnimation() != 13288){
  939. door.click(true);
  940. } else if (door != null && !door.isOnScreen() && !isPlayerMoveing()){
  941. door.getLocation().clickOnMap();
  942. }
  943. Time.sleep(Random.nextInt(500, 1000));
  944. }
  945.  
  946. @Override
  947. public boolean validate() {
  948. return (Inventory.getCount() != 28) && SceneEntities.getNearest(dunEntDoorID) != null && !isPlayerMoveing();
  949. }
  950. }
  951.  
  952. private class EnterMine implements Task, Condition {
  953.  
  954. @Override
  955. public void run() {
  956. CurrentTask = "Enter Mine";
  957. SceneObject ladder = SceneEntities.getNearest(entLadderID);
  958. if (ladder != null && ladder.isOnScreen()){
  959. Mouse.move(ladder.getCentralPoint(),5,5);
  960. if (ladder.click(true)){
  961. Time.sleep(Random.nextInt(800, 1500));
  962. }
  963. } else if (ladder != null && !ladder.isOnScreen()){
  964. //Walking.walk(ladder.getLocation());
  965. }
  966.  
  967. ladder = SceneEntities.getNearest(entLadderID);
  968. if (ladder != null){
  969. Mouse.move(ladder.getCentralPoint(),5,5);
  970. if (ladder.interact("Climb-down")){
  971. Time.sleep(Random.nextInt(1000, 2000));
  972. }
  973. }
  974. }
  975.  
  976. @Override
  977. public boolean validate() {
  978. return (Inventory.getCount() != 28) && SceneEntities.getNearest(entLadderID) != null && SceneEntities.getNearest(entLadderID).isOnScreen() && (!isPlayerMoveing() || Calculations.distanceTo(SceneEntities.getNearest(entLadderID).getLocation()) <= 5);
  979. }
  980. }
  981.  
  982. private class WalkToMine implements Task, Condition {
  983.  
  984. @Override
  985. public void run() {
  986. CurrentTask = "Walk to mine";
  987. Tile NextTile = GetNextTile(Path_bank, false, 1);
  988. if (debug){
  989. log.info(NextTile.toString());
  990. }
  991. if (NextClicked != LastClicked){
  992. //if (NextTile.clickOnMap()){
  993. if (NextTile.clickOnMap()){
  994. LastClicked = NextClicked;
  995. Time.sleep(Random.nextInt(1000, 2000));
  996. }
  997.  
  998. }
  999.  
  1000. }
  1001.  
  1002. @Override
  1003. public boolean validate() {
  1004. try{
  1005. return (Inventory.getCount() != 28) && area_top.contains(Players.getLocal().getLocation()) && (SceneEntities.getNearest(entLadderID) == null || !SceneEntities.getNearest(entLadderID).isOnScreen());
  1006. }catch (RuntimeException e ){
  1007. log.info(e.getMessage());
  1008. return false;
  1009. }finally{}
  1010. }
  1011. }
  1012.  
  1013. private class UseBank implements Task, Condition {
  1014. private static final int PIN_WIDGET = 13;
  1015. @Override
  1016. public void run() {
  1017. CurrentTask = "Use bank";
  1018. if (!isBankOpen() && !(Widgets.get(PIN_WIDGET, 1).visible())){
  1019. SceneObject bank = SceneEntities.getNearest(bankBoothID);
  1020. if (bank.isOnScreen()){
  1021. Mouse.move(bank.getCentralPoint(),5,5);
  1022. if (bank.interact("Bank", "Bank booth")){
  1023. Time.sleep(Random.nextInt(1000, 2000));
  1024. }
  1025. }
  1026.  
  1027. }
  1028.  
  1029.  
  1030. if (!isBankOpen() && !(Widgets.get(PIN_WIDGET, 1).visible())){
  1031. NPC banker = NPCs.getNearest(6200);
  1032. if (banker != null && banker.isOnScreen()){
  1033. Mouse.move(banker.getCentralPoint(),5,5);
  1034. if (banker.interact("Bank")){
  1035. Time.sleep(Random.nextInt(700, 1600));
  1036. }
  1037. }
  1038. }
  1039. if (isBankOpen()){
  1040. depositAllExcept(PickaxeID);
  1041. Time.sleep(Random.nextInt(300, 700));
  1042. }
  1043.  
  1044. }
  1045.  
  1046. @Override
  1047. public boolean validate() {
  1048. if (Inventory.getCount() == 28){
  1049. if (area_top.contains(Players.getLocal().getLocation())){
  1050. if (SceneEntities.getNearest(bankBoothID) != null){
  1051. if (SceneEntities.getNearest(bankBoothID).isOnScreen() && (!isPlayerMoveing() || Calculations.distanceTo(SceneEntities.getNearest(bankBoothID).getLocation()) <= 4) && !(Widgets.get(PIN_WIDGET, 1).visible())){
  1052. return true;
  1053. }
  1054. }
  1055.  
  1056. }
  1057. }
  1058. return false;
  1059. }
  1060. }
  1061.  
  1062. public static boolean onMap(final Tile tile) {
  1063. return Calculations.worldToMap(tile.getX(), tile.getY()).getX() != -1;
  1064. }
  1065.  
  1066. public Tile GetNextTile(Tile tiles[], boolean reverse, int rand){
  1067. if (reverse == false){
  1068. for (int x = 0; x < tiles.length; x++){
  1069. Tile NewTile = new Tile (tiles[x].getX() + Random.nextInt(-rand, rand),tiles[x].getY() + Random.nextInt(-rand, rand),0);
  1070. if (onMap(NewTile) && NewTile.isOnMap() && Calculations.distanceTo(NewTile) <= 16){
  1071. NextClicked = tiles[x];
  1072. return NewTile;
  1073. }
  1074. }
  1075. } else {
  1076.  
  1077. for (int x = (tiles.length-1); x>=0; x--){
  1078. Tile NewTile = new Tile (tiles[x].getX() + Random.nextInt(-rand, rand),tiles[x].getY() + Random.nextInt(-rand, rand),0);
  1079. if (onMap(NewTile) && NewTile.isOnMap() && Calculations.distanceTo(NewTile) <= 16){
  1080. NextClicked = tiles[x];
  1081. return NewTile;
  1082. }
  1083. }
  1084. }
  1085. return new Tile(0,0,0);
  1086. }
  1087.  
  1088. private class WalkToBank implements Task, Condition {
  1089.  
  1090. @Override
  1091. public void run() {
  1092. CurrentTask = "Walk to bank";
  1093.  
  1094. Tile NextTile = GetNextTile(Path_bank, true, 1);
  1095. if (NextClicked != LastClicked){
  1096. if (NextTile.clickOnMap()){
  1097. LastClicked = NextClicked;
  1098. Time.sleep(Random.nextInt(1000, 2000));
  1099. }
  1100. }
  1101. }
  1102.  
  1103. @Override
  1104. public boolean validate() {
  1105. return (Inventory.getCount() == 28) && area_top.contains(Players.getLocal().getLocation()) && (SceneEntities.getNearest(bankBoothID) == null || !SceneEntities.getNearest(bankBoothID).isOnScreen());
  1106. }
  1107. }
  1108.  
  1109. private class LeaveMine implements Task, Condition {
  1110.  
  1111. @Override
  1112. public void run() {
  1113. CurrentTask = "Leave Mine";
  1114. final SceneObject ladder = SceneEntities.getNearest(exitLadderID);
  1115. if (ladder != null && ladder.isOnScreen() && Players.getLocal().getAnimation() != 828){
  1116. ladder.click(true);
  1117. } else if (ladder != null && !ladder.isOnScreen()){
  1118. ladder.getLocation().clickOnMap();
  1119. }
  1120. Time.sleep(Random.nextInt(1500, 2000));
  1121. }
  1122.  
  1123. @Override
  1124. public boolean validate() {
  1125. return (Inventory.getCount() == 28) && SceneEntities.getNearest(exitLadderID) != null && !isPlayerMoveing();
  1126. }
  1127. }
  1128.  
  1129. private class LeaveDung implements Task, Condition {
  1130.  
  1131. @Override
  1132. public void run() {
  1133. CurrentTask = "Leave Dung";
  1134. final SceneObject door = SceneEntities.getNearest(dungExitDoorID);
  1135. if (door != null && door.isOnScreen() && Players.getLocal().getAnimation() != 13288){
  1136. door.click(true);
  1137. System.gc();
  1138. } else if (door != null && !door.isOnScreen()){
  1139. door.getLocation().clickOnMap();
  1140. }
  1141. Time.sleep(Random.nextInt(500, 1000));
  1142. }
  1143.  
  1144. @Override
  1145. public boolean validate() {
  1146. return (Inventory.getCount() == 28) && SceneEntities.getNearest(dungExitDoorID) != null && !isPlayerMoveing();
  1147. }
  1148. }
  1149.  
  1150. private class HightRiskWorld implements Task, Condition {
  1151.  
  1152. @Override
  1153. public void run() {
  1154. CurrentTask = "High risk world message";
  1155. if (highRisk){
  1156. Widgets.get(906,118).click(true);
  1157. }else {
  1158. Widgets.get(906,117).click(true);
  1159. }
  1160. Time.sleep(Random.nextInt(300, 500));
  1161. }
  1162.  
  1163. @Override
  1164. public boolean validate() {
  1165. return Widgets.get(906,117).validate() && Widgets.get(906,117).visible();
  1166. }
  1167. }
  1168.  
  1169. private class MembDetection implements Task, Condition {
  1170.  
  1171. @Override
  1172. public void run() {
  1173. CurrentTask = "Members message";
  1174. Widgets.get(906,259).click(true);
  1175. Time.sleep(Random.nextInt(300, 500));
  1176. loginToRndWorld();
  1177.  
  1178. }
  1179.  
  1180. @Override
  1181. public boolean validate() {
  1182. return false;
  1183. //return Widgets.get(906,42).isVisible();
  1184. }
  1185. }
  1186.  
  1187. private class LobbyDetection implements Task, Condition {
  1188.  
  1189. @Override
  1190. public void run() {
  1191. CurrentTask = "At lobby";
  1192. loginToRndWorld();
  1193.  
  1194. }
  1195.  
  1196. @Override
  1197. public boolean validate() {
  1198. return WS.isAtLobby() && !WS.loginErrorVisible() && worldHop == true;
  1199. }
  1200. }
  1201.  
  1202. private class SwitchWorld implements Task, Condition {
  1203.  
  1204. @Override
  1205. public void run() {
  1206. CurrentTask = "Switch world";
  1207. if(Camera.getPitch() < 85 && WS.isLoggedIn()){
  1208. Camera.setPitch(true);
  1209. }
  1210. Time.sleep(Random.nextInt(1000, 2000));
  1211. final SceneObject rock = getRock();
  1212. if (rock == null){
  1213. WS.exitToLobby();
  1214. System.gc();
  1215.  
  1216. Time.sleep(Random.nextInt(1500, 2500));
  1217. loginToRndWorld();
  1218. }
  1219. }
  1220.  
  1221. @Override
  1222. public boolean validate() {
  1223. if (Inventory.getCount() < 28 && worldHop){
  1224. final SceneObject rock = getRock();
  1225. if (rock == null && Players.getLocal().getAnimation() != 624){
  1226. if (SceneEntities.getNearest(dungExitDoorID) != null){
  1227. return true;
  1228. }
  1229. }
  1230. }
  1231. return false;
  1232. }
  1233. }
  1234.  
  1235.  
  1236. private void loginToRndWorld() {
  1237. CheckedCurrentWorldForOres = false;
  1238. if (WS.isAtLobby() && !WS.loginErrorVisible() && !WS.isLoggingIn()) {
  1239. if (WS.ValidateEmailMessageVisible()) {
  1240. WS.SkipValidateEmailMessage();
  1241. }
  1242. if (!WS.worldSelectTabSelected()) {
  1243. WS.showSelectWorldTab();
  1244. }
  1245. if (WS.worldSelectTabSelected()) {
  1246. int rndWorld = 0;
  1247. int loopCount = 0;
  1248. for (long t : ReturnTime) {
  1249. if (t != 0 && loopCount != 0 && t < System.currentTimeMillis() && loopCount != WS.getCurrentWorld()) {
  1250. rndWorld = loopCount;
  1251. log.info("Return to World: " + rndWorld + " memb: "+ (WS.isWorldMembers(rndWorld)) + " WorldID: "+ (WS.WorldToID(rndWorld)));
  1252. break;
  1253. }
  1254. loopCount += 1;
  1255. }
  1256. if (rndWorld == 0) {
  1257. rndWorld = Random.nextInt(1, 139);
  1258. while ((WS.WorldToID(rndWorld) == -1)
  1259. || (WS.isWorldMembers(rndWorld) && !memb)
  1260. || (!WS.isWorldMembers(rndWorld) && !useFreeWorlds)
  1261. || (WS.getCurrentWorld() == rndWorld)
  1262. || (WS.getWorldActivity(rndWorld).contains("High-risk") && !highRisk)
  1263. || (WS.getWorldActivity(rndWorld).contains("Skill Total") && !skillWorlds)
  1264. || ReturnTime[rndWorld] != 0)
  1265. {
  1266. rndWorld = Random.nextInt(1, 139);
  1267. }
  1268. log.info("Random World: " + rndWorld + " memb: "+ (WS.isWorldMembers(rndWorld)) + " WorldID: "+ (WS.WorldToID(rndWorld)));
  1269. }
  1270.  
  1271. boolean correctWorld = WS.selectWorld(rndWorld, true);
  1272. if (!correctWorld) {
  1273. correctWorld = WS.selectWorld(rndWorld, false);
  1274. }
  1275. if (correctWorld) {
  1276. CurrentWorldNum = rndWorld;
  1277. CurrentWorldPop = WS.getWorldPopulation(rndWorld);
  1278. CheckedCurrentWorldForOres = false;
  1279. if (WS.playGame()){
  1280. ReturnTime[rndWorld] = 0;
  1281. }
  1282. int count = 0;
  1283. do {
  1284. if (Widgets.get(906, 119).validate() && Widgets.get(906, 119).visible()) {
  1285. if (highRisk){
  1286. Widgets.get(906,118).click(true);
  1287. }else {
  1288. Widgets.get(906,117).click(true);
  1289. break;
  1290. }
  1291. }
  1292. Time.sleep(Random.nextInt(900, 1100));
  1293. count += 1;
  1294. } while ((count < 60)
  1295. && (Game.getClientState() == 9
  1296. || Game.getClientState() == 7 || WS
  1297. .isLoggingIn())
  1298. && !Widgets.get(906, 115).isOnScreen()
  1299. && !WS.loginErrorVisible());
  1300. RockTimer.reset();
  1301. }
  1302. }
  1303. }
  1304. }
  1305.  
  1306. private class MineRicks implements Task, Condition {
  1307.  
  1308. @Override
  1309. public void run() {
  1310. CurrentTask = "Mine rock";
  1311. final SceneObject rock = getRock();
  1312. if (rock != null) {
  1313. if (rock.isOnScreen()) {
  1314. if (clickLess) {
  1315. if (LastRockClicked != null
  1316. && LastRockClicked.getLocation().equals(
  1317. rock.getLocation())
  1318. && faceingTile(Players.getLocal(),
  1319. rock.getLocation())) {
  1320. Time.sleep(Random.nextInt(800, 1300));
  1321. }
  1322. }
  1323.  
  1324. Time.sleep(Random.nextInt(100, 300));
  1325. if (Players.getLocal().getAnimation() != 624
  1326. || !faceingTile(Players.getLocal(),
  1327. rock.getLocation())) {
  1328. if (rock.interact("Mine")) {
  1329. LastRockClicked = rock;
  1330. Time.sleep(Random.nextInt(1000, 1500));
  1331. }
  1332. SceneObject NextRock = getNextRock();
  1333. if (NextRock != null && !NextRock.isOnScreen()) {
  1334. Locatable l = (NextRock.getLocation());
  1335. Camera.turnTo(l);
  1336. }
  1337.  
  1338. Mouse.move(NextRock.getCentralPoint(), 10, 10);
  1339. }
  1340. } else {
  1341. rock.getLocation().clickOnMap();
  1342. Time.sleep(Random.nextInt(200, 300));
  1343. }
  1344. }
  1345. }
  1346.  
  1347. @Override
  1348. public boolean validate() {
  1349. if (Inventory.getCount() < 28){
  1350. final SceneObject rock = getRock();
  1351. if (rock != null){
  1352. if (compaireID(rock.getId() ,RuniteRockID)){
  1353. if (!RockTimer.isRunning()){
  1354. long RespornTime = (25 - (CurrentWorldPop/160)) * 60 * 1000;
  1355. //long returnTime = Random.nextInt(0, 30000) + RespornTime ;
  1356. ReturnTime[CurrentWorldNum] = System.currentTimeMillis() + RespornTime;
  1357. CheckedCurrentWorldForOres = true;
  1358. }
  1359. } else if (CheckedCurrentWorldForOres == false){
  1360. ReturnTime[CurrentWorldNum] = 0;
  1361. CheckedCurrentWorldForOres = true;
  1362. }
  1363. } else if (rock == null && worldHop == false){
  1364. Tile next = nextSpawnLocation();
  1365. if (next != null && Calculations.distanceTo(next) >= 2 && Players.getLocal().isMoving() == false && rockPrediction){
  1366. if (next.isOnScreen()){
  1367. next.click(true);
  1368. } else {
  1369. next.clickOnMap();
  1370. }
  1371. Time.sleep(300, 800);
  1372. }
  1373. } else if (rock == null && WS.isLoggedIn() && Game.isLoggedIn() && CheckedCurrentWorldForOres == false){
  1374. ReturnTime[CurrentWorldNum] = 0;
  1375. CheckedCurrentWorldForOres = true;
  1376. }
  1377. if (rock != null){
  1378. if (!faceingTile(Players.getLocal(), rock.getLocation()) && !isPlayerMoveing()){
  1379. return true;
  1380. }
  1381. if (Players.getLocal().getAnimation() != 624 && !isPlayerMoveing()){
  1382. Time.sleep(Random.nextInt(100, 300));
  1383. return true;
  1384. }
  1385.  
  1386. }
  1387. }
  1388. return false;
  1389. }
  1390. }
  1391.  
  1392. private Tile nextSpawnLocation(){
  1393. int smallest = 0, count = 0;
  1394. for (long l : RespawnTime){
  1395. if (l < RespawnTime[smallest] && l != 0){
  1396. smallest = count;
  1397. }
  1398. count++;
  1399. }
  1400. return Rocks.values()[smallest].getLocation();
  1401. }
  1402.  
  1403.  
  1404. @Override
  1405. public void messageReceived(MessageEvent m) {
  1406. if (m.getMessage().contains("mine some runite") ){
  1407. RuniteOreCount += 1;
  1408. } else if (m.getMessage().contains("mine some mith")){
  1409. MithOreCount += 1;
  1410. }else if (m.getMessage().contains("mine some ada")){
  1411. AddOreCount += 1;
  1412. }
  1413.  
  1414. }
  1415.  
  1416. public static boolean isBankOpen() {
  1417. return Widgets.get(762).validate();
  1418. }
  1419.  
  1420. public boolean inventoryContains(final int... IDs){
  1421. for (int ID : IDs){
  1422. if (Inventory.getCount(ID) != 0){
  1423. return true;
  1424. }
  1425. }
  1426. return false;
  1427. }
  1428.  
  1429. private final class enterBankPin extends Strategy implements Task {
  1430. private static final int PIN_WIDGET = 13;
  1431.  
  1432. @Override
  1433. public boolean validate() {
  1434. return (Widgets.get(PIN_WIDGET, 1).visible()) && pin[0] != -1 && pin[1] != -1 && pin[2] != -1 && pin[3] != -1;
  1435. }
  1436.  
  1437. @Override
  1438. public void run() {
  1439. CurrentTask = "Bank Pin";
  1440. if (Widgets.get(PIN_WIDGET, 1).visible()) {
  1441. int pos = 1;
  1442. for (int i : pin) {
  1443. int numb = i + 6;
  1444. if (Widgets.get(PIN_WIDGET, numb).click(true)) {
  1445. Time.sleep(300);
  1446. int count = 0;
  1447. pos ++;
  1448. while (Widgets.get(PIN_WIDGET).getChild(pos)
  1449. .getText() == "?") {
  1450. Time.sleep(200);
  1451. if (count >= 4){
  1452. break;
  1453. }
  1454. count ++;
  1455. }
  1456. }
  1457. }
  1458. }
  1459. }
  1460. }
  1461.  
  1462. public void depositAllExcept(final int... IDs) {
  1463.  
  1464. if (inventoryContains(IDs) && isBankOpen()){
  1465. int[] DepositedIDs;
  1466. DepositedIDs = new int[27];
  1467. int Pos = 0;
  1468. int timeout = 0;
  1469. boolean bankAgain = false;
  1470. do {
  1471. for (final Item item : Inventory.getItems()) {
  1472. if (item != null) {
  1473.  
  1474. boolean deposit = true;
  1475. for (final int ID : IDs) {
  1476. if (item.getId() == ID) {
  1477. deposit = false;
  1478. break;
  1479. }
  1480. }
  1481. for (int IDD : DepositedIDs) {
  1482. if (item.getId() == IDD) {
  1483. deposit = false;
  1484. break;
  1485. }
  1486. }
  1487. if (deposit) {
  1488. int count = Inventory.getCount(item.getId());
  1489. if (item.getWidgetChild().interact(
  1490. count > 1 ? "Deposit-All" : "Deposit")) {
  1491. DepositedIDs[Pos] = item.getId();
  1492. Pos += 1;
  1493. Time.sleep(Random.nextInt(100, 300));
  1494. }
  1495. }
  1496. }
  1497. }
  1498. for (final Item item : Inventory.getItems()) {
  1499. boolean validItem = false;
  1500. for (final int ID : IDs) {
  1501. validItem = false;
  1502. if (item.getId() == ID){
  1503. validItem = true;
  1504. break;
  1505. }
  1506. }
  1507. if (!validItem){
  1508. bankAgain = true;
  1509. break;
  1510. }
  1511. }
  1512. timeout += 1;
  1513. } while (bankAgain || timeout >= 5);
  1514. } else {
  1515. if (isBankOpen()){
  1516. if (Widgets.get(762, 34).validate()){
  1517. Widgets.get(762, 34).click(true);
  1518. }
  1519. }
  1520. }
  1521.  
  1522. }
  1523.  
  1524. public boolean ClickTile (Tile t){
  1525. if (onMap(t)){
  1526. Point po = Calculations.worldToMap(t.getX(), t.getY());
  1527. Mouse.click(po, true);
  1528. return true;
  1529. }
  1530. return false;
  1531. }
  1532.  
  1533. //From API
  1534.  
  1535. public static String formatTime(final long time) {
  1536. final StringBuilder t = new StringBuilder();
  1537. final long total_secs = time / 1000;
  1538. final long total_mins = total_secs / 60;
  1539. final long total_hrs = total_mins / 60;
  1540. final int secs = (int) total_secs % 60;
  1541. final int mins = (int) total_mins % 60;
  1542. final int hrs = (int) total_hrs % 24;
  1543. if (hrs != 0) {
  1544. if (hrs < 10) {
  1545. t.append("0");
  1546. }
  1547. t.append(hrs);
  1548. t.append(":");
  1549. }
  1550. if (mins != 0) {
  1551. if (mins < 10) {
  1552. t.append("0");
  1553. }
  1554. t.append(mins);
  1555. t.append(":");
  1556. }
  1557.  
  1558. if (secs < 10) {
  1559. t.append("0");
  1560. }
  1561. t.append(secs);
  1562. return t.toString();
  1563. }
  1564.  
  1565. // Credits to Deprecated for the mouse trail
  1566. public class MouseTrail {
  1567. private final static int SIZE = 25;
  1568.  
  1569. private Point[] points;
  1570. private int index;
  1571.  
  1572. public MouseTrail() {
  1573. points = new Point[SIZE];
  1574. index = 0;
  1575. }
  1576.  
  1577. public void add(Point p) {
  1578. points[index++] = p;
  1579. index %= SIZE;
  1580. }
  1581.  
  1582. public void draw(Graphics graphics) {
  1583. double alpha = 0;
  1584.  
  1585. for (int i = index; i != (index == 0 ? SIZE-1 : index-1); i = (i+1)%SIZE) {
  1586. if (points[i] != null && points[(i+1)%SIZE] != null) {
  1587. graphics.setColor(new Color(0, 255, 0, (int) alpha));
  1588. graphics.drawLine(points[i].x, points[i].y, points[(i+1)%SIZE].x, points[(i+1)%SIZE].y);
  1589. alpha += (255.0/SIZE);
  1590. }
  1591. }
  1592. }
  1593. }
  1594.  
  1595. public static int lookup(int itemID) {
  1596. try {
  1597. final URL url = new URL(
  1598. "http://services.runescape.com/m=itemdb_rs/viewitem.ws?obj="
  1599. + itemID);
  1600. final BufferedReader in = new BufferedReader(new InputStreamReader(
  1601. url.openStream()));
  1602.  
  1603. String input;
  1604. while ((input = in.readLine()) != null) {
  1605. if (input.contains("Current guide price:")) {
  1606. input = in.readLine();
  1607. return Integer.parseInt(formatter(input.substring(4,
  1608. input.lastIndexOf('<'))));
  1609. }
  1610. }
  1611. } catch (Exception e) {
  1612. }
  1613. return -1;
  1614. }
  1615.  
  1616. private static String formatter(String num) {
  1617. try {
  1618. return num.replaceAll("\\.", "").replaceAll("m", "00000")
  1619. .replaceAll("k", "00").replaceAll(",", "");
  1620. } catch (Exception e) {
  1621. }
  1622. return "0";
  1623. }
  1624.  
  1625. public static class WorldSelect {
  1626. private String MembersMessage = "You need a member's account to log in to this world.";
  1627. private String AlreadyLoggedOnMessage = "Your account has not logged out from its last session.";
  1628. private String SkillWorldMessage = "1500";
  1629. private String LoginLimit = "Login limit exceeded";
  1630. private String ProfileTransferMessage = "You have only just left another world";
  1631. private String OfflineWorldMessage = "Could not connect you to the chosen world";
  1632. private String FullWorld = "This world is full. Please use a different world.";
  1633.  
  1634. public boolean fullWorld(){
  1635. if (isAtLobby()){
  1636. return Widgets.get(906, 252).getText().contains(FullWorld);
  1637. }
  1638. return false;
  1639. }
  1640.  
  1641. public boolean offlineWorld(){
  1642. if (isAtLobby()){
  1643. return Widgets.get(906, 252).getText().contains(OfflineWorldMessage);
  1644. }
  1645. return false;
  1646. }
  1647.  
  1648. public boolean transferingProfile(){
  1649. if (isAtLobby()){
  1650. return Widgets.get(906, 252).getText().contains(ProfileTransferMessage);
  1651. }
  1652. return false;
  1653. }
  1654.  
  1655. public boolean LoginLimieExceeded(){
  1656. if (isAtLobby()){
  1657. return Widgets.get(906, 252).getText().contains(LoginLimit);
  1658. }
  1659. return false;
  1660. }
  1661.  
  1662. public boolean closeLogonErrorMessage(){
  1663. if (isAtLobby() && loginErrorVisible()){
  1664. return Widgets.get(906, 262).click(true);
  1665. }
  1666. return false;
  1667. }
  1668.  
  1669. public boolean ValidateEmailMessageVisible(){
  1670. return Widgets.get(906, 381).validate() && Widgets.get(906, 381).visible();
  1671. }
  1672.  
  1673. public boolean SkipValidateEmailMessage(){
  1674. if (ValidateEmailMessageVisible()){
  1675. Widgets.get(906, 381).click(true);
  1676. return true;
  1677. }
  1678. return false;
  1679. }
  1680.  
  1681. public boolean loginErrorVisible(){
  1682. return isMembersMessageOnScreen() || isAlreadyLoggedOnMessageOnScreen() || isSkillTotalWorldMessageOnScreen() || LoginLimieExceeded() || offlineWorld() || fullWorld();
  1683. }
  1684.  
  1685. public boolean isMembersMessageOnScreen(){
  1686. if (isAtLobby()){
  1687. return Widgets.get(906, 252).getText().contains(MembersMessage);
  1688. }
  1689. return false;
  1690. }
  1691.  
  1692. public boolean isAlreadyLoggedOnMessageOnScreen(){
  1693. if (isAtLobby()){
  1694. return Widgets.get(906, 252).getText().contains(AlreadyLoggedOnMessage);
  1695. }
  1696. return false;
  1697. }
  1698.  
  1699. public boolean isSkillTotalWorldMessageOnScreen(){
  1700. if (isAtLobby()){
  1701. return Widgets.get(906, 252).getText().contains(SkillWorldMessage);
  1702. }
  1703. return false;
  1704. }
  1705.  
  1706. public boolean worldSelectTabSelected(){
  1707. return Widgets.get(906, 28).getTextureId() == 4671;
  1708. }
  1709.  
  1710. public boolean areFavouritWorldsSelected(){
  1711. if (isAtLobby() && !loginErrorVisible() && !isLoggingIn()){
  1712. if (Widgets.get(910, 21).validate() && Widgets.get(910, 21).getChildren().length > 2){
  1713. return Widgets.get(910, 21).getChild(4).validate();
  1714. }
  1715. }
  1716. return false;
  1717. }
  1718.  
  1719. public boolean removeFavouritedWorlds(){
  1720. if (isAtLobby() && !loginErrorVisible() && !isLoggingIn()){
  1721. if (Widgets.get(910, 22).validate() && Widgets.get(910, 22).getChildren().length > 2 && Widgets.get(910, 22).getChild(4).validate()){
  1722. Widgets.get(910, 22).getChild(4).click(true);
  1723. Time.sleep(50, 100);
  1724. }
  1725. if (Widgets.get(910, 21).validate() && Widgets.get(910, 21).getChildren().length > 2 && Widgets.get(910, 21).getChild(4).validate()){
  1726. Widgets.get(910, 21).getChild(4).click(true);
  1727. Time.sleep(50, 100);
  1728. }
  1729. } else {
  1730. return false;
  1731. }
  1732. return true;
  1733. }
  1734.  
  1735. public boolean exitToLobby() {
  1736. WidgetChild closeBn = Widgets.get(548, 159);
  1737. if (closeBn.validate()) {
  1738. closeBn.click(true);
  1739. Time.sleep(Random.nextInt(300, 800));
  1740. WidgetChild lobbyBn = Widgets.get(182, 6);
  1741. if (lobbyBn.validate()) {
  1742. lobbyBn.click(true);
  1743. Time.sleep(Random.nextInt(300, 800));
  1744. }
  1745. }
  1746. return Game.getClientState() == -1 || Game.getClientState() == 7;
  1747. }
  1748.  
  1749. public boolean isWorldMembers(int world){
  1750. int worldID = WorldToID(world);
  1751. if (worldID != -1){
  1752. WidgetChild w = Widgets.get(910,74).getChildren()[worldID];
  1753. return w.getText().endsWith("Members");
  1754. }
  1755. return false;
  1756. }
  1757.  
  1758. public String getWorldActivity(int world){
  1759. int worldID = WorldToID(world);
  1760. if (worldID != -1){
  1761. WidgetChild w = Widgets.get(910,72).getChildren()[worldID];
  1762. return w.getText();
  1763. }
  1764. return "";
  1765. }
  1766.  
  1767. public int getWorldPopulation(int world){
  1768. int worldID = WorldToID(world);
  1769. if (worldID != -1){
  1770. WidgetChild w = Widgets.get(910,71).getChildren()[worldID];
  1771. return Integer.parseInt(w.getText());
  1772. }
  1773. return -1;
  1774. }
  1775.  
  1776.  
  1777. public boolean isLoggedIn(){
  1778. return Game.isLoggedIn();
  1779. }
  1780.  
  1781. public boolean isLoggingIn(){
  1782. return Game.getClientState() == 9 || transferingProfile();
  1783. }
  1784.  
  1785. public boolean isAtLobby(){
  1786. return Game.getClientState() == 7;
  1787. }
  1788.  
  1789. public boolean playGame(){
  1790. WidgetChild playBn = Widgets.get(906, 186);
  1791. playBn.click(true);
  1792. Time.sleep(Random.nextInt(400, 700));
  1793. return Game.getClientState() == 9;
  1794. }
  1795.  
  1796. public boolean showSelectWorldTab(){
  1797. WidgetChild WST = Widgets.get(906, 28);
  1798. WST.click(true);
  1799. Time.sleep(Random.nextInt(100, 300));
  1800. return true;
  1801. }
  1802.  
  1803. public boolean worldOnScreen (int world){
  1804. int worldID = WorldToID(world);
  1805. WidgetChild w = Widgets.get(910,77).getChildren()[worldID];
  1806. Rectangle screen = new Rectangle(70,137,612,297);
  1807. int yP = w.getAbsoluteY();
  1808. Rectangle WorldRect = new Rectangle(150,yP, w.getWidth() - 200, w.getHeight());
  1809. return screen.contains(WorldRect);
  1810. }
  1811.  
  1812. public boolean selectWorld (int world, boolean DragScroll){
  1813. if (isAtLobby() && !loginErrorVisible() && !isLoggingIn()){
  1814. if (areFavouritWorldsSelected()){
  1815. removeFavouritedWorlds();
  1816. }
  1817. int worldID = WorldToID(world);
  1818. if (worldID != -1){
  1819. WidgetChild w = Widgets.get(910,77).getChildren()[worldID];
  1820. WidgetChild s = Widgets.get(910, 86).getChildren()[1];
  1821. int worldPos = w.getRelativeY();
  1822. int worldScrollPos = (int)((worldPos) / 8.4);
  1823. int scrollPos = s.getRelativeY();
  1824. Timer safeTimer = new Timer(30000);
  1825. if (DragScroll){
  1826. if (!worldOnScreen(world)){
  1827. scrollPos = s.getRelativeY();
  1828. int scrollOffset = Random.nextInt(2, s.getHeight() - 3);
  1829. Point StartPt = new Point(Random.nextInt(s.getAbsoluteX() + 2,s.getAbsoluteX() + s.getWidth() - 4), s.getAbsoluteY() + scrollOffset);
  1830. Point EndPoint = new Point(Random.nextInt(s.getAbsoluteX() + 2,s.getAbsoluteX() + s.getWidth() - 4), Widgets.get(910, 86).getAbsoluteY() + worldScrollPos + scrollOffset + Random.nextInt(-4, -1));
  1831. Time.sleep(Random.nextInt(20, 200));
  1832. Mouse.move(StartPt);
  1833. //Mouse.drag(EndPoint.x - StartPt.x, EndPoint.y - StartPt.y);
  1834. Mouse.drag(EndPoint);
  1835. Time.sleep(Random.nextInt(20, 200));
  1836. }
  1837.  
  1838. } else {
  1839. if (worldScrollPos > scrollPos){
  1840. while (!worldOnScreen(world) && scrollPos < 247 && safeTimer.isRunning() && !loginErrorVisible() && !isLoggingIn()) {
  1841. scrollPos = Widgets.get(910, 86).getChildren()[1].getRelativeY();
  1842. Mouse.move((Widgets.get(910, 86).getChildren()[5]).getCentralPoint().x, (Widgets.get(910, 86).getChildren()[5]).getCentralPoint().y, (Widgets.get(910, 86).getChildren()[5]).getWidth()/2, (Widgets.get(910, 86).getChildren()[5]).getHeight()/2);
  1843. Mouse.hold(Random.nextInt(200, 600), true);
  1844. }
  1845. }else {
  1846. while (!worldOnScreen(world) && scrollPos > 16 && safeTimer.isRunning() && !loginErrorVisible() && !isLoggingIn()){
  1847. scrollPos = Widgets.get(910, 86).getChildren()[1].getRelativeY();
  1848. Mouse.move((Widgets.get(910, 86).getChildren()[4]).getCentralPoint().x, (Widgets.get(910, 86).getChildren()[4]).getCentralPoint().y, (Widgets.get(910, 86).getChildren()[4]).getWidth()/2, (Widgets.get(910, 86).getChildren()[4]).getHeight()/2);
  1849. Mouse.hold(Random.nextInt(200, 600), true);
  1850. }
  1851. }
  1852. }
  1853. WidgetChild worldBox = Widgets.get(910, 62);
  1854. w = Widgets.get(910,77).getChildren()[worldID];
  1855. Rectangle screen = worldBox.getBoundingRectangle();
  1856. Point worldPt = new Point(Random.nextInt(100, w.getWidth()/2),(w.getAbsoluteY() + Random.nextInt(1, w.getHeight() - 3)));
  1857. if (screen.contains(worldPt)){
  1858. //Mouse.move(worldPt.x, worldPt.y);
  1859. //Time.sleep(Random.nextInt(300, 500));
  1860. //Mouse.click(true);
  1861. Mouse.click(worldPt, true);
  1862. String currentWorld = Widgets.get(910,11).getText();
  1863. if (currentWorld.endsWith(String.valueOf(world))){
  1864. return true;
  1865. } else {
  1866. return false;
  1867. }
  1868. }else {
  1869. return false;
  1870. }
  1871.  
  1872.  
  1873. } else {
  1874. return false;
  1875. }
  1876. }
  1877. return false;
  1878. }
  1879.  
  1880. public int getCurrentWorld(){
  1881. String currentWorld = Widgets.get(910,11).getText();
  1882. return Integer.parseInt(currentWorld.substring(6));
  1883. }
  1884.  
  1885. public int WorldToID (int world){
  1886. WidgetChild worlds[] = Widgets.get(910, 69).getChildren();
  1887. for (WidgetChild w : worlds){
  1888. if (Integer.decode(w.getText()) == world){
  1889. return w.getIndex();
  1890. }
  1891. }
  1892. return -1;
  1893. }
  1894.  
  1895. public int idToWorld (int id){
  1896. WidgetChild worlds[] = Widgets.get(910, 69).getChildren();
  1897. if (worlds.length > id ){
  1898. return Integer.parseInt(worlds[id].getText());
  1899. } else {
  1900. return -1;
  1901. }
  1902. }
  1903. }
  1904.  
  1905.  
  1906. public class RuniteMinerGUI extends JFrame {
  1907. private static final long serialVersionUID = 1L;
  1908. private boolean uptodate = true;
  1909.  
  1910. @Override
  1911. public void paint(Graphics g) {
  1912. super.paintComponents(g);
  1913. g.drawString("Current Version: " + currentVerstion, 5, 310);
  1914. g.drawString("Latest Version: " + latestVerstion, 130, 310);
  1915. if (uptodate){
  1916. g.setColor(Color.green);
  1917. } else {
  1918. g.setColor(Color.red);
  1919. }
  1920. g.drawString(verstionMessage, 246, 310);
  1921. }
  1922.  
  1923.  
  1924. public RuniteMinerGUI() {
  1925. getVerionInfo();
  1926. initComponents();
  1927. //LoadSettings();
  1928. }
  1929.  
  1930. private void thisWindowClosing(WindowEvent e) {
  1931. gui.dispose();
  1932. }
  1933.  
  1934. private void CbRuniteOreStateChanged(ChangeEvent e) {
  1935. mineRunite = CbRuniteOre.isSelected();
  1936. }
  1937.  
  1938. private void CbAddOreStateChanged(ChangeEvent e) {
  1939. mineAdd = CbAddOre.isSelected();
  1940. }
  1941.  
  1942. private void CbMithOreStateChanged(ChangeEvent e) {
  1943. mineMith = CbMithOre.isSelected();
  1944. }
  1945.  
  1946. private void CbMemWorldStateChanged(ChangeEvent e) {
  1947. memb = CbMemWorld.isSelected();
  1948. }
  1949.  
  1950. private void CbHighRiskWorldStateChanged(ChangeEvent e) {
  1951. highRisk = CbHighRiskWorld.isSelected();
  1952. }
  1953.  
  1954. private void CbWorldHopStateChanged(ChangeEvent e) {
  1955. worldHop = !CbWorldHop.isSelected();
  1956. }
  1957.  
  1958. private void CbSkillWorldsStateChanged(ChangeEvent e) {
  1959. skillWorlds = CbSkillWorlds.isSelected();
  1960. }
  1961.  
  1962. private void thisMouseClicked(MouseEvent e) {
  1963. if (e.getY() >= 230){
  1964. openUrl("http://www.powerbot.org/community/topic/679105-runite-miner-world-hops-banks-resource-dungeon/");
  1965.  
  1966. }
  1967. }
  1968.  
  1969. private void CbPoliteModeStateChanged(ChangeEvent e) {
  1970. politeMode = CbPoliteMode.isSelected();
  1971. }
  1972.  
  1973. private void CbClickLessItemStateChanged(ItemEvent e) {
  1974. clickLess = CbClickLess.isSelected();
  1975. }
  1976.  
  1977. private void CbFreeWorldItemStateChanged(ItemEvent e) {
  1978. useFreeWorlds = CbFreeWorld.isSelected();
  1979. }
  1980.  
  1981. private void cbRockPredictionStateChanged(ChangeEvent e) {
  1982. rockPrediction = cbRockPrediction.isSelected();
  1983. }
  1984.  
  1985. private void cbCutGemsStateChanged(ChangeEvent e) {
  1986. cutGems = cbCutGems.isSelected();
  1987. }
  1988.  
  1989. private void cbTopGemDropItemStateChanged(ItemEvent e) {
  1990. if (cbTopGemDrop.getSelectedItem().toString() == "Sapphire"){
  1991. topGemToDrop = Gems.SAPPHIRE.getRank();
  1992. } else if (cbTopGemDrop.getSelectedItem().toString() == "Emerald"){
  1993. topGemToDrop = Gems.EMERALD.getRank();
  1994. } else if (cbTopGemDrop.getSelectedItem().toString() == "Ruby"){
  1995. topGemToDrop = Gems.RUBY.getRank();
  1996. } else if (cbTopGemDrop.getSelectedItem().toString() == "Diamond"){
  1997. topGemToDrop = Gems.DIAMOND.getRank();
  1998. } else if (cbTopGemDrop.getSelectedItem().toString() == "Dragonstone"){
  1999. topGemToDrop = Gems.DRAGONSTONE.getRank();
  2000. } else if (cbTopGemDrop.getSelectedItem().toString() == "Onyx"){
  2001. topGemToDrop = Gems.ONYX.getRank();
  2002. } else if (cbTopGemDrop.getSelectedItem().toString() == "Top gem to drop"){
  2003. topGemToDrop = 0;
  2004. }
  2005. }
  2006.  
  2007. private void BnStartMouseClicked(MouseEvent e) {
  2008. //SaveSettings();
  2009. pin[0] = (Integer) SPin1.getValue();
  2010. pin[1] = (Integer) SPin2.getValue();
  2011. pin[2] = (Integer) SPin3.getValue();
  2012. pin[3] = (Integer) SPin4.getValue();
  2013. startTime = System.currentTimeMillis();
  2014. runPerCent = Random.nextInt(60, 80);
  2015. final MineRicks minerocks = new MineRicks();
  2016. final LobbyDetection lobbydetection = new LobbyDetection();
  2017. final SwitchWorld switchworld = new SwitchWorld();
  2018. final MembDetection membdetection = new MembDetection();
  2019. final HightRiskWorld highriskworld = new HightRiskWorld();
  2020. final LeaveDung leavedung = new LeaveDung();
  2021. final LeaveMine leaveMine = new LeaveMine();
  2022. final WalkToBank walktobank = new WalkToBank();
  2023. final UseBank usebank = new UseBank();
  2024. final WalkToMine walktomine = new WalkToMine();
  2025. final EnterMine entermine = new EnterMine();
  2026. final EnterDung enterdung = new EnterDung();
  2027. final Antiban antiban = new Antiban();
  2028. final ActivateRun activaterun = new ActivateRun();
  2029. final CamerSetPitch camerasetpitch = new CamerSetPitch();
  2030. final Resting resting = new Resting();
  2031. final CloseLoginError closeloginerror = new CloseLoginError();
  2032. final InventorySelect inventoryselect = new InventorySelect();
  2033. final RunIntoMine runintomine = new RunIntoMine();
  2034. final ClearLastClickTile clearlastclicktile = new ClearLastClickTile();
  2035. final CloseMayMadness closemaymadness = new CloseMayMadness();
  2036. final MouseHover mousehover = new MouseHover();
  2037. final enterBankPin enterbankpin = new enterBankPin();
  2038. final RockChanged rockchanged = new RockChanged();
  2039. final UpdateWorldPop updateworldpop = new UpdateWorldPop();
  2040. final CutGems cutgems = new CutGems();
  2041. final DropGems dropgems = new DropGems();
  2042.  
  2043. final Strategy MineRocksStrategy = new Strategy(minerocks,minerocks);
  2044. final Strategy LobbyDetectionStrategy = new Strategy(lobbydetection,lobbydetection);
  2045. final Strategy SwitchWorldStrategy = new Strategy(switchworld,switchworld);
  2046. final Strategy MembDetectionStrategy = new Strategy(membdetection,membdetection);
  2047. final Strategy HighRiskWorldStrategy = new Strategy(highriskworld,highriskworld);
  2048. final Strategy LeaveDungStrategy = new Strategy(leavedung,leavedung);
  2049. final Strategy LeaveMineStrategy = new Strategy(leaveMine,leaveMine);
  2050. final Strategy WalkToBankStrategy = new Strategy(walktobank,walktobank);
  2051. final Strategy UseBankStrategy = new Strategy(usebank,usebank);
  2052. final Strategy WalkToMineStrategy = new Strategy(walktomine,walktomine);
  2053. final Strategy EnterMineStrategy = new Strategy(entermine,entermine);
  2054. final Strategy EnterDungStrategy = new Strategy(enterdung,enterdung);
  2055. final Strategy AntibanStrategy = new Strategy(antiban,antiban);
  2056. final Strategy ActivateRunStrategy = new Strategy(activaterun,activaterun);
  2057. final Strategy CameraSetPitchStrategy = new Strategy(camerasetpitch,camerasetpitch);
  2058. final Strategy RestingStrategy = new Strategy(resting,resting);
  2059. final Strategy CloseLoginErrorStrategy = new Strategy(closeloginerror,closeloginerror);
  2060. final Strategy InventorySelectStrategy = new Strategy(inventoryselect,inventoryselect);
  2061. final Strategy RunIntoMineStrategy = new Strategy (runintomine,runintomine);
  2062. final Strategy ClearLastClickTileStrategy = new Strategy(clearlastclicktile,clearlastclicktile);
  2063. final Strategy CloseMayMadnessStrategy = new Strategy(closemaymadness,closemaymadness);
  2064. final Strategy MouseHoverStrategy = new Strategy(mousehover,mousehover);
  2065. final Strategy EnterBankPinStrategy = new Strategy(enterbankpin,enterbankpin);
  2066. final Strategy RockChangedStrategy = new Strategy(rockchanged,rockchanged);
  2067. final Strategy UpdateWorldPopStrategy = new Strategy(updateworldpop,updateworldpop);
  2068. final Strategy CutGemsStrategy = new Strategy(cutgems,cutgems);
  2069. final Strategy DropGemsStrategy = new Strategy(dropgems,dropgems);
  2070.  
  2071. provide(CutGemsStrategy);
  2072. provide(DropGemsStrategy);
  2073. provide(UpdateWorldPopStrategy);
  2074. provide(EnterBankPinStrategy);
  2075. provide(RockChangedStrategy);
  2076. provide(CloseMayMadnessStrategy);
  2077. provide(ClearLastClickTileStrategy);
  2078. provide(RunIntoMineStrategy);
  2079. provide(InventorySelectStrategy);
  2080. provide(CloseLoginErrorStrategy);
  2081. provide(RestingStrategy);
  2082.  
  2083. provide(ActivateRunStrategy);
  2084. provide(AntibanStrategy);
  2085. provide(EnterDungStrategy);
  2086. provide(EnterMineStrategy);
  2087. provide(WalkToMineStrategy);
  2088. provide(UseBankStrategy);
  2089. provide(WalkToBankStrategy);
  2090. provide(LeaveMineStrategy);
  2091. provide(LeaveDungStrategy);
  2092. provide(HighRiskWorldStrategy);
  2093. provide(MembDetectionStrategy);
  2094. provide(LobbyDetectionStrategy);
  2095. provide(SwitchWorldStrategy);
  2096. provide(MineRocksStrategy);
  2097. provide(MouseHoverStrategy);
  2098. provide(CameraSetPitchStrategy);
  2099. gui.setVisible(false);
  2100. gui.dispose();
  2101. }
  2102.  
  2103. private void SaveSettings(){
  2104. Properties propOut = new Properties();
  2105. File file = new File("./RuneMiner.Settings");
  2106. if(file.exists()) {
  2107. file.delete();
  2108. }
  2109. FileOutputStream fos;
  2110. try {
  2111. fos = new FileOutputStream("./RuneMiner.Settings");
  2112. propOut.setProperty("runite", ""+CbRuniteOre.isSelected());
  2113. propOut.setProperty("addy", ""+CbAddOre.isSelected());
  2114. propOut.setProperty("mith", ""+CbMithOre.isSelected());
  2115. propOut.setProperty("free", ""+CbFreeWorld.isSelected());
  2116. propOut.setProperty("risk", ""+CbHighRiskWorld.isSelected());
  2117. propOut.setProperty("total", ""+CbSkillWorlds.isSelected());
  2118. propOut.setProperty("hop", ""+CbWorldHop.isSelected());
  2119. propOut.setProperty("polite", ""+CbPoliteMode.isSelected());
  2120. propOut.setProperty("less", ""+CbClickLess.isSelected());
  2121. propOut.store(fos, "RuniteMiner");
  2122. } catch (FileNotFoundException e1) {
  2123. } catch (IOException e) {
  2124. }
  2125.  
  2126.  
  2127. }
  2128.  
  2129. private void LoadSettings(){
  2130. Properties propIn = new Properties();
  2131. FileInputStream fis;
  2132. try {
  2133. fis = new FileInputStream("./RuneMiner.Settings");
  2134. propIn.load(fis);
  2135. CbRuniteOre.setSelected(Boolean.parseBoolean(propIn.getProperty("runite")));
  2136. CbAddOre.setSelected(Boolean.parseBoolean(propIn.getProperty("addy")));
  2137. CbMithOre.setSelected(Boolean.parseBoolean(propIn.getProperty("mith")));
  2138. CbFreeWorld.setSelected(Boolean.parseBoolean(propIn.getProperty("free")));
  2139. CbHighRiskWorld.setSelected(Boolean.parseBoolean(propIn.getProperty("risk")));
  2140. CbSkillWorlds.setSelected(Boolean.parseBoolean(propIn.getProperty("total")));
  2141. CbWorldHop.setSelected(Boolean.parseBoolean(propIn.getProperty("hop")));
  2142. CbPoliteMode.setSelected(Boolean.parseBoolean(propIn.getProperty("polite")));
  2143. CbClickLess.setSelected(Boolean.parseBoolean(propIn.getProperty("less")));
  2144. fis.close();
  2145. } catch (FileNotFoundException e) {
  2146. } catch (IOException e) {
  2147. }
  2148.  
  2149. }
  2150.  
  2151. private void openUrl(String url) {
  2152. URI uri = null;
  2153. try {
  2154. uri = new URI(url);
  2155. } catch (URISyntaxException e) {
  2156. e.printStackTrace();
  2157. }
  2158. if (Desktop.isDesktopSupported()) {
  2159. try {
  2160. Desktop.getDesktop().browse(uri);
  2161. } catch (IOException e) { log.info(e.getMessage()); }
  2162. } else { log.info("Hyperlink error");}
  2163. }
  2164.  
  2165.  
  2166. private void getVerionInfo(){
  2167. try {
  2168. final URL url = new URL(
  2169. "http://hogrog.webatu.com/index.html");
  2170. final BufferedReader in = new BufferedReader(new InputStreamReader(
  2171. url.openStream()));
  2172.  
  2173. String input;
  2174. input = in.readLine();
  2175.  
  2176. try
  2177. {
  2178. float v = Float.valueOf(input.trim()).floatValue();
  2179. latestVerstion = v;
  2180. if (currentVerstion == latestVerstion){
  2181. verstionMessage = "Script Up To Date";
  2182. uptodate = true;
  2183. } else {
  2184. verstionMessage = "Update available CLICK HERE";
  2185. uptodate = false;
  2186. }
  2187.  
  2188. }
  2189. catch (NumberFormatException nfe)
  2190. {
  2191. verstionMessage = "Version data unavailable";
  2192. uptodate = false;
  2193. }
  2194.  
  2195.  
  2196. } catch (Exception e) {
  2197. verstionMessage = "Version data unavailable";
  2198. uptodate = false;
  2199. }
  2200. }
  2201.  
  2202. private void initComponents() {
  2203. panel3 = new JPanel();
  2204. CbRuniteOre = new JCheckBox();
  2205. CbAddOre = new JCheckBox();
  2206. CbMithOre = new JCheckBox();
  2207. panel4 = new JPanel();
  2208. CbFreeWorld = new JCheckBox();
  2209. CbMemWorld = new JCheckBox();
  2210. CbHighRiskWorld = new JCheckBox();
  2211. CbSkillWorlds = new JCheckBox();
  2212. CbWorldHop = new JCheckBox();
  2213. CbPoliteMode = new JCheckBox();
  2214. CbClickLess = new JCheckBox();
  2215. cbRockPrediction = new JCheckBox();
  2216. BnStart = new JButton();
  2217. panel5 = new JPanel();
  2218. SPin1 = new JSpinner();
  2219. SPin2 = new JSpinner();
  2220. SPin3 = new JSpinner();
  2221. SPin4 = new JSpinner();
  2222. panel1 = new JPanel();
  2223. cbCutGems = new JCheckBox();
  2224. cbTopGemDrop = new JComboBox();
  2225.  
  2226. //======== this ========
  2227. setTitle("Runite Miner GUI");
  2228. setResizable(false);
  2229. setAlwaysOnTop(true);
  2230. addWindowListener(new WindowAdapter() {
  2231. @Override
  2232. public void windowClosing(WindowEvent e) {
  2233. thisWindowClosing(e);
  2234. }
  2235. });
  2236. addMouseListener(new MouseAdapter() {
  2237. @Override
  2238. public void mouseClicked(MouseEvent e) {
  2239. thisMouseClicked(e);
  2240. }
  2241. });
  2242. Container contentPane = getContentPane();
  2243. contentPane.setLayout(null);
  2244.  
  2245. //======== panel3 ========
  2246. {
  2247. panel3.setBorder(new TitledBorder("Select Rocks To Mine"));
  2248.  
  2249. // JFormDesigner evaluation mark
  2250. panel3.setBorder(new javax.swing.border.CompoundBorder(
  2251. new javax.swing.border.TitledBorder(new javax.swing.border.EmptyBorder(0, 0, 0, 0),
  2252. "", javax.swing.border.TitledBorder.CENTER,
  2253. javax.swing.border.TitledBorder.BOTTOM, new java.awt.Font("Dialog", java.awt.Font.BOLD, 12),
  2254. java.awt.Color.red), panel3.getBorder())); panel3.addPropertyChangeListener(new java.beans.PropertyChangeListener(){public void propertyChange(java.beans.PropertyChangeEvent e){if("border".equals(e.getPropertyName()))throw new RuntimeException();}});
  2255.  
  2256. panel3.setLayout(null);
  2257.  
  2258. //---- CbRuniteOre ----
  2259. CbRuniteOre.setText("Runite");
  2260. CbRuniteOre.setSelected(true);
  2261. CbRuniteOre.addChangeListener(new ChangeListener() {
  2262. @Override
  2263. public void stateChanged(ChangeEvent e) {
  2264. CbRuniteOreStateChanged(e);
  2265. }
  2266. });
  2267. panel3.add(CbRuniteOre);
  2268. CbRuniteOre.setBounds(6, 20, 133, CbRuniteOre.getPreferredSize().height);
  2269.  
  2270. //---- CbAddOre ----
  2271. CbAddOre.setText("Adamant");
  2272. CbAddOre.addChangeListener(new ChangeListener() {
  2273. @Override
  2274. public void stateChanged(ChangeEvent e) {
  2275. CbAddOreStateChanged(e);
  2276. }
  2277. });
  2278. panel3.add(CbAddOre);
  2279. CbAddOre.setBounds(6, 43, 133, CbAddOre.getPreferredSize().height);
  2280.  
  2281. //---- CbMithOre ----
  2282. CbMithOre.setText("Mithril");
  2283. CbMithOre.addChangeListener(new ChangeListener() {
  2284. @Override
  2285. public void stateChanged(ChangeEvent e) {
  2286. CbMithOreStateChanged(e);
  2287. }
  2288. });
  2289. panel3.add(CbMithOre);
  2290. CbMithOre.setBounds(6, 66, 133, CbMithOre.getPreferredSize().height);
  2291.  
  2292. { // compute preferred size
  2293. Dimension preferredSize = new Dimension();
  2294. for(int i = 0; i < panel3.getComponentCount(); i++) {
  2295. Rectangle bounds = panel3.getComponent(i).getBounds();
  2296. preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
  2297. preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
  2298. }
  2299. Insets insets = panel3.getInsets();
  2300. preferredSize.width += insets.right;
  2301. preferredSize.height += insets.bottom;
  2302. panel3.setMinimumSize(preferredSize);
  2303. panel3.setPreferredSize(preferredSize);
  2304. }
  2305. }
  2306. contentPane.add(panel3);
  2307. panel3.setBounds(200, 10, 175, 105);
  2308.  
  2309. //======== panel4 ========
  2310. {
  2311. panel4.setLayout(null);
  2312.  
  2313. //---- CbFreeWorld ----
  2314. CbFreeWorld.setText("Use Free Worlds");
  2315. CbFreeWorld.setToolTipText("Check this option to use non members worlds.");
  2316. CbFreeWorld.setSelected(true);
  2317. CbFreeWorld.addItemListener(new ItemListener() {
  2318. @Override
  2319. public void itemStateChanged(ItemEvent e) {
  2320. CbFreeWorldItemStateChanged(e);
  2321. }
  2322. });
  2323. panel4.add(CbFreeWorld);
  2324. CbFreeWorld.setBounds(0, 0, 170, CbFreeWorld.getPreferredSize().height);
  2325.  
  2326. //---- CbMemWorld ----
  2327. CbMemWorld.setText("Use Members Worlds");
  2328. CbMemWorld.setToolTipText("If this is checked the bot will try to login to members servers");
  2329. CbMemWorld.addChangeListener(new ChangeListener() {
  2330. @Override
  2331. public void stateChanged(ChangeEvent e) {
  2332. CbMemWorldStateChanged(e);
  2333. }
  2334. });
  2335. panel4.add(CbMemWorld);
  2336. CbMemWorld.setBounds(0, 23, 170, CbMemWorld.getPreferredSize().height);
  2337.  
  2338. //---- CbHighRiskWorld ----
  2339. CbHighRiskWorld.setText("Use High Risk Worlds");
  2340. CbHighRiskWorld.setToolTipText("If this option is checked the bot will login to high ridk wilderness worlds");
  2341. CbHighRiskWorld.addChangeListener(new ChangeListener() {
  2342. @Override
  2343. public void stateChanged(ChangeEvent e) {
  2344. CbHighRiskWorldStateChanged(e);
  2345. }
  2346. });
  2347. panel4.add(CbHighRiskWorld);
  2348. CbHighRiskWorld.setBounds(0, 46, 170, CbHighRiskWorld.getPreferredSize().height);
  2349.  
  2350. //---- CbSkillWorlds ----
  2351. CbSkillWorlds.setText("Use Skill Worlds");
  2352. CbSkillWorlds.setToolTipText("Check this if you have a level over 1500 and the script will use the skill worlds");
  2353. CbSkillWorlds.addChangeListener(new ChangeListener() {
  2354. @Override
  2355. public void stateChanged(ChangeEvent e) {
  2356. CbSkillWorldsStateChanged(e);
  2357. }
  2358. });
  2359. panel4.add(CbSkillWorlds);
  2360. CbSkillWorlds.setBounds(0, 69, 170, CbSkillWorlds.getPreferredSize().height);
  2361.  
  2362. //---- CbWorldHop ----
  2363. CbWorldHop.setText("Don't World Hop");
  2364. CbWorldHop.setToolTipText("Check this if you only want to mine in one world");
  2365. CbWorldHop.addChangeListener(new ChangeListener() {
  2366. @Override
  2367. public void stateChanged(ChangeEvent e) {
  2368. CbWorldHopStateChanged(e);
  2369. }
  2370. });
  2371. panel4.add(CbWorldHop);
  2372. CbWorldHop.setBounds(0, 92, 170, CbWorldHop.getPreferredSize().height);
  2373.  
  2374. //---- CbPoliteMode ----
  2375. CbPoliteMode.setText("Polite Mode");
  2376. CbPoliteMode.setToolTipText("The bot will avoid stealing rocks where posible");
  2377. CbPoliteMode.setSelected(true);
  2378. CbPoliteMode.addChangeListener(new ChangeListener() {
  2379. @Override
  2380. public void stateChanged(ChangeEvent e) {
  2381. CbPoliteModeStateChanged(e);
  2382. }
  2383. });
  2384. panel4.add(CbPoliteMode);
  2385. CbPoliteMode.setBounds(0, 115, 170, CbPoliteMode.getPreferredSize().height);
  2386.  
  2387. //---- CbClickLess ----
  2388. CbClickLess.setText("Click Less");
  2389. CbClickLess.setToolTipText("Reduces rock detection sensetivity");
  2390. CbClickLess.addItemListener(new ItemListener() {
  2391. @Override
  2392. public void itemStateChanged(ItemEvent e) {
  2393. CbClickLessItemStateChanged(e);
  2394. }
  2395. });
  2396. panel4.add(CbClickLess);
  2397. CbClickLess.setBounds(0, 138, 170, CbClickLess.getPreferredSize().height);
  2398.  
  2399. //---- cbRockPrediction ----
  2400. cbRockPrediction.setText("Next Rock Prediction");
  2401. cbRockPrediction.setToolTipText("When no rocks are availible it will run to the next rock to respawn");
  2402. cbRockPrediction.addChangeListener(new ChangeListener() {
  2403. @Override
  2404. public void stateChanged(ChangeEvent e) {
  2405. cbRockPredictionStateChanged(e);
  2406. }
  2407. });
  2408. panel4.add(cbRockPrediction);
  2409. cbRockPrediction.setBounds(0, 161, 170, CbClickLess.getPreferredSize().height);
  2410.  
  2411. //---- BnStart ----
  2412. BnStart.setText("Start");
  2413. BnStart.setToolTipText("Start the bot");
  2414. BnStart.addMouseListener(new MouseAdapter() {
  2415. @Override
  2416. public void mouseClicked(MouseEvent e) {
  2417. BnStartMouseClicked(e);
  2418. BnStartMouseClicked(e);
  2419. }
  2420. });
  2421. panel4.add(BnStart);
  2422. BnStart.setBounds(0, 184, 170, BnStart.getPreferredSize().height);
  2423.  
  2424. { // compute preferred size
  2425. Dimension preferredSize = new Dimension();
  2426. for(int i = 0; i < panel4.getComponentCount(); i++) {
  2427. Rectangle bounds = panel4.getComponent(i).getBounds();
  2428. preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
  2429. preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
  2430. }
  2431. Insets insets = panel4.getInsets();
  2432. preferredSize.width += insets.right;
  2433. preferredSize.height += insets.bottom;
  2434. panel4.setMinimumSize(preferredSize);
  2435. panel4.setPreferredSize(preferredSize);
  2436. }
  2437. }
  2438. contentPane.add(panel4);
  2439. panel4.setBounds(15, 10, 170, 220);
  2440.  
  2441. //======== panel5 ========
  2442. {
  2443. panel5.setBorder(new TitledBorder("Bank Pin"));
  2444. panel5.setToolTipText("Set to -1 for no pin");
  2445. panel5.setLayout(null);
  2446.  
  2447. //---- SPin1 ----
  2448. SPin1.setModel(new SpinnerNumberModel(-1, -1, 9, 1));
  2449. SPin1.setToolTipText("Pin digit 1 (-1 = no pin)");
  2450. panel5.add(SPin1);
  2451. SPin1.setBounds(10, 20, 35, SPin1.getPreferredSize().height);
  2452.  
  2453. //---- SPin2 ----
  2454. SPin2.setModel(new SpinnerNumberModel(-1, -1, 9, 1));
  2455. SPin2.setToolTipText("Pin digit 2 (-1 = no pin)");
  2456. panel5.add(SPin2);
  2457. SPin2.setBounds(50, 20, 35, 20);
  2458.  
  2459. //---- SPin3 ----
  2460. SPin3.setModel(new SpinnerNumberModel(-1, -1, 9, 1));
  2461. SPin3.setToolTipText("Pin digit 3 (-1 = no pin)");
  2462. panel5.add(SPin3);
  2463. SPin3.setBounds(90, 20, 35, 20);
  2464.  
  2465. //---- SPin4 ----
  2466. SPin4.setModel(new SpinnerNumberModel(-1, -1, 9, 1));
  2467. SPin4.setToolTipText("Pin digit 4 (-1 = no pin)");
  2468. panel5.add(SPin4);
  2469. SPin4.setBounds(130, 20, 35, 20);
  2470.  
  2471. { // compute preferred size
  2472. Dimension preferredSize = new Dimension();
  2473. for(int i = 0; i < panel5.getComponentCount(); i++) {
  2474. Rectangle bounds = panel5.getComponent(i).getBounds();
  2475. preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
  2476. preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
  2477. }
  2478. Insets insets = panel5.getInsets();
  2479. preferredSize.width += insets.right;
  2480. preferredSize.height += insets.bottom;
  2481. panel5.setMinimumSize(preferredSize);
  2482. panel5.setPreferredSize(preferredSize);
  2483. }
  2484. }
  2485. contentPane.add(panel5);
  2486. panel5.setBounds(200, 120, 175, 60);
  2487.  
  2488.  
  2489. //======== panel1 ========
  2490. {
  2491. panel1.setBorder(new TitledBorder("Gems"));
  2492. panel1.setLayout(null);
  2493.  
  2494. //---- cbCutGems ----
  2495. cbCutGems.setText("Cut Gems");
  2496. cbCutGems.setToolTipText("Cut gems in you inventory");
  2497. cbCutGems.addChangeListener(new ChangeListener() {
  2498. @Override
  2499. public void stateChanged(ChangeEvent e) {
  2500. cbCutGemsStateChanged(e);
  2501. }
  2502. });
  2503. panel1.add(cbCutGems);
  2504. cbCutGems.setBounds(15, 20, 135, cbCutGems.getPreferredSize().height);
  2505.  
  2506. //---- cbTopGemDrop ----
  2507. cbTopGemDrop.setToolTipText("Drop gems upto and including the selected gem");
  2508. cbTopGemDrop.setModel(new DefaultComboBoxModel(new String[] {
  2509. "Top gem to drop",
  2510. "Sapphire",
  2511. "Emerald",
  2512. "Ruby",
  2513. "Diamond",
  2514. "Dragonstone",
  2515. "Onyx"
  2516. }));
  2517. cbTopGemDrop.addItemListener(new ItemListener() {
  2518. @Override
  2519. public void itemStateChanged(ItemEvent e) {
  2520. cbTopGemDropItemStateChanged(e);
  2521. }
  2522. });
  2523. panel1.add(cbTopGemDrop);
  2524. cbTopGemDrop.setBounds(15, 45, 125, cbTopGemDrop.getPreferredSize().height);
  2525.  
  2526. { // compute preferred size
  2527. Dimension preferredSize = new Dimension();
  2528. for(int i = 0; i < panel1.getComponentCount(); i++) {
  2529. Rectangle bounds = panel1.getComponent(i).getBounds();
  2530. preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
  2531. preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
  2532. }
  2533. Insets insets = panel1.getInsets();
  2534. preferredSize.width += insets.right;
  2535. preferredSize.height += insets.bottom;
  2536. panel1.setMinimumSize(preferredSize);
  2537. panel1.setPreferredSize(preferredSize);
  2538. }
  2539. }
  2540. contentPane.add(panel1);
  2541. panel1.setBounds(205, 185, 165, 80);
  2542.  
  2543.  
  2544. { // compute preferred size
  2545. Dimension preferredSize = new Dimension();
  2546. for(int i = 0; i < contentPane.getComponentCount(); i++) {
  2547. Rectangle bounds = contentPane.getComponent(i).getBounds();
  2548. preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
  2549. preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
  2550. }
  2551. Insets insets = contentPane.getInsets();
  2552. preferredSize.width += insets.right;
  2553. preferredSize.height += insets.bottom;
  2554. Dimension d = new Dimension(415,310);
  2555. contentPane.setMinimumSize(d);
  2556. contentPane.setPreferredSize(d);
  2557. }
  2558. pack();
  2559. setLocationRelativeTo(getOwner());
  2560. }
  2561.  
  2562. private JPanel panel3;
  2563. private JCheckBox CbRuniteOre;
  2564. private JCheckBox CbAddOre;
  2565. private JCheckBox CbMithOre;
  2566. private JPanel panel4;
  2567. private JCheckBox CbFreeWorld;
  2568. private JCheckBox CbMemWorld;
  2569. private JCheckBox CbHighRiskWorld;
  2570. private JCheckBox CbSkillWorlds;
  2571. private JCheckBox CbWorldHop;
  2572. private JCheckBox CbPoliteMode;
  2573. private JCheckBox CbClickLess;
  2574. private JCheckBox cbRockPrediction;
  2575. private JButton BnStart;
  2576. private JPanel panel5;
  2577. private JSpinner SPin1;
  2578. private JSpinner SPin2;
  2579. private JSpinner SPin3;
  2580. private JSpinner SPin4;
  2581. private JPanel panel1;
  2582. private JCheckBox cbCutGems;
  2583. private JComboBox cbTopGemDrop;
  2584. }
  2585.  
  2586. public enum Rock {
  2587. RUNE,
  2588. ADDY,
  2589. MITH;
  2590. }
  2591.  
  2592. public enum Gem {
  2593. SAPPHIRE,
  2594. EMERALD,
  2595. RUBY,
  2596. DIAMOND,
  2597. DRAGONSTONE,
  2598. ONYX;
  2599. }
  2600.  
  2601. public enum Rocks {
  2602. MITH1(Rock.MITH, new Tile(1049,4520,0), 32439, 33401),
  2603. MITH2(Rock.MITH, new Tile(1061,4515,0), 32440, 33402),
  2604. MITH3(Rock.MITH, new Tile(1061,4513,0), 32440, 33402),
  2605. MITH4(Rock.MITH, new Tile(1061,4511,0), 32439, 33401),
  2606. MITH5(Rock.MITH, new Tile(1059,4510,0), 32438, 33400),
  2607. MITH6(Rock.MITH, new Tile(1058,4511,0), 32440, 33402),
  2608. MITH7(Rock.MITH, new Tile(1057,4511,0), 32439, 33401),
  2609. MITH8(Rock.MITH, new Tile(1058,4514,0), 32439, 33401),
  2610.  
  2611. ADDY1(Rock.ADDY, new Tile(1050,4514,0), 32437, 33402),
  2612. ADDY2(Rock.ADDY, new Tile(1049,4513,0), 32436, 33401),
  2613. ADDY3(Rock.ADDY, new Tile(1051,4512,0), 32437, 33402),
  2614. ADDY4(Rock.ADDY, new Tile(1051,4510,0), 32435, 33400),
  2615.  
  2616. RUNE1(Rock.RUNE, new Tile(1051,4516,0), 33078, 33400),
  2617. RUNE2(Rock.RUNE, new Tile(1060,4516,0), 33078, 33400),
  2618. RUNE3(Rock.RUNE, new Tile(1052,4510,0), 33079, 33401)
  2619. ;
  2620.  
  2621. private Rocks(Rock type, Tile location, int upID, int downID) {
  2622.  
  2623. this.type = type;
  2624. this.location = location;
  2625. this.upID = upID;
  2626. this.downID = downID;
  2627. }
  2628.  
  2629. private final Rock type;
  2630. private final Tile location;
  2631. private final int upID;
  2632. private final int downID;
  2633.  
  2634. public Rock getType() {
  2635.  
  2636. return type;
  2637. }
  2638.  
  2639. public Tile getLocation() {
  2640.  
  2641. return location;
  2642. }
  2643.  
  2644. public int getUpID() {
  2645.  
  2646. return upID;
  2647. }
  2648.  
  2649. public int getDownID() {
  2650.  
  2651. return downID;
  2652. }
  2653. }
  2654.  
  2655. public enum Gems {
  2656.  
  2657. SAPPHIRE(Gem.SAPPHIRE, 1623, 20, 1, 1607),
  2658. EMERALD(Gem.EMERALD, 1621, 27, 2, 1605),
  2659. RUBY(Gem.RUBY, 1619, 34, 3, 1603),
  2660. DIAMOND(Gem.DIAMOND, 1617, 43, 4, 1601),
  2661. DRAGONSTONE(Gem.DRAGONSTONE, 1631, 55, 5, 1615),
  2662. ONYX(Gem.ONYX, 6571, 67, 6, 6573)
  2663. ;
  2664.  
  2665. private Gems(Gem type, int ID, int LVL, int rank, int cutID) {
  2666. this.cutID = cutID;
  2667. this.type = type;
  2668. this.ID = ID;
  2669. this.LVL = LVL;
  2670. this.rank = rank;
  2671. }
  2672.  
  2673. private final int[] allIDs = {1623,1621, 1619,1617,1631,6571};
  2674. private final int[] allCutIDs = {1607, 1605, 1603, 1601, 1615, 6573};
  2675. private final Gem type;
  2676. private final int ID;
  2677. private final int LVL;
  2678. private final int rank;
  2679. private final int cutID;
  2680.  
  2681. public int[] getAllCutIDs(){
  2682. return allCutIDs;
  2683. }
  2684. public int[] getAllIDs(){
  2685. return allIDs;
  2686. }
  2687. public int getRank(){
  2688. return rank;
  2689. }
  2690. public int getCutID(){
  2691. return cutID;
  2692. }
  2693. public Gem getType() {
  2694. return type;
  2695. }
  2696.  
  2697. public int getID() {
  2698. return ID;
  2699. }
  2700.  
  2701. public int getLVL(){
  2702. return LVL;
  2703. }
  2704. }
  2705.  
  2706. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement