BrownBirdScripts

BBgoldMiner v0.2 BETA

May 1st, 2012
329
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.15 KB | None | 0 0
  1. import java.awt.Color;
  2. import java.awt.Graphics;
  3. import java.awt.Point;
  4. import java.awt.Polygon;
  5. import java.awt.Rectangle;
  6.  
  7. import org.powerbot.concurrent.Task;
  8. import org.powerbot.concurrent.strategy.Condition;
  9. import org.powerbot.concurrent.strategy.Strategy;
  10. import org.powerbot.game.api.ActiveScript;
  11. import org.powerbot.game.api.Manifest;
  12. import org.powerbot.game.api.methods.Calculations;
  13. import org.powerbot.game.api.methods.Tabs;
  14. import org.powerbot.game.api.methods.Walking;
  15. import org.powerbot.game.api.methods.Widgets;
  16. import org.powerbot.game.api.methods.input.Mouse;
  17. import org.powerbot.game.api.methods.interactive.Players;
  18. import org.powerbot.game.api.methods.node.Menu;
  19. import org.powerbot.game.api.methods.node.SceneEntities;
  20. import org.powerbot.game.api.methods.tab.Inventory;
  21. import org.powerbot.game.api.methods.tab.Skills;
  22. import org.powerbot.game.api.methods.widget.Camera;
  23. import org.powerbot.game.api.util.Random;
  24. import org.powerbot.game.api.util.Time;
  25. import org.powerbot.game.api.wrappers.Area;
  26. import org.powerbot.game.api.wrappers.Tile;
  27. import org.powerbot.game.api.wrappers.node.SceneObject;
  28. import org.powerbot.game.api.wrappers.widget.WidgetChild;
  29. import org.powerbot.game.bot.event.MessageEvent;
  30. import org.powerbot.game.bot.event.listener.MessageListener;
  31. import org.powerbot.game.bot.event.listener.PaintListener;
  32.  
  33.  
  34. import java.awt.*;
  35. import javax.imageio.ImageIO;
  36. import javax.swing.JFrame;
  37. import javax.swing.JOptionPane;
  38.  
  39. import java.io.IOException;
  40. import java.net.URL;
  41. import java.util.ArrayList;
  42.  
  43.  
  44. /**
  45. * @author BrownBirdScripts
  46. * @version 1.00
  47. * Copyright 2011 - 2012 All Rights Reserved
  48. * ONLY BrownBird may edit this script, no exception.
  49. * Website: www.brownbirdscripts.net78.net
  50. */
  51.  
  52. @Manifest(authors = { "BrownBirdScripts" }, name = "BBgoldMiner", description = "Mines gold ore for money.", version = 1.01, website = "http://www.brownbirdscripts.net78.net", premium = false)
  53. public class BBgoldMiner extends ActiveScript implements PaintListener, MessageListener{
  54.  
  55.  
  56.  
  57. //IDS
  58. final static private int[] goldOreRock = {9720, 9722, 11184, 11183, 11185};
  59. final static private int bank = 11758;
  60. final static private int goldOre = 444;
  61. final static private int craftingDoor = 2647;
  62. final static private int[] pickaxes = { 1265, 1267, 1269, 1271, 1273, 1275};
  63.  
  64. //PAINT
  65. private int startExp = 0;
  66. private int expGained;
  67. public int mined;
  68. public int gems;
  69. String status = "";
  70. public long startTime = 0;
  71. public long millis = 0;
  72. public long hours = 0;
  73. public long minutes = 0;
  74. public long seconds = 0;
  75. public long last = 0;
  76. public int expHour = 0;
  77.  
  78. //TILES
  79. private Tile[] pathToBank = new Tile[] { new Tile(2977, 3238, 0),
  80. new Tile(2978, 3245, 0), new Tile(2978, 3251, 0),
  81. new Tile(2981, 3258, 0), new Tile(2989, 3267, 0),
  82. new Tile(2996, 3275, 0), new Tile(3001, 3279, 0),
  83. new Tile(3005, 3284, 0), new Tile(3006, 3294, 0),
  84. new Tile(3006, 3306, 0), new Tile(3006, 3314, 0),
  85. new Tile(3006, 3321, 0), new Tile(3006, 3327, 0),
  86. new Tile(3007, 3332, 0), new Tile(3007, 3338, 0),
  87. new Tile(3007, 3345, 0), new Tile(3007, 3352, 0),
  88. new Tile(3007, 3359, 0), new Tile(3011, 3356, 0)};
  89. private Tile[] pathToMine = new Tile[] {new Tile(3011, 3356, 0),
  90. new Tile(3007, 3359, 0), new Tile(3007, 3352, 0),
  91. new Tile(3007, 3345, 0), new Tile(3007, 3338, 0),
  92. new Tile(3007, 3332, 0), new Tile(3006, 3327, 0),
  93. new Tile(3006, 3321, 0), new Tile(3006, 3314, 0),
  94. new Tile(3006, 3306, 0), new Tile(3006, 3294, 0),
  95. new Tile(3005, 3284, 0), new Tile(3001, 3279, 0),
  96. new Tile(2996, 3275, 0), new Tile(2989, 3267, 0),
  97. new Tile(2981, 3258, 0), new Tile(2978, 3251, 0),
  98. new Tile(2978, 3245, 0), new Tile(2977, 3238, 0),
  99. new Tile(2976, 3234, 0),};
  100.  
  101. private Tile[] pathToBankCG = new Tile[] { new Tile(2933, 3291, 0), new Tile(2934, 3297, 0),
  102. new Tile(2936, 3303, 0), new Tile(2942, 3304, 0),
  103. new Tile(2947, 3300, 0), new Tile(2952, 3296, 0),
  104. new Tile(2958, 3294, 0), new Tile(2964, 3295, 0),
  105. new Tile(2970, 3292, 0), new Tile(2975, 3288, 0),
  106. new Tile(2981, 3292, 0), new Tile(2982, 3298, 0),
  107. new Tile(2988, 3300, 0), new Tile(2994, 3300, 0),
  108. new Tile(3000, 3300, 0), new Tile(3000, 3306, 0),
  109. new Tile(3002, 3312, 0), new Tile(3004, 3318, 0),
  110. new Tile(3006, 3324, 0), new Tile(3006, 3330, 0),
  111. new Tile(3006, 3336, 0), new Tile(3007, 3342, 0),
  112. new Tile(3006, 3348, 0), new Tile(3006, 3354, 0),
  113. new Tile(3005, 3360, 0), new Tile(3011, 3362, 0),
  114. new Tile(3013, 3356, 0) };
  115. private Tile[] pathToMineCG = new Tile[] {
  116. new Tile(3015, 3355, 0), new Tile(3012, 3361, 0),
  117. new Tile(3006, 3362, 0), new Tile(3005, 3356, 0),
  118. new Tile(3007, 3350, 0), new Tile(3006, 3344, 0),
  119. new Tile(3005, 3338, 0), new Tile(3006, 3332, 0),
  120. new Tile(3006, 3326, 0), new Tile(3006, 3320, 0),
  121. new Tile(3004, 3314, 0), new Tile(2999, 3310, 0),
  122. new Tile(2994, 3305, 0), new Tile(2989, 3300, 0),
  123. new Tile(2984, 3296, 0), new Tile(2980, 3291, 0),
  124. new Tile(2975, 3287, 0), new Tile(2969, 3285, 0),
  125. new Tile(2964, 3289, 0), new Tile(2959, 3293, 0),
  126. new Tile(2954, 3297, 0), new Tile(2948, 3297, 0),
  127. new Tile(2942, 3297, 0), new Tile(2936, 3297, 0),
  128. new Tile(2932, 3292, 0), new Tile(2933, 3290, 0)};
  129. private Tile[] pathToMiningSpotWalk = new Tile[] { new Tile(2936, 3283, 0), new Tile(2940, 3280, 0)};
  130. private Tile[] pathTobankingSpotWalk = new Tile[] { new Tile(2934, 3284, 0)};
  131. private final Area outsideDoor = new Area(new Tile(2930, 3289, 0), new Tile(2936, 3294, 0));
  132. private final Area craftingArea = new Area(new Tile(2929, 3289, 0), new Tile(2936, 3278, 0));
  133. private final Area walkBackAreaCG = new Area(new Tile[] {
  134. new Tile(2932, 3293, 0), new Tile(2938, 3293, 0),
  135. new Tile(2944, 3294, 0), new Tile(2950, 3294, 0),
  136. new Tile(2955, 3290, 0), new Tile(2955, 3284, 0),
  137. new Tile(2960, 3280, 0), new Tile(2966, 3278, 0),
  138. new Tile(2972, 3276, 0), new Tile(2978, 3274, 0),
  139. new Tile(2984, 3273, 0), new Tile(2990, 3272, 0),
  140. new Tile(2996, 3271, 0), new Tile(3002, 3272, 0),
  141. new Tile(3008, 3274, 0), new Tile(3012, 3279, 0),
  142. new Tile(3013, 3288, 0), new Tile(3014, 3294, 0),
  143. new Tile(3014, 3300, 0), new Tile(3015, 3306, 0),
  144. new Tile(3017, 3312, 0), new Tile(3018, 3318, 0),
  145. new Tile(3017, 3324, 0), new Tile(3016, 3330, 0),
  146. new Tile(3016, 3336, 0), new Tile(3017, 3342, 0),
  147. new Tile(3021, 3347, 0), new Tile(3023, 3353, 0),
  148. new Tile(3023, 3359, 0), new Tile(3021, 3365, 0),
  149. new Tile(3015, 3366, 0), new Tile(3009, 3365, 0),
  150. new Tile(3003, 3362, 0), new Tile(2998, 3358, 0),
  151. new Tile(2994, 3353, 0), new Tile(2988, 3351, 0),
  152. new Tile(2982, 3349, 0), new Tile(2976, 3348, 0),
  153. new Tile(2970, 3347, 0), new Tile(2964, 3346, 0),
  154. new Tile(2959, 3342, 0), new Tile(2954, 3338, 0),
  155. new Tile(2948, 3334, 0), new Tile(2943, 3330, 0),
  156. new Tile(2938, 3326, 0), new Tile(2933, 3321, 0),
  157. new Tile(2929, 3316, 0), new Tile(2928, 3310, 0),
  158. new Tile(2929, 3304, 0), new Tile(2927, 3298, 0)
  159. });
  160. private final Area walkToAreaCG = new Area(new Tile(2933, 3289, 0), new Tile(3017, 3362, 0));
  161. private final Area miningAreaCG = new Area(new Tile(2937, 3285, 0), new Tile(2944, 3275, 0));
  162. private final Area bankArea = new Area(new Tile(3009, 3358, 0), new Tile(3018, 3355, 0));
  163.  
  164. @Override
  165. protected void setup() {
  166.  
  167. startTime = System.currentTimeMillis();
  168. startExp = Skills.getExperience(Skills.MINING);
  169.  
  170. chooseMine cM = new chooseMine();
  171. submit(cM);
  172. }
  173.  
  174. private class chooseMine implements Task, Condition {
  175.  
  176. @Override
  177. public void run() {
  178. try {
  179. Object[] possibilities = {"Rimmington Mine", "Crafting Guide" };
  180. JFrame frame = new JFrame("Choose Mine");
  181. String s = (String) JOptionPane.showInputDialog(frame,
  182. "Choose your Mine:\n",
  183. "BBgoldMiner",
  184. JOptionPane.INFORMATION_MESSAGE,
  185. null,
  186. possibilities,
  187. possibilities[0]);
  188. if ("Rimmington Mine".equals(s)) {
  189. mineGold mG = new mineGold();
  190. Strategy mGStrategy = new Strategy(mG, mG);
  191. provide(mGStrategy);
  192.  
  193. walkToBankRigg wBR = new walkToBankRigg();
  194. Strategy wBRStrategy = new Strategy(wBR, wBR);
  195. provide(wBRStrategy);
  196.  
  197. useBank uB = new useBank();
  198. Strategy uBStrategy = new Strategy(uB, uB);
  199. provide(uBStrategy);
  200.  
  201. walkToMineRigg wMR = new walkToMineRigg();
  202. Strategy wMRStrategy = new Strategy(wMR, wMR);
  203. provide(wMRStrategy);
  204.  
  205. Antiban ab = new Antiban();
  206. Strategy abStrategy = new Strategy(ab, ab);
  207. provide(abStrategy);
  208.  
  209. } if ("Crafting Guide".equals(s)) {
  210.  
  211. mineGoldCG mG = new mineGoldCG();
  212. Strategy mGStrategy = new Strategy(mG, mG);
  213. provide(mGStrategy);
  214.  
  215. walkToBankingspot walk = new walkToBankingspot();
  216. Strategy walkStrategy = new Strategy(walk, walk);
  217. provide(walkStrategy);
  218.  
  219. walkToBankCG wBCG = new walkToBankCG();
  220. Strategy wBCGRStrategy = new Strategy(wBCG, wBCG);
  221. provide(wBCGRStrategy);
  222.  
  223. useBank uB = new useBank();
  224. Strategy uBStrategy = new Strategy(uB, uB);
  225. provide(uBStrategy);
  226.  
  227. walkToMineCG wMCG = new walkToMineCG();
  228. Strategy wMCGStrategy = new Strategy(wMCG, wMCG);
  229. provide(wMCGStrategy);
  230.  
  231. walkToMiningSpot wTMS = new walkToMiningSpot();
  232. Strategy wTMSStrategy = new Strategy(wTMS, wTMS);
  233. provide(wTMSStrategy);
  234.  
  235. openDoor op = new openDoor();
  236. Strategy opStrategy = new Strategy(op, op);
  237. provide(opStrategy);
  238.  
  239. Antiban ab = new Antiban();
  240. Strategy abStrategy = new Strategy(ab, ab);
  241. provide(abStrategy);
  242. }
  243.  
  244. } catch (Exception e) {
  245. stop();
  246. }
  247. }
  248.  
  249. @Override
  250. public boolean validate() {
  251. return true;
  252. }
  253.  
  254. }
  255.  
  256.  
  257. private class mineGold implements Task, Condition {
  258.  
  259. @Override
  260. public void run() {
  261. if(SceneEntities.getNearest(goldOreRock).isOnScreen()){
  262.  
  263. status = "Mining Gold Ore...";
  264. if(SceneEntities.getNearest(goldOreRock).validate()){
  265. final SceneObject LS = SceneEntities.getNearest(goldOreRock);
  266. if (LS != null) {
  267. if (Calculations.distance(Players.getLocal().getLocation(),
  268. LS.getLocation()) > 4) {
  269. Walking.walk(getNextPathTile(LS.getLocation().derive(
  270. Random.nextInt(-3, 3), Random.nextInt(-3, 3))));
  271. } else {
  272. interact(LS, "Mine");
  273. Time.sleep(Random.nextInt(3000, 5000));
  274.  
  275. }
  276. }
  277.  
  278. }
  279. }
  280. }
  281.  
  282. @Override
  283. public boolean validate() {
  284. return (Tabs.INVENTORY.open() && Players.getLocal().getAnimation() == -1);
  285. }
  286.  
  287. }
  288.  
  289. private class mineGoldCG implements Task, Condition {
  290.  
  291. @Override
  292. public void run() {
  293. if(miningAreaCG.contains(Players.getLocal().getLocation())) {
  294. if(SceneEntities.getNearest(goldOreRock).isOnScreen()){
  295. status = "Mining Gold Ore...";
  296. if(SceneEntities.getNearest(goldOreRock).validate()){
  297. final SceneObject LS = SceneEntities.getNearest(goldOreRock);
  298. if (LS != null) {
  299. Camera.turnTo(LS);
  300. interact(LS, "Mine");
  301. Time.sleep(Random.nextInt(1600, 1800));
  302. if(Players.getLocal().getAnimation() == 624){
  303. Time.sleep(Random.nextInt(2000, 3000));
  304. }
  305. }
  306.  
  307. }
  308. }
  309. }
  310. }
  311. @Override
  312. public boolean validate() {
  313. return (Tabs.INVENTORY.open() && Inventory.getCount() < 28 && Players.getLocal().getAnimation() == -1);
  314. }
  315.  
  316. }
  317.  
  318.  
  319. private class walkToBankRigg implements Task, Condition {
  320.  
  321. @Override
  322. public void run() {
  323. status = "Walking to bank";
  324. walkPath(pathToBank);
  325. }
  326.  
  327.  
  328. @Override
  329. public boolean validate() {
  330. return (Inventory.getCount() >=28 && Players.getLocal().getAnimation() == -1);
  331. }
  332.  
  333. }
  334.  
  335.  
  336. private class walkToBankCG implements Task, Condition {
  337.  
  338. @Override
  339. public void run() {
  340.  
  341. if(walkToAreaCG.contains(Players.getLocal().getLocation()) && (Inventory.getCount() == 28)) {
  342. status = "Walking to bank";
  343. walkPath(pathToBankCG);
  344. }
  345. }
  346.  
  347.  
  348. @Override
  349. public boolean validate() {
  350. return (Inventory.getCount() >=28);
  351. }
  352.  
  353. }
  354.  
  355. private class useBank implements Task, Condition {
  356.  
  357. @Override
  358. public void run() {
  359. if(bankArea.contains(Players.getLocal().getLocation())) {
  360. status = "Opening bank";
  361. final SceneObject LS = SceneEntities.getNearest(bank);
  362. if (LS != null) {
  363. if (Calculations.distance(Players.getLocal().getLocation(),
  364. LS.getLocation()) > 4) {
  365. Walking.walk(getNextPathTile(LS.getLocation().derive(
  366. Random.nextInt(-3, 3), Random.nextInt(-3, 3))));
  367. } else {
  368. interact(LS, "Bank");
  369. Time.sleep(Random.nextInt(1000, 2000));
  370. status = "Despositing items";
  371. depositAllExcept(pickaxes);
  372. /* old banking method:
  373. if(Widgets.get(762, 1).validate() && Inventory.getCount() >= 28) {
  374. Widgets.get(762, 34).click(true);
  375. Time.sleep(Random.nextInt(1200, 2000));
  376. Widgets.get(762, 45).click(true);
  377. Time.sleep(Random.nextInt(1200, 2000));*/
  378.  
  379.  
  380. }
  381. }
  382. }
  383.  
  384. }
  385.  
  386. @Override
  387. public boolean validate() {
  388. return (Inventory.getCount() >= 28 );
  389.  
  390. }
  391.  
  392. }
  393.  
  394. private class walkToMineRigg implements Task, Condition {
  395.  
  396. @Override
  397. public void run() {
  398.  
  399. status = "Walking to back to Mine";
  400. walkPath(pathToMine);
  401.  
  402. }
  403.  
  404. @Override
  405. public boolean validate() {
  406. return (Inventory.getCount(goldOre) == 0 && Players.getLocal().getAnimation() == -1 );
  407. }
  408.  
  409. }
  410.  
  411. private class walkToMineCG implements Task, Condition {
  412.  
  413. @Override
  414. public void run() {
  415. if(walkBackAreaCG.contains(Players.getLocal().getLocation()) && Inventory.getCount(goldOre) == 0 && Players.getLocal().getAnimation() == -1 ){
  416. status = "Walking to back to Mine";
  417. walkPath(pathToMineCG);
  418. }
  419. }
  420. @Override
  421. public boolean validate() {
  422. return (Players.getLocal().getAnimation() == -1 && Inventory.getCount(goldOre) >= 0 );
  423. }
  424.  
  425. }
  426.  
  427. private class Antiban implements Task, Condition {
  428.  
  429. @Override
  430. public void run() {
  431.  
  432.  
  433. switch (Random.nextInt(1, 600)) {
  434.  
  435. case 0:
  436. status = "Antiban";
  437. Camera.setAngle(Random.nextInt(-180, 180));
  438. case 119:
  439. status = "Antiban";
  440. Camera.setAngle(Random.nextInt(1, 150));
  441. case 289:
  442. status = "Antiban";
  443. Mouse.move(Random.nextInt(1, 500), Random.nextInt(1, 500));
  444. case 33:
  445. status = "Antiban";
  446. Tabs.STATS.open();
  447. Time.sleep(Random.nextInt(300, 500));
  448. Widgets.get(320, 3);
  449. Time.sleep(Random.nextInt(500, 800));
  450. }
  451. Time.sleep(Random.nextInt(100, 500));
  452. }
  453.  
  454. @Override
  455. public boolean validate() {
  456. return true;
  457. }
  458.  
  459. }
  460.  
  461. private boolean openDoor() {
  462. final SceneObject LS = SceneEntities.getNearest(craftingDoor);
  463. if (LS != null) {
  464. Camera.turnTo(LS);
  465. interact(LS, "Open");
  466. Time.sleep(Random.nextInt(2002, 3000));
  467. }
  468. return false;
  469. }
  470.  
  471. private class openDoor implements Task, Condition {
  472.  
  473. @Override
  474. public void run() {
  475.  
  476. if(craftingArea.contains(Players.getLocal().getLocation()) && Inventory.getCount() == 28 && SceneEntities.getNearest(craftingDoor).isOnScreen()) {
  477. status = "Opening Door";
  478. openDoor();
  479. }
  480.  
  481. if(outsideDoor.contains(Players.getLocal().getLocation()) && Inventory.getCount() == 0 && SceneEntities.getNearest(craftingDoor).isOnScreen()) {
  482. status = "Opening Door";
  483. openDoor();
  484. }
  485.  
  486. }
  487.  
  488. @Override
  489. public boolean validate() {
  490. return true;
  491. }
  492.  
  493. }
  494.  
  495. private class walkToMiningSpot implements Task, Condition {
  496.  
  497. @Override
  498. public void run() {
  499. if(craftingArea.contains(Players.getLocal().getLocation()) && Inventory.getCount(goldOre) == 0 && Players.getLocal().getAnimation() == -1 ){
  500. status = "Walking to back to Mine";
  501. walkPath(pathToMiningSpotWalk);
  502. }
  503. }
  504. @Override
  505. public boolean validate() {
  506. return (Inventory.getCount(goldOre) >= 0 && Players.getLocal().getAnimation() == -1 );
  507. }
  508.  
  509. }
  510.  
  511. private class walkToBankingspot implements Task, Condition {
  512.  
  513. @Override
  514. public void run() {
  515. if(miningAreaCG.contains(Players.getLocal().getLocation()) && Inventory.getCount() == 28 && Players.getLocal().getAnimation() == -1){
  516. status = "Walking to bank";
  517. walkPath(pathTobankingSpotWalk);
  518. }
  519. }
  520.  
  521. @Override
  522. public boolean validate() {
  523. return (Players.getLocal().getAnimation() == -1 && Inventory.getCount() >= 28);
  524. }
  525. }
  526.  
  527.  
  528.  
  529. public void walkPath(final Tile... path) {
  530. if (Walking.getEnergy() > Random.nextInt(30, 50)) {
  531. Walking.setRun(true);
  532. }
  533. for (int i = path.length - 1; i >= 0; i--) {
  534. if (Calculations.distanceTo(path[i]) >= 15) {
  535. continue;
  536. }
  537. if (Walking.walk(path[i])) {
  538. break;
  539. }
  540. }
  541. }
  542.  
  543. private Tile getNextPathTile(final Tile tile) {
  544. final Tile pos = Players.getLocal().getLocation();
  545. return new Tile((int) (pos.getX() + (tile.getX() - pos.getX())
  546. * Random.nextDouble(.75D, .9D)),
  547. (int) (pos.getY() + (tile.getY() - pos.getY())
  548. * Random.nextDouble(.75D, .9D)), tile.getPlane());
  549. }
  550.  
  551. private boolean interact(final SceneObject l, final String action) {
  552. final java.awt.geom.Area a = new java.awt.geom.Area();
  553. for (final Polygon p : l.getBounds())
  554. a.add(new java.awt.geom.Area(p));
  555. final Rectangle bounds = a.getBounds();
  556. Point p;
  557. do {
  558. p = new Point(Random.nextGaussian(bounds.x,
  559. bounds.x + bounds.width, 20), Random.nextGaussian(bounds.y,
  560. bounds.y + bounds.height, 20));
  561. } while (!a.contains(p));
  562. Mouse.move(p.x, p.y);
  563. final String[] actions = Menu.getActions();
  564. if (actions.length > 0 && actions[0].contains(action)) {
  565. Mouse.click(true);
  566. return true;
  567. } else {
  568. for (final String item : actions) {
  569. if (item.contains(action)) {
  570. Mouse.click(false);
  571. Time.sleep(Random.nextInt(200, 400));
  572. return Menu.select(item);
  573. }
  574. }
  575. }
  576. return false;
  577. }
  578.  
  579. private Image getImage(String url) {
  580. try {
  581. return ImageIO.read(new URL(url));
  582. } catch(IOException e) {
  583. return null;
  584. }
  585. }
  586.  
  587. private final Color color1 = new Color(255, 255, 255);
  588.  
  589. private final Font font1 = new Font("Gnuolane Free", 0, 20);
  590.  
  591. private final Image img1 = getImage("http://i46.tinypic.com/333vmm0.png");
  592.  
  593. public void onRepaint(Graphics g1) {
  594. Graphics2D g = (Graphics2D)g1;
  595. millis = System.currentTimeMillis() - startTime;
  596. hours = millis / (1000 * 60 * 60);
  597. millis -= hours * (1000 * 60 * 60);
  598. minutes = millis / (1000 * 60);
  599. millis -= minutes * (1000 * 60);
  600. seconds = millis / 1000;
  601. Point mLoc = Mouse.getLocation();
  602. g.setColor(Color.black);
  603. g.drawLine(mLoc.x, 0, mLoc.x, 502);
  604. g.drawLine(0, mLoc.y, 764, mLoc.y);
  605. expGained = Skills.getExperience(Skills.MINING) - startExp;
  606. expHour = (int) ((expGained) * 3600000D / (System.currentTimeMillis() - startTime));
  607. g.drawImage(img1, 1, 339, null);
  608. g.setFont(font1);
  609. g.setColor(color1);
  610. g.drawString(" "+ hours + ":" + minutes + ":" + seconds, 119, 430);
  611. g.drawString(" "+ expGained, 132, 448);
  612. g.drawString(" "+ expHour, 107, 469);
  613. g.drawString(" "+ mined, 324, 430);
  614. g.drawString(" "+ gems, 327, 450);
  615. g.drawString(" "+ status, 282, 469);
  616. }
  617.  
  618. public void messageReceived(MessageEvent e) {
  619. String svrmsg = e.getMessage();
  620. if (svrmsg.contains("You just found") ) {
  621. gems++;
  622. }
  623. if(svrmsg.contains("You ma")) {
  624. mined++;
  625. }
  626. }
  627.  
  628. //Aaimister's code.
  629. private void depositAllExcept(int... item) {
  630. ArrayList<Integer> ids = new ArrayList<Integer>();
  631. int ninvCount = -1;
  632. int invCount = Inventory.getCount();
  633. for (int id : item) {
  634. ids.add(id);
  635. }
  636. for (int i = 0; i < 28; i++) {
  637. WidgetChild slot = Widgets.get(679, 0).getChild(i);
  638. int slotId = slot.getChildId();
  639. if (slot.validate() && Inventory.getCount(slotId) > 0) {
  640. if (!ids.contains(slotId)) {
  641. for (int tries = 0; tries < 5; tries++) {
  642. if (Inventory.getCount(slotId) > 1) {
  643. if (slot.interact("Deposit-All"));
  644. else
  645. tries = 5;
  646. } else {
  647. if (slot.interact("Deposit"));
  648. else
  649. tries = 5;
  650. }
  651. Time.sleep(625, 902);
  652. ninvCount = Inventory.getCount();
  653. if (invCount > ninvCount) {
  654. invCount = ninvCount;
  655. tries = 5;
  656. }
  657. }
  658. }
  659. }
  660. }
  661. }
  662.  
  663. }
Advertisement
Add Comment
Please, Sign In to add comment