BrownBirdScripts

BBgoldMiner v0.3

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