Advertisement
wafflecat

asg3y

Mar 11th, 2012
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 124.84 KB | None | 0 0
  1. import java.awt.*;
  2. import java.awt.event.*;
  3. import java.awt.image.BufferedImage;
  4. import java.awt.image.RenderedImage;
  5. import java.io.BufferedReader;
  6. import java.io.File;
  7. import java.io.IOException;
  8. import java.io.InputStreamReader;
  9. import java.lang.reflect.InvocationTargetException;
  10. import java.net.URI;
  11. import java.net.URL;
  12. import java.net.URLConnection;
  13. import java.util.*;
  14. import java.util.logging.Logger;
  15. import org.rsbot.Configuration;
  16. import javax.imageio.ImageIO;
  17. import javax.swing.*;
  18. import javax.swing.border.*;
  19. import com.rarebot.event.events.*;
  20. import com.rarebot.event.listeners.*;
  21. import com.rarebot.script.*;
  22. import com.rarebot.script.methods.*;
  23. import com.rarebot.script.methods.Game.ChatButton;
  24. import com.rarebot.script.methods.Game.Tab;
  25. import com.rarebot.script.wrappers.*;
  26.  
  27. @ScriptManifest(authors = { "Fuser" }, keywords = { "Combat", "Giant", "Spider", "Fuser" }, name = "Giant Spider Fuser", version = 2.6, description = "Lets Max out Combat!")
  28. public class GiantSpiderFuser extends Script implements PaintListener, MessageListener, MouseListener {
  29.  
  30.  
  31. public double getVersion() {
  32. return getClass().getAnnotation(ScriptManifest.class).version();
  33. }
  34. public String scriptName = "Giant Spider Fuser";
  35. public String author = "Fuser";
  36. private int foodID;
  37. private int eatingValue[];
  38. private int arrow;
  39. private int potions[] = { 0, 0, 0, 0, 0 };
  40. private int amounts[] = { 1, 1, 1, 1, 1 };
  41. private int currentRoom;
  42. private int tries;
  43. private int objTries;
  44. private int bankTab = -1;
  45. private int stats[][];
  46. private int trainedSkill = -1;
  47. private int mouseSpeed1;
  48.  
  49. private long startTime;
  50. long lastTime = System.currentTimeMillis();
  51. int nextWait = 30000;
  52. GSFGUI gui = new GSFGUI();
  53. updateChecker uc = new updateChecker();
  54. public boolean GuiIsOpen = true;
  55. boolean guiClosed;
  56.  
  57. private boolean enableTeleporting;
  58. private boolean changeRooms;
  59. private boolean useTablets;
  60. private boolean enableRange;
  61. private boolean noArrowsLeft;
  62. private boolean atSpiders;
  63. private boolean needBank;
  64. String status;
  65.  
  66. Rectangle close = new Rectangle(405, 5, 111, 26);
  67. Point p;
  68. boolean hide = false;
  69.  
  70. private RSTile myTile;
  71. private RSTile bankTile;
  72.  
  73. private final RSTile edgeTile = new RSTile(3094, 3491);
  74. private final RSTile varrockTile = new RSTile(3189, 3437);
  75. private final RSTile entranceTile = new RSTile(3081, 3421);
  76.  
  77. private final RSTile caveToVarrockTiles[] = { new RSTile(3081, 3421),
  78. new RSTile(3087, 3420), new RSTile(3095, 3420),
  79. new RSTile(3103, 3421), new RSTile(3113, 3420),
  80. new RSTile(3120, 3418), new RSTile(3128, 3417),
  81. new RSTile(3138, 3417), new RSTile(3148, 3417),
  82. new RSTile(3157, 3419), new RSTile(3163, 3424),
  83. new RSTile(3171, 3428), new RSTile(3180, 3429),
  84. new RSTile(3186, 3433), new RSTile(3189, 3437) };
  85.  
  86. private final RSTile varrockToCaveTiles[] = {new RSTile(3189, 3437),
  87. new RSTile(3186, 3433), new RSTile(3180, 3429),
  88. new RSTile(3171, 3428), new RSTile(3163, 3424),
  89. new RSTile(3157, 3419), new RSTile(3148, 3417),
  90. new RSTile(3138, 3417), new RSTile(3128, 3417),
  91. new RSTile(3120, 3418), new RSTile(3113, 3420),
  92. new RSTile(3103, 3421), new RSTile(3095, 3420),
  93. new RSTile(3087, 3420), new RSTile(3081, 3421)};
  94.  
  95. private final RSTile caveToEdgyTiles[] = { new RSTile(3081, 3421),
  96. new RSTile(3086, 3427), new RSTile(3090, 3431),
  97. new RSTile(3088, 3441), new RSTile(3087, 3451),
  98. new RSTile(3087, 3459), new RSTile(3087, 3465),
  99. new RSTile(3082, 3465), new RSTile(3079, 3468),
  100. new RSTile(3079, 3475), new RSTile(3079, 3481),
  101. new RSTile(3083, 3485), new RSTile(3088, 3491),
  102. new RSTile(3094, 3491) };
  103.  
  104. private final RSTile edgyToCaveTiles[] = { new RSTile(3094, 3491),
  105. new RSTile(3088, 3491), new RSTile(3083, 3485),
  106. new RSTile(3079, 3481), new RSTile(3079, 3475),
  107. new RSTile(3079, 3468), new RSTile(3082, 3465),
  108. new RSTile(3087, 3465), new RSTile(3087, 3459),
  109. new RSTile(3087, 3451), new RSTile(3088, 3441),
  110. new RSTile(3090, 3431), new RSTile(3068, 3427),
  111. new RSTile(3081, 3421) };
  112.  
  113. private final RSTile doors[] = { new RSTile(2132, 5257),
  114. new RSTile(2132, 5260), new RSTile(2132, 5278),
  115. new RSTile(2132, 5281), new RSTile(2138, 5294),
  116. new RSTile(2141, 5294), new RSTile(2148, 5299),
  117. new RSTile(2148, 5302) };
  118.  
  119. private final RSArea floor1 = new RSArea(new RSTile(1856, 5236),
  120. new RSTile(1866, 5245));
  121. private final RSArea floor1Middle = new RSArea(new RSTile(1900, 5210),
  122. new RSTile(1917, 5230));
  123. private final RSArea floor2 = new RSArea(new RSTile(2037, 5239),
  124. new RSTile(2046, 5246));
  125. private final RSArea floor2Middle = new RSArea(new RSTile(2009, 5203),
  126. new RSTile(2034, 5228));
  127. private final RSArea floor3 = new RSArea(new RSTile(2116, 5250),
  128. new RSTile(2131, 5259));
  129. private final RSArea floor3Front = new RSArea(new RSTile(2131, 5253),
  130. new RSTile(2133, 5256));
  131.  
  132. private final RSArea doors1 = new RSArea(new RSTile(2132, 5257),
  133. new RSTile(2133, 5259));
  134. private final RSArea doors2 = new RSArea(new RSTile(2132, 5279),
  135. new RSTile(2133, 5281));
  136. private final RSArea doors3 = new RSArea(new RSTile(2138, 5294),
  137. new RSTile(2140, 5295));
  138. private final RSArea doors4 = new RSArea(new RSTile(2148, 5299),
  139. new RSTile(2149, 5301));
  140.  
  141. private final RSArea room1 = new RSArea(new RSTile(2117, 5267), new RSTile(
  142. 2134, 5277));
  143. private final RSArea room2 = new RSArea(new RSTile(2142, 5302), new RSTile(
  144. 2156, 5311));
  145.  
  146. private final int potionConstants[] = { Skills.ATTACK, Skills.STRENGTH,
  147. Skills.STRENGTH, Skills.ATTACK, Skills.DEFENSE };
  148. private final int skillConstants[] = { Skills.ATTACK, Skills.STRENGTH,
  149. Skills.DEFENSE, Skills.RANGE };
  150. private final int foods[] = { 361, 379, 373, 7946, 385 };
  151. private final int potionID[][] = { { 9745, 9743, 9741, 9739 },
  152. { 119, 117, 115, 113 }, { 161, 159, 157, 2440 },
  153. { 149, 147, 145, 2436 }, { 167, 165, 163, 2442 } };
  154. private final int rewardID[] = { 11640, 2528, 6199, 14664 };
  155. private final int bowID[] = { 841, 843, 849, 853, 857, 861, 839, 845, 847,
  156. 851, 855, 859 };
  157. private final int arrowID[] = { 882, 884, 886, 888, 890, 892 };
  158. private final int spiderID = 4400;
  159. private final int tabletID = 8007;
  160. private final int lawID = 563;
  161. private final int fireID = 554;
  162. private final int airID = 556;
  163. private final int vialID = 229;
  164.  
  165. /*
  166. * Paint Variables
  167. */
  168. private final String skillNames[] = { "Attack", "Strength", "Defense",
  169. "Range" };
  170. private long runTime;
  171. private int currentLevel;
  172. private int levelsGained;
  173. private int xpGained;
  174. private int xpHour;
  175. private int TNL;
  176. private int percentTNL;
  177. private long timeTNL;
  178. private String skillName;
  179.  
  180. private int kills;
  181. private int killsph;
  182. private int spiderXP = 200;
  183.  
  184. URLConnection url = null;
  185. BufferedReader in = null;
  186. private String PBthread = "http://www.powerbot.org/community/topic/538285-giant-spider-fuser-anti-ban-flawless/";
  187. private String FSthread = "http://fuserscripts.org/community/index.php?/topic/96-giant-spider-fuser-download/";
  188.  
  189. Image fsicon;
  190. Image guilogo;
  191. Image paint;
  192. Image showhide;
  193. Image statusback;
  194.  
  195. Rectangle avatarSpotShape = new Rectangle(426, 286, 87, 54);
  196. Rectangle scriptLogoShape = new Rectangle(184, 283, 235, 54);
  197. Rectangle FuserScriptsLogoShape = new Rectangle(5, 282, 174, 54);
  198.  
  199. private static SystemTray tray = SystemTray.getSystemTray();
  200. private static TrayIcon icon = new TrayIcon(Toolkit.getDefaultToolkit().getImage(Configuration.Paths.getScriptsDirectory() + File.separator + "fs_icon.png"));
  201. public GiantSpiderFuser() {
  202. icon.addActionListener(new ActionListener() {
  203. @Override
  204. public void actionPerformed(ActionEvent e) {
  205. if (Desktop.isDesktopSupported()) {
  206. try {
  207. Desktop.getDesktop().browse(new URI("http://fuserscripts.org/"));
  208. } catch (Exception e1) {
  209. e1.printStackTrace();
  210. }
  211. }
  212. }
  213. });
  214. }
  215.  
  216. private static class Images {
  217. private static Logger log = Logger.getLogger(Images.class.getName());
  218.  
  219. public static Image getImage(String fileName) {
  220. try {
  221. File f = new File(
  222. Configuration.Paths.getScriptsDirectory() + File.separator
  223. + fileName);
  224. if (f.exists()) {
  225. log.info("Successfully loaded " + fileName
  226. + " from scripts folder.");
  227. return ImageIO.read(f.toURI().toURL());
  228. }
  229. BufferedImage img = ImageIO.read(new URL(
  230. "http://scripters.powerbot.org/files/378722/" + fileName));
  231. if (img != null) {
  232. log.info("Downloading images...");
  233. ImageIO.write((RenderedImage) img, "PNG", f);
  234. log.info("Saved " + fileName
  235. + " to Scripts folder successfully.");
  236. return img;
  237. }
  238. } catch (IOException e) {
  239. log.info("No Internet Connection or Broken Image Link.");
  240. }
  241. return null;
  242. }
  243. }
  244.  
  245. @Override
  246. public boolean onStart() {
  247. try {
  248. if (!game.isLoggedIn()) {
  249. log.info("Please login before starting");
  250. return false;
  251. }
  252.  
  253. guilogo = Images.getImage("gsfgui_logov21.png");
  254. fsicon = Images.getImage("fs_icon.png");
  255. paint = Images.getImage("gsf_paintv22.png");
  256. statusback = Images.getImage("statusback.png");
  257. showhide = Images.getImage("showhide.png");
  258.  
  259. /*
  260. * FS Tray
  261. */
  262. if (SystemTray.isSupported()) {
  263. try {
  264. tray.add(icon);
  265. } catch (AWTException e) {
  266. e.printStackTrace();
  267. }
  268. } else {
  269. log("System Tray is not supported.");
  270. }
  271. /*
  272. * Update Checker
  273. */
  274. if (getUpdate() > getVersion()) {
  275. showMessage(scriptName + ": Script Update found!");
  276. update();
  277. return false;
  278. }
  279. else {
  280. showMessage(scriptName + ": Script is Up to Date!");
  281. /*
  282. * GUI Init
  283. */
  284. try {
  285. SwingUtilities.invokeAndWait(new Runnable() {
  286. @Override
  287. public void run() {
  288. gui.setVisible(true);
  289. }
  290. });
  291. } catch (InterruptedException ignored) {
  292. } catch (InvocationTargetException ignored) {
  293. }
  294. while (GuiIsOpen) {
  295. Methods.sleep(25);
  296. }
  297. }
  298. if (guiClosed) {
  299. return false;
  300. }
  301. /*
  302. * Eating
  303. */
  304. if (gui.textField1.getText().length() > 0) {
  305. try {
  306. foodID = Integer.parseInt(gui.textField1.getText());
  307. } catch (NumberFormatException e) {
  308. log.severe("Invalid food id");
  309. return false;
  310. }
  311. } else {
  312. if (gui.list1.getSelectedIndex() != -1) {
  313. foodID = foods[gui.list1.getSelectedIndex()];
  314. } else {
  315. log.severe("No food selected");
  316. return false;
  317. }
  318. }
  319. try {
  320. final int value = Integer
  321. .parseInt(gui.textField2.getText());
  322. final int value1 = Integer.parseInt(gui.textField3
  323. .getText());
  324. eatingValue = new int[] { random(value, value1), value,
  325. value1 };
  326. } catch (NumberFormatException e) {
  327. log.severe("Invalid eating value(s)");
  328. return false;
  329. }
  330. /*
  331. * Potions
  332. */
  333. final JCheckBox selections[] = { gui.checkBox1, gui.checkBox2,
  334. gui.checkBox3, gui.checkBox4, gui.checkBox5 };
  335. final JTextField fields[] = { gui.textField4, gui.textField5,
  336. gui.textField6, gui.textField7, gui.textField8 };
  337. for (int i = 0; i < selections.length; i++) {
  338. if (selections[i].isSelected()) {
  339. potions[i] = 1;
  340. try {
  341. amounts[i] = Integer.parseInt(fields[i].getText());
  342. } catch (NumberFormatException e) {
  343. log.severe("Invalid potion amount(s)");
  344. return false;
  345. }
  346. }
  347. }
  348. /*
  349. * Banking
  350. */
  351. if (!gui.radioButton2.isSelected()) {
  352. bankTile = varrockTile;
  353. } else {
  354. bankTile = edgeTile;
  355. }
  356. if (!gui.radioButton3.isSelected()) {
  357. enableTeleporting = true;
  358. if (!gui.radioButton4.isSelected()) {
  359. useTablets = true;
  360. }
  361. }
  362. /*
  363. * Other
  364. */
  365. if (gui.mouseSpeed.getValue() == 1) {
  366. mouseSpeed1 = 10;
  367. }
  368. else if (gui.mouseSpeed.getValue() == 2) {
  369. mouseSpeed1 = 9;
  370. }
  371. else if (gui.mouseSpeed.getValue() == 3) {
  372. mouseSpeed1 = 8;
  373. }
  374. else if (gui.mouseSpeed.getValue() == 4) {
  375. mouseSpeed1 = 7;
  376. }
  377. else if (gui.mouseSpeed.getValue() == 5) {
  378. mouseSpeed1 = 6;
  379. }
  380. else if (gui.mouseSpeed.getValue() == 6) {
  381. mouseSpeed1 = 5;
  382. }
  383. else if (gui.mouseSpeed.getValue() == 7) {
  384. mouseSpeed1 = 4;
  385. }
  386. else if (gui.mouseSpeed.getValue() == 8) {
  387. mouseSpeed1 = 3;
  388. }
  389. else if (gui.mouseSpeed.getValue() == 9) {
  390. mouseSpeed1 = 2;
  391. }
  392. else if (gui.mouseSpeed.getValue() == 10) {
  393. mouseSpeed1 = 1;
  394. }
  395.  
  396. if (gui.radioButton7.isSelected()) {
  397. changeRooms = true;
  398. } else {
  399. if (gui.radioButton8.isSelected()) {
  400. currentRoom = 1;
  401. } else {
  402. currentRoom = 2;
  403. }
  404. }
  405. if (gui.checkBox6.isSelected()) {
  406. enableRange = true;
  407. final RSItem knive = equipment.getItem(Equipment.WEAPON);
  408. if (knive != null && knive.getID() == 863) {
  409. arrow = 863;
  410. } else {
  411. final RSItem weared = equipment.getItem(Equipment.AMMO);
  412. for (final int id : arrowID) {
  413. if (weared != null && weared.getID() == id) {
  414. arrow = id;
  415. break;
  416. }
  417. }
  418. if (arrow < 1) {
  419. log.severe("No arrows found");
  420. return false;
  421. }
  422. }
  423. if (!equipment.containsOneOf(bowID) && arrow != 863) {
  424. log.severe("No bow found");
  425. return false;
  426. }
  427. }
  428. stats = new int[][] {
  429. { skills.getRealLevel(Skills.ATTACK),
  430. skills.getCurrentExp(Skills.ATTACK) },
  431. { skills.getRealLevel(Skills.STRENGTH),
  432. skills.getCurrentExp(Skills.STRENGTH) },
  433. { skills.getRealLevel(Skills.DEFENSE),
  434. skills.getCurrentExp(Skills.DEFENSE) },
  435. { skills.getRealLevel(Skills.RANGE),
  436. skills.getCurrentExp(Skills.RANGE) } };
  437. if (!combat.isAutoRetaliateEnabled()) {
  438. combat.setAutoRetaliate(true);
  439. }
  440. setRoom();
  441. startTime = System.currentTimeMillis();
  442. /*
  443. * Disabling Rewards Box Solver
  444. */
  445. env.disableRandom("Improved Rewards Box");
  446. showMessage("Script Started Successfully!");
  447. return true;
  448. } catch (Exception e) {
  449. e.printStackTrace();
  450. return false;
  451. }
  452. }
  453.  
  454. public static void showMessage(Object text) {
  455. icon.displayMessage("Fuser Scripts", text.toString(), TrayIcon.MessageType.INFO);
  456. }
  457.  
  458. private void update() {
  459. try {
  460. SwingUtilities.invokeAndWait(new Runnable() {
  461. @Override
  462. public void run() {
  463. uc.setVisible(true);
  464. }
  465. });
  466. } catch (InterruptedException ignored) {
  467. } catch (InvocationTargetException ignored) {
  468. }
  469. while (uc.isVisible()) {
  470. sleep(100);
  471. }
  472. }
  473.  
  474. public double getUpdate() {
  475. try {
  476. BufferedReader r = new BufferedReader(new InputStreamReader(new URL("http://scripters.powerbot.org/files/378722/gsfversion.txt").openStream()));
  477. double d = Double.parseDouble(r.readLine());
  478. r.close();
  479. return d;
  480. } catch(Exception e) {
  481. log("Unable to check for update.");
  482. }
  483. return getVersion();
  484. }
  485.  
  486. public void openThread(String thread){
  487. if (java.awt.Desktop.isDesktopSupported()) {
  488. java.awt.Desktop desktop = java.awt.Desktop.getDesktop();
  489.  
  490. if (!desktop.isSupported(java.awt.Desktop.Action.BROWSE)) {
  491. log("Unable to Open Script Thread.");
  492. return;
  493. }
  494.  
  495. try {
  496.  
  497. java.net.URI uri = new java.net.URI(thread);
  498. desktop.browse(uri);
  499. } catch (Exception e) {
  500.  
  501. }
  502. }
  503. }
  504.  
  505.  
  506. @Override
  507. public int loop() {
  508. if (!game.isLoggedIn()) {
  509. return random(800, 1200);
  510. }
  511. mouse.setSpeed(mouseSpeed1);
  512. checkRunning();
  513. if (eat()) {
  514. return random(100, 250);
  515. }
  516. if (teleport()) {
  517. return random(5000, 6000);
  518. }
  519. if (!hasFood() || noArrowsLeft) {
  520. if (!needBank) {
  521. setRoom();
  522. needBank = true;
  523. atSpiders = false;
  524. if (tries != 0) {
  525. tries = 0;
  526. }
  527. }
  528. } else {
  529. needBank = false;
  530. }
  531. if (atSpiders) {
  532. if (getMyPlayer().getInteracting() == null) {
  533. if (!pickArrows()) {
  534. attackSpiders();
  535. }
  536. } else {
  537. status = "Fighting...";
  538. if (tries != 0) {
  539. tries = 0;
  540. }
  541. if (!drinkPotions() && !equipArrows()) {
  542. antiban();
  543. }
  544. }
  545. return random(100, 250);
  546. }
  547. if ((myTile = getMyPlayer().getLocation()) != null) {
  548. if (floor1.contains(myTile)) {
  549. if (!needBank) {
  550. clickObject(16150, "Enter");
  551. status = "Entering Portal";
  552. } else {
  553. clickObject(16148, "Climb-up");
  554. status = "Climbing Up";
  555. }
  556. } else if (floor1Middle.contains(myTile)) {
  557. clickObject(16149, "Climb-down");
  558. status = "Climbing Down";
  559. } else if (floor2.contains(myTile)) {
  560. if (!needBank) {
  561. clickObject(16082, "Enter");
  562. status = "Entering Portal";
  563. } else {
  564. clickObject(16080, "Climb-up");
  565. status = "Climbing Up";
  566. }
  567. } else if (floor2Middle.contains(myTile)) {
  568. clickObject(16081, "Climb-down");
  569. status = "Climbing Down";
  570. } else if (floor3.contains(myTile)) {
  571. if (!needBank) {
  572. clickDoor(doors[0]);
  573. status = "Opening Doors";
  574. } else {
  575. clickObject(16114, "Climb-up");
  576. status = "Climbing Up";
  577. }
  578. } else if (floor3Front.contains(myTile)) {
  579. if (!needBank) {
  580. clickDoor(doors[0]);
  581. status = "Opening Doors";
  582. } else {
  583. clickObject(16114, "Climb-up");
  584. status = "Climbing Up";
  585. }
  586. } else if (doors1.contains(myTile)) {
  587. if (!needBank) {
  588. clickDoor(doors[1]);
  589. status = "Opening Doors";
  590. } else {
  591. clickDoor(doors[0]);
  592. status = "Opening Doors";
  593. }
  594. } else if (myTile.getY() >= 5260 && myTile.getY() <= 5278) {
  595. if (!needBank) {
  596. if (currentRoom == 1) {
  597. if (room1.contains(myTile)) {
  598. atSpiders = true;
  599. status = "Reached Spiders";
  600. } else {
  601. walkToTile(room1.getCentralTile());
  602. }
  603. } else {
  604. clickDoor(doors[2]);
  605. status = "Opening Doors";
  606. }
  607. } else {
  608. clickDoor(doors[1]);
  609. status = "Opening Doors";
  610. }
  611. } else if (doors2.contains(myTile)) {
  612. if (!needBank && currentRoom == 2) {
  613. clickDoor(doors[3]);
  614. status = "Opening Doors";
  615. } else {
  616. clickDoor(doors[2]);
  617. status = "Opening Doors";
  618. }
  619. } else if (myTile.getY() >= 5282 && myTile.getY() <= 5295
  620. && myTile.getX() <= 2137) {
  621. if (!needBank && currentRoom == 2) {
  622. clickDoor(doors[4]);
  623. status = "Opening Doors";
  624. } else {
  625. clickDoor(doors[3]);
  626. status = "Opening Doors";
  627. }
  628. } else if (doors3.contains(myTile)) {
  629. if (!needBank && currentRoom == 2) {
  630. clickDoor(doors[5]);
  631. status = "Opening Doors";
  632. } else {
  633. clickDoor(doors[4]);
  634. status = "Opening Doors";
  635. }
  636. } else if (myTile.getY() >= 5294 && myTile.getY() <= 5298
  637. && myTile.getX() >= 2141) {
  638. if (!needBank && currentRoom == 2) {
  639. clickDoor(doors[6]);
  640. status = "Opening Doors";
  641. } else {
  642. clickDoor(doors[5]);
  643. status = "Opening Doors";
  644. }
  645. } else if (doors4.contains(myTile)) {
  646. if (!needBank && currentRoom == 2) {
  647. clickDoor(doors[7]);
  648. status = "Opening Doors";
  649. } else {
  650. clickDoor(doors[6]);
  651. status = "Opening Doors";
  652. }
  653. } else if (room2.contains(myTile)) {
  654. if (!needBank && currentRoom == 2) {
  655. walkToTile(room2.getCentralTile());
  656. atSpiders = true;
  657. status = "Reached Spiders";
  658. } else {
  659. clickDoor(doors[7]);
  660. status = "Opening Doors";
  661. }
  662. } else {
  663. if (needBank) {
  664. if (dropVials()) {
  665. status = "Dropping Vials";
  666. return random(800, 1200);
  667. }
  668. if (dropRewards()) {
  669. status = "Dropping Reward Box";
  670. return random(800, 1200);
  671. }
  672. if (calc.distanceTo(bankTile) < 5) {
  673. if (bank.isOpen()) {
  674. status = "Banking...";
  675. if (tries != 0) {
  676. tries = 0;
  677. }
  678. if (noArrowsLeft) {
  679. log.severe("No arrows left");
  680. showMessage(scriptName + ": No Arrows Left, Stopping Script...");
  681. stopScript(true);
  682. }
  683. if (openBankTab()) {
  684. return random(800, 1200);
  685. }
  686. if (depositCrap()) {
  687. return random(800, 1200);
  688. }
  689. if (enableTeleporting) {
  690. if (useTablets) {
  691. if (!inventory.contains(tabletID)
  692. && bank.getCount(tabletID) > 0) {
  693. bank.withdraw(tabletID, 1);
  694. return random(800, 1200);
  695. }
  696. } else {
  697. if (!inventory.contains(lawID)
  698. && bank.getCount(lawID) > 0) {
  699. bank.withdraw(lawID, 1);
  700. return random(800, 1200);
  701. } else if (inventory.getCount(true, airID) < 3
  702. && bank.getCount(airID) >= 3) {
  703. bank.withdraw(airID, 3);
  704. return random(800, 1200);
  705. } else if (!inventory.contains(fireID)
  706. && bank.getCount(fireID) > 0) {
  707. bank.withdraw(fireID, 1);
  708. return random(800, 1200);
  709. }
  710. }
  711. }
  712. for (int i = 0; i < potionID.length; i++) {
  713. if (potions[i] == 1) {
  714. if (inventory.getCount(potionID[i]) > amounts[i]) {
  715. if (depositPotion(potionID[i])) {
  716. return random(800, 1200);
  717. }
  718. } else if (inventory.getCount(potionID[i]) < amounts[i]) {
  719. if (withdrawPotion(potionID[i])) {
  720. return random(800, 1200);
  721. }
  722. }
  723. }
  724. }
  725. if (!inventory.contains(foodID)) {
  726. if (bank.getCount(foodID) < 5) {
  727. log.severe("No food left");
  728. showMessage(scriptName + ": No Food Left, Stopping Script...");
  729. stopScript(true);
  730. } else {
  731. bank.withdraw(foodID, 0);
  732. return random(800, 1200);
  733. }
  734. } else {
  735. needBank = false;
  736. }
  737. } else {
  738. if (tries > 3) {
  739. walkToTile(bankTile);
  740. tries = 0;
  741. } else {
  742. if (clickObject((bankTile.equals(edgeTile)) ? 42217 : 782, "Use-quickly")) {
  743. tries++;
  744. status = "Opening Bank ...";
  745. }
  746. }
  747. }
  748. } else {
  749. walkPath((bankTile.equals(edgeTile)) ? caveToEdgyTiles : caveToVarrockTiles);
  750. status = "Walking to Bank";
  751. }
  752. } else {
  753. if (calc.distanceTo(entranceTile) < 5) {
  754. clickObject(16154, "Climb-down");
  755. } else {
  756. walkPath(((bankTile.equals(edgeTile)) ? edgyToCaveTiles : varrockToCaveTiles));
  757. status = "Walking to Cave";
  758. }
  759. }
  760. }
  761. }
  762. return random(100, 250);
  763. }
  764.  
  765. @Override
  766. public void onFinish() {
  767. showMessage("Thanks for Using " + scriptName + " - By " + author);
  768. sleep(5000);
  769. tray.remove(icon);
  770. }
  771.  
  772. private boolean teleport() {
  773. if (enableTeleporting && game.getBaseY() > 4000 && needBank
  774. && canTeleport()) {
  775. if (useTablets) {
  776. final RSItem tablet = inventory.getItem(tabletID);
  777. if (tablet != null) {
  778. status = "Teleporting, Breaking Tab";
  779. return tablet.interact("Break");
  780. }
  781. } else {
  782. status = "Teleporting, Casting Spell";
  783. return magic.castSpell(Magic.SPELL_VARROCK_TELEPORT);
  784. }
  785. }
  786. return false;
  787. }
  788.  
  789. private int getNextTile(final RSTile path[]) {
  790. for (int i = path.length - 1; i >= 0; i--) {
  791. if (calc.tileOnMap(path[i])) {
  792. return i;
  793. }
  794. }
  795. return -1;
  796. }
  797.  
  798. private void walkPath(final RSTile path[]) {
  799. final int next = getNextTile(path);
  800. if (next != -1) {
  801. if (walking.walkTileMM(path[next], 2, 2)) {
  802. if (path[next].equals(path[path.length - 1])) {
  803. sleep(700, 900);
  804. waitToStop();
  805. } else {
  806. for (int i = 0; i < 20; i++) {
  807. if (getMyPlayer().isMoving()) {
  808. i = 0;
  809. }
  810. if (calc.tileOnMap(path[next + 1])) {
  811. break;
  812. }
  813. sleep(100, 200);
  814. }
  815. }
  816. }
  817. } else {
  818. walkToTile(path[path.length - 1]);
  819. }
  820. }
  821.  
  822. private void waitToStop() {
  823. while (getMyPlayer().isMoving()) {
  824. sleep(100, 250);
  825. }
  826. }
  827.  
  828. private boolean canTeleport() {
  829. return (inventory.contains(tabletID))
  830. || (inventory.contains(lawID)
  831. && inventory.getCount(true, airID) >= 3 && inventory
  832. .contains(fireID));
  833. }
  834.  
  835.  
  836. private boolean dropVials() {
  837. if (inventory.contains(vialID)) {
  838. for (final RSItem item : inventory.getItems()) {
  839. if (item != null && item.getID() == vialID
  840. && item.interact("Drop")) {
  841. sleep(50, 90);
  842. }
  843. }
  844. return true;
  845. }
  846. return false;
  847. }
  848.  
  849.  
  850. private boolean dropRewards() {
  851. if (inventory.containsOneOf(rewardID)) {
  852. for (final RSItem item : inventory.getItems()) {
  853. if (item != null && isReward(item.getID())
  854. && item.interact("Drop")) {
  855. sleep(50, 90);
  856. }
  857. }
  858. return true;
  859. }
  860. return false;
  861. }
  862.  
  863. private boolean isReward(final int thisID) {
  864. for (final int id : rewardID) {
  865. if (thisID == id)
  866. return true;
  867. }
  868. return false;
  869. }
  870.  
  871. private boolean isPotion(final int thisID) {
  872. for (final int id[] : potionID) {
  873. for (final int id2 : id) {
  874. if (thisID == id2)
  875. return true;
  876. }
  877. }
  878. return false;
  879. }
  880.  
  881.  
  882. private boolean depositCrap() {
  883. ArrayList<Integer> items = new ArrayList<Integer>();
  884. for (final RSItem item : inventory.getItems()) {
  885. if (item != null) {
  886. final int id = item.getID();
  887. if (!items.contains(id) && id > 0 && id != lawID && id != airID
  888. && id != fireID && id != tabletID && id != foodID
  889. && id != arrow && !isPotion(id) && !isReward(id)) {
  890. if (item.interact("Deposit-All")) {
  891. items.add(id);
  892. sleep(60, 120);
  893. }
  894. item.interact("Deposit");
  895. }
  896. }
  897. }
  898. return items.size() > 0;
  899. }
  900.  
  901.  
  902. private boolean equipArrows() {
  903. if (enableRange && inventory.getCount(true, arrow) >= random(20, 30)) {
  904. final RSItem arrows = inventory.getItem(arrow);
  905. if (arrows != null && arrows.interact("Wield")) {
  906. status = "Weilding Arrows";
  907. sleep(600, 900);
  908. return true;
  909. }
  910. }
  911. return false;
  912. }
  913.  
  914.  
  915. private boolean pickArrows() {
  916. if (enableRange && !inventory.isFull()) {
  917. RSGroundItem thisItem = null;
  918. final RSGroundItem items[] = groundItems.getAll();
  919. for (final RSGroundItem item : items) {
  920. if (item != null) {
  921. if (room1.contains(item.getLocation())
  922. || room2.contains(item.getLocation())) {
  923. final RSItem stack = item.getItem();
  924. if (stack != null && stack.getID() == arrow
  925. && stack.getStackSize() >= 5) {
  926. thisItem = item;
  927. break;
  928. }
  929. }
  930. }
  931. }
  932. if (thisItem != null) {
  933. if (thisItem.isOnScreen()) {
  934. if (!getMyPlayer().isMoving() && thisItem.interact("Take")) {
  935. status = "Picking Up Arrows";
  936. sleep(700, 900);
  937. waitToStop();
  938. for (int i = 0; i < 20; i++) {
  939. if (needToEat()) {
  940. break;
  941. }
  942. sleep(50, 80);
  943. }
  944. return true;
  945. }
  946. } else {
  947. walkToTile(thisItem.getLocation());
  948. }
  949. }
  950. }
  951. return false;
  952. }
  953.  
  954. private boolean containsPotion(final int potion[]) {
  955. return inventory.containsOneOf(potion);
  956. }
  957.  
  958. private boolean hasFood() {
  959. for (final RSItem food : (!bank.isOpen()) ? inventory.getItems() : inventory.getItems()) {
  960. if (food != null && food.getID() == foodID)
  961. return true;
  962. }
  963. return false;
  964. }
  965.  
  966.  
  967. private boolean drinkPotions() {
  968. for (int i = 0; i < potionID.length; i++) {
  969. if (potions[i] == 1
  970. && containsPotion(potionID[i])
  971. && skills.getCurrentLevel(potionConstants[i])
  972. - skills.getRealLevel(potionConstants[i]) <= random(
  973. 2, 5)) {
  974. final RSItem potion = inventory.getItem(potionID[i]);
  975. if (potion != null && potion.interact("Drink")) {
  976. status = "Drinking Potions *Hic*";
  977. sleep(1000, 1300);
  978. return true;
  979. }
  980. break;
  981. }
  982. }
  983. return false;
  984. }
  985.  
  986. private boolean openBankTab() {
  987. if (bankTab != -1) {
  988. if (bank.getCurrentTab() != bankTab) {
  989. final RSComponent tab = interfaces.getComponent(
  990. Bank.INTERFACE_BANK, Bank.INTERFACE_BANK_TAB[bankTab]);
  991. if (tab.isValid()) {
  992. return tab.doClick();
  993. }
  994. }
  995. } else {
  996. bankTab = bank.getCurrentTab();
  997. }
  998. return false;
  999. }
  1000.  
  1001. private boolean withdrawPotion(final int potion[]) {
  1002. for (int i = potion.length - 1; i >= 0; i--) {
  1003. if (bank.getCount(potion[i]) > 0) {
  1004. bank.withdraw(potion[i], 1);
  1005. return true;
  1006. }
  1007. }
  1008. return false;
  1009. }
  1010.  
  1011. private boolean depositPotion(final int potion[]) {
  1012. for (final int id : potion) {
  1013. if (inventory.contains(id)) {
  1014. bank.deposit(id, 0);
  1015. return true;
  1016. }
  1017. }
  1018. return false;
  1019. }
  1020.  
  1021.  
  1022. private boolean eat() {
  1023. if (needToEat()) {
  1024. final RSItem food = inventory.getItem(foodID);
  1025. if (food != null && food.interact("Eat")) {
  1026. status = "Eating, *Om nom nom nom...*";
  1027. sleep(1000, 1300);
  1028. eatingValue[0] = random(eatingValue[1], eatingValue[2]);
  1029. return true;
  1030. }
  1031. }
  1032. return false;
  1033. }
  1034.  
  1035. private boolean needToEat() {
  1036. return combat.getLifePoints() <= eatingValue[0];
  1037. }
  1038.  
  1039.  
  1040. private boolean clickObject(final int id, final String action) {
  1041. final RSObject obj = objects.getNearest(id);
  1042. if (obj != null) {
  1043. if (obj.isOnScreen()) {
  1044. if (!getMyPlayer().isMoving()) {
  1045. if (objTries > 5) {
  1046. camera.setAngle(random(1, 360));
  1047. objTries = 0;
  1048. } else {
  1049. if (obj.interact(action)) {
  1050. objTries = 0;
  1051. sleep(2500, 3000);
  1052. return true;
  1053. } else {
  1054. objTries++;
  1055. }
  1056. }
  1057. }
  1058. } else {
  1059. walkToTile(obj.getLocation());
  1060. }
  1061. }
  1062. return false;
  1063. }
  1064.  
  1065.  
  1066. private void clickDoor(final RSTile doorTile) {
  1067. if (camera.getPitch() != 3072) {
  1068. camera.setPitch(true);
  1069. }
  1070. final RSObject obj = objects.getTopAt(doorTile);
  1071. if (obj != null) {
  1072. if (obj.isOnScreen()) {
  1073. if (!getMyPlayer().isMoving()) {
  1074. if (objTries > 5) {
  1075. camera.setAngle(random(1, 360));
  1076. objTries = 0;
  1077. } else {
  1078. if (obj.interact("Open")) {
  1079. objTries = 0;
  1080. sleep(3500, 4000);
  1081. } else {
  1082. objTries++;
  1083. }
  1084. }
  1085. }
  1086. } else {
  1087. walkToTile(obj.getLocation());
  1088. }
  1089. } else {
  1090. walkToTile(doorTile);
  1091. }
  1092. }
  1093.  
  1094. private void setRoom() {
  1095. if (changeRooms) {
  1096. currentRoom = random(1, 3);
  1097. }
  1098. }
  1099.  
  1100. private void walkToTile(final RSTile destination) {
  1101. if (calc.tileOnMap(destination)) {
  1102. if (walking.walkTileMM(destination, 2, 2)) {
  1103. sleep(700, 900);
  1104. waitToStop();
  1105. }
  1106. } else {
  1107. if (!getMyPlayer().isMoving()
  1108. || walking.getDestination() == null
  1109. || calc.distanceTo(walking.getDestination()) <= random(3, 8)) {
  1110. final RSTile step = walking.getClosestTileOnMap(destination);
  1111. if (step != null && walking.walkTileMM(step, 2, 2)) {
  1112. sleep(700, 900);
  1113. }
  1114. }
  1115. }
  1116. }
  1117.  
  1118. private void checkRunning() {
  1119. if (!walking.isRunEnabled() && walking.getEnergy() >= random(25, 35)) {
  1120. walking.setRun(true);
  1121. sleep(900, 1300);
  1122. }
  1123. }
  1124.  
  1125.  
  1126. private void attackSpiders() {
  1127. final RSNPC agressive = getAgressive();
  1128. if (agressive != null) {
  1129. if (tries < 15) {
  1130. if (!agressive.isMoving()) {
  1131. tries++;
  1132. }
  1133. return;
  1134. }
  1135. }
  1136. final RSNPC free = getFree();
  1137. if (free != null) {
  1138. if (free.isOnScreen()) {
  1139. if (random(1,6) == 3) {
  1140. camera.turnTo(free, random(3,5));
  1141. }
  1142. if (free.interact("Attack")) {
  1143. status = "Attacking Spiders";
  1144. sleep(700, 900);
  1145. waitToStop();
  1146. for (int i = 0; i < 20; i++) {
  1147. if (needToEat()) {
  1148. break;
  1149. }
  1150. sleep(50, 150);
  1151. }
  1152. }
  1153. } else {
  1154. walkToTile(free.getLocation());
  1155. }
  1156. }
  1157. }
  1158.  
  1159. private RSNPC getFree() {
  1160. RSNPC winner = null;
  1161. int distance = 1000;
  1162. for (final RSNPC npc : npcs.getAll()) {
  1163. if (npc != null && npc.getID() == spiderID && !npc.isInCombat()
  1164. && npc.getHPPercent() > 0) {
  1165. if (room1.contains(npc.getLocation())
  1166. || room2.contains(npc.getLocation())) {
  1167. final int thisDistance = calc.distanceTo(npc.getLocation());
  1168. if (thisDistance < distance) {
  1169. winner = npc;
  1170. distance = thisDistance;
  1171. }
  1172. }
  1173. }
  1174. }
  1175. status = "Searching for Free Spiders";
  1176. return winner;
  1177. }
  1178.  
  1179. private RSNPC getAgressive() {
  1180. for (final RSNPC npc : npcs.getAll()) {
  1181. if (npc != null && npc.getID() == spiderID
  1182. && npc.getInteracting() != null
  1183. && npc.getInteracting().equals(getMyPlayer())) {
  1184. return npc;
  1185. }
  1186. }
  1187. return null;
  1188. }
  1189.  
  1190. boolean timeSinceLast(int a) {
  1191. return (System.currentTimeMillis() - lastTime > a);
  1192. }
  1193.  
  1194. void setNext(int a, int b) {
  1195. lastTime = System.currentTimeMillis();
  1196. nextWait = random(a, b);
  1197. }
  1198.  
  1199. public void antiban() {
  1200. if (timeSinceLast(nextWait)) {
  1201. int cC = random(1, 30);
  1202. doAntiban(cC, 100);
  1203. setNext(60000, 120000);
  1204. }
  1205. }
  1206.  
  1207. public void doAntiban(int ws, int randRecur) {
  1208. switch (ws) {
  1209. case 1:
  1210. if (random(0, 100) <= 50) {
  1211. new rotation("", random(1000, 5000));
  1212. } else {
  1213. new rotation("anti", random(1000, 5000));
  1214. }
  1215. mouse.moveRandomly(200, 600);
  1216. mouse.moveSlightly();
  1217. break;
  1218.  
  1219. case 2:
  1220. RSPlayer target = null;
  1221. for (RSPlayer p : players.getAll()) {
  1222. if (p.isOnScreen()) {
  1223. target = p;
  1224. break;
  1225. }
  1226. target = null;
  1227. }
  1228. if (random(0, 100) <= 50) {
  1229. new rotation("", random(1000, 2000));
  1230. } else {
  1231. new rotation("anti", random(1000, 2000));
  1232. }
  1233. if (target != null) {
  1234. Point pt = target.getScreenLocation();
  1235. mouse.click(pt, false);
  1236. sleep(500, 1200);
  1237. mouse.moveRandomly(400, 500);
  1238. }
  1239. break;
  1240.  
  1241. case 3:
  1242. if (random(0, 100) <= 50) {
  1243. new rotation("", random(200, 400));
  1244. } else {
  1245. new rotation("anti", random(200, 400));
  1246. }
  1247. if (random(0, 100) <= 50) {
  1248. game.openTab(Tab.ATTACK);
  1249. sleep(200, 2000);
  1250. game.openTab(Tab.STATS);
  1251. sleep(200, 2000);
  1252. } else {
  1253. game.openTab(Tab.STATS);
  1254. sleep(200, 2000);
  1255. game.openTab(Tab.ATTACK);
  1256. sleep(200, 2000);
  1257. }
  1258. break;
  1259.  
  1260. case 4:
  1261. RSObject objTarg = null;
  1262. for (RSObject p : objects.getAll()) {
  1263. if (p.isOnScreen()) {
  1264. objTarg = p;
  1265. break;
  1266. }
  1267. }
  1268. if (objTarg != null) {
  1269. new rotation("anti", random(200, 1000));
  1270. objTarg.doClick(false);
  1271. sleep(200, 700);
  1272. mouse.moveSlightly();
  1273. mouse.moveRandomly(200, 350);
  1274. }
  1275. break;
  1276.  
  1277. case 5:
  1278. if (random(0, 100) <= 50) {
  1279. new rotation("", random(200, 400));
  1280. } else {
  1281. new rotation("anti", random(200, 400));
  1282. }
  1283. break;
  1284.  
  1285. case 6:
  1286. case 25:
  1287. case 26:
  1288. case 27:
  1289. case 28:
  1290. case 29:
  1291. case 30:
  1292. if (random(0, 100) <= 50) {
  1293. new rotation("", random(200, 400));
  1294. } else {
  1295. new rotation("anti", random(200, 400));
  1296. }
  1297. Point base = new Point(588 + random(0, 17), 175 + random(0, 20));
  1298. Point skillBase = new Point(550 + random(0, 170), 210 + random(0,
  1299. 200));
  1300. mouse.click(base, true);
  1301. sleep(0, 100);
  1302. mouse.move(skillBase);
  1303. sleep(1000, 2000);
  1304. if (random(0, 100) <= 50) {
  1305. new rotation("", random(100, 200));
  1306. } else {
  1307. new rotation("anti", random(100, 200));
  1308. }
  1309. break;
  1310.  
  1311. case 7:
  1312. if (random(0, 100) <= 50) {
  1313. new rotation("", random(200, 400));
  1314. } else {
  1315. new rotation("anti", random(200, 400));
  1316. }
  1317. mouse.moveRandomly(400, 600);
  1318. break;
  1319.  
  1320. case 8:
  1321. Point based = new Point(588 + random(0, 17), 175 + random(0, 20));
  1322. Point skillBased = new Point(550 + random(0, 170), 210 + random(0,
  1323. 200));
  1324. mouse.click(based, true);
  1325. sleep(0, 100);
  1326. mouse.move(skillBased);
  1327. sleep(1000, 2000);
  1328. if (random(0, 100) <= 50) {
  1329. new rotation("", random(100, 200));
  1330. } else {
  1331. new rotation("anti", random(100, 200));
  1332. }
  1333. break;
  1334.  
  1335. case 9:
  1336. game.openTab(Tab.FRIENDS);
  1337. sleep(1300, 1700);
  1338. if (random(0, 100) <= 50) {
  1339. new rotation("", random(100, 200));
  1340. } else {
  1341. new rotation("anti", random(100, 200));
  1342. }
  1343. break;
  1344.  
  1345. case 10:
  1346. game.openTab(Tab.QUESTS);
  1347. sleep(1100, 1700);
  1348. if (random(0, 100) <= 50) {
  1349. new rotation("", random(100, 200));
  1350. } else {
  1351. new rotation("anti", random(100, 200));
  1352. }
  1353. break;
  1354.  
  1355. case 11:
  1356. game.openTab(Tab.ATTACK);
  1357. sleep(1300, 1700);
  1358. if (random(0, 100) <= 50) {
  1359. new rotation("", random(100, 200));
  1360. } else {
  1361. new rotation("anti", random(100, 200));
  1362. }
  1363. break;
  1364.  
  1365. case 12:
  1366. if (random(0, 100) <= 50) {
  1367. new rotation("", random(200, 400));
  1368. } else {
  1369. new rotation("anti", random(200, 400));
  1370. }
  1371. if (random(0, 100) <= 50) {
  1372. new rotation("", random(200, 400));
  1373. } else {
  1374. new rotation("anti", random(200, 400));
  1375. }
  1376. if (random(0, 100) <= 50) {
  1377. new rotation("", random(200, 400));
  1378. } else {
  1379. new rotation("anti", random(200, 400));
  1380. }
  1381. break;
  1382.  
  1383. case 13:
  1384. if (random(0, 100) <= 50) {
  1385. new rotation("", random(200, 400));
  1386. } else {
  1387. new rotation("anti", random(200, 400));
  1388. }
  1389. mouse.moveRandomly(300, 600);
  1390. break;
  1391.  
  1392. case 14:
  1393. if (random(0, 100) <= 50) {
  1394. new rotation("", random(400, 600));
  1395. } else {
  1396. new rotation("anti", random(400, 600));
  1397. }
  1398. break;
  1399.  
  1400. case 15:
  1401. if (random(0, 100) <= 50) {
  1402. new rotation("", random(200, 400));
  1403. } else {
  1404. new rotation("anti", random(200, 400));
  1405. }
  1406. mouse.moveRandomly(400, 600);
  1407. mouse.moveSlightly();
  1408. break;
  1409.  
  1410. case 16:
  1411. Point baseq = new Point(588 + random(0, 17), 175 + random(0, 20));
  1412. Point skillBaseq = new Point(550 + random(0, 170), 210 + random(0,
  1413. 200));
  1414. mouse.click(baseq, true);
  1415. sleep(0, 100);
  1416. mouse.move(skillBaseq);
  1417. sleep(1000, 2000);
  1418. if (random(0, 100) <= 50) {
  1419. new rotation("", random(100, 200));
  1420. } else {
  1421. new rotation("anti", random(100, 200));
  1422. }
  1423. break;
  1424.  
  1425. case 17:
  1426. game.openTab(Tab.FRIENDS);
  1427. sleep(300, 700);
  1428. if (random(0, 100) <= 50) {
  1429. new rotation("", random(100, 200));
  1430. } else {
  1431. new rotation("anti", random(100, 200));
  1432. }
  1433. break;
  1434.  
  1435. case 18:
  1436. Point start = inventory.getItems()[random(0,
  1437. inventory.getItems().length - 1)].getComponent()
  1438. .getLocation();
  1439. Point destination = inventory.getItems()[random(0,
  1440. inventory.getItems().length - 1)].getComponent()
  1441. .getLocation();
  1442. mouse.move(start);
  1443. mouse.drag(destination);
  1444. break;
  1445.  
  1446. case 19:
  1447. inventory.getItems()[random(0, inventory.getItems().length - 1)]
  1448. .interact("Examine");
  1449. mouse.moveRandomly(random(20, 30));
  1450. sleep(323, 700);
  1451. break;
  1452.  
  1453. case 20:
  1454. if (random(0, 100) <= 50) {
  1455. new rotation("", random(200, 2500));
  1456. } else {
  1457. new rotation("anti", random(200, 2500));
  1458. }
  1459. RSObject objTarg3 = null;
  1460. for (RSObject p : objects.getAll()) {
  1461. if (p.isOnScreen()) {
  1462. objTarg3 = p;
  1463. break;
  1464. }
  1465. objTarg3 = null;
  1466. }
  1467. if (objTarg3 != null) {
  1468. new rotation("anti", random(200, 1000));
  1469. objTarg3.interact("Examine");
  1470. mouse.moveRandomly(random(20, 30));
  1471. sleep(200, 700);
  1472. mouse.moveSlightly();
  1473. mouse.moveRandomly(200, 350);
  1474. }
  1475. break;
  1476.  
  1477. case 21:
  1478. if (random(0, 100) <= 50) {
  1479. new rotation("", random(400, 700));
  1480. } else {
  1481. new rotation("anti", random(400, 700));
  1482. }
  1483. RSObject objTarg2 = null;
  1484. for (RSObject p : objects.getAll()) {
  1485. if (p.isOnScreen()) {
  1486. objTarg2 = p;
  1487. break;
  1488. }
  1489. objTarg = null;
  1490. }
  1491. if (objTarg2 != null) {
  1492. objTarg2.interact("Examine");
  1493. mouse.moveRandomly(random(20, 30));
  1494. }
  1495. break;
  1496.  
  1497. case 22:
  1498. RSNPC fc = npcs.getNearest("Giant spider");
  1499. if (fc != null) {
  1500. Point p = fc.getScreenLocation();
  1501. mouse.click(p, false);
  1502. mouse.moveRandomly(random(20, 30));
  1503. sleep(500, 1000);
  1504. mouse.moveSlightly();
  1505. mouse.moveSlightly();
  1506. } else {
  1507. if (random(0, 100) <= 50) {
  1508. new rotation("", random(200, 400));
  1509. } else {
  1510. new rotation("anti", random(200, 400));
  1511. }
  1512. }
  1513. break;
  1514.  
  1515. case 23:
  1516. RSNPC fc2 = npcs.getNearest("Giant spider");
  1517. if (fc2 != null) {
  1518. fc2.interact("Examine");
  1519. mouse.moveRandomly(random(20, 30));
  1520. sleep(500, 1000);
  1521. } else {
  1522. if (random(0, 100) <= 50) {
  1523. new rotation("", random(200, 400));
  1524. } else {
  1525. new rotation("anti", random(200, 400));
  1526. }
  1527. }
  1528. break;
  1529.  
  1530. case 24:
  1531. if (random(0, 100) <= 50) {
  1532. new rotation("", random(200, 400));
  1533. } else {
  1534. new rotation("anti", random(200, 400));
  1535. }
  1536. int b = random(1, 8);
  1537. if (b == 1) {
  1538. game.mouseChatButton(ChatButton.ALL, false);
  1539. sleep(300, 1000);
  1540. }
  1541. if (b == 2) {
  1542. game.mouseChatButton(ChatButton.GAME, false);
  1543. sleep(300, 1000);
  1544. }
  1545. if (b == 3) {
  1546. game.mouseChatButton(ChatButton.PUBLIC, false);
  1547. sleep(300, 1000);
  1548. }
  1549. if (b == 4) {
  1550. game.mouseChatButton(ChatButton.PRIVATE, false);
  1551. sleep(300, 1000);
  1552. }
  1553. if (b == 5) {
  1554. game.mouseChatButton(ChatButton.FRIENDS, false);
  1555. sleep(300, 1000);
  1556. }
  1557. if (b == 6) {
  1558. game.mouseChatButton(ChatButton.CLAN, false);
  1559. sleep(300, 1000);
  1560. }
  1561. if (b == 7) {
  1562. game.mouseChatButton(ChatButton.TRADE, false);
  1563. sleep(300, 1000);
  1564. }
  1565. if (b == 8) {
  1566. game.mouseChatButton(ChatButton.ASSIST, false);
  1567. sleep(300, 1000);
  1568. }
  1569. mouse.moveSlightly();
  1570. break;
  1571. }
  1572. if (random(0, 180) <= randRecur) {
  1573. int cC = ws;
  1574. while (cC == ws) {
  1575. cC = random(1, 30);
  1576. }
  1577. status = "Doing Anti-Ban, Case " + cC;
  1578. doAntiban(cC, randRecur / 2);
  1579. }
  1580. }
  1581.  
  1582. final char anticlockwise = 37;
  1583. final char clockwise = 39;
  1584. private char rotationDirection;
  1585.  
  1586. class rotation extends Thread {
  1587. int maxDuration = 3000, type = 1, angle = 10;
  1588. RSNPC npc = null;
  1589. RSObject object = null;
  1590. String direction = "";
  1591.  
  1592. public rotation(RSNPC npc, int maxDuration) {
  1593. this.npc = npc;
  1594. this.maxDuration = maxDuration;
  1595. type = 1;
  1596. this.setPriority(3);
  1597. this.start();
  1598. }
  1599.  
  1600. public rotation(RSObject object, int maxDuration) {
  1601. this.object = object;
  1602. this.maxDuration = maxDuration;
  1603. type = 1;
  1604. this.setPriority(3);
  1605. this.start();
  1606. }
  1607.  
  1608. public rotation(String direction, int maxDuration) {
  1609. this.direction = direction;
  1610. this.maxDuration = maxDuration;
  1611. type = 2;
  1612. this.setPriority(3);
  1613. this.start();
  1614. }
  1615.  
  1616. public rotation(int angle, int maxDuration) {
  1617. this.angle = angle;
  1618. this.maxDuration = maxDuration;
  1619. type = 3;
  1620. this.setPriority(3);
  1621. this.start();
  1622. }
  1623.  
  1624. public void run() {
  1625. switch (type) {
  1626. case 1:
  1627. doRotate();
  1628. break;
  1629.  
  1630. case 2:
  1631. rotateDuration();
  1632. break;
  1633.  
  1634. case 3:
  1635. rotateToAngle();
  1636. break;
  1637. default:
  1638.  
  1639. break;
  1640. }
  1641. }
  1642.  
  1643. void doRotate() {
  1644. if (npc != null) {
  1645. rotateToNPC();
  1646. } else if (object != null) {
  1647. rotateToObject();
  1648. }
  1649. }
  1650.  
  1651. public void rotateDuration() {
  1652. if (direction.toLowerCase().contains("anti")) {
  1653. rotationDirection = anticlockwise;
  1654. } else {
  1655. rotationDirection = clockwise;
  1656. }
  1657. long sTime = System.currentTimeMillis();
  1658. keyboard.pressKey(rotationDirection);
  1659. while (System.currentTimeMillis() - sTime < maxDuration) {
  1660. try {
  1661. sleep(50);
  1662. } catch (InterruptedException e) {
  1663. }
  1664. }
  1665. keyboard.pressKey(clockwise);
  1666. keyboard.pressKey(anticlockwise);
  1667. keyboard.releaseKey(anticlockwise);
  1668. keyboard.releaseKey(clockwise);
  1669. }
  1670.  
  1671. public void rotateToAngle() {
  1672. long cTime = 0;
  1673. int aT = angle;
  1674. int aC = camera.getAngle();
  1675. int absoluteDifference = Math.abs(aC - aT);
  1676. if (aC < aT && absoluteDifference < 180) {
  1677. rotationDirection = clockwise;
  1678. } else if (aC < aT && absoluteDifference >= 180) {
  1679. rotationDirection = anticlockwise;
  1680. } else if (aC > aT && absoluteDifference > 180) {
  1681. rotationDirection = clockwise;
  1682. } else if (aC > aT && absoluteDifference <= 180) {
  1683. rotationDirection = anticlockwise;
  1684. }
  1685. cTime = System.currentTimeMillis();
  1686. keyboard.pressKey(rotationDirection);
  1687. while (System.currentTimeMillis() - cTime < maxDuration
  1688. && absoluteDifference > 5) {
  1689. aT = angle;
  1690. aC = camera.getAngle();
  1691. absoluteDifference = Math.abs(aC - aT);
  1692. try {
  1693. sleep(50);
  1694. } catch (InterruptedException e) {
  1695. }
  1696. }
  1697. keyboard.pressKey(clockwise);
  1698. keyboard.pressKey(anticlockwise);
  1699. keyboard.releaseKey(anticlockwise);
  1700. keyboard.releaseKey(clockwise);
  1701. }
  1702.  
  1703. public void rotateToObject() {
  1704. long cTime = 0;
  1705. int aT = camera.getTileAngle(object.getLocation());
  1706. int aC = camera.getAngle();
  1707. int absoluteDifference = Math.abs(aC - aT);
  1708. if (aC < aT && absoluteDifference < 180) {
  1709. rotationDirection = clockwise;
  1710. } else if (aC < aT && absoluteDifference >= 180) {
  1711. rotationDirection = anticlockwise;
  1712. } else if (aC > aT && absoluteDifference > 180) {
  1713. rotationDirection = clockwise;
  1714. } else if (aC > aT && absoluteDifference <= 180) {
  1715. rotationDirection = anticlockwise;
  1716. }
  1717. cTime = System.currentTimeMillis();
  1718. keyboard.pressKey(rotationDirection);
  1719. while ((!object.isOnScreen() && System.currentTimeMillis() - cTime < maxDuration)) {
  1720. aT = camera.getTileAngle(object.getLocation());
  1721. aC = camera.getAngle();
  1722. absoluteDifference = Math.abs(aC - aT);
  1723. try {
  1724. sleep(50);
  1725. } catch (InterruptedException e) {
  1726. }
  1727. }
  1728. keyboard.pressKey(clockwise);
  1729. keyboard.pressKey(anticlockwise);
  1730. keyboard.releaseKey(anticlockwise);
  1731. keyboard.releaseKey(clockwise);
  1732. }
  1733.  
  1734. public void rotateToNPC() {
  1735. long cTime = 0;
  1736. int aT = camera.getTileAngle(npc.getLocation());
  1737. int aC = camera.getAngle();
  1738. int absoluteDifference = Math.abs(aC - aT);
  1739. if (aC < aT && absoluteDifference < 180) {
  1740. rotationDirection = clockwise;
  1741. } else if (aC < aT && absoluteDifference >= 180) {
  1742. rotationDirection = anticlockwise;
  1743. } else if (aC > aT && absoluteDifference > 180) {
  1744. rotationDirection = clockwise;
  1745. } else if (aC > aT && absoluteDifference <= 180) {
  1746. rotationDirection = anticlockwise;
  1747. }
  1748. cTime = System.currentTimeMillis();
  1749. keyboard.pressKey(rotationDirection);
  1750. while ((!npc.isOnScreen() && System.currentTimeMillis() - cTime < maxDuration)
  1751. || (!npc.isOnScreen() && absoluteDifference > 3)) {
  1752. aT = camera.getTileAngle(npc.getLocation());
  1753. aC = camera.getAngle();
  1754. absoluteDifference = Math.abs(aC - aT);
  1755. try {
  1756. sleep(50);
  1757. } catch (InterruptedException e) {
  1758. }
  1759. }
  1760. keyboard.pressKey(clockwise);
  1761. keyboard.pressKey(anticlockwise);
  1762. keyboard.releaseKey(anticlockwise);
  1763. keyboard.releaseKey(clockwise);
  1764. }
  1765. }
  1766.  
  1767. public class MousePaint {
  1768.  
  1769. public int waveSize = 0;
  1770.  
  1771. @SuppressWarnings({"serial", "unused"})
  1772. public class MousePathPoint extends Point {
  1773.  
  1774. private long finishTime;
  1775. private double lastingTime;
  1776.  
  1777. public MousePathPoint(int x, int y, int lastingTime) {
  1778. super(x, y);
  1779. this.lastingTime = lastingTime;
  1780. finishTime = System.currentTimeMillis() + lastingTime;
  1781. }
  1782.  
  1783. public boolean isUp() {
  1784. return System.currentTimeMillis() > finishTime;
  1785. }
  1786.  
  1787. }
  1788.  
  1789. public double getRot(int ticks){
  1790. return (System.currentTimeMillis() % (360 * ticks)) / ticks;
  1791. }
  1792.  
  1793. public LinkedList<MousePathPoint> MousePath = new LinkedList<MousePathPoint>();
  1794.  
  1795. public void drawTrail(Graphics g1) {
  1796. Graphics2D g = (Graphics2D) g1;
  1797. g.setStroke(new BasicStroke(1));
  1798. while (!MousePath.isEmpty() && MousePath.peek().isUp()) {
  1799. MousePath.remove();
  1800. }
  1801. Point clientCursor = mouse.getLocation();
  1802. MousePathPoint mpp = new MousePathPoint(clientCursor.x, clientCursor.y, 250);
  1803. if (MousePath.isEmpty() || !MousePath.getLast().equals(mpp)) {
  1804. MousePath.add(mpp);
  1805. }
  1806. MousePathPoint lastPoint = null;
  1807. for (MousePathPoint a : MousePath) {
  1808. if (lastPoint != null) {
  1809. long mpt = System.currentTimeMillis() - mouse.getPressTime();
  1810. if (mouse.getPressTime() == -1 || mpt >= 250) {
  1811. g.setColor(Color.BLACK);
  1812. }
  1813. if (mpt < 250) {
  1814. g.setColor(Color.RED);
  1815. }
  1816. g.drawLine(a.x, a.y, lastPoint.x, lastPoint.y);
  1817. }
  1818. lastPoint = a;
  1819. }
  1820. }
  1821.  
  1822. public void drawMouse(Graphics g1) {
  1823. Graphics2D g = (Graphics2D) g1;
  1824. g.setRenderingHints(new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON));
  1825. g.setStroke(new BasicStroke(3));
  1826. g.setColor(Color.BLACK);
  1827. g.drawOval(mouse.getLocation().x - 13, mouse.getLocation().y - 13, 25, 25);
  1828. g.setStroke(new BasicStroke(1));
  1829. g.setColor(new Color(0, 0, 0, 114));
  1830. g.fillOval(mouse.getLocation().x - 13, mouse.getLocation().y - 13, 25, 25);
  1831. Point MouseLoc = mouse.getLocation();
  1832. long mpt = System.currentTimeMillis() - mouse.getPressTime();
  1833. g.rotate(Math.toRadians(getRot(5)), mouse.getLocation().x, mouse.getLocation().y);
  1834. if (mouse.getPressTime() == -1 || mpt >= 250) {
  1835. g.setColor(Color.GRAY);
  1836. g.drawLine(MouseLoc.x - 5, MouseLoc.y, MouseLoc.x + 5, MouseLoc.y);
  1837. g.drawLine(MouseLoc.x, MouseLoc.y - 5, MouseLoc.x, MouseLoc.y + 5);
  1838. }
  1839. if (mpt < 250) {
  1840. g.setColor(Color.RED);
  1841. g.drawLine(MouseLoc.x - 5, MouseLoc.y, MouseLoc.x + 5, MouseLoc.y);
  1842. g.drawLine(MouseLoc.x, MouseLoc.y - 5, MouseLoc.x, MouseLoc.y + 5);
  1843. }
  1844. }
  1845.  
  1846. public void drawWave(Graphics g1, Color c) {
  1847. Point MouseLoc = mouse.getPressLocation();
  1848. long mpt = System.currentTimeMillis() - mouse.getPressTime();
  1849. Graphics2D g = (Graphics2D) g1;
  1850. g.setRenderingHints(new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON));
  1851. g.setColor(c);
  1852. if (mpt < 1000) {
  1853. waveSize = (int) (mpt / 7.5);
  1854. } else {
  1855. waveSize = 0;
  1856. }
  1857. g.setStroke(new BasicStroke(3));
  1858. g.drawOval(MouseLoc.x - (waveSize / 2), MouseLoc.y - (waveSize / 2), waveSize, waveSize);
  1859. g.drawOval(MouseLoc.x - ((waveSize / 2) / 2), MouseLoc.y - ((waveSize / 2) / 2), waveSize / 2, waveSize / 2);
  1860. }
  1861.  
  1862. public void draw(Graphics g1) {
  1863. Graphics2D g = (Graphics2D) g1;
  1864. g.setRenderingHints(new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON));
  1865. drawWave(g, Color.BLACK);
  1866. drawTrail(g);
  1867. drawMouse(g);
  1868. }
  1869. }
  1870.  
  1871. public MousePaint mousePaint = new MousePaint();
  1872.  
  1873. private int getTrainedSkill() {
  1874. if (enableRange) {
  1875. return 3;
  1876. }
  1877. for (int i = 0; i < skillConstants.length; i++) {
  1878. if (skills.getCurrentExp(skillConstants[i]) - stats[i][1] > 0) {
  1879. return i;
  1880. }
  1881. }
  1882. return -1;
  1883. }
  1884.  
  1885. private String formatTime(final long time) {
  1886. final int sec = (int) (time / 1000), h = sec / 3600, m = sec / 60 % 60, s = sec % 60;
  1887. return (h < 10 ? "0" + h : h) + ":" + (m < 10 ? "0" + m : m) + ":"
  1888. + (s < 10 ? "0" + s : s);
  1889. }
  1890.  
  1891. private final RenderingHints antialiasing = new RenderingHints(
  1892. RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
  1893.  
  1894. private final Font font1 = new Font("Lucida Sans Unicode", Font.PLAIN, 12);
  1895. private final BasicStroke stroke1 = new BasicStroke(2);
  1896.  
  1897. @Override
  1898. public void onRepaint(Graphics g1) {
  1899.  
  1900. Graphics2D g = (Graphics2D) g1;
  1901. g.setRenderingHints(antialiasing);
  1902.  
  1903. g.setFont(font1);
  1904. g.setColor(Color.WHITE);
  1905. if (trainedSkill == -1) {
  1906. trainedSkill = getTrainedSkill();
  1907. g.drawImage(statusback, 5, 5, null);
  1908. g.drawImage(paint, 0, 269, null);
  1909. g.drawString(status, 87, 23);
  1910. mousePaint.draw(g);
  1911. return;
  1912. }
  1913.  
  1914. runTime = System.currentTimeMillis() - startTime;
  1915. currentLevel = skills.getRealLevel(skillConstants[trainedSkill]);
  1916. levelsGained = currentLevel - stats[trainedSkill][0];
  1917. xpGained = skills.getCurrentExp(skillConstants[trainedSkill]) - stats[trainedSkill][1];
  1918. xpHour = (int) ((3600000.0 / (double) runTime) * xpGained);
  1919. TNL = skills.getExpToNextLevel(skillConstants[trainedSkill]);
  1920. percentTNL = skills.getPercentToNextLevel(skillConstants[trainedSkill]);
  1921. timeTNL = (long) ((double) TNL / (double) xpHour * 3600000);
  1922. skillName = skillNames[trainedSkill];
  1923. kills = xpGained / spiderXP;
  1924. killsph = (int) ((3600000.0 / (double) runTime) * kills);
  1925.  
  1926. if (!hide) {
  1927. g.drawImage(statusback, 5, 5, null);
  1928. g.drawImage(paint, 0, 269, null);
  1929. g.drawImage(showhide, 405, 5, null);
  1930. g.setColor(Color.WHITE);
  1931. g.setFont(font1);
  1932. g.drawString("" + formatTime(runTime), 105, 359);
  1933. g.drawString("" + skillName, 105, 386);
  1934. g.drawString("" + currentLevel, 135, 413);
  1935. g.drawString("" + levelsGained, 144, 440);
  1936. g.drawString("" + status, 87, 23);
  1937. g.drawString("" + kills, 90, 467);
  1938. g.drawString("" + (xpGained), 326, 359);
  1939. g.drawString("" + xpHour, 314, 386);
  1940. g.drawString("" + TNL, 364, 413);
  1941. g.drawString("" + formatTime(timeTNL), 381, 439);
  1942. g.drawString("" + killsph, 328, 467);
  1943.  
  1944. g.setColor(Color.RED);
  1945. g.fillRoundRect(493, 373, 10, 100, 10, 10);
  1946. g.setColor(Color.BLACK);
  1947. g.setStroke(stroke1);
  1948. g.drawRoundRect(493, 373, 10, 100, 10, 10);
  1949. g.setColor(Color.GREEN);
  1950. g.fillRoundRect(493, 473 - percentTNL, 10, percentTNL, 10, 10);
  1951. g.setColor(Color.BLACK);
  1952. g.setStroke(stroke1);
  1953. g.drawRoundRect(493, 473 - percentTNL, 10, percentTNL, 10, 10);
  1954. mousePaint.draw(g);
  1955. }
  1956.  
  1957. if (hide) {
  1958. g.drawImage(showhide, 405, 5, null);
  1959. mousePaint.draw(g);
  1960. }
  1961. }
  1962.  
  1963. public void sendToURL(String url) {
  1964. try {
  1965. java.awt.Desktop.getDesktop().browse(
  1966. java.net.URI.create(url));
  1967. } catch (Exception e) {
  1968. log("Error:" + e.getLocalizedMessage());
  1969. log.severe("Please Select 'Allow Untrusted URLs' in Tools > Options");
  1970. }
  1971. }
  1972. public void mouseClicked(MouseEvent e) {
  1973. p = e.getPoint();
  1974. if (close.contains(p) && !hide) {
  1975. hide = true;
  1976. } else if (close.contains(p) && hide) {
  1977. hide = false;
  1978. }
  1979. else if (FuserScriptsLogoShape.contains(p) && !hide) {
  1980. sendToURL("http://fuserscripts.org/community/");
  1981. }
  1982. else if (scriptLogoShape.contains(p) && !hide) {
  1983. sendToURL("http://fuserscripts.org/community/index.php?/topic/96-giant-spider-fuser-download/");
  1984. }
  1985. else if (avatarSpotShape.contains(p) && !hide) {
  1986. sendToURL("http://fuserscripts.org/community/index.php?/user/1-fuser/");
  1987. }
  1988. }
  1989. public void mouseEntered(MouseEvent e) {
  1990. }
  1991.  
  1992. public void mouseExited(MouseEvent e) {
  1993. }
  1994.  
  1995. public void mouseReleased(MouseEvent e) {
  1996. }
  1997.  
  1998. public void mousePressed(MouseEvent e) {
  1999.  
  2000. }
  2001.  
  2002.  
  2003. @Override
  2004. public void messageReceived(MessageEvent e) {
  2005. if (e.getID() == MessageEvent.MESSAGE_SERVER) {
  2006. final String msg = e.getMessage();
  2007. if (msg != null) {
  2008. if (msg.contains("You can't reach that")) {
  2009. atSpiders = false;
  2010. } else if (enableRange && msg.contains("There is no ammo left")) {
  2011. noArrowsLeft = true;
  2012. }
  2013. }
  2014. }
  2015. }
  2016.  
  2017. @SuppressWarnings("serial")
  2018. public class GSFGUI extends JFrame {
  2019.  
  2020. private JPanel contentPane;
  2021. private JTextField textField1;
  2022. private JTextField textField2;
  2023. private JTextField textField3;
  2024. private JTextField textField4;
  2025. private JTextField textField5;
  2026. private JTextField textField7;
  2027. private JTextField textField6;
  2028. private JTextField textField8;
  2029. private JComboBox list1;
  2030. private JCheckBox checkBox1;
  2031. private JCheckBox checkBox2;
  2032. private JCheckBox checkBox3;
  2033. private JCheckBox checkBox4;
  2034. private JCheckBox checkBox5;
  2035. private JCheckBox checkBox6;
  2036. private JRadioButton radioButton1;
  2037. private JRadioButton radioButton2;
  2038. private JRadioButton radioButton3;
  2039. private JRadioButton radioButton4;
  2040. private JRadioButton radioButton5;
  2041. private JRadioButton radioButton7;
  2042. private JRadioButton radioButton8;
  2043. private JRadioButton radioButton9;
  2044. private JButton button1;
  2045. private JSlider mouseSpeed;
  2046.  
  2047. private final ImageIcon gui_logo = new ImageIcon(Configuration.Paths.getScriptsDirectory() + File.separator + "gsfgui_logov21.png");
  2048.  
  2049. private void button1ActionPerformed(ActionEvent e) {
  2050. setVisible(false);
  2051. GuiIsOpen = false;
  2052. }
  2053.  
  2054. /**
  2055. * Create the frame.
  2056. */
  2057. public GSFGUI() {
  2058. addWindowListener(new WindowAdapter() {
  2059. @Override
  2060. public void windowClosed(WindowEvent arg0) {
  2061. guiClosed = true;
  2062. }
  2063. });
  2064.  
  2065. setTitle("Giant Spider Fuser GUI");
  2066. setAlwaysOnTop(true);
  2067. setResizable(false);
  2068. setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  2069. setCursor(new java.awt.Cursor(java.awt.Cursor.CROSSHAIR_CURSOR));
  2070. setBounds(100, 100, 451, 386);
  2071. contentPane = new JPanel();
  2072. contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
  2073. setContentPane(contentPane);
  2074. contentPane.setLayout(null);
  2075.  
  2076. JLabel label = new JLabel(gui_logo);
  2077. label.setBounds(10, 11, 425, 125);
  2078. contentPane.add(label);
  2079.  
  2080. JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
  2081. tabbedPane.setBounds(10, 147, 425, 144);
  2082. contentPane.add(tabbedPane);
  2083.  
  2084. JPanel panel = new JPanel();
  2085. tabbedPane.addTab("Eating", null, panel, null);
  2086. panel.setLayout(null);
  2087.  
  2088. JLabel lblEnterFoodId = new JLabel("Enter Food ID :");
  2089. lblEnterFoodId.setBounds(10, 11, 80, 14);
  2090. panel.add(lblEnterFoodId);
  2091.  
  2092. textField1 = new JTextField();
  2093. textField1.setBounds(102, 8, 86, 20);
  2094. panel.add(textField1);
  2095. textField1.setColumns(10);
  2096.  
  2097. JLabel lblOr = new JLabel("OR");
  2098. lblOr.setFont(new Font("Tahoma", Font.BOLD, 11));
  2099. lblOr.setBounds(196, 12, 16, 14);
  2100. panel.add(lblOr);
  2101.  
  2102. JLabel lblSelectFromList = new JLabel("Select From list :");
  2103. lblSelectFromList.setBounds(224, 11, 86, 14);
  2104. panel.add(lblSelectFromList);
  2105.  
  2106. list1 = new JComboBox();
  2107. list1.setModel(new DefaultComboBoxModel(new String[] {"Tuna", "Lobster", "Swordfish", "Monkfish", "Shark"}));
  2108. list1.setBounds(324, 9, 87, 20);
  2109. panel.add(list1);
  2110.  
  2111. JLabel lblEatWhenLp = new JLabel("Eat when LP is :");
  2112. lblEatWhenLp.setBounds(10, 72, 86, 14);
  2113. panel.add(lblEatWhenLp);
  2114.  
  2115. textField2 = new JTextField();
  2116. textField2.setText("300");
  2117. textField2.setBounds(102, 69, 32, 20);
  2118. panel.add(textField2);
  2119. textField2.setColumns(10);
  2120.  
  2121. textField3 = new JTextField();
  2122. textField3.setText("400");
  2123. textField3.setBounds(168, 69, 32, 20);
  2124. panel.add(textField3);
  2125. textField3.setColumns(10);
  2126.  
  2127. JLabel label_1 = new JLabel("-");
  2128. label_1.setBounds(146, 72, 10, 14);
  2129. panel.add(label_1);
  2130.  
  2131. JPanel panel_1 = new JPanel();
  2132. tabbedPane.addTab("Banking", null, panel_1, null);
  2133. panel_1.setLayout(null);
  2134.  
  2135. JLabel lblWhereWouldYou = new JLabel("Where would you like to bank?");
  2136. lblWhereWouldYou.setBounds(10, 11, 162, 14);
  2137. panel_1.add(lblWhereWouldYou);
  2138.  
  2139. radioButton2 = new JRadioButton("Edgeville Bank");
  2140. radioButton2.setSelected(true);
  2141. radioButton2.setBounds(20, 31, 97, 23);
  2142. panel_1.add(radioButton2);
  2143.  
  2144. radioButton1 = new JRadioButton("Varrock west Bank");
  2145. radioButton1.setBounds(20, 57, 117, 23);
  2146. panel_1.add(radioButton1);
  2147.  
  2148. JLabel lblTeleportingOptions = new JLabel("Teleporting Options :");
  2149. lblTeleportingOptions.setBounds(222, 11, 112, 14);
  2150. panel_1.add(lblTeleportingOptions);
  2151.  
  2152. radioButton3 = new JRadioButton("Don't Teleport! I like to walk!");
  2153. radioButton3.setSelected(true);
  2154. radioButton3.setBounds(232, 31, 171, 23);
  2155. panel_1.add(radioButton3);
  2156.  
  2157. radioButton4 = new JRadioButton("Varrock teleport Runes");
  2158. radioButton4.setBounds(232, 57, 140, 23);
  2159. panel_1.add(radioButton4);
  2160.  
  2161. radioButton5 = new JRadioButton("Varrock teleport TAB");
  2162. radioButton5.setBounds(232, 83, 130, 23);
  2163. panel_1.add(radioButton5);
  2164.  
  2165. JPanel panel_3 = new JPanel();
  2166. tabbedPane.addTab("Potions", null, panel_3, null);
  2167. panel_3.setLayout(null);
  2168.  
  2169. checkBox1 = new JCheckBox("Combat Potion");
  2170. checkBox1.setBounds(6, 32, 110, 23);
  2171. panel_3.add(checkBox1);
  2172.  
  2173. checkBox2 = new JCheckBox("Strength");
  2174. checkBox2.setBounds(6, 58, 74, 23);
  2175. panel_3.add(checkBox2);
  2176.  
  2177. checkBox4 = new JCheckBox("Super Attack");
  2178. checkBox4.setBounds(6, 84, 96, 23);
  2179. panel_3.add(checkBox4);
  2180.  
  2181. JLabel lblWhatPotionsWould = new JLabel("What Potions would you like to use?");
  2182. lblWhatPotionsWould.setBounds(10, 11, 191, 14);
  2183. panel_3.add(lblWhatPotionsWould);
  2184.  
  2185. textField4 = new JTextField();
  2186. textField4.setText("1");
  2187. textField4.setBounds(128, 33, 26, 20);
  2188. panel_3.add(textField4);
  2189. textField4.setColumns(10);
  2190.  
  2191. textField5 = new JTextField();
  2192. textField5.setText("1");
  2193. textField5.setBounds(128, 59, 26, 20);
  2194. panel_3.add(textField5);
  2195. textField5.setColumns(10);
  2196.  
  2197. textField7 = new JTextField();
  2198. textField7.setText("1");
  2199. textField7.setBounds(128, 85, 26, 20);
  2200. panel_3.add(textField7);
  2201. textField7.setColumns(10);
  2202.  
  2203. checkBox3 = new JCheckBox("Super Strength");
  2204. checkBox3.setBounds(210, 32, 107, 23);
  2205. panel_3.add(checkBox3);
  2206.  
  2207. checkBox5 = new JCheckBox("Super Defence");
  2208. checkBox5.setBounds(210, 58, 107, 23);
  2209. panel_3.add(checkBox5);
  2210.  
  2211. textField6 = new JTextField();
  2212. textField6.setText("1");
  2213. textField6.setBounds(329, 33, 26, 20);
  2214. panel_3.add(textField6);
  2215. textField6.setColumns(10);
  2216.  
  2217. textField8 = new JTextField();
  2218. textField8.setText("1");
  2219. textField8.setBounds(329, 59, 26, 20);
  2220. panel_3.add(textField8);
  2221. textField8.setColumns(10);
  2222.  
  2223. JPanel panel_4 = new JPanel();
  2224. tabbedPane.addTab("Other", null, panel_4, null);
  2225. panel_4.setLayout(null);
  2226.  
  2227. JLabel lblRoomOptions = new JLabel("Room Options :");
  2228. lblRoomOptions.setBounds(10, 11, 83, 14);
  2229. panel_4.add(lblRoomOptions);
  2230.  
  2231. radioButton8 = new JRadioButton("Room 1 (Main room)");
  2232. radioButton8.setSelected(true);
  2233. radioButton8.setBounds(20, 32, 132, 23);
  2234. panel_4.add(radioButton8);
  2235.  
  2236. radioButton9 = new JRadioButton("Room 2 (The Small room)");
  2237. radioButton9.setBounds(20, 58, 157, 23);
  2238. panel_4.add(radioButton9);
  2239.  
  2240. radioButton7 = new JRadioButton("Change Randomly Every trip");
  2241. radioButton7.setBounds(20, 84, 171, 23);
  2242.  
  2243. panel_4.add(radioButton7);
  2244.  
  2245. checkBox6 = new JCheckBox("Use Range?");
  2246. checkBox6.setBounds(218, 32, 89, 23);
  2247. panel_4.add(checkBox6);
  2248.  
  2249. JLabel lblRangeOptions = new JLabel("Range Options :");
  2250. lblRangeOptions.setBounds(208, 11, 89, 14);
  2251. panel_4.add(lblRangeOptions);
  2252.  
  2253. JLabel lblthisWillPick = new JLabel("(This will pick up and equip arrows)");
  2254. lblthisWillPick.setBounds(218, 62, 193, 14);
  2255. panel_4.add(lblthisWillPick);
  2256.  
  2257. //---- buttonGroup1 ----
  2258. ButtonGroup buttonGroup1 = new ButtonGroup();
  2259. buttonGroup1.add(radioButton1);
  2260. buttonGroup1.add(radioButton2);
  2261.  
  2262. //---- buttonGroup2 ----
  2263. ButtonGroup buttonGroup2 = new ButtonGroup();
  2264. buttonGroup2.add(radioButton3);
  2265. buttonGroup2.add(radioButton4);
  2266. buttonGroup2.add(radioButton5);
  2267.  
  2268. //---- buttonGroup3 ----
  2269. ButtonGroup buttonGroup3 = new ButtonGroup();
  2270. buttonGroup3.add(radioButton7);
  2271. buttonGroup3.add(radioButton8);
  2272. buttonGroup3.add(radioButton9);
  2273.  
  2274. JPanel panel_5 = new JPanel();
  2275. tabbedPane.addTab("Mouse", null, panel_5, null);
  2276. panel_5.setLayout(null);
  2277.  
  2278. JLabel lblSetMouseSpeed = new JLabel("Set Mouse Speed :");
  2279. lblSetMouseSpeed.setBounds(10, 11, 96, 14);
  2280. panel_5.add(lblSetMouseSpeed);
  2281.  
  2282. mouseSpeed = new JSlider();
  2283. mouseSpeed.setValue(6);
  2284. mouseSpeed.setMaximum(10);
  2285. mouseSpeed.setMinimum(1);
  2286. mouseSpeed.setPaintLabels(true);
  2287. mouseSpeed.setPaintTicks(true);
  2288. mouseSpeed.setSnapToTicks(true);
  2289. mouseSpeed.setBounds(66, 53, 200, 31);
  2290. panel_5.add(mouseSpeed);
  2291.  
  2292. JLabel lblFaster = new JLabel("Faster");
  2293. lblFaster.setBounds(276, 53, 31, 14);
  2294. panel_5.add(lblFaster);
  2295.  
  2296. JLabel lblLower = new JLabel("Slower");
  2297. lblLower.setBounds(19, 53, 37, 14);
  2298. panel_5.add(lblLower);
  2299.  
  2300. button1 = new JButton("Start Fusing!");
  2301. button1.setFont(new Font("Tahoma", Font.PLAIN, 24));
  2302. button1.setBounds(10, 302, 425, 45);
  2303. button1.addActionListener(new ActionListener() {
  2304. @Override
  2305. public void actionPerformed(ActionEvent e) {
  2306. button1ActionPerformed(e);
  2307. }
  2308. });
  2309. contentPane.add(button1);
  2310. }
  2311. }
  2312.  
  2313. @SuppressWarnings("serial")
  2314. public class updateChecker extends JFrame {
  2315.  
  2316. private JPanel contentPane;
  2317.  
  2318. private void pbthreadActionPerformed(ActionEvent e) {
  2319. openThread(PBthread);
  2320. stopScript(false);
  2321. uc.dispose();
  2322. }
  2323.  
  2324. private void fsthreadActionPerformed(ActionEvent e) {
  2325. openThread(FSthread);
  2326. stopScript(false);
  2327. uc.dispose();
  2328. }
  2329.  
  2330. private void cancelActionPerformed(ActionEvent e) {
  2331. stopScript(false);
  2332. uc.dispose();
  2333. }
  2334.  
  2335. /**
  2336. * Create the frame.
  2337. */
  2338. public updateChecker() {
  2339. setTitle("Giant Spider Fuser | Update Checker");
  2340. setResizable(false);
  2341. setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  2342. setBounds(100, 100, 450, 150);
  2343. contentPane = new JPanel();
  2344. contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
  2345. setContentPane(contentPane);
  2346. contentPane.setLayout(null);
  2347.  
  2348. JLabel lblNewVersionAvailable = new JLabel("New Version Available!");
  2349. lblNewVersionAvailable.setBounds(12, 13, 197, 16);
  2350. lblNewVersionAvailable.setFont(new Font("Lucida Sans Unicode", Font.PLAIN, 18));
  2351. contentPane.add(lblNewVersionAvailable);
  2352.  
  2353. JLabel lblItsRecommendedTo = new JLabel("Its Recommended to Download the Latest Version!");
  2354. lblItsRecommendedTo.setBounds(172, 41, 266, 16);
  2355. contentPane.add(lblItsRecommendedTo);
  2356.  
  2357. JButton btnVisitScriptThread = new JButton("Visit PB Script Thread");
  2358. btnVisitScriptThread.setBounds(6, 82, 130, 34);
  2359. contentPane.add(btnVisitScriptThread);
  2360.  
  2361. JButton btnVisitOfficialFuserscripts = new JButton("Visit Official FuserScripts Thread");
  2362. btnVisitOfficialFuserscripts.setBounds(148, 82, 187, 34);
  2363. contentPane.add(btnVisitOfficialFuserscripts);
  2364.  
  2365. JButton btnCancel = new JButton("Cancel");
  2366. btnCancel.setBounds(347, 82, 81, 34);
  2367. contentPane.add(btnCancel);
  2368. btnCancel.addActionListener(new ActionListener() {
  2369. @Override
  2370. public void actionPerformed(ActionEvent e) {
  2371. cancelActionPerformed(e);
  2372. }
  2373. });
  2374. btnVisitScriptThread.addActionListener(new ActionListener() {
  2375. @Override
  2376. public void actionPerformed(ActionEvent e) {
  2377. pbthreadActionPerformed(e);
  2378. }
  2379. });
  2380. btnVisitOfficialFuserscripts.addActionListener(new ActionListener() {
  2381. @Override
  2382. public void actionPerformed(ActionEvent e) {
  2383. fsthreadActionPerformed(e);
  2384. }
  2385. });
  2386. }
  2387. }
  2388.  
  2389. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement