Thondar

WaterRunner 1.0

Jul 27th, 2012
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.61 KB | None | 0 0
  1. import java.awt.*;
  2. import java.awt.event.ActionEvent;
  3. import java.awt.event.ActionListener;
  4. import java.io.BufferedReader;
  5. import java.io.IOException;
  6. import java.io.InputStreamReader;
  7. import java.net.URL;
  8. import java.net.URLConnection;
  9.  
  10. import javax.swing.DefaultComboBoxModel;
  11. import javax.swing.JButton;
  12. import javax.swing.JComboBox;
  13. import javax.swing.JFrame;
  14. import javax.swing.JLabel;
  15. import javax.swing.SwingConstants;
  16.  
  17. import org.powerbot.concurrent.Task;
  18. import org.powerbot.concurrent.strategy.Condition;
  19. import org.powerbot.concurrent.strategy.Strategy;
  20. import org.powerbot.game.api.ActiveScript;
  21. import org.powerbot.game.api.Manifest;
  22. import org.powerbot.game.api.methods.Tabs;
  23. import org.powerbot.game.api.methods.Walking;
  24. import org.powerbot.game.api.methods.Widgets;
  25. import org.powerbot.game.api.methods.input.Mouse;
  26. import org.powerbot.game.api.methods.interactive.NPCs;
  27. import org.powerbot.game.api.methods.interactive.Players;
  28. import org.powerbot.game.api.methods.node.SceneEntities;
  29. import org.powerbot.game.api.methods.tab.Inventory;
  30. import org.powerbot.game.api.methods.widget.Camera;
  31. import org.powerbot.game.api.util.Random;
  32. import org.powerbot.game.api.util.Time;
  33. import org.powerbot.game.api.wrappers.Area;
  34. import org.powerbot.game.api.wrappers.Tile;
  35. import org.powerbot.game.api.wrappers.widget.WidgetChild;
  36. import org.powerbot.game.bot.event.listener.PaintListener;
  37.  
  38.  
  39.  
  40. @Manifest(name = "Water Runner", description = "Fills Vials, Jugs, bowls etc. also softens clay", version = 1.0, authors = {"Thondar"})
  41. public class WaterRunner extends ActiveScript implements PaintListener {
  42.  
  43. int Empty;
  44. int Full;
  45. int Clay = 434;
  46. int SoftClay = 1761;
  47. int Vial = 229;
  48. int VialWater = 227;
  49. int Bucket = 1925;
  50. int BucketWater = 1929;
  51. int Jug = 1935;
  52. int JugWater = 1937;
  53. int Bowl = 1923;
  54. int BowlWater = 1921;
  55. int ClayPrice, SoftClayPrice, VialPrice, VialWaterPrice, BucketPrice, BucketWaterPrice, JugPrice, JugWaterPrice, BowlPrice, BowlWaterPrice;
  56. int WaterPump = 11661;
  57. int FullCount;
  58. int FullInv;
  59. int Profit;
  60. int ProfitHour;
  61. int FullPrice;
  62. int EmptyPrice;
  63. int SleepTimer;
  64. int Claycheck;
  65. int Banker = 6200;
  66. long startTime;
  67. long runTime, xpTime;
  68. long hr, min, sec;
  69. long xpGain;
  70.  
  71. private static WidgetChild ClayWidget;
  72.  
  73. String time;
  74. String status;
  75.  
  76. Area BankArea = new Area(new Tile(2943, 3367, 0), new Tile(2949, 3370, 0));
  77. Area WaterArea = new Area(new Tile(2946, 3381, 0), new Tile(2950, 3384, 0));
  78.  
  79. Tile WaterTile = new Tile(2949, 3382, 0);
  80. Tile BankTile = new Tile(2946, 3368, 0);
  81.  
  82. boolean start = true;
  83.  
  84. private int getPrice(int id) throws IOException {
  85. URL url = new URL("http://open.tip.it/json/ge_single_item?item=" + Clay);
  86. URLConnection con = url.openConnection();
  87. BufferedReader in = new BufferedReader(new InputStreamReader(
  88. con.getInputStream()));
  89. String line = "";
  90. String inputLine;
  91. while ((inputLine = in.readLine()) != null) {
  92. line += inputLine;
  93. }
  94. in.close();
  95. if (!line.contains("mark_price"))
  96. return -1;
  97. line = line.substring(line.indexOf("mark_price\":\"")
  98. + "mark_price\":\"".length());
  99. line = line.substring(0, line.indexOf("\""));
  100. return Integer.parseInt(line.replaceAll(",", ""));
  101. }
  102.  
  103. private int getPrice1(int id) throws IOException {
  104. URL url = new URL("http://open.tip.it/json/ge_single_item?item=" + SoftClay);
  105. URLConnection con = url.openConnection();
  106. BufferedReader in = new BufferedReader(new InputStreamReader(
  107. con.getInputStream()));
  108. String line = "";
  109. String inputLine;
  110. while ((inputLine = in.readLine()) != null) {
  111. line += inputLine;
  112. }
  113. in.close();
  114. if (!line.contains("mark_price"))
  115. return -1;
  116. line = line.substring(line.indexOf("mark_price\":\"")
  117. + "mark_price\":\"".length());
  118. line = line.substring(0, line.indexOf("\""));
  119. return Integer.parseInt(line.replaceAll(",", ""));
  120. }
  121. private int getPrice2(int id) throws IOException {
  122. URL url = new URL("http://open.tip.it/json/ge_single_item?item=" + Vial);
  123. URLConnection con = url.openConnection();
  124. BufferedReader in = new BufferedReader(new InputStreamReader(
  125. con.getInputStream()));
  126. String line = "";
  127. String inputLine;
  128. while ((inputLine = in.readLine()) != null) {
  129. line += inputLine;
  130. }
  131. in.close();
  132. if (!line.contains("mark_price"))
  133. return -1;
  134. line = line.substring(line.indexOf("mark_price\":\"")
  135. + "mark_price\":\"".length());
  136. line = line.substring(0, line.indexOf("\""));
  137. return Integer.parseInt(line.replaceAll(",", ""));
  138. }
  139.  
  140. private int getPrice3(int id) throws IOException {
  141. URL url = new URL("http://open.tip.it/json/ge_single_item?item=" + VialWater);
  142. URLConnection con = url.openConnection();
  143. BufferedReader in = new BufferedReader(new InputStreamReader(
  144. con.getInputStream()));
  145. String line = "";
  146. String inputLine;
  147. while ((inputLine = in.readLine()) != null) {
  148. line += inputLine;
  149. }
  150. in.close();
  151. if (!line.contains("mark_price"))
  152. return -1;
  153. line = line.substring(line.indexOf("mark_price\":\"")
  154. + "mark_price\":\"".length());
  155. line = line.substring(0, line.indexOf("\""));
  156. return Integer.parseInt(line.replaceAll(",", ""));
  157. }
  158. private int getPrice4(int id) throws IOException {
  159. URL url = new URL("http://open.tip.it/json/ge_single_item?item=" + Bucket);
  160. URLConnection con = url.openConnection();
  161. BufferedReader in = new BufferedReader(new InputStreamReader(
  162. con.getInputStream()));
  163. String line = "";
  164. String inputLine;
  165. while ((inputLine = in.readLine()) != null) {
  166. line += inputLine;
  167. }
  168. in.close();
  169. if (!line.contains("mark_price"))
  170. return -1;
  171. line = line.substring(line.indexOf("mark_price\":\"")
  172. + "mark_price\":\"".length());
  173. line = line.substring(0, line.indexOf("\""));
  174. return Integer.parseInt(line.replaceAll(",", ""));
  175. }
  176.  
  177. private int getPrice5(int id) throws IOException {
  178. URL url = new URL("http://open.tip.it/json/ge_single_item?item=" + BucketWater);
  179. URLConnection con = url.openConnection();
  180. BufferedReader in = new BufferedReader(new InputStreamReader(
  181. con.getInputStream()));
  182. String line = "";
  183. String inputLine;
  184. while ((inputLine = in.readLine()) != null) {
  185. line += inputLine;
  186. }
  187. in.close();
  188. if (!line.contains("mark_price"))
  189. return -1;
  190. line = line.substring(line.indexOf("mark_price\":\"")
  191. + "mark_price\":\"".length());
  192. line = line.substring(0, line.indexOf("\""));
  193. return Integer.parseInt(line.replaceAll(",", ""));
  194. }
  195. private int getPrice6(int id) throws IOException {
  196. URL url = new URL("http://open.tip.it/json/ge_single_item?item=" + Jug);
  197. URLConnection con = url.openConnection();
  198. BufferedReader in = new BufferedReader(new InputStreamReader(
  199. con.getInputStream()));
  200. String line = "";
  201. String inputLine;
  202. while ((inputLine = in.readLine()) != null) {
  203. line += inputLine;
  204. }
  205. in.close();
  206. if (!line.contains("mark_price"))
  207. return -1;
  208. line = line.substring(line.indexOf("mark_price\":\"")
  209. + "mark_price\":\"".length());
  210. line = line.substring(0, line.indexOf("\""));
  211. return Integer.parseInt(line.replaceAll(",", ""));
  212. }
  213.  
  214. private int getPrice7(int id) throws IOException {
  215. URL url = new URL("http://open.tip.it/json/ge_single_item?item=" + JugWater);
  216. URLConnection con = url.openConnection();
  217. BufferedReader in = new BufferedReader(new InputStreamReader(
  218. con.getInputStream()));
  219. String line = "";
  220. String inputLine;
  221. while ((inputLine = in.readLine()) != null) {
  222. line += inputLine;
  223. }
  224. in.close();
  225. if (!line.contains("mark_price"))
  226. return -1;
  227. line = line.substring(line.indexOf("mark_price\":\"")
  228. + "mark_price\":\"".length());
  229. line = line.substring(0, line.indexOf("\""));
  230. return Integer.parseInt(line.replaceAll(",", ""));
  231. }
  232. private int getPrice8(int id) throws IOException {
  233. URL url = new URL("http://open.tip.it/json/ge_single_item?item=" + Bowl);
  234. URLConnection con = url.openConnection();
  235. BufferedReader in = new BufferedReader(new InputStreamReader(
  236. con.getInputStream()));
  237. String line = "";
  238. String inputLine;
  239. while ((inputLine = in.readLine()) != null) {
  240. line += inputLine;
  241. }
  242. in.close();
  243. if (!line.contains("mark_price"))
  244. return -1;
  245. line = line.substring(line.indexOf("mark_price\":\"")
  246. + "mark_price\":\"".length());
  247. line = line.substring(0, line.indexOf("\""));
  248. return Integer.parseInt(line.replaceAll(",", ""));
  249. }
  250.  
  251. private int getPrice9(int id) throws IOException {
  252. URL url = new URL("http://open.tip.it/json/ge_single_item?item=" + BowlWater);
  253. URLConnection con = url.openConnection();
  254. BufferedReader in = new BufferedReader(new InputStreamReader(
  255. con.getInputStream()));
  256. String line = "";
  257. String inputLine;
  258. while ((inputLine = in.readLine()) != null) {
  259. line += inputLine;
  260. }
  261. in.close();
  262. if (!line.contains("mark_price"))
  263. return -1;
  264. line = line.substring(line.indexOf("mark_price\":\"")
  265. + "mark_price\":\"".length());
  266. line = line.substring(0, line.indexOf("\""));
  267. return Integer.parseInt(line.replaceAll(",", ""));
  268. }
  269.  
  270. GUI g;
  271. private boolean guiWait = true;
  272.  
  273. @Override
  274. protected void setup() {
  275. startTime = System.currentTimeMillis();
  276. FullCount = 0;
  277.  
  278. try {
  279. ClayPrice = getPrice(Clay);
  280. SoftClayPrice = getPrice1(SoftClay);
  281. VialPrice = getPrice2(Vial);
  282. VialWaterPrice = getPrice3(VialWater);
  283. BucketPrice = getPrice4(Bucket);
  284. BucketWaterPrice = getPrice5(BucketWater);
  285. JugPrice = getPrice6(Jug);
  286. JugWaterPrice = getPrice7(JugWater);
  287. BowlPrice = getPrice8(Bowl);
  288. BowlWaterPrice = getPrice9(BowlWater);
  289. } catch (IOException e) {
  290. e.printStackTrace();
  291. }
  292.  
  293. g = new GUI();
  294. g.setVisible(true);
  295.  
  296. final WaitGui guiTask = new WaitGui();
  297. provide(new Strategy(guiTask, guiTask));
  298. provide(new Strategy(new WaitGui(), new WaitGui()));
  299.  
  300. BankOpen bankopen = new BankOpen();
  301. Strategy bankopenStrategy = new Strategy(bankopen, bankopen);
  302. provide(bankopenStrategy);
  303.  
  304. Bank bank = new Bank();
  305. Strategy bankStrategy = new Strategy(bank, bank);
  306. provide(bankStrategy);
  307.  
  308. Water water = new Water();
  309. Strategy waterStrategy = new Strategy(water, water);
  310. provide(waterStrategy);
  311.  
  312. Clay clay = new Clay();
  313. Strategy clayStrategy = new Strategy(clay, clay);
  314. provide(clayStrategy);
  315.  
  316. AntiBan ab = new AntiBan();
  317. Strategy abStrategy = new Strategy(ab, ab);
  318. provide(abStrategy);
  319.  
  320. Tabs.INVENTORY.open(false);
  321. Walking.setRun(true);
  322.  
  323. }
  324.  
  325. private class WaitGui implements Task, Condition {
  326.  
  327. @Override
  328. public void run() {
  329. while (guiWait) {
  330. Time.sleep(500);
  331. }
  332. }
  333.  
  334. public boolean validate() {
  335. return guiWait;
  336. }
  337.  
  338. }
  339.  
  340.  
  341. private class BankOpen implements Task, Condition {
  342.  
  343. @Override
  344. public void run() {
  345. if(!BankArea.contains(Players.getLocal())){
  346. status = ("Running to Bank");
  347. Walking.walk(BankTile);
  348. Time.sleep(Random.nextInt(500, 700));
  349. }
  350. if(BankArea.contains(Players.getLocal())){
  351. status = ("Banking");
  352. NPCs.getNearest(Banker).interact("Bank");
  353. Time.sleep(Random.nextInt(900, 1200));
  354. }
  355. }
  356.  
  357. @Override
  358. public boolean validate() {
  359. return (Inventory.getCount(Empty) == 0) && !org.powerbot.game.api.methods.widget.Bank.isOpen();
  360. }
  361.  
  362. }
  363.  
  364.  
  365. private class Bank implements Task, Condition {
  366.  
  367. @Override
  368. public void run() {
  369. status = ("Banking");
  370. FullInv = Inventory.getCount(Full);
  371. FullCount += FullInv;
  372. org.powerbot.game.api.methods.widget.Bank.depositInventory();
  373. Time.sleep(Random.nextInt(300, 500));
  374. org.powerbot.game.api.methods.widget.Bank.withdraw(Empty, 28);
  375. Time.sleep(Random.nextInt(300, 500));
  376. org.powerbot.game.api.methods.widget.Bank.close();
  377. }
  378.  
  379. @Override
  380. public boolean validate() {
  381. return Inventory.getCount(Empty) < 1 && org.powerbot.game.api.methods.widget.Bank.isOpen() && BankArea.contains(Players.getLocal());
  382. }
  383.  
  384. }
  385.  
  386. private class Water implements Task, Condition {
  387.  
  388. @Override
  389. public void run() {
  390. ClayWidget = Widgets.get(905, 14);
  391. if(!WaterArea.contains(Players.getLocal())){
  392. status = ("Running to Water");
  393. Walking.setRun(true);
  394. Walking.walk(WaterTile);
  395. }
  396. if(WaterArea.contains(Players.getLocal())){
  397. status = ("Using Water");
  398. Inventory.getItem(Empty).getWidgetChild().interact("Use");
  399. Camera.turnTo(SceneEntities.getNearest(WaterPump).getLocation());
  400. Time.sleep(Random.nextInt(300, 500));
  401. SceneEntities.getNearest(WaterPump).interact("Use", "Waterpump");
  402. Time.sleep(Random.nextInt(300, 500));
  403. Time.sleep(SleepTimer);
  404. }
  405.  
  406. }
  407. @Override
  408. public boolean validate() {
  409. return (Inventory.getCount(Empty) > 0) && (Players.getLocal().getAnimation() == -1) && Claycheck == 1;
  410. }
  411.  
  412. }
  413.  
  414. private class Clay implements Task, Condition {
  415.  
  416. @Override
  417. public void run() {
  418. ClayWidget = Widgets.get(905, 14);
  419. if(!WaterArea.contains(Players.getLocal())){
  420. status = ("Running to Water");
  421. Walking.walk(WaterTile);
  422. }
  423. if(WaterArea.contains(Players.getLocal())){
  424. status = ("Using Water");
  425. Inventory.getItem(Empty).getWidgetChild().interact("Use");
  426. Camera.turnTo(SceneEntities.getNearest(WaterPump).getLocation());
  427. Time.sleep(Random.nextInt(300, 500));
  428. SceneEntities.getNearest(WaterPump).interact("Use", "Waterpump");
  429. Time.sleep(Random.nextInt(1100, 1500));
  430. ClayWidget.click(true);
  431. Time.sleep(SleepTimer);
  432. }
  433.  
  434. }
  435. @Override
  436. public boolean validate() {
  437. return (Inventory.getCount(Empty) > 0) && (Players.getLocal().getAnimation() == -1) && Claycheck == 2;
  438. }
  439.  
  440. }
  441.  
  442.  
  443. private class AntiBan implements Task, Condition {
  444.  
  445. @Override
  446. public void run() {
  447. switch(Random.nextInt(1, 100)){
  448. case 3:
  449. Camera.setAngle(Random.nextInt(1, 150));
  450. case 33:
  451. Camera.setAngle(Random.nextInt(1, 310));
  452. case 75:
  453. Camera.setAngle(Random.nextInt(1, 210));
  454. default:
  455. }
  456. Time.sleep(Random.nextInt(500, 1000));
  457. }
  458.  
  459. @Override
  460. public boolean validate() {
  461. return start;
  462. }
  463.  
  464. }
  465.  
  466.  
  467.  
  468.  
  469. private AlphaComposite makeComposite(float alpha) {
  470. int type = AlphaComposite.SRC_OVER;
  471.  
  472. return(AlphaComposite.getInstance(type, alpha));
  473. }
  474.  
  475.  
  476. private final Font font1 = new Font("Verdana", 0, 16);
  477. private final Font font5 = new Font("Verdana", 1, 16);
  478. private final Font font2 = new Font("Verdana", 0, 12);
  479. private final Font font3 = new Font("Verdana", 0, 13);
  480. private final Font font4 = new Font("Verdana", 0, 9);
  481.  
  482.  
  483. @Override
  484. public void onRepaint(Graphics g) {
  485. Graphics2D g2d = (Graphics2D) g;
  486.  
  487. g2d.setColor(Color.CYAN);
  488. g2d.drawLine((Mouse.getX() -3), Mouse.getY(), (Mouse.getX() +3), Mouse.getY());
  489. g2d.drawLine(Mouse.getX(), (Mouse.getY() - 3), Mouse.getX(), (Mouse.getY() + 3));
  490. g2d.drawLine((Mouse.getX() - 1), (Mouse.getY() - 1), (Mouse.getX() + 1), (Mouse.getY() + 1));
  491. g2d.drawLine((Mouse.getX() + 1), (Mouse.getY() - 1), (Mouse.getX() - 1), (Mouse.getY() + 1));
  492.  
  493.  
  494. int FullHour = (int) ((FullCount) * 3600000D / (System
  495. .currentTimeMillis() - startTime));
  496.  
  497. int FullPrice1 = FullPrice - EmptyPrice;
  498.  
  499. Profit = FullCount * FullPrice1;
  500. ProfitHour = FullHour * FullPrice1;
  501.  
  502. Rectangle bg = new Rectangle(0, 0, 800, 50);
  503. g2d.setComposite(makeComposite(1f));
  504. g2d.setColor(Color.BLACK);
  505. g2d.fill(bg);
  506.  
  507. g2d.setFont(font1);
  508. g2d.setComposite(makeComposite(1f));
  509. g2d.setColor(Color.BLUE);
  510. g2d.drawString("Water Runner", 15, 20);
  511. g2d.setFont(font3);
  512. g2d.drawString("by Thondar", 27, 35);
  513. g2d.setFont(font4);
  514. g2d.drawString("Version 1.0", 33, 45);
  515.  
  516. g2d.setFont(font2);
  517. g2d.setComposite(makeComposite(.8f));
  518. g2d.setColor(Color.CYAN);
  519. g2d.drawString("Time Run: " + timeRun(), 150, 20);
  520.  
  521. g2d.setComposite(makeComposite(.8f));
  522. g2d.setColor(Color.CYAN);
  523. g2d.drawString("Status: " + status, 150, 40);
  524.  
  525. g2d.setComposite(makeComposite(.8f));
  526. g2d.setColor(Color.CYAN);
  527. g2d.drawString("Items Banked: " + FullCount, 350, 20);
  528.  
  529. g2d.setComposite(makeComposite(.8f));
  530. g2d.setColor(Color.CYAN);
  531. g2d.drawString("Items Banked/H: " + FullHour, 350, 40);
  532.  
  533. g2d.setComposite(makeComposite(.8f));
  534. g2d.setColor(Color.CYAN);
  535. g2d.drawString("Profit: " + Profit, 550, 20);
  536.  
  537. g2d.setComposite(makeComposite(.8f));
  538. g2d.setColor(Color.CYAN);
  539. g2d.drawString("Profit/H: " + ProfitHour, 550, 40);
  540.  
  541. if(Empty == Clay){
  542. g2d.setFont(font5);
  543. g2d.setColor(Color.BLUE);
  544. g2d.drawString("Clay", 690, 33);
  545. }
  546. if(Empty == Vial){
  547. g2d.setFont(font5);
  548. g2d.setColor(Color.BLUE);
  549. g2d.drawString("Vials", 690, 33);
  550. }
  551. if(Empty == Jug){
  552. g2d.setFont(font5);
  553. g2d.setColor(Color.BLUE);
  554. g2d.drawString("Jugs", 690, 33);
  555. }
  556. if(Empty == Bucket){
  557. g2d.setFont(font5);
  558. g2d.setColor(Color.BLUE);
  559. g2d.drawString("Buckets", 675, 33);
  560. }
  561. if(Empty == Bowl){
  562. g2d.setFont(font5);
  563. g2d.setColor(Color.BLUE);
  564. g2d.drawString("Bowls", 690, 33);
  565. }
  566.  
  567.  
  568. }
  569.  
  570. public String timeRun() {
  571. runTime = System.currentTimeMillis() - startTime;
  572. time = "";
  573. hr = runTime / (1000 * 60 * 60);
  574. min = (runTime % (1000 * 60 * 60)) / (1000 * 60);
  575. sec = ((runTime % (1000 * 60 * 60)) % (1000 * 60)) / 1000;
  576.  
  577. if (hr < 10)
  578. time += "0" + hr + ":";
  579. else
  580. time += hr + ":";
  581.  
  582. if (min < 10)
  583. time += "0" + min + ":";
  584. else
  585. time += min + ":";
  586. if (sec < 10)
  587. time += "0" + sec;
  588. else
  589. time += sec;
  590. return time;
  591. }
  592.  
  593.  
  594. class GUI extends JFrame {
  595. public GUI() {
  596. initComponents();
  597. }
  598.  
  599. int ClayGUI = (SoftClayPrice - ClayPrice) * 1200;
  600. int VialGUI = (VialWaterPrice - VialPrice) * 2200;
  601. int BucketGUI = (BucketWaterPrice - BucketPrice) * 2200;
  602. int JugGUI = (JugWaterPrice - JugPrice) * 2200;
  603. int BowlGUI = (BowlWaterPrice - BowlPrice) * 2200;
  604.  
  605. private void StartButtonActionPerformed(ActionEvent e) {
  606. String u = comboBox1.getSelectedItem().toString(); {
  607. if (u.equals("Soft Clay")) {
  608. Full = SoftClay;
  609. Empty = Clay;
  610. FullPrice = SoftClayPrice;
  611. EmptyPrice = ClayPrice;
  612. SleepTimer = 34500;
  613. Claycheck = 2;
  614. }else if (u.equals("Vial of Water")) {
  615. Full = VialWater;
  616. Empty = Vial;
  617. FullPrice = VialWaterPrice;
  618. EmptyPrice = VialPrice;
  619. SleepTimer = 17000;
  620. Claycheck = 1;
  621. }else if (u.equals("Bucket of Water")) {
  622. Full = BucketWater;
  623. Empty = Bucket;
  624. FullPrice = BucketWaterPrice;
  625. EmptyPrice = BucketPrice;
  626. SleepTimer = 17000;
  627. Claycheck = 1;
  628. }else if (u.equals("Jug of Water")) {
  629. Full = JugWater;
  630. Empty = Jug;
  631. FullPrice = JugWaterPrice;
  632. EmptyPrice = JugPrice;
  633. SleepTimer = 17000;
  634. Claycheck = 1;
  635. }else if (u.equals("Bowl of Water")) {
  636. Full = BowlWater;
  637. Empty = Bowl;
  638. FullPrice = BowlWaterPrice;
  639. EmptyPrice = BowlPrice;
  640. SleepTimer = 17000;
  641. Claycheck = 1;
  642. }
  643.  
  644. }
  645. guiWait = false;
  646. g.dispose();
  647. }
  648.  
  649. private void initComponents() {
  650. // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
  651. // Generated using JFormDesigner Evaluation license - Jonas Bill Jensen
  652. label1 = new JLabel();
  653. StartButton = new JButton();
  654. comboBox1 = new JComboBox();
  655. label2 = new JLabel();
  656. label8 = new JLabel();
  657. label9 = new JLabel();
  658. label10 = new JLabel();
  659. label11 = new JLabel();
  660. label12 = new JLabel();
  661. label13 = new JLabel();
  662.  
  663. //======== this ========
  664. Container contentPane = getContentPane();
  665. contentPane.setLayout(null);
  666.  
  667. //---- label1 ----
  668. label1.setText("Water Runner");
  669. label1.setHorizontalAlignment(SwingConstants.CENTER);
  670. label1.setFont(new Font("Segoe Print", Font.BOLD, 26));
  671. contentPane.add(label1);
  672. label1.setBounds(0, 0, 375, 50);
  673.  
  674. //---- StartButton ----
  675. StartButton.setText("Start");
  676. StartButton.setFont(new Font("Verdana", Font.PLAIN, 12));
  677. StartButton.addActionListener(new ActionListener() {
  678. @Override
  679. public void actionPerformed(ActionEvent e) {
  680. StartButtonActionPerformed(e);
  681. }
  682. });
  683. contentPane.add(StartButton);
  684. StartButton.setBounds(5, 270, 365, 60);
  685.  
  686. //---- comboBox1 ----
  687. comboBox1.setModel(new DefaultComboBoxModel(new String[] {
  688. "Soft Clay",
  689. "Vial of Water",
  690. "Bucket of Water",
  691. "Jug of Water",
  692. "Bowl of Water"
  693. }));
  694. contentPane.add(comboBox1);
  695. comboBox1.setBounds(115, 95, 145, 30);
  696.  
  697. //---- label2 ----
  698. label2.setText("What to run?");
  699. label2.setHorizontalAlignment(SwingConstants.CENTER);
  700. label2.setFont(new Font("Verdana", Font.PLAIN, 12));
  701. contentPane.add(label2);
  702. label2.setBounds(0, 70, 375, 30);
  703.  
  704. //---- label8 ----
  705. label8.setText("Currently you will get:");
  706. label8.setHorizontalAlignment(SwingConstants.CENTER);
  707. label8.setFont(new Font("Verdana", Font.ITALIC, 12));
  708. contentPane.add(label8);
  709. label8.setBounds(0, 150, 375, label8.getPreferredSize().height);
  710.  
  711. //---- label9 ----
  712. label9.setText(ClayGUI + " Gold per hour from Soft Clay");
  713. label9.setHorizontalAlignment(SwingConstants.CENTER);
  714. label9.setFont(label9.getFont().deriveFont(label9.getFont().getStyle() | Font.ITALIC));
  715. contentPane.add(label9);
  716. label9.setBounds(0, 175, 375, label9.getPreferredSize().height);
  717.  
  718. //---- label10 ----
  719. label10.setText(VialGUI + " Gold per hour from Vials of Water");
  720. label10.setHorizontalAlignment(SwingConstants.CENTER);
  721. label10.setFont(label10.getFont().deriveFont(label10.getFont().getStyle() | Font.ITALIC));
  722. contentPane.add(label10);
  723. label10.setBounds(0, 190, 375, 14);
  724.  
  725. //---- label11 ----
  726. label11.setText(BucketGUI + " Gold per hour from Bucket of Water");
  727. label11.setHorizontalAlignment(SwingConstants.CENTER);
  728. label11.setFont(label11.getFont().deriveFont(label11.getFont().getStyle() | Font.ITALIC));
  729. contentPane.add(label11);
  730. label11.setBounds(0, 205, 375, label11.getPreferredSize().height);
  731.  
  732. //---- label12 ----
  733. label12.setText(JugGUI + " Gold per hour from Jug of Water");
  734. label12.setHorizontalAlignment(SwingConstants.CENTER);
  735. label12.setFont(label12.getFont().deriveFont(label12.getFont().getStyle() | Font.ITALIC));
  736. contentPane.add(label12);
  737. label12.setBounds(0, 220, 375, label12.getPreferredSize().height);
  738.  
  739. //---- label13 ----
  740. label13.setText(BowlGUI + " Gold per hour from Bowl of Water");
  741. label13.setHorizontalAlignment(SwingConstants.CENTER);
  742. label13.setFont(label13.getFont().deriveFont(label13.getFont().getStyle() | Font.ITALIC));
  743. contentPane.add(label13);
  744. label13.setBounds(0, 235, 375, label13.getPreferredSize().height);
  745.  
  746. { // compute preferred size
  747. Dimension preferredSize = new Dimension();
  748. for(int i = 0; i < contentPane.getComponentCount(); i++) {
  749. Rectangle bounds = contentPane.getComponent(i).getBounds();
  750. preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
  751. preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
  752. }
  753. Insets insets = contentPane.getInsets();
  754. preferredSize.width += insets.right;
  755. preferredSize.height += insets.bottom;
  756. contentPane.setMinimumSize(preferredSize);
  757. contentPane.setPreferredSize(preferredSize);
  758. }
  759. pack();
  760. setLocationRelativeTo(getOwner());
  761. // JFormDesigner - End of component initialization //GEN-END:initComponents
  762. }
  763.  
  764. // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
  765. // Generated using JFormDesigner Evaluation license - Jonas Bill Jensen
  766. private JLabel label1;
  767. private JButton StartButton;
  768. private JComboBox comboBox1;
  769. private JLabel label2;
  770. private JLabel label8;
  771. private JLabel label9;
  772. private JLabel label10;
  773. private JLabel label11;
  774. private JLabel label12;
  775. private JLabel label13;
  776. // JFormDesigner - End of variables declaration //GEN-END:variables
  777. }
  778.  
  779.  
  780.  
  781.  
  782. }
Advertisement
Add Comment
Please, Sign In to add comment