Advertisement
Guest User

ok_SpiderEgg

a guest
Dec 7th, 2013
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 40.97 KB | None | 0 0
  1. package scripts;
  2.  
  3. import java.awt.Graphics;
  4. import java.awt.Polygon;
  5.  
  6. import org.tribot.api2007.types.RSGroundItem;
  7. import org.tribot.api2007.Camera;
  8. import org.tribot.api2007.Combat;
  9. import org.tribot.api2007.GameTab;
  10. import org.tribot.api2007.GameTab.TABS;
  11. import org.tribot.api2007.GroundItems;
  12. import org.tribot.api2007.Login;
  13. import org.tribot.api2007.Banking;
  14. import org.tribot.api2007.Objects;
  15. import org.tribot.api2007.Player;
  16. import org.tribot.api2007.Screen;
  17. import org.tribot.api2007.Walking;
  18. import org.tribot.api2007.types.RSObject;
  19. import org.tribot.api2007.types.RSTile;
  20. import org.tribot.api2007.types.RSItem;
  21. import org.tribot.api2007.Inventory;
  22. import org.tribot.api.DynamicClicking;
  23. import org.tribot.api.General;
  24. import org.tribot.api.Timing;
  25. import org.tribot.api.input.Mouse;
  26. import org.tribot.api.types.generic.Condition;
  27. import org.tribot.script.Script;
  28. import org.tribot.script.ScriptManifest;
  29. import org.tribot.script.interfaces.Painting;
  30. import org.tribot.script.interfaces.Pausing;
  31. import org.tribot.script.interfaces.RandomEvents;
  32.  
  33. import java.awt.Color;
  34. import java.awt.Font;
  35. import java.awt.Graphics2D;
  36. import java.awt.Image;
  37. import java.io.IOException;
  38. import java.net.URL;
  39.  
  40. import javax.imageio.ImageIO;
  41.  
  42.  
  43. @ScriptManifest(authors = { "Okokokok" }, category = "ok_Scripts", name = "ok_spiderEgg")
  44. public class ok_spiderEgg extends Script implements Painting, Pausing, RandomEvents {
  45.  
  46. private boolean paused = false;
  47.  
  48. private final String gateName = "Gate",
  49. ladderName = "Ladder",
  50. trapdoorName = "Trapdoor",
  51. spiderEggName = "Red spiders' eggs",
  52. lobsterName = "Lobster";
  53.  
  54.  
  55. private int eatPercent = 0,
  56. withdrawFoodies = 0;
  57.  
  58. private boolean eatFully = false,
  59. withdrawFoodTrue = false,
  60. waitGUI = true;
  61.  
  62. private final RSTile EDGE_BANK = new RSTile(3093, 3491, 0),
  63. EDGE_TILE = new RSTile(3093, 3481, 0),
  64. TRAPDOOR_TILE_UP = new RSTile(3094, 3470, 0),
  65. LADDER_TILE_DOWN = new RSTile(3096, 9867, 0),
  66. FIRST_GATE_TILE = new RSTile(3101, 9909, 0),
  67. FIRST_GATE_TILE_R = new RSTile(3106, 9909, 0),
  68. SECOND_GATE_TILE = new RSTile(3131, 9917, 0),
  69. SECOND_GATE_TILE_R = new RSTile(3132, 9920, 0),
  70. SPIDER_AREA_TILE = new RSTile(3123, 9952, 0),
  71. FIRST_EGG_TILE = new RSTile(3118, 9948, 0),
  72. SECOND_EGG_TILE = new RSTile(3128, 9956, 0),
  73. OUT_OF_BOUND_TILE_NORTH = new RSTile(3120, 9964, 0),
  74. OUT_OF_BOUND_TILE_EAST = new RSTile (3107, 9953, 0),
  75. myPos = Player.getPosition();
  76.  
  77. private final RSTile[] trapdoorPath = new RSTile[] { new RSTile(3089, 3490, 0),
  78. new RSTile(3090, 3485, 0),
  79. new RSTile(3093, 3481, 0),
  80. new RSTile(3094, 3476, 0),
  81. new RSTile(3094, 3470, 0)},
  82. bankPath = new RSTile[] { new RSTile(3094, 3476, 0),
  83. new RSTile(3093, 3481, 0),
  84. new RSTile(3090, 3485, 0),
  85. new RSTile(3089, 3490, 0),
  86. new RSTile(3093, 3493, 0)},
  87. firstGatePath = new RSTile[] { new RSTile(3096, 9872, 0),
  88. new RSTile(3096, 9878, 0),
  89. new RSTile(3096, 9883, 0),
  90. new RSTile(3095, 9888, 0),
  91. new RSTile(3095, 9894, 0),
  92. new RSTile(3095, 9900, 0),
  93. new RSTile(3098, 9905, 0),
  94. new RSTile(3102, 9909, 0)},
  95. firstGateRPath = new RSTile[] { new RSTile(3098, 9905, 0),
  96. new RSTile(3095, 9900, 0),
  97. new RSTile(3095, 9894, 0),
  98. new RSTile(3095, 9888, 0),
  99. new RSTile(3096, 9883, 0),
  100. new RSTile(3096, 9878, 0),
  101. new RSTile(3096, 9872, 0),
  102. new RSTile(3096, 9869, 0)},
  103. secondGatePath = new RSTile[] { new RSTile(3109, 9909, 0),
  104. new RSTile(3116, 9910, 0),
  105. new RSTile(3123, 9909, 0),
  106. new RSTile(3129, 9911, 0),
  107. new RSTile(3131, 9914, 0),
  108. new RSTile(3131, 9917, 0)},
  109. secondGateRPath = new RSTile[] { new RSTile(3131, 9914, 0),
  110. new RSTile(3129, 9911, 0),
  111. new RSTile(3123, 9909, 0),
  112. new RSTile(3116, 9910, 0),
  113. new RSTile(3109, 9909, 0),
  114. new RSTile(3105, 9911, 0)},
  115. spiderPath = new RSTile[] { new RSTile(3132, 9922, 0),
  116. new RSTile(3132, 9927, 0),
  117. new RSTile(3132, 9932, 0),
  118. new RSTile(3132, 9937, 0),
  119. new RSTile(3132, 9943, 0),
  120. new RSTile(3130, 9948, 0),
  121. new RSTile(3124, 9951, 0)},
  122. spiderRPath = new RSTile[] {new RSTile(3130, 9948, 0),
  123. new RSTile(3132, 9943, 0),
  124. new RSTile(3132, 9937, 0),
  125. new RSTile(3132, 9932, 0),
  126. new RSTile(3132, 9927, 0),
  127. new RSTile(3133, 9919, 0)},
  128. northPath = new RSTile[] {new RSTile (3120, 9961, 0),
  129. new RSTile (3121, 9956, 0)},
  130. eastPath = new RSTile[] {new RSTile (3110, 9956, 0),
  131. new RSTile (3114, 9958, 0),
  132. new RSTile (3119, 9955, 0)};
  133.  
  134. private final int SPIDER_EGG_ID = 223;
  135.  
  136.  
  137. private final Polygon secondGateArea = new Polygon(
  138. new int[] { 3130, 3134, 3134, 3130 },
  139. new int[] { 9918, 9918, 9915, 9915 },
  140. 4),
  141. secondGateAreaR = new Polygon(
  142. new int[] { 3130, 3134, 3134, 3130 },
  143. new int[] { 9921, 9921, 9918, 9918 },
  144. 4),
  145. firstEggArea = new Polygon(
  146. new int[] { 3116, 3122, 3122, 3116 },
  147. new int[] { 9954, 9954, 9948, 9948 },
  148. 4),
  149. secondEggArea = new Polygon(
  150. new int[] { 3124, 3130, 3130, 3124 },
  151. new int[] { 9959, 9959, 9952, 9952 },
  152. 4),
  153. ladderToFirstGateArea = new Polygon(
  154. new int[] { 3093, 3103, 3103, 3093 },
  155. new int[] { 9915, 9915, 9867, 9867 },
  156. 4),
  157. firstGateToSecondGateArea = new Polygon(
  158. new int[] { 3102, 3135, 3135, 3102 },
  159. new int[] { 9918, 9918, 9905, 9905 },
  160. 4),
  161. secondGateToSpidersArea = new Polygon(
  162. new int[] { 3130, 3136, 3136, 3130 },
  163. new int[] { 9948, 9948, 9916, 9916 },
  164. 4);
  165.  
  166. // MISC METHODS
  167.  
  168. public boolean logout()
  169. {
  170. if (Login.getLoginState() == Login.STATE.INGAME)
  171. {
  172. Login.logout();
  173. for(int x = 0; x < 6; x++)
  174. {
  175. if(loggedOut())
  176. {
  177. return true;
  178. }
  179. sleep(490,510);
  180. }
  181. }
  182. return false;
  183. }
  184.  
  185. public boolean waitFor(Condition c, long timeout) {
  186. Timer t = new Timer(timeout);
  187. while (t.isRunning()) {
  188. if (c.active()) {
  189. return true;
  190. }
  191. sleep(60, 80);
  192. }
  193. return false;
  194. }
  195.  
  196. public boolean loggedOut() {
  197. return (Login.getLoginState() == Login.STATE.LOGINSCREEN)
  198. && (!Screen.getColorAt(100, 200).equals(new Color(0, 0, 0)));
  199. }
  200.  
  201. // ANTI-BAN BY SOKCRA
  202. public void antiBan(int rotation) {
  203. int number = General.random(1, 500);
  204. sleep(200);
  205. switch (number) {
  206. case 1:
  207. case 2:
  208. case 3:
  209. case 4:
  210. case 5:
  211. Camera.setCameraRotation(Camera.getCameraRotation() + rotation);
  212. break;
  213. case 20:
  214. case 21:
  215. case 22:
  216. case 23:
  217. case 24:
  218. case 25:
  219. case 26:
  220. case 27:
  221. case 28:
  222. case 29:
  223. case 30:
  224. case 31:
  225. Mouse.move(General.random(100, 200), General.random(200, 400));
  226. sleep(200);
  227. break;
  228. case 50:
  229. GameTab.open(TABS.INVENTORY);
  230. sleep(200);
  231. break;
  232. case 75:
  233. GameTab.open(TABS.STATS);
  234. sleep(300);
  235. Mouse.moveBox(678, 386, 725, 366);
  236. sleep(1000, 1500);
  237. GameTab.open(TABS.INVENTORY);
  238. break;
  239. case 76:
  240. GameTab.open(TABS.FRIENDS);
  241. sleep(2000, 3000);
  242. GameTab.open(TABS.INVENTORY);
  243. break;
  244. case 89:
  245. case 90:
  246. case 91:
  247. case 92:
  248. case 93:
  249. case 94:
  250. Camera.setCameraAngle(Camera.getCameraRotation() + rotation);
  251. sleep(200, 400);
  252. break;
  253. case 95:
  254. case 96:
  255. case 97:
  256. case 98:
  257. case 99:
  258. case 100:
  259. Camera.setCameraAngle(Camera.getCameraRotation() + rotation);
  260. sleep(200, 400);
  261. break;
  262. }
  263. }
  264.  
  265. //AREA CHECKS
  266.  
  267. private boolean closeToDestination(RSTile whichTile, int radius){
  268. return myPos.distanceTo(whichTile) < radius;
  269. }
  270.  
  271. private boolean areaContainsPlayer(Polygon area){
  272. return area.contains(Player.getPosition().getX(), Player.getPosition().getY());
  273. }
  274.  
  275. //WALKING METHODS
  276.  
  277. private void walkDestination(final RSTile[] whichPath, final RSTile whichTile, final Polygon whichArea, final int radius) {
  278. if (myPos != whichTile && !Player.isMoving()) {
  279. sleep(50, 100);
  280. if (Walking.walkPath(whichPath)) {
  281. waitFor(new Condition() {
  282. @Override
  283. public boolean active() {
  284. return areaContainsPlayer(whichArea) && closeToDestination(whichTile, radius) && !Player.isMoving();
  285. }
  286. }, 2000);
  287. }
  288. }
  289. }
  290.  
  291. private void walkDestinationCustom(final RSTile[] whichPath, final RSTile whichTile, final int radius) {
  292. if (myPos != whichTile) {
  293. sleep(50, 100);
  294. if (Walking.walkPath(whichPath)) {
  295. waitFor(new Condition() {
  296. @Override
  297. public boolean active() {
  298. return closeToDestination(whichTile, radius);
  299. }
  300. }, 4000);
  301. }
  302. }
  303. }
  304.  
  305. // CHECK AREA METHODS
  306.  
  307. private boolean atEdgeArea() {
  308. RSTile myPos = Player.getPosition();
  309. return myPos.distanceTo(EDGE_TILE) < 14;
  310. }
  311.  
  312. private boolean atLadderToFirstGateArea() {
  313. return ladderToFirstGateArea.contains(Player.getPosition().getX(),
  314. Player.getPosition().getY());
  315. }
  316.  
  317. private boolean atFirstGateToSecondGateArea() {
  318. return firstGateToSecondGateArea.contains(Player.getPosition().getX(),
  319. Player.getPosition().getY());
  320. }
  321.  
  322. private boolean atSecondGateToSpidersArea() {
  323. return secondGateToSpidersArea.contains(Player.getPosition().getX(),
  324. Player.getPosition().getY());
  325. }
  326.  
  327. private boolean atBank() {
  328. RSTile myPos = Player.getPosition();
  329. return myPos.distanceTo(EDGE_BANK) < 6;
  330. }
  331.  
  332. private boolean atLadderUp() {
  333. RSTile myPos = Player.getPosition();
  334. return myPos.distanceTo(TRAPDOOR_TILE_UP) < 6;
  335. }
  336.  
  337. private boolean atLadderDown() {
  338. RSTile myPos = Player.getPosition();
  339. return myPos.distanceTo(LADDER_TILE_DOWN) < 4;
  340. }
  341.  
  342. private boolean atFirstGate() {
  343. RSTile myPos = Player.getPosition();
  344. return myPos.distanceTo(FIRST_GATE_TILE) < 5;
  345. }
  346.  
  347. private boolean atFirstGateR() {
  348. RSTile myPos = Player.getPosition();
  349. return myPos.distanceTo(FIRST_GATE_TILE_R) < 3;
  350. }
  351.  
  352. private boolean atSecondGate() {
  353. return secondGateArea.contains(Player.getPosition().getX(), Player
  354. .getPosition().getY());
  355. }
  356.  
  357. private boolean atSecondGateR() {
  358. return secondGateAreaR.contains(Player.getPosition().getX(), Player
  359. .getPosition().getY());
  360. }
  361.  
  362. private boolean atFirstEggArea() {
  363. RSTile myPos = Player.getPosition();
  364. return myPos.distanceTo(FIRST_EGG_TILE) < 4;
  365. }
  366.  
  367. private boolean atSecondEggArea() {
  368. RSTile myPos = Player.getPosition();
  369. return myPos.distanceTo(SECOND_EGG_TILE) < 4;
  370. }
  371.  
  372. private boolean atSpiderArea() {
  373. RSTile myPos = Player.getPosition();
  374. return myPos.distanceTo(SPIDER_AREA_TILE) < 10;
  375. }
  376.  
  377. // BANKING METHODS
  378.  
  379. private boolean openBank() {
  380. eggsCollected += Inventory.getCount(SPIDER_EGG_ID);
  381. if (!Banking.isBankScreenOpen()) {
  382. return Banking.openBankBooth();
  383. } else {
  384. if (Banking.isBankScreenOpen());
  385. return false;
  386. }
  387. }
  388.  
  389. private void depositEggs() {
  390. RSItem[] spiderEgg = Inventory.find(spiderEggName);
  391. if (spiderEgg != null && spiderEgg.length > 0
  392. && Banking.isBankScreenOpen()) {
  393. Banking.depositAll();
  394. }
  395. }
  396.  
  397. private boolean withdrawFood(boolean r) {
  398. return r;
  399. }
  400.  
  401. private boolean withdrawFoodAmount(int a) {
  402. return Banking.withdraw(a, lobsterName);
  403. }
  404.  
  405. // WALKING METHODS
  406.  
  407. private void walkToEggs1() {
  408. RSTile myPos = Player.getPosition();
  409. RSTile eggTile1 = new RSTile(3118, 9948, 0);
  410. Walking.setControlClick(true);
  411. if (myPos != eggTile1 && !Player.isMoving()) {
  412. if (Walking.walkTo(eggTile1)) {
  413. waitFor(new Condition() {
  414. @Override
  415. public boolean active() {
  416. return atFirstEggArea() && !Player.isMoving();
  417. }
  418. }, 2000);
  419. }
  420. }
  421. }
  422.  
  423. private void walkToEggs2() {
  424. RSTile myPos = Player.getPosition();
  425. RSTile eggTile2 = new RSTile(3128, 9956, 0);
  426. if (myPos != eggTile2 && !Player.isMoving()) {
  427. if (Walking.walkTo(eggTile2)) {
  428. waitFor(new Condition() {
  429. @Override
  430. public boolean active() {
  431. return atSecondEggArea() && !Player.isMoving();
  432. }
  433. }, 2000);
  434. }
  435. }
  436. }
  437.  
  438. // GATES, LADDERS EN TRAPDOORS
  439.  
  440. private void climbDownTrapdoor() {
  441. RSObject[] trapdoorOpen = Objects.findNearest(6, trapdoorName);
  442. boolean top = org.tribot.api2007.Game.isUptext("Open"),
  443. climbdown = org.tribot.api2007.Game.isUptext("Climb-down");
  444. if (trapdoorOpen != null && trapdoorOpen.length > 0) {
  445. if (trapdoorOpen[0].hover()) {
  446. if (top || climbdown){
  447. Mouse.click(1);
  448. waitFor(new Condition() {
  449. @Override
  450. public boolean active() {
  451. return !Player.isMoving();
  452. }
  453. }, 2000);
  454. }
  455. }
  456. }
  457. }
  458.  
  459. private void climbUpLadder() {
  460. RSObject[] ladderUp = Objects.findNearest(8, ladderName);
  461. if (ladderUp != null && ladderUp.length > 0) {
  462. if (DynamicClicking.clickRSObject(ladderUp[0], "Climb-up")) {
  463. waitFor(new Condition() {
  464. @Override
  465. public boolean active() {
  466. return atLadderUp();
  467. }
  468. }, 2000);
  469. }
  470. }
  471. }
  472.  
  473. private boolean isFirstGateOpen() {
  474. RSObject[] firstGateOpen = Objects.findNearest(8, gateName);
  475. boolean open = org.tribot.api2007.Game.isUptext("Close");
  476. return firstGateOpen != null && firstGateOpen.length > 0 && open;
  477. }
  478.  
  479. private void goThroughFirstGate() {
  480. RSObject[] firstGate = Objects.findNearest(3, gateName);
  481. boolean closed = org.tribot.api2007.Game.isUptext("Open");
  482. if (firstGate != null && firstGate.length > 0) {
  483. if (firstGate[0].hover()) {
  484. if (closed) {
  485. Mouse.click(1);
  486. waitFor(new Condition() {
  487. @Override
  488. public boolean active() {
  489. return isFirstGateOpen();
  490. }
  491. }, 2000);
  492. }
  493. }
  494. }
  495. }
  496.  
  497. private void goThroughSecondGate() {
  498. RSObject[] secondGate = Objects.findNearest(8, gateName);
  499. if (secondGate != null && secondGate.length > 0) {
  500. if (DynamicClicking.clickRSObject(secondGate[0], "Open")) {
  501. waitFor(new Condition() {
  502. @Override
  503. public boolean active() {
  504. return atSecondGateR() && !Player.isMoving();
  505. }
  506. }, 2000);
  507. }
  508. }
  509. }
  510.  
  511. private void goThroughSecondGateR() {
  512. RSObject[] secondGate = Objects.findNearest(8, gateName);
  513. if (secondGate != null && secondGate.length > 0) {
  514. for (int i = 0; i < secondGate.length; i++) {
  515. if (DynamicClicking.clickRSObject(secondGate[0], "Open")) {
  516. waitFor(new Condition() {
  517. @Override
  518. public boolean active() {
  519. return atSecondGate() && !Player.isMoving();
  520. }
  521. }, 2000);
  522. }
  523. }
  524. }
  525. }
  526.  
  527. // ITEM METHODS
  528.  
  529. private boolean foodInInvent() {
  530. RSItem[] food = Inventory.find(lobsterName);
  531. return food != null && food.length > 0;
  532. }
  533.  
  534. public RSTile getEggPosition() {
  535. RSGroundItem[] eggs = GroundItems.find(spiderEggName);
  536. return eggs[0].getPosition();
  537. }
  538.  
  539. private boolean areEggsThereArea1() {
  540. RSGroundItem[] eggs = GroundItems.find(spiderEggName);
  541. if (eggs != null && eggs.length > 0) {
  542. if (firstEggArea.contains(eggs[0].getPosition().getX(), eggs[0]
  543. .getPosition().getY())) {
  544. return true;
  545. }
  546. }
  547. return false;
  548. }
  549.  
  550. private boolean areEggsThereArea2() {
  551. RSGroundItem[] eggs = GroundItems.find(spiderEggName);
  552. if (eggs != null && eggs.length > 0) {
  553. if (secondEggArea.contains(eggs[0].getPosition().getX(), eggs[0]
  554. .getPosition().getY())) {
  555. return true;
  556. }
  557. }
  558. return false;
  559. }
  560.  
  561. public boolean gainedEgg() {
  562. int invCount = Inventory.getAll().length;
  563. return Inventory.getAll().length > invCount;
  564. }
  565.  
  566. public boolean ateFood() {
  567. int invCount = Inventory.getAll().length;
  568. return Inventory.getAll().length < invCount;
  569. }
  570.  
  571. private void pickUpEggs() {
  572. RSGroundItem[] egg = GroundItems.findNearest(spiderEggName);
  573. RSTile myPos = Player.getPosition();
  574. if (egg != null && egg.length > 0) {
  575. for (int i = 0; i < egg.length; i++) {
  576. if (myPos.distanceTo(getEggPosition()) < 6) {
  577. if (DynamicClicking.clickRSTile(egg[i],
  578. "Take Red spiders' egg")) {
  579. waitFor(new Condition() {
  580. @Override
  581. public boolean active() {
  582. return gainedEgg() || Inventory.isFull();
  583. }
  584. }, 2000);
  585. }
  586. }
  587. }
  588. }
  589.  
  590. }
  591.  
  592. // COMBAT RELATED AND HEALTH RELATED METHODS
  593.  
  594. private boolean eatEverything(boolean q) {
  595. return q;
  596. }
  597.  
  598. private void eatAllFood() {
  599. RSItem[] food = Inventory.find(lobsterName);
  600. if (food != null && food.length > 0) {
  601. for (int i = 0; i < food.length; i++) {
  602. if (food[0].click("Eat")){
  603. waitFor(new Condition(){
  604. @Override
  605. public boolean active(){
  606. return ateFood();
  607. }
  608. }, 1000);
  609. }
  610. }
  611. }
  612. }
  613.  
  614. private boolean checkHealth(int p) {
  615. int percentage = Combat.getHPRatio();
  616. return percentage < p;
  617. }
  618.  
  619. private boolean eatFood() {
  620. RSItem[] food = Inventory.find(lobsterName);
  621. for (int i = 0; i < food.length; i++) {
  622. if (checkHealth(eatPercent)) {
  623. return food[i].click("Eat");
  624. }
  625. }
  626. return false;
  627. }
  628.  
  629. // GUI STUFF
  630.  
  631. class spiderGUI extends javax.swing.JFrame {
  632.  
  633. /**
  634. * Creates new form spiderGUI
  635. */
  636. public spiderGUI() {
  637. initComponents();
  638. }
  639.  
  640. /**
  641. * This method is called from within the constructor to initialize the
  642. * form. WARNING: Do NOT modify this code. The content of this method is
  643. * always regenerated by the Form Editor.
  644. */
  645. @SuppressWarnings("unchecked")
  646. // <editor-fold defaultstate="collapsed" desc="Generated Code">
  647. private void initComponents() {
  648.  
  649. jPanel1 = new javax.swing.JPanel();
  650. jLabel4 = new javax.swing.JLabel();
  651. jScrollPane1 = new javax.swing.JScrollPane();
  652. jTextArea1 = new javax.swing.JTextArea();
  653. jButton1 = new javax.swing.JButton();
  654. jLabel1 = new javax.swing.JLabel();
  655. jPanel2 = new javax.swing.JPanel();
  656. jLabel2 = new javax.swing.JLabel();
  657. jLabel3 = new javax.swing.JLabel();
  658. jLabel5 = new javax.swing.JLabel();
  659. withdrawAmount = new javax.swing.JTextField();
  660. eatPercentage = new javax.swing.JTextField();
  661. jLabel6 = new javax.swing.JLabel();
  662. jRadioButton1 = new javax.swing.JRadioButton();
  663. jRadioButton2 = new javax.swing.JRadioButton();
  664. isReady = new javax.swing.JButton();
  665.  
  666. javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(
  667. jPanel1);
  668. jPanel1.setLayout(jPanel1Layout);
  669. jPanel1Layout.setHorizontalGroup(jPanel1Layout.createParallelGroup(
  670. javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 100,
  671. Short.MAX_VALUE));
  672. jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(
  673. javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 100,
  674. Short.MAX_VALUE));
  675.  
  676. jLabel4.setFont(new java.awt.Font("Forte", 0, 18)); // NOI18N
  677. jLabel4.setForeground(new java.awt.Color(149, 26, 12));
  678. jLabel4.setText("Amount to withdraw?");
  679.  
  680. jTextArea1.setColumns(20);
  681. jTextArea1.setRows(5);
  682. jScrollPane1.setViewportView(jTextArea1);
  683.  
  684. jButton1.setText("jButton1");
  685.  
  686. setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
  687. setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
  688. setForeground(java.awt.Color.red);
  689.  
  690. jLabel1.setFont(new java.awt.Font("Forte", 3, 24)); // NOI18N
  691. jLabel1.setForeground(new java.awt.Color(149, 26, 12));
  692. jLabel1.setText("ok_spiderEgg GUI");
  693.  
  694. jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
  695.  
  696. jLabel2.setFont(new java.awt.Font("Forte", 0, 18)); // NOI18N
  697. jLabel2.setForeground(new java.awt.Color(149, 26, 12));
  698. jLabel2.setText("Amount to withdraw?");
  699.  
  700. jLabel3.setFont(new java.awt.Font("Forte", 0, 18)); // NOI18N
  701. jLabel3.setForeground(new java.awt.Color(149, 26, 12));
  702. jLabel3.setText("Eat when inv full?");
  703.  
  704. jLabel5.setFont(new java.awt.Font("Forte", 0, 18)); // NOI18N
  705. jLabel5.setForeground(new java.awt.Color(149, 26, 12));
  706. jLabel5.setText("HP percentage to eat at?");
  707.  
  708. withdrawAmount.setFont(new java.awt.Font("Tahoma", 3, 11)); // NOI18N
  709. withdrawAmount.setForeground(new java.awt.Color(149, 26, 12));
  710. withdrawAmount.setText("6");
  711. withdrawAmount
  712. .addActionListener(new java.awt.event.ActionListener() {
  713. public void actionPerformed(
  714. java.awt.event.ActionEvent evt) {
  715. withdrawAmountActionPerformed(evt);
  716. }
  717. });
  718.  
  719. eatPercentage.setFont(new java.awt.Font("Tahoma", 3, 11)); // NOI18N
  720. eatPercentage.setForeground(new java.awt.Color(149, 26, 12));
  721. eatPercentage.setText("60");
  722. eatPercentage
  723. .addActionListener(new java.awt.event.ActionListener() {
  724. public void actionPerformed(
  725. java.awt.event.ActionEvent evt) {
  726. eatPercentageActionPerformed(evt);
  727. }
  728. });
  729.  
  730. jLabel6.setFont(new java.awt.Font("Forte", 0, 18)); // NOI18N
  731. jLabel6.setForeground(new java.awt.Color(149, 26, 12));
  732. jLabel6.setText("Withdraw food?");
  733.  
  734. jRadioButton2
  735. .addActionListener(new java.awt.event.ActionListener() {
  736. public void actionPerformed(
  737. java.awt.event.ActionEvent evt) {
  738. jRadioButton2ActionPerformed(evt);
  739. }
  740. });
  741.  
  742. javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(
  743. jPanel2);
  744. jPanel2.setLayout(jPanel2Layout);
  745. jPanel2Layout
  746. .setHorizontalGroup(jPanel2Layout
  747. .createParallelGroup(
  748. javax.swing.GroupLayout.Alignment.LEADING)
  749. .addGroup(
  750. jPanel2Layout
  751. .createSequentialGroup()
  752. .addGap(23, 23, 23)
  753. .addGroup(
  754. jPanel2Layout
  755. .createParallelGroup(
  756. javax.swing.GroupLayout.Alignment.LEADING)
  757. .addComponent(
  758. jLabel2)
  759. .addComponent(
  760. jLabel5)
  761. .addComponent(
  762. jLabel6,
  763. javax.swing.GroupLayout.PREFERRED_SIZE,
  764. 132,
  765. javax.swing.GroupLayout.PREFERRED_SIZE)
  766. .addComponent(
  767. jLabel3))
  768. .addPreferredGap(
  769. javax.swing.LayoutStyle.ComponentPlacement.RELATED,
  770. 72, Short.MAX_VALUE)
  771. .addGroup(
  772. jPanel2Layout
  773. .createParallelGroup(
  774. javax.swing.GroupLayout.Alignment.LEADING)
  775. .addGroup(
  776. javax.swing.GroupLayout.Alignment.TRAILING,
  777. jPanel2Layout
  778. .createSequentialGroup()
  779. .addGroup(
  780. jPanel2Layout
  781. .createParallelGroup(
  782. javax.swing.GroupLayout.Alignment.LEADING)
  783. .addComponent(
  784. withdrawAmount,
  785. javax.swing.GroupLayout.Alignment.TRAILING,
  786. javax.swing.GroupLayout.PREFERRED_SIZE,
  787. 57,
  788. javax.swing.GroupLayout.PREFERRED_SIZE)
  789. .addComponent(
  790. eatPercentage,
  791. javax.swing.GroupLayout.Alignment.TRAILING,
  792. javax.swing.GroupLayout.PREFERRED_SIZE,
  793. 57,
  794. javax.swing.GroupLayout.PREFERRED_SIZE))
  795. .addGap(54,
  796. 54,
  797. 54))
  798. .addGroup(
  799. javax.swing.GroupLayout.Alignment.TRAILING,
  800. jPanel2Layout
  801. .createSequentialGroup()
  802. .addGroup(
  803. jPanel2Layout
  804. .createParallelGroup(
  805. javax.swing.GroupLayout.Alignment.LEADING)
  806. .addComponent(
  807. jRadioButton1)
  808. .addComponent(
  809. jRadioButton2))
  810. .addGap(72,
  811. 72,
  812. 72)))));
  813. jPanel2Layout
  814. .setVerticalGroup(jPanel2Layout
  815. .createParallelGroup(
  816. javax.swing.GroupLayout.Alignment.LEADING)
  817. .addGroup(
  818. jPanel2Layout
  819. .createSequentialGroup()
  820. .addContainerGap(21,
  821. Short.MAX_VALUE)
  822. .addGroup(
  823. jPanel2Layout
  824. .createParallelGroup(
  825. javax.swing.GroupLayout.Alignment.TRAILING)
  826. .addComponent(
  827. jLabel6,
  828. javax.swing.GroupLayout.PREFERRED_SIZE,
  829. 32,
  830. javax.swing.GroupLayout.PREFERRED_SIZE)
  831. .addComponent(
  832. jRadioButton1))
  833. .addPreferredGap(
  834. javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  835. .addGroup(
  836. jPanel2Layout
  837. .createParallelGroup(
  838. javax.swing.GroupLayout.Alignment.TRAILING)
  839. .addComponent(
  840. jLabel3,
  841. javax.swing.GroupLayout.PREFERRED_SIZE,
  842. 32,
  843. javax.swing.GroupLayout.PREFERRED_SIZE)
  844. .addComponent(
  845. jRadioButton2))
  846. .addGap(8, 8, 8)
  847. .addGroup(
  848. jPanel2Layout
  849. .createParallelGroup(
  850. javax.swing.GroupLayout.Alignment.BASELINE)
  851. .addComponent(
  852. jLabel2,
  853. javax.swing.GroupLayout.PREFERRED_SIZE,
  854. 32,
  855. javax.swing.GroupLayout.PREFERRED_SIZE)
  856. .addComponent(
  857. withdrawAmount,
  858. javax.swing.GroupLayout.PREFERRED_SIZE,
  859. javax.swing.GroupLayout.DEFAULT_SIZE,
  860. javax.swing.GroupLayout.PREFERRED_SIZE))
  861. .addPreferredGap(
  862. javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  863. .addGroup(
  864. jPanel2Layout
  865. .createParallelGroup(
  866. javax.swing.GroupLayout.Alignment.BASELINE)
  867. .addComponent(
  868. jLabel5,
  869. javax.swing.GroupLayout.PREFERRED_SIZE,
  870. 32,
  871. javax.swing.GroupLayout.PREFERRED_SIZE)
  872. .addComponent(
  873. eatPercentage,
  874. javax.swing.GroupLayout.PREFERRED_SIZE,
  875. javax.swing.GroupLayout.DEFAULT_SIZE,
  876. javax.swing.GroupLayout.PREFERRED_SIZE))));
  877.  
  878. isReady.setFont(new java.awt.Font("Forte", 3, 18)); // NOI18N
  879. isReady.setForeground(new java.awt.Color(149, 26, 12));
  880. isReady.setText("Start");
  881. isReady.addActionListener(new java.awt.event.ActionListener() {
  882. public void actionPerformed(java.awt.event.ActionEvent evt) {
  883. isReadyActionPerformed(evt);
  884. }
  885. });
  886.  
  887. javax.swing.GroupLayout layout = new javax.swing.GroupLayout(
  888. getContentPane());
  889. getContentPane().setLayout(layout);
  890. layout.setHorizontalGroup(layout
  891. .createParallelGroup(
  892. javax.swing.GroupLayout.Alignment.LEADING)
  893. .addComponent(jPanel2,
  894. javax.swing.GroupLayout.DEFAULT_SIZE,
  895. javax.swing.GroupLayout.DEFAULT_SIZE,
  896. Short.MAX_VALUE)
  897. .addGroup(
  898. layout.createSequentialGroup()
  899. .addGap(85, 85, 85)
  900. .addComponent(
  901. jLabel1,
  902. javax.swing.GroupLayout.PREFERRED_SIZE,
  903. 219,
  904. javax.swing.GroupLayout.PREFERRED_SIZE)
  905. .addContainerGap(
  906. javax.swing.GroupLayout.DEFAULT_SIZE,
  907. Short.MAX_VALUE))
  908. .addGroup(
  909. javax.swing.GroupLayout.Alignment.TRAILING,
  910. layout.createSequentialGroup()
  911. .addContainerGap()
  912. .addComponent(
  913. isReady,
  914. javax.swing.GroupLayout.DEFAULT_SIZE,
  915. javax.swing.GroupLayout.DEFAULT_SIZE,
  916. Short.MAX_VALUE).addContainerGap()));
  917. layout.setVerticalGroup(layout
  918. .createParallelGroup(
  919. javax.swing.GroupLayout.Alignment.LEADING)
  920. .addGroup(
  921. layout.createSequentialGroup()
  922. .addContainerGap()
  923. .addComponent(
  924. jLabel1,
  925. javax.swing.GroupLayout.PREFERRED_SIZE,
  926. 51,
  927. javax.swing.GroupLayout.PREFERRED_SIZE)
  928. .addPreferredGap(
  929. javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  930. .addComponent(
  931. jPanel2,
  932. javax.swing.GroupLayout.PREFERRED_SIZE,
  933. javax.swing.GroupLayout.DEFAULT_SIZE,
  934. javax.swing.GroupLayout.PREFERRED_SIZE)
  935. .addPreferredGap(
  936. javax.swing.LayoutStyle.ComponentPlacement.RELATED,
  937. javax.swing.GroupLayout.DEFAULT_SIZE,
  938. Short.MAX_VALUE)
  939. .addComponent(isReady).addContainerGap()));
  940.  
  941. pack();
  942. }// </editor-fold>
  943.  
  944. private void withdrawAmountActionPerformed(
  945. java.awt.event.ActionEvent evt) {
  946. // TODO add your handling code here:
  947. }
  948.  
  949. private void eatPercentageActionPerformed(java.awt.event.ActionEvent evt) {
  950. // TODO add your handling code here:
  951. }
  952.  
  953. private void jRadioButton2ActionPerformed(java.awt.event.ActionEvent evt) {
  954. // TODO add your handling code here:
  955. }
  956.  
  957. private void isReadyActionPerformed(java.awt.event.ActionEvent evt) { // TODO
  958. // etc
  959. // etc
  960.  
  961. if (jRadioButton1.isSelected()) {
  962. withdrawFoodTrue = true;
  963. }
  964.  
  965. if (jRadioButton2.isSelected()) {
  966. eatFully = true;
  967. }
  968.  
  969. ok_spiderEgg.this.eatPercent = Integer.parseInt(this.eatPercentage
  970. .getText());
  971. ok_spiderEgg.this.withdrawFoodies = Integer
  972. .parseInt(this.withdrawAmount.getText());
  973.  
  974. waitGUI = false;
  975.  
  976. }
  977.  
  978. // Variables declaration - do not modify
  979. private javax.swing.JTextField eatPercentage;
  980. private javax.swing.JButton isReady;
  981. private javax.swing.JButton jButton1;
  982. private javax.swing.JLabel jLabel1;
  983. private javax.swing.JLabel jLabel2;
  984. private javax.swing.JLabel jLabel3;
  985. private javax.swing.JLabel jLabel4;
  986. private javax.swing.JLabel jLabel5;
  987. private javax.swing.JLabel jLabel6;
  988. private javax.swing.JPanel jPanel1;
  989. private javax.swing.JPanel jPanel2;
  990. private javax.swing.JRadioButton jRadioButton1;
  991. private javax.swing.JRadioButton jRadioButton2;
  992. private javax.swing.JScrollPane jScrollPane1;
  993. private javax.swing.JTextArea jTextArea1;
  994. private javax.swing.JTextField withdrawAmount;
  995. // End of variables declaration
  996. }
  997.  
  998. // PAINTSTUFF
  999.  
  1000. private Image getImage(String url) {
  1001. try {
  1002. return ImageIO.read(new URL(url));
  1003. } catch (IOException e) {
  1004. return null;
  1005. }
  1006. }
  1007.  
  1008. private final Image img = getImage("http://i40.tinypic.com/2whjrqw.jpg");
  1009. private static final long startTime = System.currentTimeMillis();
  1010. private int eggsCollected;
  1011.  
  1012. // Manual price, will put this in the GUI in a later version!
  1013.  
  1014. Font font = new Font("Forte", Font.PLAIN, 18);
  1015.  
  1016. @Override
  1017. public void onPaint(Graphics g) {
  1018.  
  1019. Graphics2D gg = (Graphics2D) g;
  1020. gg.drawImage(img, 9, 345, null);
  1021.  
  1022. long timeRan = System.currentTimeMillis() - startTime;
  1023. double multiplier = timeRan / 3600000D;
  1024. int eggs = eggsCollected;
  1025. int price = 230;
  1026.  
  1027. g.setFont(font);
  1028. g.setColor(new Color(149, 26, 12));
  1029. g.drawString("Action: " + SCRIPT_STATE, 14, 395);
  1030. g.drawString("Time running: " + Timing.msToString(timeRan), 14, 410);
  1031. g.drawString("Spider eggs p/h: " + (int) (eggs / multiplier) + " p/h",
  1032. 14, 425);
  1033. g.drawString(
  1034. "Profit p/h: " + ((int) (eggs / multiplier) * price) + "K", 14,
  1035. 440);
  1036. g.drawString("Spider eggs collected: " + eggs, 14, 455);
  1037. g.drawString("Profit made: " + ((double) (eggs * price) / 1000) + "K",
  1038. 14, 470);
  1039.  
  1040. }
  1041.  
  1042. public enum State {
  1043. OPENING_BANK, BANKING_EGGS,
  1044. WALKING_TO_TRAPDOOR,
  1045. OPENING_TRAPDOOR, CLIMBING_DOWN_TRAPDOOR,
  1046. WALKING_TO_FIRST_GATE, OPENING_FIRST_GATE,
  1047. WALKING_TO_SECOND_GATE, OPENING_SECOND_GATE,
  1048. WALKING_TO_SPIDERS, WALKING_TO_EGGS_1,
  1049. WALKING_TO_EGGS_2, PICKING_UP_EGGS,
  1050. WALKING_TO_SECOND_GATE_R,
  1051. OPENING_SECOND_GATE_R, OPENING_FIRST_GATE_R,
  1052. WALKING_TO_LADDER, CLIMBING_UP_LADDER, WALKING_TO_BANK,
  1053. WAITING_FOR_EGGS, WITHDRAWING_FOOD, EATING,
  1054. CLEARING_SPACE_IN_INVENTORY, CLOSING_BANK,
  1055. WALKING_TO_SPIDERS_R, LOGING_OUT,
  1056. WALKING_BACK_FROM_NORTH, WALKING_BACK_FROM_EAST;
  1057. }
  1058.  
  1059. private State getState() {
  1060. if (closeToDestination(OUT_OF_BOUND_TILE_NORTH, 5)){
  1061. return State.WALKING_BACK_FROM_NORTH;
  1062. }
  1063. if (closeToDestination(OUT_OF_BOUND_TILE_EAST, 9)){
  1064. return State.WALKING_BACK_FROM_EAST;
  1065. }
  1066. if (atBank()) {
  1067. if (Inventory.isFull()) {
  1068. if (!Banking.isBankScreenOpen()) {
  1069. return State.OPENING_BANK;
  1070. }
  1071. if (Banking.isBankScreenOpen()) {
  1072. return State.BANKING_EGGS;
  1073. }
  1074. }
  1075. if (Banking.isBankScreenOpen() && !Inventory.isFull()
  1076. && !withdrawFood(withdrawFoodTrue)) {
  1077. return State.CLOSING_BANK;
  1078. }
  1079. if (!Banking.isBankScreenOpen() && !Inventory.isFull()
  1080. && !withdrawFood(withdrawFoodTrue)) {
  1081. return State.WALKING_TO_TRAPDOOR;
  1082. }
  1083. if (!Banking.isBankScreenOpen() && !Inventory.isFull()
  1084. && withdrawFood(withdrawFoodTrue) && !foodInInvent()) {
  1085. return State.OPENING_BANK;
  1086. }
  1087. if (Banking.isBankScreenOpen() && !Inventory.isFull()
  1088. && withdrawFood(withdrawFoodTrue) && !foodInInvent()) {
  1089. return State.WITHDRAWING_FOOD;
  1090. }
  1091. if (Banking.isBankScreenOpen() && !Inventory.isFull()
  1092. && withdrawFood(withdrawFoodTrue) && foodInInvent()) {
  1093. return State.CLOSING_BANK;
  1094. }
  1095. if (!Banking.isBankScreenOpen() && !Inventory.isFull()
  1096. && withdrawFood(withdrawFoodTrue) && foodInInvent()) {
  1097. return State.WALKING_TO_TRAPDOOR;
  1098. }
  1099. }
  1100. if (atLadderUp()) {
  1101. if (Inventory.isFull()) {
  1102. return State.WALKING_TO_BANK;
  1103. }
  1104. if (!Inventory.isFull()) {
  1105. return State.CLIMBING_DOWN_TRAPDOOR;
  1106. }
  1107. }
  1108. if (atLadderDown()) {
  1109. if (Inventory.isFull()) {
  1110. return State.CLIMBING_UP_LADDER;
  1111. }
  1112. if (!Inventory.isFull()) {
  1113. return State.WALKING_TO_FIRST_GATE;
  1114. }
  1115. }
  1116. if (atFirstGate()) {
  1117. if (!Inventory.isFull() && !isFirstGateOpen()) {
  1118. return State.OPENING_FIRST_GATE;
  1119. }
  1120. if (!Inventory.isFull() && isFirstGateOpen()) {
  1121. return State.WALKING_TO_SECOND_GATE;
  1122. }
  1123. }
  1124. if (atFirstGateR()) {
  1125. if (!Inventory.isFull()) {
  1126. return State.WALKING_TO_SECOND_GATE;
  1127. }
  1128. if (Inventory.isFull() && !isFirstGateOpen()) {
  1129. return State.OPENING_FIRST_GATE_R;
  1130. }
  1131. if (Inventory.isFull() && isFirstGateOpen()) {
  1132. return State.WALKING_TO_LADDER;
  1133. }
  1134. }
  1135. if (atSecondGate()) {
  1136. if (!Inventory.isFull()) {
  1137. return State.OPENING_SECOND_GATE;
  1138. }
  1139. if (Inventory.isFull()) {
  1140. return State.WALKING_TO_SECOND_GATE_R;
  1141. }
  1142. }
  1143. if (atSecondGateR()) {
  1144. if (!Inventory.isFull()) {
  1145. return State.WALKING_TO_SPIDERS;
  1146. }
  1147. if (Inventory.isFull()) {
  1148. return State.OPENING_SECOND_GATE_R;
  1149. }
  1150. }
  1151. if (atSpiderArea()) {
  1152. if (!Inventory.isFull() && !areEggsThereArea1()
  1153. && !areEggsThereArea2()) {
  1154. return State.WAITING_FOR_EGGS;
  1155. }
  1156. if (!Inventory.isFull() && !atFirstEggArea() && !atSecondEggArea()
  1157. && areEggsThereArea1()) {
  1158. return State.WALKING_TO_EGGS_1;
  1159. }
  1160. if (!Inventory.isFull() && atFirstEggArea() && areEggsThereArea1()) {
  1161. return State.PICKING_UP_EGGS;
  1162. }
  1163. if (!Inventory.isFull() && atFirstEggArea() && !areEggsThereArea1()) {
  1164. return State.WALKING_TO_EGGS_2;
  1165. }
  1166. if (!Inventory.isFull() && atSecondEggArea() && areEggsThereArea2()) {
  1167. return State.PICKING_UP_EGGS;
  1168. }
  1169. if (!Inventory.isFull() && atSecondEggArea()
  1170. && !areEggsThereArea2()) {
  1171. return State.WALKING_TO_EGGS_1;
  1172. }
  1173. if (Inventory.isFull() && !foodInInvent()) {
  1174. return State.WALKING_TO_SPIDERS_R;
  1175. }
  1176. if (Inventory.isFull() && eatEverything(eatFully) && foodInInvent()) {
  1177. return State.CLEARING_SPACE_IN_INVENTORY;
  1178. }
  1179. if (checkHealth(eatPercent) && foodInInvent()) {
  1180. return State.EATING;
  1181. }
  1182. if (checkHealth(eatPercent) && !foodInInvent()) {
  1183. return State.WALKING_TO_SPIDERS_R;
  1184. }
  1185. }
  1186. if (atSecondGateToSpidersArea()) {
  1187. if (Inventory.isFull()) {
  1188. return State.WALKING_TO_SPIDERS_R;
  1189. }
  1190. if (!Inventory.isFull()) {
  1191. return State.WALKING_TO_SPIDERS;
  1192. }
  1193. }
  1194. if (atFirstGateToSecondGateArea()) {
  1195. if (Inventory.isFull()) {
  1196. return State.WALKING_TO_SECOND_GATE_R;
  1197. }
  1198. if (!Inventory.isFull()) {
  1199. return State.WALKING_TO_SECOND_GATE;
  1200. }
  1201. }
  1202. if (atLadderToFirstGateArea()) {
  1203. if (Inventory.isFull()) {
  1204. return State.WALKING_TO_LADDER;
  1205. }
  1206. if (!Inventory.isFull()) {
  1207. return State.WALKING_TO_FIRST_GATE;
  1208. }
  1209. }
  1210. if (atEdgeArea()) {
  1211. if (Inventory.isFull()) {
  1212. return State.WALKING_TO_BANK;
  1213. }
  1214. if (!Inventory.isFull()) {
  1215. return State.WALKING_TO_TRAPDOOR;
  1216. }
  1217. }
  1218. return State.LOGING_OUT;
  1219. }
  1220.  
  1221. private State SCRIPT_STATE = getState();
  1222.  
  1223. @SuppressWarnings("deprecation")
  1224. @Override
  1225. public void run() {
  1226. spiderGUI g = new spiderGUI();
  1227. g.setVisible(true);
  1228. while (waitGUI)
  1229. sleep(300);
  1230.  
  1231. g.setVisible(false);
  1232.  
  1233. println("Started collecting Spider Eggs");
  1234. super.setRandomSolverState(true);
  1235. Walking.setControlClick(true);
  1236.  
  1237. while (true) {
  1238. if (loggedOut()) {
  1239. super.setLoginBotState(active);
  1240. } else {
  1241. while (!loggedOut()) {
  1242. SCRIPT_STATE = getState();
  1243. int mSpeed = General.random(130, 160);
  1244. Mouse.setSpeed(mSpeed);
  1245.  
  1246. switch (SCRIPT_STATE) {
  1247.  
  1248. case CLIMBING_DOWN_TRAPDOOR:
  1249. climbDownTrapdoor();
  1250. sleep(800, 900);
  1251. break;
  1252.  
  1253. case CLIMBING_UP_LADDER:
  1254. climbUpLadder();
  1255. sleep(800, 900);
  1256. break;
  1257.  
  1258. case OPENING_BANK:
  1259. sleep(300, 350);
  1260. openBank();
  1261. sleep(1000, 2000);
  1262. break;
  1263.  
  1264. case OPENING_FIRST_GATE:
  1265. goThroughFirstGate();
  1266. sleep(300, 350);
  1267. break;
  1268.  
  1269. case OPENING_FIRST_GATE_R:
  1270. goThroughFirstGate();
  1271. sleep(300, 350);
  1272. break;
  1273.  
  1274. case OPENING_SECOND_GATE:
  1275. goThroughSecondGate();
  1276. sleep(300, 350);
  1277. break;
  1278.  
  1279. case OPENING_SECOND_GATE_R:
  1280. goThroughSecondGateR();
  1281. sleep(600, 700);
  1282. break;
  1283.  
  1284. case OPENING_TRAPDOOR:
  1285. climbDownTrapdoor();
  1286. sleep(300, 350);
  1287. break;
  1288.  
  1289. case PICKING_UP_EGGS:
  1290. pickUpEggs();
  1291. sleep(300, 350);
  1292. break;
  1293.  
  1294. case WALKING_TO_BANK:
  1295. walkDestinationCustom(bankPath, EDGE_BANK, 3);
  1296. sleep(300, 350);
  1297. break;
  1298.  
  1299. case WALKING_TO_EGGS_1:
  1300. walkToEggs1();
  1301. sleep(300, 350);
  1302. break;
  1303.  
  1304. case WALKING_TO_EGGS_2:
  1305. Walking.setControlClick(true);
  1306. walkToEggs2();
  1307. sleep(3000, 3500);
  1308. break;
  1309.  
  1310. case WALKING_TO_FIRST_GATE:
  1311. walkDestinationCustom(firstGatePath, FIRST_GATE_TILE, 8);
  1312. sleep(300, 350);
  1313. break;
  1314.  
  1315. case WALKING_TO_LADDER:
  1316. walkDestinationCustom(firstGateRPath, LADDER_TILE_DOWN, 8);
  1317. sleep(300, 350);
  1318. break;
  1319.  
  1320. case WALKING_TO_SECOND_GATE:
  1321. walkDestination(secondGatePath, SECOND_GATE_TILE, secondGateArea, 8);
  1322. sleep(300, 350);
  1323. break;
  1324.  
  1325. case WALKING_TO_SECOND_GATE_R:
  1326. walkDestinationCustom(secondGateRPath, FIRST_GATE_TILE_R, 8);
  1327. sleep(300, 350);
  1328. break;
  1329.  
  1330. case WALKING_TO_SPIDERS:
  1331. walkDestinationCustom(spiderPath, SPIDER_AREA_TILE, 8);
  1332. sleep(300, 350);
  1333. break;
  1334.  
  1335. case WALKING_TO_TRAPDOOR:
  1336. walkDestinationCustom(trapdoorPath, TRAPDOOR_TILE_UP, 8);
  1337. sleep(300, 350);
  1338. break;
  1339.  
  1340. case BANKING_EGGS:
  1341. depositEggs();
  1342. sleep(300, 350);
  1343. break;
  1344.  
  1345. case WAITING_FOR_EGGS:
  1346. int rotation = General.random(90, 200);
  1347. antiBan(rotation);
  1348.  
  1349. sleep(250, 400);
  1350. break;
  1351.  
  1352. case CLEARING_SPACE_IN_INVENTORY:
  1353. eatAllFood();
  1354. sleep(300, 350);
  1355. break;
  1356.  
  1357. case EATING:
  1358. eatFood();
  1359. sleep(300, 350);
  1360. break;
  1361.  
  1362. case WITHDRAWING_FOOD:
  1363. withdrawFoodAmount(withdrawFoodies);
  1364. sleep(550, 600);
  1365. break;
  1366.  
  1367. case CLOSING_BANK:
  1368. Banking.close();
  1369. sleep(300, 350);
  1370. break;
  1371.  
  1372. case WALKING_TO_SPIDERS_R:
  1373. walkDestination(spiderRPath, SECOND_GATE_TILE_R, secondGateAreaR, 8);
  1374. sleep(300, 350);
  1375. break;
  1376.  
  1377. case LOGING_OUT:
  1378. logout();
  1379. stopScript();
  1380. break;
  1381.  
  1382. case WALKING_BACK_FROM_EAST:
  1383. walkDestinationCustom(eastPath, SPIDER_AREA_TILE, 9);
  1384. sleep(300, 350);
  1385. break;
  1386.  
  1387. case WALKING_BACK_FROM_NORTH:
  1388. walkDestinationCustom(northPath, SPIDER_AREA_TILE, 5);
  1389. sleep(300, 350);
  1390. break;
  1391.  
  1392. }
  1393. }
  1394. }
  1395. sleep(50, 150);
  1396. }
  1397. }
  1398.  
  1399. @Override
  1400. public void onRandom(RANDOM_SOLVERS arg0) {
  1401. paused = true;
  1402.  
  1403. }
  1404.  
  1405. @Override
  1406. public boolean randomFailed(RANDOM_SOLVERS arg0) {
  1407. paused = false;
  1408. return false;
  1409. }
  1410.  
  1411. @Override
  1412. public void randomSolved(RANDOM_SOLVERS arg0) {
  1413. paused = false;
  1414.  
  1415. }
  1416.  
  1417. @Override
  1418. public void onPause() {
  1419. paused = true;
  1420.  
  1421. while(paused){
  1422. sleep(100, 200);
  1423. }
  1424.  
  1425. }
  1426.  
  1427. @Override
  1428. public void onResume() {
  1429. paused = false;
  1430.  
  1431. }
  1432. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement