Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 30.14 KB | None | 0 0
  1. import java.awt.Color;
  2. import java.awt.Cursor;
  3. import java.awt.Font;
  4. import java.awt.Graphics;
  5. import java.awt.Graphics2D;
  6. import java.awt.Point;
  7. import java.awt.RenderingHints;
  8. import java.awt.event.ActionEvent;
  9. import java.awt.event.ActionListener;
  10. import java.awt.event.InputEvent;
  11. import java.awt.event.KeyEvent;
  12. import java.util.HashSet;
  13. import java.util.Set;
  14.  
  15. import javax.swing.ButtonGroup;
  16. import javax.swing.DefaultComboBoxModel;
  17. import javax.swing.GroupLayout;
  18. import javax.swing.JButton;
  19. import javax.swing.JCheckBox;
  20. import javax.swing.JComboBox;
  21. import javax.swing.JFrame;
  22. import javax.swing.JLabel;
  23. import javax.swing.JMenu;
  24. import javax.swing.JMenuBar;
  25. import javax.swing.JMenuItem;
  26. import javax.swing.JPanel;
  27. import javax.swing.JRadioButton;
  28. import javax.swing.JSeparator;
  29. import javax.swing.JTabbedPane;
  30. import javax.swing.JTextField;
  31. import javax.swing.KeyStroke;
  32. import javax.swing.LayoutStyle;
  33. import javax.swing.SwingConstants;
  34. import javax.swing.UIManager;
  35. import javax.swing.WindowConstants;
  36.  
  37. import org.rsbot.event.listeners.PaintListener;
  38. import org.rsbot.script.Script;
  39. import org.rsbot.script.ScriptManifest;
  40. import org.rsbot.script.methods.Skills;
  41. import org.rsbot.script.util.Filter;
  42. import org.rsbot.script.util.Timer;
  43. import org.rsbot.script.wrappers.RSArea;
  44. import org.rsbot.script.wrappers.RSNPC;
  45. import org.rsbot.script.wrappers.RSTile;
  46. import org.rsbot.script.wrappers.*;
  47.  
  48. @ScriptManifest(name = "Bobys Rock Crabs", authors = { "Vastico Boby" }, version = 1.0, description = "Rock Crabs Bobys Edit")
  49. public class BobysRockCrabs extends Script implements PaintListener {
  50.  
  51. public static interface Constants {
  52.  
  53. RSArea CAMELOT_AREA = new RSArea(2721, 3475, 2760, 3493);
  54.  
  55. RSArea BANK_AREA = new RSArea(2721, 3489, 2730, 3493);
  56.  
  57. RSArea CRABS_AREA = new RSArea(2662, 3712, 2688, 3722);
  58.  
  59. RSArea RESET_CRABS_AREA = new RSArea(2677, 3688, 2667, 3682);
  60.  
  61. int[] ROCK_CRABS = new int[] {1265, 1266, 1267, 1268};
  62.  
  63. int TELETAB = 8010;
  64.  
  65. int[] FOOD = new int[] { 1161, 1965, 1969, 1967, 1895, 1893,
  66. 1891, 1971, 4293, 2142, 4291, 2140, 3228, 9980, 7223, 6297, 6293,
  67. 6295, 6299, 7521, 9988, 7228, 2878, 7568, 2343, 1861, 13433, 315,
  68. 325, 319, 3144, 347, 355, 333, 339, 351, 329, 3381, 361, 10136,
  69. 5003, 379, 365, 373, 7946, 385, 397, 391, 3369, 3371, 3373, 2309,
  70. 2325, 2333, 2327, 2331, 2323, 2335, 7178, 7180, 7188, 7190, 7198,
  71. 7200, 7208, 7210, 7218, 7220, 2003, 2011, 2289, 2291, 2293, 2295,
  72. 2297, 2299, 2301, 2303, 1891, 1893, 1895, 1897, 1899, 1901, 7072,
  73. 7062, 7078, 7064, 7084, 7082, 7066, 7068, 1942, 6701, 6703, 7054,
  74. 6705, 7056, 7060, 2130, 1985, 1993, 1989, 1978, 5763, 5765, 1913,
  75. 5747, 1905, 5739, 1909, 5743, 1907, 1911, 5745, 2955, 5749, 5751,
  76. 5753, 5755, 5757, 5759, 5761, 2084, 2034, 2048, 2036, 2217, 2213,
  77. 2205, 2209, 2054, 2040, 2080, 2277, 2225, 2255, 2221, 2253, 2219,
  78. 2281, 2227, 2223, 2191, 2233, 2092, 2032, 2074, 2030, 2281, 2235,
  79. 2064, 2028, 2187, 2185, 2229 };
  80.  
  81. Color PLAYER_FILL_COLOR = new Color(0, 255, 0, 50);
  82.  
  83. Color AREA_FILL_COLOR = new Color(18, 48, 178, 20);
  84.  
  85. Color TEXT_COLOR = new Color(255, 54, 255, 255);
  86.  
  87. Color CRAB_MODEL_COLOR = new Color(43, 45, 255, 50);
  88.  
  89. Color BACKGROUND_COLOR = new Color(22, 23, 66, 50);
  90.  
  91. RenderingHints ANTI_ALIASING = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
  92.  
  93. }
  94.  
  95. public static abstract class Action {
  96.  
  97. public abstract void process();
  98.  
  99. public abstract boolean isValid();
  100.  
  101. public abstract String getDescription();
  102.  
  103. public void complete() {
  104. }
  105.  
  106. public void paint(Graphics render) {
  107. }
  108.  
  109. }
  110.  
  111. public class Bank extends Action {
  112.  
  113. private RSArea area;
  114.  
  115. public Bank(RSArea area) {
  116. this.area = area;
  117. }
  118.  
  119. public void process() {
  120. if (bank.isOpen()) {
  121. if (inventory.getCount() > 0) {
  122. if (inventory.getCount(Constants.TELETAB) == 0) {
  123. bank.depositAll();
  124. } else {
  125. bank.depositAllExcept(Constants.TELETAB);
  126. }
  127. sleep(400);
  128. }
  129. if (inventory.getCount(Constants.TELETAB) == 0) {
  130. if (bank.getCount(Constants.TELETAB) > 0) {
  131. bank.withdraw(Constants.TELETAB, 1);
  132. sleep(400);
  133. }
  134. }
  135. if (bank.getCount(Constants.FOOD) > 0) {
  136. for (int id : Constants.FOOD) {
  137. bank.withdraw(id, 0);
  138. }
  139. } else {
  140. log("No food. Stopping script.");
  141. stopScript();
  142. return;
  143. }
  144. if (inventory.getCount(Constants.FOOD) == 0) {
  145. sleep(400);
  146. }
  147. } else {
  148. bank.open();
  149. }
  150. }
  151.  
  152. public boolean isValid() {
  153. return !hasFood() && area.contains(getMyPlayer().getLocation()) && banking;
  154. }
  155.  
  156. public String getDescription() {
  157. return "Banking";
  158. }
  159.  
  160. }
  161.  
  162. public abstract class EatFood extends Action {
  163.  
  164. public abstract boolean isTargetValid();
  165.  
  166. public void process() {
  167. for (int id : Constants.FOOD) {
  168. if (!eatingFood) {
  169. log("No food we didn't want you to die so we stopped script.");
  170. log("Stopping script.");
  171. stopScript();
  172. return;
  173. }
  174. if (bank.isOpen()) {
  175. bank.close();
  176. } else {
  177. if (inventory.getCount(id) == 0) {
  178. continue;
  179. }
  180. inventory.getItem(id).doAction("Eat");
  181. sleep(500);
  182. break;
  183. }
  184. }
  185. }
  186.  
  187. public boolean isValid() {
  188. return hasFood() && isTargetValid();
  189. }
  190.  
  191. public String getDescription() {
  192. return "Eating";
  193. }
  194.  
  195. }
  196.  
  197. public abstract class AttackRockCrab extends Action {
  198.  
  199. public abstract boolean isTargetValid();
  200. public abstract void process();
  201. private String name;
  202.  
  203. public AttackRockCrab(String name) {
  204. this.name = name;
  205. }
  206.  
  207. public String getDescription() {
  208. return "Attack" + name + ".";
  209. }
  210.  
  211. }
  212.  
  213. public abstract class WalkToArea extends Action {
  214.  
  215. private RSArea dest;
  216. private String name;
  217. private RSTile last;
  218.  
  219. public WalkToArea(RSArea dest, String name) {
  220. this.dest = dest;
  221. this.name = name;
  222. }
  223.  
  224. protected abstract boolean isTargetValid();
  225.  
  226. public void process() {
  227. if (!walking.isRunEnabled() && walking.getEnergy() > 30) {
  228. walking.setRun(true);
  229. sleep(200);
  230. }
  231. RSTile tile = dest.getCentralTile();
  232. if (last == null || getMyPlayer().isIdle() || (calc.distanceTo(last) < 10 && !dest.contains(last))) {
  233. if (!walking.walkTo(tile)) {
  234. walking.walkTileOnScreen(calc.getTileOnScreen(tile));
  235. }
  236. last = walking.getDestination();
  237. sleep(random(1000, 1800));
  238. } else {
  239. idle();
  240. }
  241. }
  242.  
  243. public boolean isValid() {
  244. return isTargetValid() && !dest.contains(getMyPlayer().getLocation());
  245. }
  246.  
  247. public void complete() {
  248. last = null;
  249. }
  250.  
  251. public void paint(Graphics render) {
  252. render.setColor(Constants.AREA_FILL_COLOR);
  253. for (RSTile t : dest.getTileArray()) {
  254. Point pn = calc.tileToScreen(t, 0, 0, 0);
  255. Point px = calc.tileToScreen(t, 1, 0, 0);
  256. Point py = calc.tileToScreen(t, 0, 1, 0);
  257. Point pxy = calc.tileToScreen(t, 1, 1, 0);
  258. if (pn.x > -1 && px.x > -1 && py.x > -1 && pxy.x > -1) {
  259. render.fillPolygon(new int[] { py.x, pxy.x, px.x, pn.x },
  260. new int[] { py.y, pxy.y, px.y, pn.y }, 4);
  261. }
  262. }
  263. }
  264.  
  265. public String getDescription() {
  266. return "Walking to " + name + ".";
  267. }
  268.  
  269. }
  270.  
  271. private Set<Action> actions;
  272. private Action action;
  273.  
  274. private long scriptStartTime = 0;
  275. private int kills = 0;
  276. private int attempts = 0;
  277. private final int[] startXp = new int[6];
  278. private final int[] startLevel = new int[6];
  279. private RSNPC last = null;
  280. private AdminGUI gui;
  281. private Action eatAction;
  282. private Action stealAction;
  283.  
  284. private boolean stealingCrabs;
  285. private boolean usingTabs;
  286. private boolean eatingFood;
  287. private boolean banking;
  288. private int INTERFACE_BANK_TAB = 1;
  289.  
  290. RSTile[] BankToCrabs = new RSTile[]{new RSTile(2727, 3484),
  291. new RSTile(2727, 3484), new RSTile(2735, 3492),
  292. new RSTile(2741, 3502), new RSTile(2741, 3511),
  293. new RSTile(2741, 3525), new RSTile(2738, 3537),
  294. new RSTile(2728, 3543), new RSTile(2720, 3544),
  295. new RSTile(2711, 3544), new RSTile(2702, 3543),
  296. new RSTile(2694, 3545), new RSTile(2685, 3546),
  297. new RSTile(2674, 3551), new RSTile(2668, 3558),
  298. new RSTile(2660, 3562), new RSTile(2657, 3572),
  299. new RSTile(2654, 3581), new RSTile(2654, 3589),
  300. new RSTile(2654, 3602), new RSTile(2663, 3615),
  301. new RSTile(2665, 3624), new RSTile(2667, 3640),
  302. new RSTile(2659, 3655), new RSTile(2668, 3668),
  303. new RSTile(2671, 3681), new RSTile(2674, 3693),
  304. new RSTile(2673, 3706), new RSTile(2670, 3715)};
  305.  
  306.  
  307. {
  308. mouse.setSpeed(8);
  309. gui = new AdminGUI();
  310. gui.setVisible(true);
  311.  
  312. while (!gui.start) {
  313. sleep(200, 300);
  314. }
  315.  
  316. startL = skills.getCurrentLevel(skills.STRENGTH);
  317.  
  318. if (!isAutoRetaliationOn()) {
  319. toggleAutoRetaliation();
  320. }
  321.  
  322. usingTabs = gui.chk_teletabs.isSelected();
  323. banking = gui.chk_banking.isSelected();
  324. eatingFood = gui.chk_food_eat.isSelected();
  325. stealingCrabs = gui.chk_rock_crabs.isSelected();
  326. actions = new HashSet<Action>();
  327.  
  328. stealAction = new AttackRockCrab() {
  329. public boolean isTargetValid() {
  330. return requiresROCK_CRABS() && stealingCrabs;
  331. }
  332.  
  333. };
  334. actions.add(stealAction);
  335.  
  336. actions.add(new stealAction() {
  337. public boolean isTargetValid() {
  338. return requiresAttackRockCrab() && stealingCrabs;
  339. }
  340.  
  341. });
  342.  
  343.  
  344. eatAction = new EatFood() {
  345. public boolean isTargetValid() {
  346. return requiresFood() && eatingFood;
  347. }
  348. };
  349.  
  350. actions.add(eatAction);
  351.  
  352. actions.add(new EatFood() {
  353. public boolean isTargetValid() {
  354. return inBank() && requiresFullHealth() && eatingFood;
  355. }
  356. });
  357.  
  358. actions.add(new WalkToArea(Constants.BANK_AREA, "bank") {
  359. protected boolean isTargetValid() {
  360. return (!hasFood() && eatingFood) && !inBank() && banking;
  361. }
  362.  
  363. public void process() {
  364. if (usingTabs && inventory.getCount(Constants.TELETAB) > 0 && !inCamelot()) {
  365. inventory.getItem(Constants.TELETAB).doAction("Break");
  366. sleep(3500);
  367. } else {
  368. super.process();
  369. }
  370. }
  371. });
  372.  
  373. actions.add(new WalkToArea(Constants.CRABS_AREA, "crabs") {
  374. protected boolean isTargetValid() {
  375. return ((hasFood() && eatingFood) && !inCrabs() && attempts <= 3) || inResetCrabs();
  376. }
  377.  
  378. public void process() {
  379. attempts = 0;
  380. super.process();
  381. }
  382. });
  383.  
  384. actions.add(new WalkToArea(Constants.CRABS_AREA, "crabs again") {
  385. protected boolean isTargetValid() {
  386. return (inventory.contains(Constants.TELETAB) && !inBank() && !inCrabs() && !inResetCrabs());
  387. }
  388. });
  389.  
  390. actions.add(new WalkToArea(Constants.RESET_CRABS_AREA, "reset area") {
  391. @Override
  392. protected boolean isTargetValid() {
  393. return attempts > 3 && !inBank();
  394. }
  395. });
  396.  
  397. actions.add(new Bank(Constants.BANK_AREA));
  398.  
  399. }
  400.  
  401.  
  402.  
  403.  
  404.  
  405.  
  406.  
  407. public int loop() {
  408. if (!game.isLoggedIn() && skills.getRealLevel(Skills.CONSTITUTION) < 10) {
  409. return random(100, 200);
  410. }
  411. mouse.setSpeed(random(6, 8));
  412. if (getMyPlayer().getInteracting() != null) {
  413. idle();
  414. attempts = 0;
  415. }
  416. for (int id : Constants.FOOD) {
  417. if (inBank() && inventory.contains(id)) {
  418. walkToCrabs();
  419. }
  420. }
  421.  
  422. if (eatAction.isValid()) {
  423. eatAction.process();
  424. }
  425. if (action != null) {
  426. if (action.isValid()) {
  427. action.process();
  428. } else {
  429. action.complete();
  430. action = null;
  431. }
  432. } else {
  433. for (Action a : actions) {
  434. if (a.isValid()) {
  435. action = a;
  436. break;
  437. }
  438. }
  439. }
  440.  
  441. if (last != null) {
  442. if (last == getMyPlayer().getInteracting()) {
  443. return random(200, 300);
  444. }
  445. if (last.getHPPercent() <= 0) {
  446. kills ++;
  447. last = null;
  448. }
  449. }
  450. if (action == null) {
  451. action = getNewCrab();
  452. }
  453. antiBan();
  454. return random(300, 500);
  455. }
  456.  
  457. public void onFinish() {
  458. log(kills + " crabs killed and gained " + generateTotalXpGained() + " xp in " + Timer.format(System.currentTimeMillis() - scriptStartTime) + ".");
  459. env.saveScreenshot(game.isLoggedIn());
  460. }
  461.  
  462. public boolean isAutoRetaliationOn() {
  463. return settings.getSetting(172) == 0;
  464. }
  465.  
  466. public void toggleAutoRetaliation() {
  467. if (game.getCurrentTab() != game.TAB_ATTACK) {
  468. game.openTab(game.TAB_ATTACK);
  469. }
  470. mouse.click(random(579, 706), random(363, 395), true);
  471. sleep(random(600, 800));
  472. }
  473.  
  474. private void walkToCrabs() {
  475. RSTile[] randomBTCPath = walking.randomizePath(BankToCrabs, 1, 1);
  476. for (RSTile aRandomBTCPath : randomBTCPath) {
  477. walking.walkTileMM(aRandomBTCPath);
  478. while (calc.distanceTo(aRandomBTCPath) > 4) {
  479. if (!getMyPlayer().isMoving()) {
  480. walking.walkTileMM(aRandomBTCPath);
  481. }
  482. sleep(random(300, 600));
  483. }
  484. }
  485. }
  486.  
  487. private Action getNewCrab() {
  488. final RSNPC n = npcs.getNearest(new Filter<RSNPC>() {
  489. public boolean accept(RSNPC t) {
  490. if (!t.isOnScreen() && t.getInteracting() != null && !t.getInteracting().equals(getMyPlayer()))
  491. return false;
  492. if (t.getHPPercent() == 0)
  493. if (t.getHPPercent() == 0)
  494. return false;
  495. if (t.getLocation().getY() >= 3722 || t.getLocation().getX() >= 2688)
  496. return false;
  497. if (t.getName().equals("Rocks") || t.getName().equals("Rock Crab"))
  498. return true;
  499. return false;
  500. }
  501. });
  502. if (n != null && n.getModel() != null) {
  503. last = n;
  504. if (n.getName().equals("Rocks") || !n.isOnScreen()) {
  505. if (isInArea(getNpcArea(n.getLocation()))) {
  506. attempts ++;
  507. }
  508. if (attempts > 3) {
  509. log("Rocks not Attacking you?");
  510. return null;
  511. }
  512. return new WalkToArea(getNpcArea(n.getLocation()), "crab") {
  513.  
  514. public void complete() {
  515. super.complete();
  516. sleep(300);
  517. }
  518.  
  519. protected boolean isTargetValid() {
  520. return inCrabs() && !inCombat();
  521. }
  522. };
  523. } else {
  524. }
  525. }
  526. return null;
  527. }
  528.  
  529. public void onRepaint(Graphics render) {
  530. if (game.isLoggedIn() && skills.getRealLevel(Skills.CONSTITUTION) > 1) {
  531. gainedL = currentL - startL;
  532. currentL = skills.getCurrentLevel(skills.STRENGTH);
  533. if (scriptStartTime == 0) {
  534. scriptStartTime = System.currentTimeMillis();
  535. for (int index = 0; index < 6; index++) {
  536. if (index == 5) {
  537. startXp[index] = skills.getCurrentExp(6);
  538. } else {
  539. startXp[index] = skills.getCurrentExp(index);
  540. }
  541. }
  542. for (int index = 0; index < 6; index++) {
  543. if (index == 5) {
  544. startLevel[index] = skills.getCurrentLevel(6);
  545. } else {
  546. startLevel[index] = skills.getCurrentLevel(index);
  547. }
  548. }
  549. }
  550. Graphics2D g = (Graphics2D) render;
  551. g.setRenderingHints(Constants.ANTI_ALIASING);
  552. g.setColor(Constants.BACKGROUND_COLOR);
  553. g.fillRect(10, 25, 175, 205);
  554. g.setColor(Constants.TEXT_COLOR);
  555. g.drawString("Rock Crab Killer by Vastico Boby edit", 20, 55);
  556. if (action != null) {
  557. action.paint(g);
  558. g.setColor(Constants.TEXT_COLOR);
  559. g.drawString(action.getDescription(), 20, 75);
  560. } else {
  561. g.setColor(Constants.TEXT_COLOR);
  562. g.drawString(getMyPlayer().getInteracting() == null ? "Idle" : "Attacking", 20, 75);
  563. }
  564. g.setColor(Constants.TEXT_COLOR);
  565. g.drawString("Kills: " + kills, 20, 95);
  566. g.drawString("Runtime: " + Timer.format(System.currentTimeMillis() - scriptStartTime), 20, 115);
  567. g.drawString("Total XP Gained: " + generateTotalXpGained(), 20, 135);
  568. g.drawString("XP Per Hour: " + generateXpPerHour(), 20, 155);
  569. g.drawString("Kills Per Hour: " + generateKillsPerHour(), 20, 175);
  570. //g.drawString("Current Level: " + currentL + " (" + gainedL + ")", 20, 195);
  571. g.drawString("Current Version: " + getClass().getAnnotation(ScriptManifest.class).version(), 20, 215);
  572. }
  573. }
  574.  
  575. int currentL;
  576. int startL;
  577. int gainedL;
  578.  
  579. private int generateTotalXpGained() {
  580. int gained = 0;
  581. for (int index = 0; index < 6; index++) {
  582. if (index == 5) {
  583. gained += this.skills.getCurrentExp(6);
  584. } else {
  585. gained += this.skills.getCurrentExp(index);
  586. }
  587. }
  588. for (int xp : this.startXp) {
  589. gained -= xp;
  590. }
  591. return gained;
  592. }
  593.  
  594. private int generateXpPerHour() {
  595. return (int) (generateTotalXpGained() * 3600000D / (System.currentTimeMillis() - scriptStartTime));
  596. }
  597.  
  598. private int generateKillsPerHour() {
  599. return (int) (kills * 3600000D / (System.currentTimeMillis() - scriptStartTime));
  600. }
  601.  
  602. private RSArea getNpcArea(RSTile t) {
  603. int x = t.getX();
  604. int y = t.getY();
  605. return new RSArea(x - 1, y - 1, x + 1, y + 1);
  606. }
  607.  
  608. private void idle() {
  609. if (random(0, 50) == 0) {
  610. int rand2 = random(1, 3);
  611. for (int i = 0; i < rand2; i++) {
  612. mouse.move(random(100, 700), random(100, 500));
  613. sleep(random(200, 700));
  614. }
  615. mouse.move(random(0, 800), 647, 50, 100);
  616. sleep(random(100, 1500));
  617. mouse.move(random(75, 400), random(75, 400), 30);
  618. }
  619. if (random(0, 50) == 0) {
  620. Point curPos = mouse.getLocation();
  621. mouse.move(random(0, 750), random(0, 500), 20);
  622. sleep(random(100, 300));
  623. mouse.move(curPos, 20, 20);
  624. }
  625. if (random(0, 50) == 0) {
  626. int angle = camera.getAngle() + random(-40, 40);
  627. if (angle < 0) {
  628. angle += 359;
  629. }
  630. if (angle > 359) {
  631. angle -= 359;
  632. }
  633. camera.setAngle(angle);
  634. }
  635. if (random(0, 50) == 0) {
  636. if (random(0, 4) == 0) {
  637. camera.setPitch(random(50, 80));
  638. } else {
  639. camera.setPitch(true);
  640. }
  641. }
  642. }
  643.  
  644.  
  645. public void antiBan() {
  646.  
  647. int b = random(0, 10);
  648. switch (b) {
  649.  
  650. case 1: //Checking HP XP
  651. if (random(0,4) == 4) {
  652.  
  653. game.openTab(1);
  654. skills.doHover(Skills.INTERFACE_CONSTITUTION);
  655. sleep(random(3000, 4000));
  656. }
  657. break;
  658.  
  659. case 2: //Mouse off Screen
  660. if (random(0,4) == 3) {
  661.  
  662. mouse.moveOffScreen();
  663. sleep(random(2000, 5500));
  664. }
  665. break;
  666.  
  667. case 3: //Move Mouse
  668. if (random(0,4) == 2) {
  669.  
  670. mouse.moveSlightly();
  671. sleep(300, 700);
  672. mouse.moveRandomly(40, 860);
  673. }
  674. break;
  675.  
  676. case 4: //Turn Screen
  677. if (random(0, 4) == 1) {
  678.  
  679. camera.setAngle(random(100, 359));
  680. sleep(500,1500);
  681. }
  682. break;
  683.  
  684. default:
  685.  
  686. break;
  687.  
  688. }
  689. }
  690.  
  691. private boolean hasFood() {
  692. return inventory.getCount(Constants.FOOD) > 0;
  693. }
  694.  
  695. private boolean requiresFood() {
  696. return combat.getLifePoints() < (skills.getRealLevel(Skills.CONSTITUTION) * 10) / 2;
  697. }
  698.  
  699. private boolean requiresFullHealth() {
  700. return combat.getLifePoints() < (skills.getRealLevel(Skills.CONSTITUTION) * 10);
  701. }
  702.  
  703. private boolean inBank() {
  704. return Constants.BANK_AREA.contains(getMyPlayer().getLocation());
  705. }
  706.  
  707. private boolean inCamelot() {
  708. return Constants.CAMELOT_AREA.contains(getMyPlayer().getLocation());
  709. }
  710.  
  711. private boolean inCombat() {
  712. return getMyPlayer().isInCombat() && getMyPlayer().getInteracting() != null;
  713. }
  714.  
  715. private boolean inCrabs() {
  716. return Constants.CRABS_AREA.contains(getMyPlayer().getLocation());
  717. }
  718.  
  719. private boolean inResetCrabs() {
  720. return Constants.RESET_CRABS_AREA.contains(getMyPlayer().getLocation());
  721. }
  722.  
  723. private boolean isInArea(RSArea area) {
  724. return area.contains(getMyPlayer().getLocation());
  725. }
  726.  
  727.  
  728. public class AdminGUI extends JFrame {
  729.  
  730. public boolean start = false;
  731.  
  732. private static final long serialVersionUID = 1L;
  733. private JCheckBox chk_rock_crabs;
  734.  
  735. public AdminGUI() {
  736. try {
  737. UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
  738. } catch (Exception e) {
  739. }
  740. initComponents();
  741. }
  742.  
  743. private void initComponents() {
  744. btn_Start = new JButton();
  745. tbp_main = new JTabbedPane();
  746. lbl_created = new JLabel();
  747. pnl_preferences = new JPanel();
  748. lbl_preferences = new JLabel();
  749. lbl_food_eat = new JLabel();
  750. txt_food_eat = new JTextField();
  751. btn_food_eat_browse = new JButton();
  752. chk_food_eat = new JCheckBox();
  753. chk_banking = new JCheckBox();
  754. chk_teletabs = new JCheckBox();
  755. chk_rock_crabs = new JCheckBox();
  756. mnu_bar = new JMenuBar();
  757. mnu_file = new JMenu();
  758. mit_exit = new JMenuItem();
  759.  
  760. setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
  761. setTitle("Rock Crab Pwner");
  762. setAlwaysOnTop(true);
  763. setFont(new Font("Georgia", 0, 12));
  764. setName("frm_main");
  765. setResizable(false);
  766.  
  767. btn_Start.setFont(new Font("Boby", 0, 12));
  768. btn_Start.setText("Start");
  769. btn_Start.setToolTipText("Start the Script!");
  770. btn_Start.setCursor(new Cursor(Cursor.HAND_CURSOR));
  771. btn_Start.setFocusable(false);
  772. btn_Start.addActionListener(new ActionListener() {
  773. public void actionPerformed(ActionEvent evt) {
  774. btn_StartActionPerformed(evt);
  775. }
  776. });
  777.  
  778. lbl_preferences.setFont(new Font("Boby", 0, 18));
  779. lbl_preferences.setHorizontalAlignment(SwingConstants.CENTER);
  780. lbl_preferences.setText("Preferences");
  781.  
  782. lbl_food_eat.setFont(new Font("Boby", 0, 12));
  783. lbl_food_eat.setText("Food to Eat:");
  784.  
  785. txt_food_eat.setFont(new Font("Boby", 0, 11));
  786. txt_food_eat.setToolTipText("Seperate each item with a comma (,)");
  787. txt_food_eat.setEnabled(false);
  788.  
  789. btn_food_eat_browse.setFont(new Font("Boby", 0, 11));
  790. btn_food_eat_browse.setText("...");
  791. btn_food_eat_browse.setToolTipText("Click here to search your inventory for food item id's");
  792. btn_food_eat_browse.setEnabled(false);
  793.  
  794. chk_food_eat.setFont(new Font("Boby", 0, 11));
  795. chk_food_eat.setText("Eat Food?");
  796. chk_food_eat.setToolTipText("Will we be eating food?");
  797.  
  798. chk_banking.setFont(new Font("Boby", 0, 11));
  799. chk_banking.setText("Banking?");
  800. chk_banking.setToolTipText("Will we be banking if we run out of food?");
  801.  
  802. chk_teletabs.setFont(new Font("Boby", 0, 11));
  803. chk_teletabs.setText("Using Teletabs?");
  804. chk_teletabs.setToolTipText("Are we using Teletabs?");
  805.  
  806. chk_rock_crabs.setFont(new Font("Boby", 0, 11));
  807. chk_rock_crabs.setText("Steal crabs?");
  808. chk_rock_crabs.setToolTipText("We will be Stealing crabs");
  809.  
  810. GroupLayout pnl_preferencesLayout = new GroupLayout(pnl_preferences);
  811. pnl_preferences.setLayout(pnl_preferencesLayout);
  812. pnl_preferencesLayout.setHorizontalGroup(
  813. pnl_preferencesLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
  814. .addGroup(pnl_preferencesLayout.createSequentialGroup()
  815. .addContainerGap()
  816. .addGroup(pnl_preferencesLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
  817. .addComponent(lbl_preferences, GroupLayout.DEFAULT_SIZE, 425, Short.MAX_VALUE)
  818. .addComponent(lbl_food_eat)
  819. .addGroup(GroupLayout.Alignment.TRAILING, pnl_preferencesLayout.createSequentialGroup()
  820. .addGroup(pnl_preferencesLayout.createParallelGroup(GroupLayout.Alignment.TRAILING)
  821. .addComponent(txt_food_eat, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 374, Short.MAX_VALUE))
  822. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  823. .addGroup(pnl_preferencesLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
  824. .addComponent(btn_food_eat_browse)))
  825. .addGroup(pnl_preferencesLayout.createSequentialGroup()
  826. .addGroup(pnl_preferencesLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
  827. .addComponent(chk_banking)
  828. .addComponent(chk_food_eat))
  829. .addGap(14, 14, 14)
  830. .addGroup(pnl_preferencesLayout.createParallelGroup(GroupLayout.Alignment.LEADING))
  831. .addGap(18, 18, 18)
  832. .addGroup(pnl_preferencesLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
  833. .addComponent(chk_teletabs))
  834. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 90, Short.MAX_VALUE)))
  835. .addContainerGap())
  836. .addGroup(pnl_preferencesLayout.createSequentialGroup()
  837. .addGap(10, 10, 10)
  838. .addGroup(pnl_preferencesLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
  839. .addGroup(pnl_preferencesLayout.createSequentialGroup()
  840. .addGap(249, 249, 249)
  841. .addComponent(chk_rock_crabs)))
  842. .addContainerGap())
  843. );
  844. pnl_preferencesLayout.setVerticalGroup(
  845. pnl_preferencesLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
  846. .addGroup(pnl_preferencesLayout.createSequentialGroup()
  847. .addContainerGap()
  848. .addComponent(lbl_preferences, GroupLayout.PREFERRED_SIZE, 19, GroupLayout.PREFERRED_SIZE)
  849. .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
  850. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  851. .addGroup(pnl_preferencesLayout.createParallelGroup(GroupLayout.Alignment.BASELINE))
  852. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  853. .addComponent(lbl_food_eat)
  854. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  855. .addGroup(pnl_preferencesLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
  856. .addComponent(txt_food_eat, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
  857. .addComponent(btn_food_eat_browse))
  858. .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
  859. .addGroup(pnl_preferencesLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
  860. .addComponent(chk_food_eat)
  861. .addComponent(chk_teletabs))
  862. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  863. .addGroup(pnl_preferencesLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
  864. .addComponent(chk_banking))
  865. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  866. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  867. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  868. .addGroup(pnl_preferencesLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
  869. .addComponent(chk_rock_crabs))
  870. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  871. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  872. .addGap(16, 16, 16))
  873. );
  874.  
  875. tbp_main.addTab("Preferences", pnl_preferences);
  876.  
  877. mnu_file.setText("File");
  878.  
  879. mit_exit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F4, InputEvent.ALT_MASK));
  880. mit_exit.setText("Exit");
  881. mit_exit.addActionListener(new ActionListener() {
  882. public void actionPerformed(ActionEvent evt) {
  883. mit_exitActionPerformed(evt);
  884. }
  885. });
  886. mnu_file.add(mit_exit);
  887.  
  888. mnu_bar.add(mnu_file);
  889.  
  890. setJMenuBar(mnu_bar);
  891.  
  892. GroupLayout layout = new GroupLayout(getContentPane());
  893. getContentPane().setLayout(layout);
  894. layout.setHorizontalGroup(
  895. layout.createParallelGroup(GroupLayout.Alignment.LEADING)
  896. .addComponent(tbp_main)
  897. .addGroup(GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
  898. .addContainerGap(341, Short.MAX_VALUE)
  899. .addComponent(btn_Start, GroupLayout.PREFERRED_SIZE, 89, GroupLayout.PREFERRED_SIZE)
  900. .addContainerGap())
  901. );
  902. layout.setVerticalGroup(
  903. layout.createParallelGroup(GroupLayout.Alignment.LEADING)
  904. .addGroup(layout.createSequentialGroup()
  905. .addComponent(tbp_main, GroupLayout.PREFERRED_SIZE, 330, GroupLayout.PREFERRED_SIZE)
  906. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  907. .addComponent(btn_Start, GroupLayout.PREFERRED_SIZE, 41, GroupLayout.PREFERRED_SIZE)
  908. .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  909. );
  910.  
  911. pack();
  912. }
  913.  
  914. private void mit_exitActionPerformed(ActionEvent evt) {
  915. stopScript();
  916. setVisible(false);
  917. }
  918.  
  919. private void btn_StartActionPerformed(ActionEvent evt) {
  920. start = true;
  921. setVisible(false);
  922. }
  923. private JButton btnrock_crabs;
  924. private JButton btn_Start;
  925. private JButton btn_food_eat_browse;
  926. private JCheckBox chk_banking;
  927. private JCheckBox chk_food_eat;
  928. private JCheckBox chk_teletabs;
  929. private JLabel lbl_created;
  930. private JLabel lbl_food_eat;
  931. private JLabel lbl_rock_crabs;
  932. private JLabel lbl_preferences;
  933. private JMenuItem mit_exit;
  934. private JMenuBar mnu_bar;
  935. private JMenu mnu_file;
  936. private JPanel pnl_preferences;
  937. private JPanel pnl_rock_crabs;
  938. private JTabbedPane tbp_main;
  939. private JTabbedPane tbp_rock_crabs;
  940. private JTextField txt_food_eat;
  941. private JTextField txt_rock_crabs;
  942. }
  943.  
  944. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement