Advertisement
deww1

Untitled

Oct 15th, 2011
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 118.83 KB | None | 0 0
  1. // <editor-fold defaultstate="collapsed" desc="Imports">
  2. import java.util.logging.Level;
  3. import java.util.logging.Logger;
  4. import org.rsbot.script.*;
  5. import org.rsbot.script.methods.GrandExchange.GEItem;
  6. import org.rsbot.script.wrappers.*;
  7. import org.rsbot.script.methods.*;
  8. import org.rsbot.script.util.Timer;
  9. import org.rsbot.script.Script;
  10. import org.rsbot.event.listeners.PaintListener;
  11. import org.rsbot.Configuration;
  12.  
  13. import java.awt.*;
  14. import java.awt.Graphics;
  15. import java.awt.event.*;
  16. import java.awt.image.BufferedImage;
  17. import java.awt.event.MouseEvent;
  18. import java.awt.event.MouseListener;
  19. import java.awt.image.RenderedImage;
  20.  
  21. import javax.swing.SwingUtilities;
  22.  
  23. import javax.imageio.ImageIO;
  24.  
  25. import java.io.BufferedReader;
  26. import java.io.File;
  27. import java.io.FileInputStream;
  28. import java.io.FileNotFoundException;
  29. import java.io.FileWriter;
  30. import java.io.InputStreamReader;
  31. import java.io.PrintWriter;
  32. import java.io.IOException;
  33. import java.lang.reflect.InvocationTargetException;
  34.  
  35. import java.util.regex.Matcher;
  36. import java.util.regex.Pattern;
  37. import java.util.Random;
  38.  
  39. import java.net.MalformedURLException;
  40. import java.net.URL;
  41. import java.util.Properties;
  42. import javax.swing.JDialog;
  43. import javax.swing.JOptionPane;
  44. import org.rsbot.event.events.MessageEvent;
  45. // </editor-fold>
  46.  
  47. @ScriptManifest(authors = {"Deww1"},
  48. keywords = {"iron", "Rimmington", "coal", "Guild Mine"},
  49. name = "Iron Picker Uper",
  50. description = "Picks up Iron ore from powerminers in Rimmington Mines",
  51. version = 3.12,
  52. website = "http://www.dayscripts.co.cc/")
  53.  
  54. public class ironPickUp extends Script implements /*PaintListener,*/ MouseListener {
  55.  
  56. public int trackNum = 311;
  57.  
  58. //<editor-fold defaultstate="collapsed" desc="Variables">
  59. private final int ORE[] = {440, 453};
  60. private final int BANK[] = {36788, 11758, 35647, 782};
  61. private final int LADDER[] = {2113, 6226};
  62.  
  63. public Properties IPUini = new Properties();
  64.  
  65. public int resterMin;
  66. public int resterMax;
  67.  
  68. RSObject BANK12;
  69.  
  70. public boolean death = false;
  71.  
  72. public int invCount = 0;
  73. public int oree;
  74. public int switches = 0;
  75. public int OreCollected = 0;
  76. /*
  77. * Area ID: 0 = None
  78. * Area ID: 1 = Rimmington Mines-fast
  79. * Area ID: 2 = Rimmington Mines-slow
  80. * Area ID: 3 = Guild Mines
  81. */
  82. public int areaID = 0; //area ID
  83.  
  84. private int mouseHopx;
  85. private int mouseHopy;
  86. private int oreCollected = 0;
  87. private int oreHr = 0;
  88. private int price = 0;
  89. private int priceHr = 0;
  90. public int orePrice;
  91.  
  92. public int tempRestLength = 0;
  93.  
  94. public Double ver = ironPickUp.class.getAnnotation(ScriptManifest.class).version();
  95. public double currVer;
  96.  
  97. private String status = "Setting up";
  98. private String MouseSpeed = "Unknown";
  99.  
  100. public String status$ = "";
  101. public String antiBanStatus = "Setting up";
  102. public String cursorU;//Cursor unclicked
  103. public String cursorC;//Cursor clicked
  104. public String area = "";
  105.  
  106. boolean showPaint1 = false; //close Paint
  107. boolean showPaint2 = true; //General tab
  108. boolean showPaint3 = false; //money tab
  109. Point p;
  110.  
  111. public boolean isDoingAnti = false;
  112. public boolean hasStarted = false;
  113. public boolean takeBreaks = false;
  114. public boolean doBank = false;
  115.  
  116. ipuAntiban antiban = new ipuAntiban();
  117. hopper hop = new hopper();
  118. FuserSkeletonGUI g = new FuserSkeletonGUI();
  119. Mouse Mouse = new Mouse();
  120. userTracker track = new userTracker();
  121.  
  122. Image fsIcon = getImage1("fs_icon.png");
  123.  
  124. final static SystemTray tray = SystemTray.getSystemTray();
  125. final static TrayIcon icon = new TrayIcon(Toolkit.getDefaultToolkit().getImage(Configuration.Paths.getScriptsDirectory() + File.separator + "fs_icon.png"));
  126.  
  127.  
  128. private boolean scriptRunning = true;
  129.  
  130. public long startTime = 0;
  131. public long millis = 0;
  132. public long hours = 0;
  133. public long minutes = 0;
  134. public long seconds = 0;
  135. public long last = 0;
  136. public long noOreTime;
  137. public long millis2 = 0;
  138. public long minutes2 = 0;
  139. public long seconds2 = 0;
  140.  
  141.  
  142. Rectangle hide = new Rectangle(5, 315, 70, 24); //hide paint button
  143. Rectangle genTab = new Rectangle(446, 315, 70, 24); //general tab button
  144. Rectangle monTab = new Rectangle(376, 315, 70, 24); //money tab button
  145.  
  146. public Timer timer; //4 mins
  147. public Timer worldTimer = new Timer(1000 * 60 * 8);
  148.  
  149. //GUI Stuff
  150. public boolean useMsRandom = false; //use Mouse Random
  151. public boolean doUpdate = false; //check for updates
  152. public boolean wHop = false; //world hop
  153. public String hopTime;
  154. public int mode;
  155. public boolean shot = false; //screenshot at end?
  156. public boolean devMode = false; //development(debug) mode - display all logs
  157. public boolean useRest = false;
  158. public boolean getOtherOre = false;
  159. public boolean garbage = false;
  160. public boolean antiThreaded = false;
  161. public boolean openGUI = true; //false if gui is closed
  162.  
  163.  
  164. public int lastWorld;
  165. public int[] freeWorlds = {1, 3, 4, 5, 7, 8, 10, 11, 13, 14, 16, 17, 19, 20, //14
  166. 25, 29, 30, 33, 34, 35, 37, 38, 41, 43, 47, 49, 50, 55, 57, 61, 62, 73, 74, //19
  167. 75, 80, 81, 87, 90, 93, 102, 105, 106, 108, 113, 118, 120, 123, 134, 135, //16
  168. 136, 141, 149, 152, 153, 154, 155, 161, 165, 167, 169}; //11
  169.  
  170. //</editor-fold>
  171.  
  172. //<editor-fold defaultstate="collapsed" desc="Walking/Area">
  173. RSTile mineTile = new RSTile(2970, 3240);
  174. RSTile bankTile = new RSTile(3012, 3355);
  175.  
  176. RSTile[] toBankfast = {new RSTile(2977, 3234), new RSTile(2991, 3233), new RSTile(3000, 3237),
  177. new RSTile(3011, 3241), new RSTile(3011, 3241), new RSTile(3023, 3241),
  178. new RSTile(3035, 3236), new RSTile(3047, 3236)} ;
  179.  
  180. RSTile [] toBankSafe = { new RSTile(2974, 3236), new RSTile(2984, 3233),
  181. new RSTile(2993, 3227), new RSTile(3000, 3220),
  182. new RSTile(3010, 3217), new RSTile(3021, 3218),
  183. new RSTile(3026, 3228), new RSTile(3035, 3236),
  184. new RSTile(3047, 3236) };
  185.  
  186.  
  187.  
  188.  
  189. RSTile toMinefast[] = { new RSTile(3047, 3236), new RSTile(3035, 3236),
  190. new RSTile(3023, 3241), new RSTile(3011, 3241), new RSTile(3000, 3237),
  191. new RSTile(2991, 3233), new RSTile(2977, 3234) };
  192.  
  193. RSTile [] toMineSafe = { new RSTile(3047, 3236),
  194. new RSTile(3035, 3236), new RSTile(3026, 3228),
  195. new RSTile(3021, 3218), new RSTile(3010, 3217),
  196. new RSTile(3000, 3220), new RSTile(2993, 3227),
  197. new RSTile(2984, 3233),new RSTile(2974, 3236) };
  198.  
  199.  
  200. RSTile toLadder[] = { new RSTile(3013, 3355),
  201. new RSTile(3013, 3359), new RSTile(3021, 3358),
  202. new RSTile(3024, 3352), new RSTile(3028, 3347),
  203. new RSTile(3029, 3341), new RSTile(3026, 3337),
  204. new RSTile(3021, 3339) };
  205. RSTile toLadder0[] = { new RSTile(3013, 3355),
  206. new RSTile(3013, 3359), new RSTile(3021, 3358),
  207. new RSTile(3024, 3352), new RSTile(3028, 3347),
  208. new RSTile(3029, 3341), new RSTile(3026, 3337),
  209. new RSTile(3021, 3339) };
  210. RSTile toLadder2[] = { new RSTile(3038, 9737),
  211. new RSTile(3032, 9738), new RSTile(3026, 9739),
  212. new RSTile(3021, 9739) };
  213. RSTile toMine2[] = { new RSTile(3021, 9739),
  214. new RSTile(3026, 9739), new RSTile(3032, 9738),
  215. new RSTile(3038, 9737) };
  216. RSTile toBank2[] = { new RSTile(3021, 3339),
  217. new RSTile(3028, 3337), new RSTile(3029, 3346),
  218. new RSTile(3025, 3354), new RSTile(3018, 3359),
  219. new RSTile(3014, 3355) };
  220.  
  221. //Al-Kharid Begin
  222. RSTile toBankAl[] = { new RSTile(3300, 3313), new RSTile(3300, 3304),
  223. new RSTile(3300, 3295), new RSTile(3299, 3286), new RSTile(3299, 3274),
  224. new RSTile(3291, 3265), new RSTile(3290, 3254), new RSTile(3286, 3242),
  225. new RSTile(3282, 3234), new RSTile(3280, 3223), new RSTile(3279, 3210),
  226. new RSTile(3279, 3200), new RSTile(3280, 3189), new RSTile(3277, 3179),
  227. new RSTile(3276, 3169), new RSTile(3269, 3168) };
  228.  
  229. RSTile toMineAl[] = { new RSTile(3269, 3167), new RSTile(3274, 3167),
  230. new RSTile(3276, 3174), new RSTile(3281, 3183), new RSTile(3281, 3197),
  231. new RSTile(3280, 3206), new RSTile(3278, 3218), new RSTile(3281, 3228),
  232. new RSTile(3282, 3240), new RSTile(3284, 3251), new RSTile(3288, 3261),
  233. new RSTile(3293, 3275), new RSTile(3298, 3284), new RSTile(3298, 3297),
  234. new RSTile(3299, 3306), new RSTile(3299, 3313) };
  235.  
  236.  
  237. private boolean atAlBank() { //Al-Kharid bank
  238. RSArea area1 = new RSArea(new RSTile(3269, 3164), new RSTile(3272, 3171));
  239. return area1.contains(getMyPlayer().getLocation());
  240. }
  241. private boolean atAlMine() {//Al-Kharid Mine
  242. RSArea area1 = new RSArea(new RSTile(3287, 3285), new RSTile(3309, 3319));
  243. return area1.contains(getMyPlayer().getLocation());
  244. }
  245. //Al-Kharid End
  246.  
  247. //Varrock East Begin
  248. RSTile toBankVE[] = { new RSTile(3286, 3368), new RSTile(3292, 3377),
  249. new RSTile(3293, 3388), new RSTile(3292, 3398), new RSTile(3287, 3409),
  250. new RSTile(3281, 3418), new RSTile(3274, 3427), new RSTile(3261, 3428),
  251. new RSTile(3254, 3420) };
  252. RSTile toMineVE[] = { new RSTile(3254, 3420), new RSTile(3260, 3426),
  253. new RSTile(3272, 3428), new RSTile(3280, 3421), new RSTile(3285, 3413),
  254. new RSTile(3290, 3402), new RSTile(3291, 3388), new RSTile(3292, 3377),
  255. new RSTile(3286, 3368) };
  256.  
  257. private boolean atVEBank() { //Varrock East Mine bank
  258. RSArea area1 = new RSArea(new RSTile(3250, 3419), new RSTile(3257, 3423));
  259. return area1.contains(getMyPlayer().getLocation());
  260. }
  261. private boolean atVEMine() {//Varrock East Mine Mine
  262. RSArea area1 = new RSArea(new RSTile(3280, 3361), new RSTile(3292, 3372));
  263. return area1.contains(getMyPlayer().getLocation());
  264. }
  265. //Varrock East End
  266.  
  267. //Varrock West Begin
  268. RSTile toBankVW[] = { new RSTile(3181, 3369), new RSTile(3180, 3380),
  269. new RSTile(3174, 3391), new RSTile(3169, 3402), new RSTile(3169, 3413),
  270. new RSTile(3172, 3426), new RSTile(3182, 3428), new RSTile(3182, 3436) };
  271. RSTile toMineVW[] = { new RSTile(3182, 3436), new RSTile(3174, 3428),
  272. new RSTile(3171, 3417), new RSTile(3169, 3405), new RSTile(3173, 3393),
  273. new RSTile(3178, 3383), new RSTile(3181, 3371) };
  274.  
  275. private boolean atVWBank() { //Varrock West Mine bank
  276. RSArea area1 = new RSArea(new RSTile(3182, 3433), new RSTile(3190, 3446));
  277. return area1.contains(getMyPlayer().getLocation());
  278. }
  279. private boolean atVWMine() {//Varrock West Mine Mine
  280. RSArea area1 = new RSArea(new RSTile(3171, 3364), new RSTile(3187, 3380));
  281. return area1.contains(getMyPlayer().getLocation());
  282. }
  283. //Varrock West End
  284.  
  285. //Rimmington Begin
  286. private boolean atBank() { //rimmington bank
  287. RSArea area1 = new RSArea(new RSTile(3043, 3234), new RSTile(3051, 3237));
  288. return area1.contains(getMyPlayer().getLocation());
  289. }
  290. private boolean atMine() {//rimmmington mine
  291. RSArea area1 = new RSArea(new RSTile(2964, 3232), new RSTile(2987, 3244));
  292. return area1.contains(getMyPlayer().getLocation());
  293. }
  294. //Rimmington End
  295.  
  296. //Guild Mine Begin
  297. private boolean atBank1() { //guild bank
  298. RSArea area1 = new RSArea(new RSTile(3008, 3352), new RSTile(3018, 3358));
  299. return area1.contains(getMyPlayer().getLocation());
  300. }
  301. private boolean atMine1() {//guild mine
  302. RSArea area1 = new RSArea(new RSTile(3026, 9734), new RSTile(3054, 9748));
  303. return area1.contains(getMyPlayer().getLocation());
  304. }
  305. private boolean atLadder0() {//ladder on ground zero
  306. RSArea area1 = new RSArea(new RSTile(3014, 3336), new RSTile(3024, 3343));
  307. return area1.contains(getMyPlayer().getLocation());
  308. }
  309. private boolean atLadder1() {//ladder on ground -1
  310. RSArea area1 = new RSArea(new RSTile(3017, 9737), new RSTile(3026, 9741));
  311. return area1.contains(getMyPlayer().getLocation());
  312. }
  313. private boolean inFally() {//check if i am on ground level in fally
  314. RSArea area1 = new RSArea(new RSTile(3004,3329), new RSTile(3036,3368));
  315. return area1.contains(getMyPlayer().getLocation());
  316. }
  317. //Guild Mine End
  318.  
  319.  
  320. private boolean AtBank(String s) {
  321. if (s.equals("Guild Mine")) {
  322. return atBank1();
  323.  
  324. } else if (s.equals("Rimmington Mines(safe)") || s.equals("Rimmington Mines(fast)")) {
  325. return atBank();
  326.  
  327. } else if (s.equals("Al-Kharid Mines")) {
  328. return atAlBank();
  329. } else if (s.equals("Varrock East Mine")) {
  330. return atVEBank();
  331. } else if (s.equals("Varrock West Mine")) {
  332. return atVWBank();
  333. }
  334. return false;
  335. }
  336. private boolean AtMine(String s) {
  337. if (s.equals("Guild Mine")) {
  338. return atMine1();
  339. } else if(s.equals("Rimmington Mines(safe)") || s.equals("Rimmington Mines(fast)")) {
  340. return atMine();
  341. } else if (s.equals("Al-Kharid Mines")) {
  342. return atAlMine();
  343. } else if (s.equals("Varrock East Mine")) {
  344. return atVEMine();
  345. } else if (s.equals("Varrock West Mine")) {
  346. return atVWMine();
  347. }
  348. return false;
  349. }
  350.  
  351. private void walkToMine() {
  352. if (area.equals("Rimmington Mines(fast)")) {
  353. if (!AtMine(area)) {
  354. RSTilePath walkingMine = walking.newTilePath(toMinefast);
  355. walkingMine.randomize(random(1, 2), random(1, 2));
  356. walkingMine.traverse();
  357. antiban.antiBanCamera();
  358. status = "Walking to the mine...";
  359. sleep(random(500, 1000));
  360. timer.reset();
  361. invCount = inventory.getCount(ORE);
  362. }
  363. }
  364. else if (area.equals("Rimmington Mines(safe)")) {
  365. if (!AtMine(area)) {
  366. RSTilePath walkingMine = walking.newTilePath(toMineSafe);
  367. walkingMine.randomize(random(1, 2), random(1, 2));
  368. walkingMine.traverse();
  369. antiban.antiBanCamera();
  370. status = "Walking to the mine...";
  371. sleep(random(500, 1000));
  372. timer.reset();
  373. invCount = inventory.getCount(ORE);
  374. }
  375. }
  376. else if (area.equals("Al-Kharid Mines")) {
  377. if (!AtMine(area)) {
  378. RSTilePath walkingMine = walking.newTilePath(toMineAl);
  379. walkingMine.randomize(random(1, 2), random(1, 2));
  380. walkingMine.traverse();
  381. antiban.antiBanCamera();
  382. status = "Walking to the mine...";
  383. sleep(random(500, 1000));
  384. timer.reset();
  385. invCount = inventory.getCount(ORE);
  386. }
  387. }
  388. else if (area.equals("Varrock East Mine")) {
  389. if (!AtMine(area)) {
  390. RSTilePath walkingMine = walking.newTilePath(toMineVE);
  391. walkingMine.randomize(random(1, 2), random(1, 2));
  392. walkingMine.traverse();
  393. antiban.antiBanCamera();
  394. status = "Walking to the mine...";
  395. sleep(random(500, 1000));
  396. timer.reset();
  397. invCount = inventory.getCount(ORE);
  398. }
  399. }
  400. else if (area.equals("Varrock West Mine")) {
  401. if (!AtMine(area)) {
  402. RSTilePath walkingMine = walking.newTilePath(toMineVW);
  403. walkingMine.randomize(random(1, 2), random(1, 2));
  404. walkingMine.traverse();
  405. antiban.antiBanCamera();
  406. status = "Walking to the mine...";
  407. sleep(random(500, 1000));
  408. timer.reset();
  409. invCount = inventory.getCount(ORE);
  410. }
  411. }
  412. else if (area.equals("Guild Mine")) {
  413. if (!AtMine(area)) {
  414. if (!atLadder0()) {
  415. RSTilePath walkingMine = walking.newTilePath(toLadder);
  416. walkingMine.randomize(random(1,2), random(1,2));
  417. walkingMine.traverse();
  418. antiban.antiBanCamera();
  419. status = "Walking to the Ladder";
  420. sleep(random(500, 1000));
  421. timer.reset();
  422. invCount = inventory.getCount(ORE);
  423. }
  424. if (atLadder0()) {
  425. RSObject lad = objects.getNearest(LADDER);
  426. if (lad != null) {
  427. if (lad.isOnScreen()) {
  428. lad.doClick();
  429. } else {
  430. walking.walkTileMM(lad.getLocation());
  431. }
  432. } else {
  433. walkToMine();
  434. }
  435. }
  436. if (atLadder1()) {
  437. RSTilePath walkingMine = walking.newTilePath(toMine2);
  438. walkingMine.randomize(random(1,2), random(1,2));
  439. walkingMine.traverse();
  440. status = "Walking to Mine";
  441. sleep(random(500,1000));
  442. timer.reset();
  443. invCount = inventory.getCount(ORE);
  444. }
  445. }
  446. }
  447. }
  448.  
  449. private void walkToBank() {
  450. if (area.equals("Rimmington Mines(fast)")) {
  451. if (!AtBank(area)) {
  452. RSTilePath walkingBank = walking.newTilePath(toBankfast);
  453. walkingBank.randomize(random(1, 2), random(1, 2));
  454. walkingBank.traverse();
  455. antiban.antiBanCamera();
  456. status = "Walking to the bank...";
  457. sleep(random(500, 1000));
  458. timer.reset();
  459. }
  460. }
  461. else if (area.equals("Rimmington Mines(safe)")) {
  462. if (!AtBank(area)) {
  463. RSTilePath walkingBank = walking.newTilePath(toBankSafe);
  464. walkingBank.randomize(random(1, 2), random(1, 2));
  465. walkingBank.traverse();
  466. antiban.antiBanCamera();
  467. status = "Walking to the bank...";
  468. sleep(random(500, 1000));
  469. timer.reset();
  470. }
  471. }
  472. else if (area.equals("Al-Kharid Mines")) {
  473. if (!AtBank(area)) {
  474. RSTilePath walkingBank = walking.newTilePath(toBankAl);
  475. walkingBank.randomize(random(1, 2), random(1, 2));
  476. walkingBank.traverse();
  477. antiban.antiBanCamera();
  478. status = "Walking to the bank...";
  479. sleep(random(500, 1000));
  480. timer.reset();
  481. }
  482. }
  483. else if (area.equals("Varrock East Mine")) {
  484. if (!AtBank(area)) {
  485. RSTilePath walkingBank = walking.newTilePath(toBankVE);
  486. walkingBank.randomize(random(1, 2), random(1, 2));
  487. walkingBank.traverse();
  488. antiban.antiBanCamera();
  489. status = "Walking to the bank...";
  490. sleep(random(500, 1000));
  491. timer.reset();
  492. }
  493. }
  494. else if (area.equals("Varrock West Mine")) {
  495. if (!AtBank(area)) {
  496. RSTilePath walkingBank = walking.newTilePath(toBankVW);
  497. walkingBank.randomize(random(1, 2), random(1, 2));
  498. walkingBank.traverse();
  499. antiban.antiBanCamera();
  500. status = "Walking to the bank...";
  501. sleep(random(500, 1000));
  502. timer.reset();
  503. }
  504. }
  505. else if (area.equals("Guild Mine")) {
  506. if (!AtBank(area)) {
  507. if (!inFally()) {
  508. RSTilePath walkingMine = walking.newTilePath(toLadder2);
  509. walkingMine.randomize(random(1,2), random(1,2));
  510. walkingMine.traverse();
  511. antiban.antiBanCamera();
  512. status = "Walking to the Ladder";
  513. sleep(random(500, 1000));
  514. timer.reset();
  515. invCount = inventory.getCount(ORE);
  516. }
  517. if (inFally()) {
  518. RSTilePath walkingMine = walking.newTilePath(toBank2);
  519. walkingMine.randomize(random(1,2), random(1,2));
  520. walkingMine.traverse();
  521. status = "Walking to Mine";
  522. sleep(random(500,1000));
  523. timer.reset();
  524. invCount = inventory.getCount(ORE);
  525. }
  526. if (atLadder1()) {
  527. RSObject lad = objects.getNearest(LADDER);
  528. if (lad != null) {
  529. if (lad.isOnScreen()) {
  530. lad.doClick();
  531. sleep(1500, 3000);
  532. } else {
  533. walking.walkTileMM(lad.getLocation());
  534. }
  535. } else {
  536. walkToBank();
  537. }
  538. }
  539. }
  540. }
  541. }
  542. //</editor-fold>
  543.  
  544. // <editor-fold defaultstate="collapsed" desc="pickup/noore stuff">
  545.  
  546. private int collectOre() {
  547. final RSGroundItem ore = groundItems.getNearest(ORE);
  548. if(ore == null || getMyPlayer().isMoving()) {
  549. return 10;
  550. }
  551. if(ore.isOnScreen()) {
  552. status = "Picking up oers";
  553. mouse.click(ore.getPoint(), true);
  554. timer.reset();
  555. if (mode == 1) {
  556. return random(800, 1200);
  557. }
  558. } else {
  559. walking.walkTileMM(ore.getLocation());
  560. }
  561. return random(300, 600);
  562. }
  563.  
  564.  
  565.  
  566. public int pickingUp() {
  567. noOres();
  568. if (AtMine(area) && !inventory.isFull()) {
  569. RSGroundItem ore = groundItems.getNearest(ORE);
  570. int randNum = random(1, 10);
  571. if (randNum > 1) {
  572. if (ore != null) {
  573. if (ore.isOnScreen()) {
  574. status = "Picking up ores";
  575. //ore.interact("Take");
  576. ore.interact("Take");
  577. timer.reset();
  578. if (mode == 1) {
  579. return random(900, 1200);
  580. }
  581. } else {
  582. if (area.equals("Rimmington Mines")) {
  583. walking.walkTileMM(ore.getLocation());
  584. } else if (area.equals("Guild Mine")) {
  585. walking.walkTileMM(ore.getLocation());
  586. }
  587. }
  588. } else {
  589. noOres();
  590. return random(100, 200);
  591. }
  592. } else {
  593. antiban.antiBanCamera();
  594. }
  595. }
  596. return random(100, 200);
  597. }
  598.  
  599. private void noOres() {
  600. RSGroundItem item = groundItems.getNearest(ORE);
  601. if (game.isLoggedIn()) {
  602. if (AtMine(area)) {
  603. if (item == null || !item.isOnScreen() || item == null && !item.isOnScreen()) {
  604. status = "Waiting for ores";
  605. antiban.antiban();
  606. if (!timer.isRunning() || timer.getRemaining() == 0) {
  607. if (wHop == true) {
  608. hop.changeWorld(freeWorlds[random(1, 60)]);
  609. timer.setEndIn((1000 * 60 * 4) + 60);
  610. }
  611. }
  612. }
  613. }
  614. }
  615. }// </editor-fold>
  616.  
  617. // <editor-fold defaultstate="collapsed" desc="banking">
  618. private void banking(String loc) {
  619. RSObject bank1 = objects.getNearest(BANK[0]); //rimmington bank
  620. if (loc.equalsIgnoreCase("Rimmington Mines(safe)") || loc.equalsIgnoreCase("Rimmington Mines(fast)")) {
  621. if (AtBank(area)) {
  622. if (bank1 != null) {
  623. if (bank1.isOnScreen()) {
  624. status = "Banking";
  625. bank1.interact("Deposit");
  626. sleep(random(2000, 4000));
  627. mouse.click(349, 280, 5, 5, true);
  628. sleep(random(1000, 4000));
  629. bank.close();
  630. doBank = false;
  631. } else {
  632. walking.walkTileMM(bank1.getLocation(), 2);
  633. }
  634. }
  635. }
  636. } else if (loc.equals("Guild Mine") ||
  637. loc.equals("Al-Kharid Mines") ||
  638. loc.equals("Varrock East Mine") ||
  639. loc.equals("Varrock West Mine")) {
  640. banking();
  641. }
  642. }
  643. public int bankOpen() {
  644. if (AtBank(area) && players.getMyPlayer().isIdle()) {
  645. status = "Opening Bank.";
  646. if (area.equals("Guild Mine")) {
  647. RSObject bankBooth = objects.getNearest(BANK[1]);
  648. if (random(1, 4) > 1) {
  649. bankBooth.interact("Use-quickly");
  650. } else {
  651. antiban.antiban();
  652. }
  653. }
  654. else if (area.equals("Al-Kharid Mines")) {
  655. RSObject bankBooth = objects.getNearest(BANK[2]);
  656. if (random(1, 4) > 1) {
  657. bankBooth.interact("Use-quickly");
  658. } else {
  659. antiban.antiban();
  660. }
  661. }
  662. else if (area.equals("Varrock East Mine") ||
  663. area.equals("Varrock West Mine")) {
  664. RSObject bankBooth = objects.getNearest(BANK[3]);
  665. if (random(1, 4) > 1) {
  666. bankBooth.interact("Use-quickly");
  667. } else {
  668. antiban.antiban();
  669. }
  670. }
  671. }
  672. return random(800, 1300);
  673. }
  674.  
  675. public int depositBank() {
  676. status = "Depositing ores";
  677. bank.depositAll();
  678. return random(300, 1100);
  679. }
  680.  
  681. public int bankClose() {
  682. if (bank.isOpen()) {
  683. status = "Closing Bank.";
  684. bank.close();
  685. sleep(random(200, 1000));
  686. }
  687. return random(300, 800);
  688. }
  689.  
  690. public void banking() {
  691. if (!bank.isOpen()) {
  692. bankOpen();
  693. antiban.antiban();
  694. }
  695. if (bank.isOpen()) {
  696. depositBank();
  697. doBank = false;
  698. antiban.antiban();
  699. sleep(random(100, 500));
  700. }
  701.  
  702. timer.reset();
  703. }
  704. // </editor-fold>
  705.  
  706. // <editor-fold defaultstate="collapsed" desc="extras">
  707. private boolean if28th() {
  708. RSGroundItem ore = groundItems.getNearest(ORE);
  709. if (inventory.getCount(ORE) == 27) {
  710. if (ore != null) {
  711. if (ore.isOnScreen()) {
  712. return true;
  713. }
  714. }
  715. }
  716. return false;
  717. }
  718.  
  719. public boolean resting() {
  720. final int anim = players.getMyPlayer().getAnimation();
  721. return anim == 12108 || anim == 2033 || anim == 2716 || anim == 11786 || anim == 5713;
  722.  
  723. }
  724. public void doRest(int start, int min, int max) {
  725. int length = random(min, max);
  726.  
  727.  
  728. tempRestLength = length;
  729. if (walking.getEnergy() < start) {
  730. if (useRest) {
  731. walking.rest(length);
  732. sleep(2000, 3000);
  733. while (walking.getEnergy() < length) {
  734. if (resting()) {
  735. sleep(500, 1000);
  736. } else {
  737. length = 0;
  738. }
  739. }
  740. }
  741. }
  742. }
  743.  
  744. private void lowHP() {
  745. combat.getHealth();
  746. if (combat.getHealth() < 30) {
  747. if (atBank()) {
  748. int rand = random(1, 2);
  749. if (rand == 1) {
  750. antiban.antiban();
  751. } else {
  752. antiban.antiBanCamera();
  753. }
  754. sleep(100, 200);
  755. }
  756. if (!atMine() || !atBank()) {
  757. walking.setRun(true);
  758. }
  759. }
  760. }
  761.  
  762. private void runCapable() {
  763. if (!walking.isRunEnabled() && walking.getEnergy() >= random(60, 80)) {
  764. walking.setRun(true);
  765. }
  766. }
  767. /**
  768. *
  769. * @param text the string to send
  770. * @param dev am I using developement mode
  771. * @param dev1 just for developement mode only
  772. * @return true if successfully sent
  773. */
  774. public boolean logger(String text, boolean dev, boolean dev1) {
  775. if (dev && dev1 || dev) {
  776. log(Color.GREEN, "dev: "+text);
  777. }
  778. if (!dev && !dev1 || !dev1) {
  779. log(text);
  780. }
  781. return false;
  782. }
  783.  
  784. public boolean guiOpenn() {
  785. // if (g.isVisible()) {
  786. // return false;
  787. // }
  788. return true;
  789. }
  790.  
  791. public boolean rest(int length) {
  792. return walking.rest(length);
  793. }
  794. // </editor-fold>
  795.  
  796. // <editor-fold defaultstate="collapsed" desc="createandwaitGUI st00f">
  797. private void createAndWaitForGUI() {
  798. if (SwingUtilities.isEventDispatchThread()) {
  799. g.setResizable(false);
  800. g.setVisible(true);
  801. //systemTray();
  802. } else {
  803. try {
  804. SwingUtilities.invokeAndWait(new Runnable() {
  805.  
  806. public void run() {
  807. g.setResizable(false);
  808. g.setVisible(true);
  809. //systemTray();
  810. }
  811. });
  812. } catch (InvocationTargetException e) {
  813. log.warning("InvocationTargetExpection Error!!");
  814. log(e);
  815. log.warning("InvocationTargetExpection Error!!");
  816. } catch (InterruptedException x) {
  817. log.warning("InterruptionException Error!!");
  818. log(x);
  819. log.warning("InterruptionException Error!!");
  820. }
  821. }
  822. sleep(1000);
  823. while (g.isVisible()) {
  824. sleep(1000);
  825. }
  826. }
  827. // </editor-fold>
  828.  
  829. // <editor-fold defaultstate="collapsed" desc="OnStart">
  830. @Override
  831. public boolean onStart() {
  832. track.getUses(track.urlToRead);
  833. g.usesLab.setText("Total Script uses on V."+ver+":");
  834. g.usesNum.setText(track.theText);
  835. currVer = checkVer();
  836. log("setting currVer");
  837. if (!game.isFixed()) {
  838. log(Color.RED, "Please set game to fixed!");
  839. stopScript();
  840. }
  841. log("Cursor loaded.");
  842.  
  843. createAndWaitForGUI();
  844.  
  845. log("Iron Pick Up Version: " + ver);
  846. startTime = System.currentTimeMillis();
  847. shot = g.screenshot.isSelected();
  848. wHop = g.jCheckBox1.isSelected();
  849. useMsRandom = g.mousespeed.isSelected();
  850. doUpdate = g.updater.isSelected();
  851. devMode = g.devMode.isSelected();
  852. useRest = g.rester.isSelected();
  853. antiThreaded = g.threadAnti.isSelected();
  854. garbage = g.gc.isSelected();
  855. mode = g.mode.getSelectedIndex();
  856. logger("Screenshot on end = " + shot, devMode, true);
  857. logger("World hopping = " + wHop, devMode, true);
  858. logger("Random Mouse = " + useMsRandom, devMode, true);
  859. logger("Check for updates = " + doUpdate, devMode, true);
  860. logger("Resting = " + useRest, devMode, true);
  861. logger("Use threaded Antiban = " + antiThreaded, devMode, true);
  862. logger("Use garbage collector = " + garbage, devMode, true);
  863. if (devMode) {
  864. log(Color.red, "Debug mode activated");
  865. }
  866. // log("loading ore prices..... please wait");
  867. // if (g.locations.getSelectedItem().toString().startsWith("Rimmington Mines")) {
  868. // GEItem orePrice1 = grandExchange.lookup(ORE[0]);
  869. // orePrice = orePrice1.getGuidePrice();
  870. // log("Iron ore is: " + orePrice);
  871. // } else if (g.locations.getSelectedItem().toString().equals("Guild Mine")) {
  872. // GEItem orePrice1 = grandExchange.lookup(ORE[1]);
  873. // orePrice = orePrice1.getGuidePrice();
  874. // log("Coal ore is: " + orePrice);
  875. // }
  876. area = g.locations.getSelectedItem().toString();
  877. if (doUpdate) {
  878. checkForUpdates();
  879. } else {
  880. if(currVer > ver) {
  881. displayVer();
  882. log(Color.MAGENTA, "Restart script, and go to my thread, or update script via GUI! :)");
  883. }
  884. }
  885. if (wHop) {
  886. Object obj = g.hopValue.getValue();
  887. hopTime = obj.toString();
  888. timer = new Timer(1000 * 60 * Integer.valueOf(hopTime));
  889. }
  890. if (useRest) {
  891. resterMin = Integer.valueOf(g.restMin.getText());
  892. resterMax = Integer.valueOf(g.restMax.getText());
  893. }
  894. // if (antiThreaded) {
  895. // antibanthread = new antiBanThread();
  896. // antibanthread.start();
  897. // }
  898. // if (garbage) {
  899. // garbagecollector = new garbageCollector();
  900. // garbagecollector.start();
  901. // }
  902. return true;
  903.  
  904. }
  905. // </editor-fold>
  906.  
  907. // <editor-fold defaultstate="collapsed" desc="Loop">
  908. public int loop() {
  909. try {
  910. if (!getMyPlayer().isIdle()) {
  911. worldTimer.reset();
  912. }
  913. //log(doBank);
  914. while (if28th()) {
  915. logger("28th ore exists, picking up!", devMode, true);
  916. collectOre();
  917. //pickingUp();
  918. if (groundItems.getNearest(ORE).getLocation().randomize(2, 2).equals(getMyPlayer().getLocation())) {
  919. sleep(1000,2000);
  920. } else {
  921. sleep(1000,4000);
  922. }
  923. doBank = true;
  924. }
  925. if (!if28th()) {
  926. logger("28th ore doesn't exist, banking!", devMode, true);
  927. doBank = true;
  928. }
  929. if (!AtBank(area) || !bank.isDepositOpen() || !bank.isOpen()) {
  930. if (invCount < inventory.getCount(ORE)) {
  931. oreCollected++;
  932. invCount = inventory.getCount(ORE);
  933. }
  934. runCapable();
  935. if (!AtBank(area)) {
  936. noOres();
  937. }
  938. lowHP();
  939. }
  940. mouseSpeed();
  941. if (AtBank(area)) {
  942. logger("we are at bank...", devMode, true);
  943. if (bank.getBoxCount() == 0 || inventory.getCount() < 27) {
  944. doRest(75, resterMin, resterMax);
  945. logger("Inv less than 27, walking to mine...", devMode, true);
  946. runCapable();
  947. walkToMine();
  948. }
  949. if (bank.isDepositOpen() && bank.getBoxCount() > 1 || inventory.getCount() >= 27) {
  950. logger("Inv more than 26, banking", devMode, true);
  951. banking(area);
  952. }
  953. }
  954. if (AtMine(area)) {
  955. logger("we are at mine...", devMode, true);
  956. if (bank.getBoxCount() == 0 || inventory.getCount() < 27) {
  957. logger("inv less than 27, picking up ores...", devMode, true);
  958. int rand = random(1, 150);
  959. if (rand > 3) {
  960. collectOre();
  961. //pickingUp();
  962. } else {
  963. antiban.antiBanCamera();
  964. }
  965. }
  966. if (doBank && bank.getBoxCount() > 0 || doBank && inventory.getCount() >= 27) {
  967. doRest(90, resterMin, resterMax);
  968. logger("Inv more than 26, walking to bank...", devMode, true);
  969. runCapable();
  970. walkToBank();
  971. }
  972. }
  973. if (!AtBank(area) || !AtMine(area)) {
  974. logger("Not at Bank OR Mine...", devMode, true);
  975. if (bank.getBoxCount() == 0 || inventory.getCount() < 27) {
  976. logger("Inv less than 27, walking to mine...", devMode, true);
  977. walkToMine();
  978. }
  979. if (doBank && bank.getBoxCount() > 0 || doBank && inventory.getCount() >= 27) {
  980. logger("Inv more than 26, walking to bank...", devMode, true);
  981. walkToBank();
  982. }
  983. }
  984. } catch (Exception e) {
  985. if (devMode) {
  986. log.warning(e.getMessage());
  987. }
  988. }
  989. return random(200, 400);
  990. }// </editor-fold>
  991.  
  992. // <editor-fold defaultstate="collapsed" desc="onFinish">
  993. @Override
  994. public void onFinish() {
  995. scriptRunning = false;
  996. tray.remove(icon);
  997. if (shot == true) {
  998. env.saveScreenshot(false);
  999. }
  1000. log("Total Ores Collected: " + oreCollected + " ores.");
  1001. log("http://www.powerbot.org/vb/showthread.php?t=770408 - my script thread. :)");
  1002. }// </editor-fold>
  1003.  
  1004. //<editor-fold defaultstate="collapsed" desc="MouseStuff">
  1005. private void mouseSpeed() {
  1006. if (useMsRandom == true) {
  1007. int rand = random(1, 5);
  1008. if (rand == 1) {
  1009. mouse.setSpeed(random(4, 7));
  1010. }
  1011. if (rand == 2) {
  1012. mouse.setSpeed(random(5, 10));
  1013. }
  1014. if (rand == 3) {
  1015. mouse.setSpeed(random(2, 5));
  1016. }
  1017. if (rand == 4) {
  1018. mouse.setSpeed(random(2, 10));
  1019. }
  1020. } else {
  1021. mouse.setSpeed(random(4, 6));
  1022. }
  1023. mouseSet();
  1024. }
  1025.  
  1026. private void mouseSet() {
  1027. if (mouse.getSpeed() >= 1 && mouse.getSpeed() <= 3) {
  1028. MouseSpeed = "Extremely fast";
  1029. }
  1030. if (mouse.getSpeed() >= 4 && mouse.getSpeed() <= 6) {
  1031. MouseSpeed = "Regular";
  1032. }
  1033. if (mouse.getSpeed() >= 7 && mouse.getSpeed() <= 10) {
  1034. MouseSpeed = "Slow";
  1035. }
  1036. }
  1037. //</editor-fold>
  1038.  
  1039. //<editor-fold defaultstate="collapsed" desc="antiban">
  1040. public class ipuAntiban {
  1041.  
  1042. private void antiban() {
  1043. // if (random(1, 2) == 1) {
  1044. // antiBan1();
  1045. // } else {
  1046. // antiBan2();
  1047. // }
  1048. }
  1049.  
  1050. private void antiBan1() {
  1051. int randomProd = random(1, 40);
  1052. if (randomProd >= 2 && randomProd <= 4) {
  1053. antiBanStatus = "Pause for a few seconds...";
  1054. sleep(1000, 2500);
  1055. }
  1056. if (randomProd >= 32) {
  1057. antiBanStatus = "Moving mouse Randomly..";
  1058. mouse.moveRandomly(100, 600);
  1059. } else {
  1060. sleep(10, 30);
  1061. }
  1062. }
  1063.  
  1064. public void antiBan2() {
  1065. int antiType = random(0, 1);
  1066. int b = random(0, 10);
  1067. switch (antiType) {
  1068. case 0:
  1069. switch (b) {
  1070. case 1:
  1071. if (random(0, 10) == 5) {
  1072. antiBanStatus = "Moving mouse randomly...";
  1073. mouse.moveSlightly();
  1074. sleep(200, 600);
  1075. mouse.moveRandomly(150, 350);
  1076. }
  1077. break;
  1078. case 2:
  1079. if (random(0, 13) == 2) {
  1080. antiBanStatus = "Changing camera angle...";
  1081. camera.setAngle(random(30, 70));
  1082. sleep(400, 1200);
  1083. }
  1084. break;
  1085. case 3:
  1086. if (random(0, 24) == 6) {
  1087. antiBanStatus = "Moving mouse of screen...";
  1088. mouse.moveOffScreen();
  1089. sleep(random(600, random(1200, 2000)));
  1090. }
  1091. break;
  1092. case 5:
  1093. if (random(0, 28) == 0 && !bank.isOpen()) {
  1094. antiBanStatus = "Checking friends list...";
  1095. game.openTab(9);
  1096. sleep(random(1000, 3400));
  1097. } else if (game.getCurrentTab() != Game.TAB_INVENTORY) {
  1098. game.openTab(4);
  1099. }
  1100. default:
  1101. break;
  1102. }
  1103. case 1:
  1104. switch (random(0, 70)) {
  1105. case 1:
  1106. antiBanStatus = "Mouse hopping...";
  1107. camera.setAngle(random(0, 90));
  1108. sleep(500, 1000);
  1109. if (random(1, 3) == 1) {
  1110. mouseHopx = random(0, 760);
  1111. mouseHopy = random(0, 500);
  1112. mouse.hop(mouseHopx, mouseHopy);
  1113. }
  1114. break;
  1115. case 2:
  1116. antiBanStatus = "Mouse hopping...";
  1117. camera.setAngle(random(90, 180));
  1118. sleep(500, 1000);
  1119. if (random(1, 3) == 1) {
  1120. mouseHopx = random(0, 760);
  1121. mouseHopy = random(0, 500);
  1122. mouse.hop(mouseHopx, mouseHopy);
  1123. }
  1124. break;
  1125. case 3:
  1126. antiBanStatus = "Mouse hopping...";
  1127. mouse.moveSlightly();
  1128. camera.setAngle(random(90, 180));
  1129. if (random(1, 3) == 1) {
  1130. mouseHopx = random(0, 760);
  1131. mouseHopy = random(0, 500);
  1132. mouse.hop(mouseHopx, mouseHopy);
  1133. }
  1134. break;
  1135. case 4:
  1136. antiBanStatus = "Mouse hopping...";
  1137. if (random(1, 3) == 1) {
  1138. mouseHopx = random(0, 760);
  1139. mouseHopy = random(0, 500);
  1140. mouse.hop(mouseHopx, mouseHopy);
  1141. } else {
  1142. antiBanStatus = "Mouse hopping...";
  1143. if (random(1, 3) == 1) {
  1144. mouseHopx = random(0, 760);
  1145. mouseHopy = random(0, 500);
  1146. mouse.hop(mouseHopx, mouseHopy);
  1147. }
  1148. }
  1149. break;
  1150. case 5:
  1151. antiBanStatus = "Mouse hopping...";
  1152. camera.setAngle(random(180, 360));
  1153. sleep(500, 1000);
  1154. if (random(1, 3) == 1) {
  1155. mouseHopx = random(0, 760);
  1156. mouseHopy = random(0, 500);
  1157. mouse.hop(mouseHopx, mouseHopy);
  1158. }
  1159. break;
  1160. }
  1161. }
  1162. }
  1163.  
  1164. public void antiBanCamera() {
  1165. isDoingAnti = true;
  1166. int rand = random(1, 30);
  1167. if (rand >= 1 && rand <= 3) {
  1168. antiBanStatus = "randomizing Camera Movement...";
  1169. camera.moveRandomly(random(2000, 5500));
  1170. isDoingAnti = false;
  1171. }
  1172. if (rand >= 4 && rand <= 5) {
  1173. antiBanStatus = "randomizing Camera Angle...";
  1174. camera.setAngle(random(10, 100));
  1175. isDoingAnti = false;
  1176. }
  1177. if (rand == 6) {
  1178. antiBanStatus = "randomizing Camera Pitch...";
  1179. camera.setPitch(random(40, 68));
  1180. isDoingAnti = false;
  1181. }
  1182. if (rand == 7) {
  1183. antiBanStatus = "randomizing Camera Pitch...";
  1184. camera.setPitch(random(20, 45));
  1185. isDoingAnti = false;
  1186. }
  1187. if (rand == 8) {
  1188. antiBanStatus = "randomizing Camera Pitch...";
  1189. camera.setPitch(random(68, 90));
  1190. isDoingAnti = false;
  1191. }
  1192. if (rand >= 9) {
  1193. isDoingAnti = false;
  1194. }
  1195. }
  1196. }
  1197. //</editor-fold>
  1198.  
  1199. // <editor-fold defaultstate="collapsed" desc="NEW GUI">
  1200.  
  1201. public class FuserSkeletonGUI extends javax.swing.JFrame {
  1202.  
  1203. // <editor-fold defaultstate="collapsed" desc="TWITTER STUFF">
  1204. public final String TWITTER_NAME = ""; //name of the twitter account
  1205. public String loadTwitterName = null; //the name that is displayed at beginning of the text field.
  1206. public String loadTwitterUpdate = null; //the actual twitter update that will be viewed.
  1207. public String HASHTAG = "#class"; //the tag that the program will look for in each twitter update.
  1208. public boolean tweetsLoaded = false; //true if the twitter update was loaded successfully
  1209.  
  1210. // <editor-fold defaultstate="collapsed" desc="Twitter Updateer">
  1211. public final void loadTweets(int count) {
  1212. loadTwitterName = "" + TWITTER_NAME; //initializes the twitter name
  1213.  
  1214. final StringBuilder url = new StringBuilder(); //will build the following URL
  1215. url.append("http://scripters.powerbot.org/files/316383/scriptdir/ipu/msgdew.xml");
  1216. //url.append(TWITTER_NAME);
  1217. //url.append("&count=");
  1218. //url.append(count); //this is what the program will load to view the twitter update
  1219.  
  1220. InputStreamReader stream = null;
  1221. BufferedReader reader = null;
  1222.  
  1223. try {
  1224. stream = new InputStreamReader(new URL(url.toString()).openStream()); //sets our stream to open a stream to url above
  1225. reader = new BufferedReader(stream); //reads the webpage
  1226. String s;
  1227. int c = 0;
  1228. while ((s = reader.readLine()) != null) { //while reader can read
  1229. final String a = "<text>", b = "</text>";
  1230. int x = s.indexOf(a);
  1231. if (x == -1) {
  1232. continue;
  1233. }
  1234. x += a.length();
  1235. final int y = s.indexOf(b, x);
  1236. if (y == -1) {
  1237. continue;
  1238. }
  1239. String msg = s.substring(x, y).trim(); //s, the actual message, will cut off <text> and </text> and trim out all unneeded spaces
  1240. // if (!msg.contains(HASHTAG)) { //if hashtag is not there, it's done
  1241. // continue;
  1242. // }
  1243. // if (msg.endsWith(HASHTAG)) { //if it has hashtag, set message
  1244. // msg = msg.substring(0, msg.length() - HASHTAG.length()).trim(); //sets the message, to msg's substring with length, without the hashtag trimmed
  1245. // }
  1246. if (msg.isEmpty()) { //if the msg is empty, we're done.
  1247. continue;
  1248. }
  1249. loadTwitterUpdate = loadTwitterName + "" + msg; //sets the update to the message visible
  1250. if (++c == count) { //count is how many to check
  1251. break;
  1252. }
  1253. tweetsLoaded = true; //tells the program that the tweets were successfully loaded.
  1254. }
  1255. } catch (final IOException ignored) {
  1256.  
  1257. } finally {
  1258. try {
  1259. if (reader != null) {
  1260. reader.close();
  1261. }
  1262. if (stream != null) {
  1263. stream.close();
  1264. }
  1265. } catch (final IOException ignored) {
  1266.  
  1267. }
  1268. }
  1269. }
  1270. // </editor-fold>
  1271. // </editor-fold>
  1272.  
  1273. final String AVATAR = "http://scripters.powerbot.org/files/316383/img/dewAvatar.png"; //link to your avatar (ONLY 65x65px)
  1274. final String SCRIPT_NAME = ironPickUp.class.getAnnotation(ScriptManifest.class).name(); //the scripts name
  1275. final String SCRIPT_VERSION = String.valueOf(ironPickUp.class.getAnnotation(ScriptManifest.class).version()); //the script's version
  1276. final String SCRIPTER = "dew"; //the script writer's name
  1277.  
  1278.  
  1279. public FuserSkeletonGUI() {
  1280. this.loadTweets(1);
  1281. initComponents();
  1282. restLab1.setVisible(false);
  1283. restLab2.setVisible(false);
  1284. restMin.setVisible(false);
  1285. restMax.setVisible(false);
  1286. }
  1287.  
  1288. @SuppressWarnings("unchecked")
  1289. // <editor-fold defaultstate="collapsed" desc="Generated Code">
  1290. private void initComponents() {
  1291.  
  1292. headerImg = new javax.swing.JLabel();
  1293. jLabel2 = new javax.swing.JLabel();
  1294. tabbed_MainPanel = new javax.swing.JTabbedPane();
  1295. tabbed_FuserScripts = new javax.swing.JPanel();
  1296. jScrollPane1 = new javax.swing.JScrollPane();
  1297. jTextArea1 = new javax.swing.JTextArea();
  1298. jLabel4 = new javax.swing.JLabel();
  1299. tabbed_credits = new javax.swing.JPanel();
  1300. jScrollPane2 = new javax.swing.JScrollPane();
  1301. creds_agreement = new javax.swing.JTextArea();
  1302. jLabel5 = new javax.swing.JLabel();
  1303. jScrollPane3 = new javax.swing.JScrollPane();
  1304. creds_credits = new javax.swing.JTextArea();
  1305. version = new javax.swing.JPanel();
  1306. log_version = new javax.swing.JLabel();
  1307. jScrollPane4 = new javax.swing.JScrollPane();
  1308. ChangeLog = new javax.swing.JTextArea();
  1309. tabbed_Settings = new javax.swing.JPanel();
  1310. mousespeed = new javax.swing.JCheckBox();
  1311. screenshot = new javax.swing.JCheckBox();
  1312. updater = new javax.swing.JCheckBox();
  1313. devMode = new javax.swing.JCheckBox();
  1314. jSeparator1 = new javax.swing.JSeparator();
  1315. locations = new javax.swing.JComboBox();
  1316. jLabel6 = new javax.swing.JLabel();
  1317. jScrollPane5 = new javax.swing.JScrollPane();
  1318. jTextArea2 = new javax.swing.JTextArea();
  1319. jCheckBox1 = new javax.swing.JCheckBox();
  1320. hopTxt = new javax.swing.JLabel();
  1321. hopValue = new javax.swing.JSpinner();
  1322. rester = new javax.swing.JCheckBox();
  1323. restLab1 = new javax.swing.JLabel();
  1324. restLab2 = new javax.swing.JLabel();
  1325. restMin = new javax.swing.JFormattedTextField();
  1326. restMax = new javax.swing.JFormattedTextField();
  1327. mode = new javax.swing.JComboBox();
  1328. threadAnti = new javax.swing.JCheckBox();
  1329. gc = new javax.swing.JCheckBox();
  1330. jPanel1 = new javax.swing.JPanel();
  1331. usesLab = new javax.swing.JLabel();
  1332. usesNum = new javax.swing.JTextField();
  1333. jLabel8 = new javax.swing.JLabel();
  1334. start = new javax.swing.JButton();
  1335. scriptthread = new javax.swing.JButton();
  1336. scripterprofile = new javax.swing.JButton();
  1337. fuserscripts = new javax.swing.JButton();
  1338. jLabel1 = new javax.swing.JLabel();
  1339. jLabel3 = new javax.swing.JLabel();
  1340. messageFromDew = new javax.swing.JTextField();
  1341. jLabel7 = new javax.swing.JLabel();
  1342.  
  1343. setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
  1344. setTitle("Iron Pick Up GUI");
  1345. setAlwaysOnTop(true);
  1346. setName("Demo FuserGUI"); // NOI18N
  1347. setResizable(false);
  1348.  
  1349. headerImg.setIcon(new javax.swing.JLabel() {
  1350. public javax.swing.Icon getIcon() {
  1351. try {
  1352. return new javax.swing.ImageIcon(
  1353. new java.net.URL("http://i.imgur.com/hrpyE.png")
  1354. );
  1355. } catch (java.net.MalformedURLException e) {
  1356. }
  1357. return null;
  1358. }
  1359. }.getIcon());
  1360. headerImg.setVerticalAlignment(javax.swing.SwingConstants.TOP);
  1361.  
  1362. jLabel2.setFont(new java.awt.Font("Calibri", 2, 12));
  1363. jLabel2.setText("Our bots are new humans!");
  1364.  
  1365. tabbed_MainPanel.setTabPlacement(javax.swing.JTabbedPane.BOTTOM);
  1366. tabbed_MainPanel.setAutoscrolls(true);
  1367. tabbed_MainPanel.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
  1368. tabbed_MainPanel.setDebugGraphicsOptions(javax.swing.DebugGraphics.NONE_OPTION);
  1369. tabbed_MainPanel.setFont(new java.awt.Font("Calibri", 0, 11));
  1370.  
  1371. jTextArea1.setColumns(20);
  1372. jTextArea1.setEditable(false);
  1373. jTextArea1.setLineWrap(true);
  1374. jTextArea1.setRows(5);
  1375. jTextArea1.setText("We started the Fuser scripts line because we missed something over at PowerBot. We missed a certain amount of minimum quality and overview on scripts. It is hard for normal users to find good scripts. We understand users just want a script to \"just work\". No Nullpointer errors, 100 error lines when compiling, scripts getting stuck within an hour and poorly updated scripts, to name a few common irritations.\n\nWe also missed some crucial interaction between script writers and script users. Because PowerBot is such an enormous success, it tends to become in-personal. Because of the massive ammounts of people making use of RSBot, many so called \"leechers\" emerged. People who copied a script, compiled it and we script writers never heard from anymore. To tell you a secret, the only reason we script writers write scripts is because we like to receive feedback. We hope that because this site has an unique script-writing model and because we are small, we will receive feedback more closely.");
  1376. jTextArea1.setWrapStyleWord(true);
  1377. jScrollPane1.setViewportView(jTextArea1);
  1378.  
  1379. jLabel4.setFont(new java.awt.Font("Calibri", 1, 14));
  1380. jLabel4.setText("Here is our story..");
  1381.  
  1382. javax.swing.GroupLayout tabbed_FuserScriptsLayout = new javax.swing.GroupLayout(tabbed_FuserScripts);
  1383. tabbed_FuserScripts.setLayout(tabbed_FuserScriptsLayout);
  1384. tabbed_FuserScriptsLayout.setHorizontalGroup(
  1385. tabbed_FuserScriptsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  1386. .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, 580, Short.MAX_VALUE)
  1387. .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 580, Short.MAX_VALUE)
  1388. );
  1389. tabbed_FuserScriptsLayout.setVerticalGroup(
  1390. tabbed_FuserScriptsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  1391. .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, tabbed_FuserScriptsLayout.createSequentialGroup()
  1392. .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, 31, Short.MAX_VALUE)
  1393. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1394. .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 222, javax.swing.GroupLayout.PREFERRED_SIZE))
  1395. );
  1396.  
  1397. tabbed_MainPanel.addTab("Fuser Scripts", tabbed_FuserScripts);
  1398.  
  1399. creds_agreement.setColumns(20);
  1400. creds_agreement.setEditable(false);
  1401. creds_agreement.setLineWrap(true);
  1402. creds_agreement.setRows(5);
  1403. creds_agreement.setText("I, dew, hereby take full responsibility of this script. By having this script officially approved, I hereby must update this script, when see fit. If I shall choose not to, I acknowledge my Script Team rank will stripped from my possession, and my script be removed.");
  1404. creds_agreement.setWrapStyleWord(true);
  1405. jScrollPane2.setViewportView(creds_agreement);
  1406.  
  1407. jLabel5.setText("This script was Written by: "+SCRIPTER);
  1408.  
  1409. creds_credits.setColumns(20);
  1410. creds_credits.setEditable(false);
  1411. creds_credits.setRows(5);
  1412. creds_credits.setText("Credits:\nDeww1 - Main Script Programming\njtryba - Creating the implemented World Switcher\nEnfilade - Creating the Built in Updater(not working)\nEnfilade - Paint assistant\nsnotboy808 - For a method to fix the GUI\n\nExtras:\nFinally get yourself an update. keep posting and get more!");
  1413. jScrollPane3.setViewportView(creds_credits);
  1414.  
  1415. javax.swing.GroupLayout tabbed_creditsLayout = new javax.swing.GroupLayout(tabbed_credits);
  1416. tabbed_credits.setLayout(tabbed_creditsLayout);
  1417. tabbed_creditsLayout.setHorizontalGroup(
  1418. tabbed_creditsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  1419. .addGroup(tabbed_creditsLayout.createSequentialGroup()
  1420. .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 261, javax.swing.GroupLayout.PREFERRED_SIZE)
  1421. .addContainerGap(319, Short.MAX_VALUE))
  1422. .addGroup(tabbed_creditsLayout.createSequentialGroup()
  1423. .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 570, Short.MAX_VALUE)
  1424. .addContainerGap())
  1425. .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 580, Short.MAX_VALUE)
  1426. );
  1427. tabbed_creditsLayout.setVerticalGroup(
  1428. tabbed_creditsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  1429. .addGroup(tabbed_creditsLayout.createSequentialGroup()
  1430. .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
  1431. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1432. .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  1433. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1434. .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE)
  1435. .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  1436. );
  1437.  
  1438. tabbed_MainPanel.addTab("Credits", tabbed_credits);
  1439.  
  1440. log_version.setFont(new java.awt.Font("Calibri", 0, 11));
  1441. log_version.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
  1442. log_version.setText("Current Script Version: "+SCRIPT_VERSION);
  1443.  
  1444. ChangeLog.setColumns(20);
  1445. ChangeLog.setEditable(false);
  1446. ChangeLog.setLineWrap(true);
  1447. ChangeLog.setRows(5);
  1448. ChangeLog.setText("V 2: Initial Public Release\n \nV 2.1:\nUpdated paint\nMore accurate ore count\n2-step updater(checks two servers)\nmore informative finish() thread\n \nV. 2.23(BETA):\nNew bank location(Port Sarim)\nDownfalls:\nVery inaccurate paint info.(if you can help msg me)\n \nV 2.35(BETA):\nbanking is now more fluid(only tested for around 30 minutes)\nMuch more accurate paint\nnew banking path! :)\n \nV 2.38:\nScript now works with 2.42! - redownload the script, and it should work! :)\n \nV 2.39:\nFixed a nullPointerException - Script should now work.\n \nV 2.58: Very big Update\nNew GUI\nNew Location(Guild Mines - Requires 60 mining) - picks up Coal\nNew features - all in GUI\nNew Paint features including profit\n:) Hope you all like the new update\n \nV 2.6:\nFinally got Script Writer rank so the updater will now work!\nAdded Debug feature: Only apply if the bot is not working correctly.\n \nV 2.61:\nAttempted to fix not loading on start\n \nV 2.63:\nFixed links in the GUI.\nThey will now correctly redirect to this page!\n \nV 2.65:\nAttempted fix on the loading. Uses two steps to check if we are still viewing GUI\nStarted a fix on world hopping(This may take some time).\n(please disregard the extra stuff on the startup. this is for testing purposes, please tell me how far these get to if you still have an issue!)\n \nV 2.66:\nFixed Debug mode. doesn't give nullpointer now.\n \nV 2.69:\nFixed GUI Problem - new sleek black design goes along with RSBot, and sadly RSBuddy, because RSBot is a copier.\n2 Paths through Rimmington Mines - Safe or Fast\nScript now checks if a 28th ore is visible. if it is, it will pick that ore up, or it will bank if it isn't visible!\n \nV 2.691:\nNew GUI button.. click it. it will open a page, you can simply close it once it has opened. :)\n \nV 2.7:\nRemoved GUI button from 2.691\nAdded new GUI button to go to a private server.\n \nV 2.8:\nNew GUI - built for FuserScripts\nfixed picking up ores problem-doensn't right click and examine\nshould work perfectly now. been testing for about 4 hours, no problems.\n\nV 2.9:\nFixed World Hopper\nAdded Resting (BETA)\nAdded World Hopper Timer (customizable)\nSoon-to-come pick up mith/gold aswell as iron/coal \n^(non-functional button)^\n\nV 3.0:\nLocations Added:\n\t-Al-Kharid Mines\n\t-Varrock West Mine\n\t-Varrock East Mine\nMessage from Dew/Dayghost Feature\nAdjustable rester\nAdjustable world hopping\nMore readable Descriptions for each location (the box to the left)\nRemoved extra pick up button\n\nV 3.1:\nNew Garbage Collector to reduce lag\nNew Threaded Antiban - FULLY functional\nNew Rimmington Walking Paths\nNew Tray Icon Options - Must see :)");
  1449. ChangeLog.setWrapStyleWord(true);
  1450. jScrollPane4.setViewportView(ChangeLog);
  1451.  
  1452. javax.swing.GroupLayout versionLayout = new javax.swing.GroupLayout(version);
  1453. version.setLayout(versionLayout);
  1454. versionLayout.setHorizontalGroup(
  1455. versionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  1456. .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 580, Short.MAX_VALUE)
  1457. .addComponent(log_version, javax.swing.GroupLayout.DEFAULT_SIZE, 580, Short.MAX_VALUE)
  1458. );
  1459. versionLayout.setVerticalGroup(
  1460. versionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  1461. .addGroup(versionLayout.createSequentialGroup()
  1462. .addComponent(log_version, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
  1463. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1464. .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 239, Short.MAX_VALUE))
  1465. );
  1466.  
  1467. tabbed_MainPanel.addTab("Complete Change Log", version);
  1468.  
  1469. mousespeed.setFont(new java.awt.Font("Calibri", 0, 12));
  1470. mousespeed.setText("Use custom mouse speed changer");
  1471.  
  1472. screenshot.setFont(new java.awt.Font("Calibri", 0, 12));
  1473. screenshot.setText("Take screenshot on finish");
  1474.  
  1475. updater.setText("Check for Updates?");
  1476.  
  1477. devMode.setText("Debug Mode (logs all messages)");
  1478.  
  1479. locations.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Pick a Location", "Rimmington Mines(safe)", "Rimmington Mines(fast)", "Al-Kharid Mines", "Varrock East Mine", "Varrock West Mine", "Guild Mine" }));
  1480. locations.addActionListener(new java.awt.event.ActionListener() {
  1481. public void actionPerformed(java.awt.event.ActionEvent evt) {
  1482. locationsActionPerformed(evt);
  1483. }
  1484. });
  1485.  
  1486. jLabel6.setFont(new java.awt.Font("Calibri", 1, 14));
  1487. jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
  1488. jLabel6.setText("Pick a location to pick up ores");
  1489.  
  1490. jTextArea2.setColumns(20);
  1491. jTextArea2.setLineWrap(true);
  1492. jTextArea2.setRows(5);
  1493. jTextArea2.setText("You must select a location!");
  1494. jTextArea2.setWrapStyleWord(true);
  1495. jScrollPane5.setViewportView(jTextArea2);
  1496.  
  1497. jCheckBox1.setText("Use World Hopper");
  1498. jCheckBox1.addActionListener(new java.awt.event.ActionListener() {
  1499. public void actionPerformed(java.awt.event.ActionEvent evt) {
  1500. jCheckBox1ActionPerformed(evt);
  1501. }
  1502. });
  1503.  
  1504. hopTxt.setText("Time to hop");
  1505. hopTxt.setVisible(false);
  1506.  
  1507. hopValue.setVisible(false);
  1508.  
  1509. rester.setText("Rest while running");
  1510. rester.addActionListener(new java.awt.event.ActionListener() {
  1511. public void actionPerformed(java.awt.event.ActionEvent evt) {
  1512. resterActionPerformed(evt);
  1513. }
  1514. });
  1515.  
  1516. restLab1.setText("Min");
  1517. restLab1.setVisible(false);
  1518.  
  1519. restLab2.setText("Max");
  1520. restLab2.setVisible(false);
  1521.  
  1522. restMin.setText("80");
  1523.  
  1524. restMax.setText("100");
  1525.  
  1526. mode.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Choose a Pick up Mode", "Accurate (better paint)", "Fast (less accurate paint)" }));
  1527. mode.addActionListener(new java.awt.event.ActionListener() {
  1528. public void actionPerformed(java.awt.event.ActionEvent evt) {
  1529. modeActionPerformed(evt);
  1530. }
  1531. });
  1532.  
  1533. threadAnti.setText("use Threaded Antiban");
  1534.  
  1535. gc.setText("Use Garbage Collector");
  1536.  
  1537. javax.swing.GroupLayout tabbed_SettingsLayout = new javax.swing.GroupLayout(tabbed_Settings);
  1538. tabbed_Settings.setLayout(tabbed_SettingsLayout);
  1539. tabbed_SettingsLayout.setHorizontalGroup(
  1540. tabbed_SettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  1541. .addGroup(tabbed_SettingsLayout.createSequentialGroup()
  1542. .addGroup(tabbed_SettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  1543. .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 608, javax.swing.GroupLayout.PREFERRED_SIZE)
  1544. .addGroup(tabbed_SettingsLayout.createSequentialGroup()
  1545. .addGap(10, 10, 10)
  1546. .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 339, javax.swing.GroupLayout.PREFERRED_SIZE)
  1547. .addGroup(tabbed_SettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
  1548. .addGroup(tabbed_SettingsLayout.createSequentialGroup()
  1549. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1550. .addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  1551. .addGroup(tabbed_SettingsLayout.createSequentialGroup()
  1552. .addGap(6, 6, 6)
  1553. .addGroup(tabbed_SettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
  1554. .addComponent(mode, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  1555. .addComponent(locations, 0, 214, Short.MAX_VALUE)))))
  1556. .addGroup(tabbed_SettingsLayout.createSequentialGroup()
  1557. .addGap(6, 6, 6)
  1558. .addGroup(tabbed_SettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  1559. .addComponent(screenshot, javax.swing.GroupLayout.PREFERRED_SIZE, 211, javax.swing.GroupLayout.PREFERRED_SIZE)
  1560. .addComponent(mousespeed)
  1561. .addComponent(updater, javax.swing.GroupLayout.PREFERRED_SIZE, 211, javax.swing.GroupLayout.PREFERRED_SIZE)
  1562. .addComponent(devMode, javax.swing.GroupLayout.PREFERRED_SIZE, 211, javax.swing.GroupLayout.PREFERRED_SIZE))
  1563. .addGap(64, 64, 64)
  1564. .addGroup(tabbed_SettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  1565. .addGroup(tabbed_SettingsLayout.createSequentialGroup()
  1566. .addComponent(jCheckBox1)
  1567. .addGap(6, 6, 6)
  1568. .addComponent(hopTxt)
  1569. .addGap(10, 10, 10)
  1570. .addComponent(hopValue, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
  1571. .addGroup(tabbed_SettingsLayout.createSequentialGroup()
  1572. .addGroup(tabbed_SettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
  1573. .addComponent(gc, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  1574. .addGroup(javax.swing.GroupLayout.Alignment.LEADING, tabbed_SettingsLayout.createSequentialGroup()
  1575. .addGroup(tabbed_SettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
  1576. .addComponent(threadAnti, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  1577. .addComponent(rester, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  1578. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1579. .addComponent(restLab1)))
  1580. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1581. .addComponent(restMin, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
  1582. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  1583. .addComponent(restLab2)
  1584. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1585. .addComponent(restMax, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)))))
  1586. .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  1587. );
  1588. tabbed_SettingsLayout.setVerticalGroup(
  1589. tabbed_SettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  1590. .addGroup(tabbed_SettingsLayout.createSequentialGroup()
  1591. .addGap(11, 11, 11)
  1592. .addGroup(tabbed_SettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
  1593. .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE)
  1594. .addGroup(tabbed_SettingsLayout.createSequentialGroup()
  1595. .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
  1596. .addGap(11, 11, 11)
  1597. .addComponent(locations, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
  1598. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  1599. .addComponent(mode, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
  1600. .addGap(11, 11, 11)
  1601. .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
  1602. .addGap(2, 2, 2)
  1603. .addGroup(tabbed_SettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  1604. .addComponent(devMode)
  1605. .addComponent(rester)
  1606. .addComponent(restLab1)
  1607. .addComponent(restMin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  1608. .addComponent(restLab2)
  1609. .addComponent(restMax, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
  1610. .addGap(3, 3, 3)
  1611. .addGroup(tabbed_SettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  1612. .addComponent(updater)
  1613. .addComponent(threadAnti))
  1614. .addGap(3, 3, 3)
  1615. .addGroup(tabbed_SettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  1616. .addComponent(mousespeed)
  1617. .addComponent(gc))
  1618. .addGap(3, 3, 3)
  1619. .addGroup(tabbed_SettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  1620. .addComponent(screenshot)
  1621. .addComponent(jCheckBox1)
  1622. .addGroup(tabbed_SettingsLayout.createSequentialGroup()
  1623. .addGap(4, 4, 4)
  1624. .addComponent(hopTxt))
  1625. .addGroup(tabbed_SettingsLayout.createSequentialGroup()
  1626. .addGap(3, 3, 3)
  1627. .addComponent(hopValue, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
  1628. );
  1629.  
  1630. tabbed_MainPanel.addTab("Settings", tabbed_Settings);
  1631.  
  1632. usesLab.setText("Total Script Uses on V. :");
  1633.  
  1634. usesNum.setText("0");
  1635. usesNum.setOpaque(false);
  1636.  
  1637. jLabel8.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
  1638. jLabel8.setText("More stuff is to come in this tab. Just wait! :)");
  1639.  
  1640. javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
  1641. jPanel1.setLayout(jPanel1Layout);
  1642. jPanel1Layout.setHorizontalGroup(
  1643. jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  1644. .addGroup(jPanel1Layout.createSequentialGroup()
  1645. .addContainerGap()
  1646. .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  1647. .addGroup(jPanel1Layout.createSequentialGroup()
  1648. .addComponent(usesLab, javax.swing.GroupLayout.PREFERRED_SIZE, 149, javax.swing.GroupLayout.PREFERRED_SIZE)
  1649. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1650. .addComponent(usesNum, javax.swing.GroupLayout.PREFERRED_SIZE, 117, javax.swing.GroupLayout.PREFERRED_SIZE))
  1651. .addComponent(jLabel8, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 560, Short.MAX_VALUE))
  1652. .addContainerGap())
  1653. );
  1654. jPanel1Layout.setVerticalGroup(
  1655. jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  1656. .addGroup(jPanel1Layout.createSequentialGroup()
  1657. .addContainerGap()
  1658. .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  1659. .addComponent(usesLab, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
  1660. .addComponent(usesNum, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
  1661. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 207, Short.MAX_VALUE)
  1662. .addComponent(jLabel8))
  1663. );
  1664.  
  1665. tabbed_MainPanel.addTab("Extras", jPanel1);
  1666.  
  1667. start.setFont(new java.awt.Font("Calibri", 0, 12));
  1668. start.setText("Start Script & Save Settings");
  1669. start.addActionListener(new java.awt.event.ActionListener() {
  1670. public void actionPerformed(java.awt.event.ActionEvent evt) {
  1671. startActionPerformed(evt);
  1672. }
  1673. });
  1674.  
  1675. scriptthread.setFont(new java.awt.Font("Calibri", 0, 12));
  1676. scriptthread.setText("View Script Thread");
  1677. scriptthread.addActionListener(new java.awt.event.ActionListener() {
  1678. public void actionPerformed(java.awt.event.ActionEvent evt) {
  1679. scriptthreadActionPerformed(evt);
  1680. }
  1681. });
  1682.  
  1683. scripterprofile.setFont(new java.awt.Font("Calibri", 0, 12));
  1684. scripterprofile.setText("View "+SCRIPTER+"'s Profile");
  1685. scripterprofile.addActionListener(new java.awt.event.ActionListener() {
  1686. public void actionPerformed(java.awt.event.ActionEvent evt) {
  1687. scripterprofileActionPerformed(evt);
  1688. }
  1689. });
  1690.  
  1691. fuserscripts.setFont(new java.awt.Font("Calibri", 0, 12));
  1692. fuserscripts.setText("Visit FuserScripts");
  1693. fuserscripts.addActionListener(new java.awt.event.ActionListener() {
  1694. public void actionPerformed(java.awt.event.ActionEvent evt) {
  1695. fuserscriptsActionPerformed(evt);
  1696. }
  1697. });
  1698.  
  1699. jLabel1.setFont(new java.awt.Font("Calibri", 1, 24));
  1700. jLabel1.setText(SCRIPT_NAME+" 3.0");
  1701.  
  1702. jLabel3.setIcon(new javax.swing.JLabel() {
  1703. public javax.swing.Icon getIcon() {
  1704. try {
  1705. return new javax.swing.ImageIcon(
  1706. new java.net.URL(AVATAR)
  1707. );
  1708. } catch (java.net.MalformedURLException e) {
  1709. }
  1710. return null;
  1711. }
  1712. }.getIcon());
  1713.  
  1714. messageFromDew.setText("There is no message!");
  1715. messageFromDew.setText(loadTwitterUpdate);
  1716.  
  1717. jLabel7.setFont(new java.awt.Font("Calibri", 2, 14));
  1718. jLabel7.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
  1719. jLabel7.setText("Message From Dew/Dayghost");
  1720.  
  1721. javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
  1722. getContentPane().setLayout(layout);
  1723. layout.setHorizontalGroup(
  1724. layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  1725. .addGroup(layout.createSequentialGroup()
  1726. .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  1727. .addGroup(layout.createSequentialGroup()
  1728. .addComponent(headerImg, javax.swing.GroupLayout.PREFERRED_SIZE, 179, javax.swing.GroupLayout.PREFERRED_SIZE)
  1729. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1730. .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  1731. .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 213, javax.swing.GroupLayout.PREFERRED_SIZE)
  1732. .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 253, javax.swing.GroupLayout.PREFERRED_SIZE))
  1733. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 56, Short.MAX_VALUE)
  1734. .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE))
  1735. .addComponent(tabbed_MainPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 585, javax.swing.GroupLayout.PREFERRED_SIZE)
  1736. .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
  1737. .addContainerGap()
  1738. .addComponent(start, javax.swing.GroupLayout.DEFAULT_SIZE, 575, Short.MAX_VALUE))
  1739. .addGroup(layout.createSequentialGroup()
  1740. .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
  1741. .addGroup(layout.createSequentialGroup()
  1742. .addGap(10, 10, 10)
  1743. .addComponent(jLabel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  1744. .addComponent(scriptthread, javax.swing.GroupLayout.PREFERRED_SIZE, 164, javax.swing.GroupLayout.PREFERRED_SIZE))
  1745. .addGap(18, 18, 18)
  1746. .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  1747. .addComponent(messageFromDew, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 388, Short.MAX_VALUE)
  1748. .addGroup(layout.createSequentialGroup()
  1749. .addComponent(fuserscripts, javax.swing.GroupLayout.DEFAULT_SIZE, 214, Short.MAX_VALUE)
  1750. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  1751. .addComponent(scripterprofile, javax.swing.GroupLayout.PREFERRED_SIZE, 164, javax.swing.GroupLayout.PREFERRED_SIZE)))))
  1752. .addContainerGap())
  1753. );
  1754. layout.setVerticalGroup(
  1755. layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  1756. .addGroup(layout.createSequentialGroup()
  1757. .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  1758. .addComponent(headerImg)
  1759. .addGroup(layout.createSequentialGroup()
  1760. .addComponent(jLabel2)
  1761. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1762. .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE))
  1763. .addGroup(layout.createSequentialGroup()
  1764. .addContainerGap()
  1765. .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE)))
  1766. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1767. .addComponent(tabbed_MainPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 287, javax.swing.GroupLayout.PREFERRED_SIZE)
  1768. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1769. .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  1770. .addComponent(scripterprofile, javax.swing.GroupLayout.DEFAULT_SIZE, 43, Short.MAX_VALUE)
  1771. .addComponent(scriptthread, javax.swing.GroupLayout.DEFAULT_SIZE, 43, Short.MAX_VALUE)
  1772. .addComponent(fuserscripts, javax.swing.GroupLayout.DEFAULT_SIZE, 43, Short.MAX_VALUE))
  1773. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1774. .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  1775. .addComponent(messageFromDew, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  1776. .addComponent(jLabel7))
  1777. .addGap(5, 5, 5)
  1778. .addComponent(start, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE))
  1779. );
  1780.  
  1781. pack();
  1782. }// </editor-fold>
  1783.  
  1784.  
  1785. private void startActionPerformed(java.awt.event.ActionEvent evt) {
  1786. if (locations.getSelectedItem().equals("Pick a Location")) {
  1787. JOptionPane j = new JOptionPane();
  1788. j.showMessageDialog(rootPane, "You must select a location before continuing!", "WARNING:", j.WARNING_MESSAGE);
  1789. return;
  1790. }
  1791. if (mode.getSelectedIndex() == 0) {
  1792. JOptionPane j = new JOptionPane();
  1793. j.showMessageDialog(rootPane, "You must select a mode before continuing!", "WARNING:", j.WARNING_MESSAGE);
  1794. return;
  1795. }
  1796. //track.getUses(track.urlToWrite);
  1797. setVisible(false);
  1798. hasStarted = true;
  1799. openGUI = false;
  1800. }
  1801.  
  1802. private void scriptthreadActionPerformed(java.awt.event.ActionEvent evt) {
  1803. sendToURL("http://www.powerbot.org/community/topic/491328-deww1s-iron-pick-up-400-oreshr/");
  1804. }
  1805.  
  1806. private void fuserscriptsActionPerformed(java.awt.event.ActionEvent evt) {
  1807. sendToURL("http://www.fuserscripts.org//");
  1808. }
  1809.  
  1810. private void scripterprofileActionPerformed(java.awt.event.ActionEvent evt) {
  1811. sendToURL("http://fuserscripts.org/community/index.php?/user/19-dew/");
  1812. }
  1813.  
  1814. private void jCheckBox1ActionPerformed(java.awt.event.ActionEvent evt) {
  1815. hopTxt.setVisible(jCheckBox1.isSelected());
  1816. hopValue.setVisible(jCheckBox1.isSelected());
  1817. hopValue.setValue(4);
  1818. }
  1819. private void locationsActionPerformed(java.awt.event.ActionEvent evt) {
  1820. if (locations.getSelectedItem().equals("Pick a Location")) {
  1821. jTextArea2.setText("You must select a location!");
  1822. }
  1823. else if (locations.getSelectedItem().equals("Rimmington Mines(safe)")) {
  1824. jTextArea2.setText("Rimmington Mines(safe):\n"
  1825. + "No Requirements, Apx. 400-600 ores/hr");
  1826. }
  1827. else if (locations.getSelectedItem().equals("Rimmington Mines(fast)")) {
  1828. jTextArea2.setText("Rimmington Mines(fast):\n"
  1829. + "No Requirements, Apx. 400-500 ores/hr\n"
  1830. + "Suggested Stats: 20+ Combat Level\n"
  1831. + "This version passes past a lvl 16 theif.");
  1832. }
  1833. else if (locations.getSelectedItem().equals("Al-Kharid Mines")) {
  1834. jTextArea2.setText("Al-Kharid Mines:\n"
  1835. + "Recommendations: 20+ combat\n"
  1836. + "NOT TESTED - as I don't play, and I don't have a 20+ combat account on hand.. sad, right?");
  1837. }
  1838. else if (locations.getSelectedItem().equals("Varrock East Mine")) {
  1839. jTextArea2.setText("Varrock East Mine:\n"
  1840. + "Recommendation: not be beginner, because the leave safe area thing pops up all the time");
  1841. }
  1842. else if (locations.getSelectedItem().equals("Varrock West Mine")) {
  1843. jTextArea2.setText("Varrock West Mine:\n"
  1844. + "Recommendation: None");
  1845. }
  1846. else if (locations.getSelectedItem().equals("Guild Mine")) {
  1847. jTextArea2.setText("Guild Mines:\n"
  1848. + "60 Mining Required, Not Tested - Give quotes/proggies");
  1849. }
  1850. }
  1851.  
  1852. private void resterActionPerformed(java.awt.event.ActionEvent evt) {
  1853. restLab1.setVisible(rester.isSelected());
  1854. restLab2.setVisible(rester.isSelected());
  1855. restMin.setVisible(rester.isSelected());
  1856. restMax.setVisible(rester.isSelected());
  1857. restMin.setText("80");
  1858. restMax.setText("100");
  1859. }
  1860.  
  1861. private void modeActionPerformed(java.awt.event.ActionEvent evt) {
  1862. if (mode.getSelectedIndex() != 0) {
  1863. jTextArea2.setText(jTextArea2.getText() + "\n------------\n"
  1864. + "Mode: Accurate\n"
  1865. + "This mode has a more accurate paint, BUT it has slower clicking\n"
  1866. + "\n"
  1867. + "Mode: Fast\n"
  1868. + "This mode has a has faster clicking, but the paint is not accurate at all.");
  1869. }
  1870. }
  1871.  
  1872. // Variables declaration - do not modify
  1873. private javax.swing.JTextArea ChangeLog;
  1874. private javax.swing.JTextArea creds_agreement;
  1875. private javax.swing.JTextArea creds_credits;
  1876. private javax.swing.JCheckBox devMode;
  1877. private javax.swing.JButton fuserscripts;
  1878. private javax.swing.JCheckBox gc;
  1879. private javax.swing.JLabel headerImg;
  1880. private javax.swing.JLabel hopTxt;
  1881. private javax.swing.JSpinner hopValue;
  1882. private javax.swing.JCheckBox jCheckBox1;
  1883. private javax.swing.JLabel jLabel1;
  1884. private javax.swing.JLabel jLabel2;
  1885. private javax.swing.JLabel jLabel3;
  1886. private javax.swing.JLabel jLabel4;
  1887. private javax.swing.JLabel jLabel5;
  1888. private javax.swing.JLabel jLabel6;
  1889. private javax.swing.JLabel jLabel7;
  1890. private javax.swing.JLabel jLabel8;
  1891. private javax.swing.JPanel jPanel1;
  1892. private javax.swing.JScrollPane jScrollPane1;
  1893. private javax.swing.JScrollPane jScrollPane2;
  1894. private javax.swing.JScrollPane jScrollPane3;
  1895. private javax.swing.JScrollPane jScrollPane4;
  1896. private javax.swing.JScrollPane jScrollPane5;
  1897. private javax.swing.JSeparator jSeparator1;
  1898. private javax.swing.JTextArea jTextArea1;
  1899. private javax.swing.JTextArea jTextArea2;
  1900. private javax.swing.JComboBox locations;
  1901. private javax.swing.JLabel log_version;
  1902. private javax.swing.JTextField messageFromDew;
  1903. private javax.swing.JComboBox mode;
  1904. private javax.swing.JCheckBox mousespeed;
  1905. private javax.swing.JLabel restLab1;
  1906. private javax.swing.JLabel restLab2;
  1907. private javax.swing.JFormattedTextField restMax;
  1908. private javax.swing.JFormattedTextField restMin;
  1909. private javax.swing.JCheckBox rester;
  1910. private javax.swing.JCheckBox screenshot;
  1911. private javax.swing.JButton scripterprofile;
  1912. private javax.swing.JButton scriptthread;
  1913. private javax.swing.JButton start;
  1914. private javax.swing.JPanel tabbed_FuserScripts;
  1915. private javax.swing.JTabbedPane tabbed_MainPanel;
  1916. private javax.swing.JPanel tabbed_Settings;
  1917. private javax.swing.JPanel tabbed_credits;
  1918. private javax.swing.JCheckBox threadAnti;
  1919. private javax.swing.JCheckBox updater;
  1920. private javax.swing.JLabel usesLab;
  1921. private javax.swing.JTextField usesNum;
  1922. private javax.swing.JPanel version;
  1923. // End of variables declaration
  1924.  
  1925. public void sendToURL(String url) {
  1926. try {
  1927. java.awt.Desktop.getDesktop().browse(java.net.URI.create(url));
  1928. } catch (Exception exception) {
  1929. log("[ERROR]SendToURL: " + exception.getLocalizedMessage());
  1930. }
  1931. }
  1932. }
  1933. // </editor-fold>
  1934.  
  1935. //<editor-fold defaultstate="collapsed" desc="Updater">
  1936. private static final String UPDATER_FILE_NAME = "ironPickUp.java";
  1937. private static final String UPDATER_URL = "http://scripters.powerbot.org/files/316383/scriptdir/ipu/ironPickUp.java";
  1938. private static final String UPDATER_CHECK_URL = "http://scripters.powerbot.org/files/316383/scriptdir/ipu/ipuver.txt";
  1939. private static final Pattern UPDATER_VERSION_PATTERN = Pattern.compile("version\\s*=\\s*([0-9.]+)");
  1940.  
  1941.  
  1942. private boolean checkForUpdates() {
  1943. try {
  1944. /* Get the current version from the Script Manifest annotation defined at the top of your script's class */
  1945. double currentVer = ironPickUp.class.getAnnotation(ScriptManifest.class).version();
  1946. double newVer = -1;
  1947. URL url = new URL(UPDATER_URL);
  1948. /* Open a stream to the newest script file hosted on your server */
  1949. BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
  1950. String line, lines = "";
  1951. Matcher m;
  1952. /* Look for the "version = x.x" string in the newer file to figure out the newest version number */
  1953. while ((line = in.readLine()) != null) {
  1954. lines += line + "\n";
  1955. if ((m = UPDATER_VERSION_PATTERN.matcher(line)).find()) {
  1956. newVer = Double.parseDouble(m.group(1));
  1957. break;
  1958. }
  1959. }
  1960. /* Check if the updater was unable to read the newest version number */
  1961. if (newVer < 0) {
  1962. in.close();
  1963. log("Unable to find the new version number. Update failed");
  1964. return false;
  1965. }
  1966. /* Compare the current version to the newest. */
  1967. if (currentVer == newVer) {
  1968. in.close();
  1969. log("You already have the latest version of the script.");
  1970. return true;
  1971. }
  1972. /* The current version is less than the newest version, so we need to download it */
  1973. log("Update found! Downloading version " + newVer);
  1974. /* Figure out where to save the file */
  1975. String scriptFilePath = Configuration.Paths.getScriptsSourcesDirectory() + "\\" + UPDATER_FILE_NAME;
  1976. PrintWriter out = new PrintWriter(scriptFilePath);
  1977. /* Print the cached lines from the version checking */
  1978. out.print(lines);
  1979. /* Print the rest of the file */
  1980. while ((line = in.readLine()) != null) {
  1981. out.println(line);
  1982. }
  1983. /* Close the streams */
  1984. out.close();
  1985. in.close();
  1986. log(Color.RED,"Successfully saved " + UPDATER_FILE_NAME + " to " + Configuration.Paths.getScriptsSourcesDirectory());
  1987. log(Color.MAGENTA, "File saved, now all you have to do is go to your RSBot directory, and compile\n the script!");
  1988. log(Color.orange, "Update successful!");
  1989. stopScript();
  1990.  
  1991. //log(Color.green, "The new version will appear near the bottom of the script selector.");
  1992. //log(Color.red, "Stop and restart the script to run the newer version.");
  1993. return true;
  1994. } catch (IOException e) {
  1995. log(e.toString());
  1996. log("Update failed.");
  1997. }
  1998. return false;
  1999. }
  2000.  
  2001. private void displayVer() {
  2002. log("An update is currently Available!");
  2003. log("Update from "+ver+" to the new version: "+currVer);
  2004. }
  2005.  
  2006. public double checkVer() {
  2007. try {
  2008. BufferedReader r = new BufferedReader(new InputStreamReader(new URL(UPDATER_CHECK_URL).openStream()));
  2009. double d = Double.parseDouble(r.readLine());
  2010. r.close();
  2011. return d;
  2012. } catch(Exception e) {
  2013. log("Error checking for latest version.");
  2014. }
  2015. return ver;
  2016. }
  2017.  
  2018. //</editor-fold>
  2019.  
  2020. //<editor-fold defaultstate="collapsed" desc="world hopper">
  2021. public class hopper {
  2022.  
  2023. public boolean getExitLobby() {
  2024. return game.isOnLogoutTab();
  2025. }
  2026.  
  2027. public boolean failsafe() {
  2028. return worldTimer.isRunning();
  2029. }
  2030.  
  2031. public boolean changeWorld(int world) {
  2032. boolean a = false;
  2033. if (lastWorld == world) {
  2034. changeWorld(freeWorlds[random(1, 60)]);
  2035. return true;
  2036. }
  2037. lastWorld = world;
  2038. try {
  2039. while(game.isLoggedIn()) {
  2040. if (!failsafe()) {
  2041. return false;
  2042. }
  2043. // Log Out
  2044. if(game.isFixed()) {
  2045. if(getExitLobby()) {
  2046. interfaces.getComponent(182, 6).doClick();
  2047. } else if(interfaces.getComponent(548, 181).isValid()) {
  2048. interfaces.getComponent(548, 181).doClick();
  2049. }
  2050. } else {
  2051. if(getExitLobby()) {
  2052. interfaces.getComponent(182, 6).doClick();
  2053. } else if(interfaces.getComponent(746, 173).isValid()) {
  2054. interfaces.getComponent(746, 173).doClick();
  2055. }
  2056. }
  2057. sleep(1000);
  2058. }
  2059. while(!game.isLoggedIn()) {
  2060. if (!failsafe()) {
  2061. return false;
  2062. }
  2063. // Disable Login Bot or Enable Login Bot
  2064. if(game.getClientState() != Game.INDEX_LOBBY_SCREEN) {
  2065. env.enableRandom("Login");
  2066. } else {
  2067. env.disableRandom("Login");
  2068. }
  2069. // Check if world full
  2070. for (int i = 0; i < interfaces.getComponent(910, 69).getComponents().length; i++) {
  2071. final String amount = interfaces.getComponent(910, 71).getComponents()[i].getText();
  2072. final String number = interfaces.getComponent(910, 69).getComponents()[i].getText();
  2073. int wnumber = Integer.parseInt(number);
  2074. if(wnumber == world) {
  2075. if (amount.contains("FULL")) {
  2076. a = false;
  2077. return a;
  2078. }
  2079. }
  2080. }
  2081. if (interfaces.getComponent(906, 224).isValid()) {
  2082. // Logging in screen
  2083. a = true;
  2084. return a;
  2085. }
  2086. if (interfaces.getComponent(910, 4).isValid()) {
  2087. // Get Selected World
  2088. String thea = interfaces.getComponent(910, 8).getText();
  2089. String theb = thea.replaceAll("Switched to game world ", "");
  2090. if(!thea.contains("Please")) {
  2091. int selworld = Integer.parseInt(theb);
  2092. if(selworld == world) {
  2093. interfaces.getComponent(906, 171).doClick();
  2094. a = true;
  2095. return a;
  2096. }
  2097. }
  2098. }
  2099. if (!interfaces.getComponent(910, 4).isValid()) {
  2100. // Open World Tab
  2101. interfaces.getComponent(906, 22).doClick();
  2102. } else {
  2103. final RSComponent comp = getWorldComponent(world);
  2104. if (comp != null) {
  2105. interfaces.scrollTo(comp, interfaces.getComponent(910, 86));
  2106. comp.doClick();
  2107. sleep(random(500, 800));
  2108. }
  2109. }
  2110. sleep(400, 1000);
  2111. }
  2112. a = true;
  2113. } catch (Exception e) {
  2114. a = false;
  2115. }
  2116. return a;
  2117. }
  2118. public RSComponent getWorldComponent(final int world) {
  2119. for (int i = 0; i < interfaces.getComponent(910, 69).getComponents().length; i++) {
  2120. final RSComponent comp = interfaces.getComponent(910, 69).getComponents()[i];
  2121. if (comp != null) {
  2122. final String number = comp.getText();
  2123. if (Integer.parseInt(number) == world) {
  2124. return interfaces.getComponent(910, 77).getComponents()[i];
  2125. }
  2126. }
  2127. }
  2128. return null;
  2129. }
  2130. }
  2131. //</editor-fold>
  2132.  
  2133. //<editor-fold defaultstate="collapsed" desc="Paint Stuff">
  2134. //START: Code generated using Enfilade's Easel
  2135. private Image getImage(String url) {
  2136. try {
  2137. return ImageIO.read(new URL(url));
  2138. } catch(IOException e) {
  2139. return null;
  2140. }
  2141. }
  2142. public Image getImage1(String fileName) {
  2143. try {
  2144. if (!new File(Configuration.Paths.getCacheDirectory() + File.separator + "ipu").exists()) {
  2145. boolean success = (
  2146. new File(Configuration.Paths.getCacheDirectory() + File.separator + "ipu")).mkdir();
  2147. if (success) {
  2148. log("Iron Pick Up Directory Successfully made!");
  2149. }
  2150. }
  2151. if (new File("ipu") != null) {
  2152. File f = new File(
  2153. Configuration.Paths.getCacheDirectory() + File.separator + "ipu" + File
  2154. .separator + fileName);
  2155. if (f.exists()) {
  2156. log.info("Successfully loaded " + fileName + " from scripts folder.");
  2157. return ImageIO.read(f.toURI().toURL());
  2158. }
  2159. BufferedImage img = ImageIO.read(new URL("http://i1178.photobucket.com/albums/x373/deww1/"
  2160. + fileName));
  2161. if (img != null) {
  2162. log.info("Downloading images...");
  2163. ImageIO.write((RenderedImage) img, "PNG", f);
  2164. log.info("Saved " + fileName + " to Scripts folder successfully.");
  2165. return img;
  2166. }
  2167. }
  2168. } catch (IOException e) {
  2169. log.info("No Internet Connection or Broken Image Link.");
  2170. }
  2171. return null;
  2172. }
  2173.  
  2174. private final Color color1 = new Color(0, 0, 0);
  2175. private final Color color2 = new Color(240, 240, 240);
  2176. private final Color color3 = new Color(255, 255, 255);
  2177. private final Color color4 = new Color(153, 153, 153, 185);
  2178. private final Color color5 = new Color(153, 153, 153, 155);
  2179. private final Color color6 = new Color(212, 222, 150);
  2180.  
  2181. private final Color restCol1 = new Color(0, 0, 0, 155);
  2182. private final Color restCol2 = new Color(0, 0, 0);
  2183. private final Color restCol3 = new Color(255, 255, 255);
  2184. private final BasicStroke stroke1 = new BasicStroke(1);
  2185.  
  2186. private final Font font1 = new Font("Times New Roman", 0, 10);
  2187. private final Font font2 = new Font("Times New Roman", 0, 12);
  2188. private final Font restFont = new Font("Calibri", 0, 12);
  2189.  
  2190.  
  2191.  
  2192. private final Image img1 = getImage1("paint-21.png");
  2193.  
  2194. public void onRepaint(Graphics g1) {
  2195. Graphics2D g = (Graphics2D)g1;
  2196. if (game.isLoggedIn()) {
  2197. long time = System.currentTimeMillis() - startTime;
  2198. int pricePH = (int) (price * 3600000D / time);
  2199. int Price = (orePrice*oreCollected);
  2200. price = orePrice*oreCollected;
  2201. priceHr = (int) ((price) * 3600000D / (System.currentTimeMillis() - startTime));
  2202. oreHr = (int) ((oreCollected) * 3600000D / (System.currentTimeMillis() - startTime));
  2203. millis = System.currentTimeMillis() - startTime;
  2204. hours = millis / (1000 * 60 * 60);
  2205. millis -= hours * (1000 * 60 * 60);
  2206. minutes = millis / (1000 * 60);
  2207. millis -= minutes * (1000 * 60);
  2208. seconds = millis / 1000;
  2209.  
  2210. millis2 = timer.getRemaining() - 60;
  2211. seconds2 = millis2 / 1000;
  2212.  
  2213. // <editor-fold defaultstate="collapsed" desc="paintClosed">
  2214. if (showPaint1) { //paint closed
  2215. g.setColor(color1);
  2216. g.draw(hide);
  2217. g.fillRect(5, 315, 70, 24);
  2218. g.setFont(font1);
  2219. g.setColor(color3);
  2220. g.drawString("Open Paint", 14, 331);// </editor-fold>
  2221.  
  2222. // <editor-fold defaultstate="collapsed" desc="genTab">
  2223. } else if (showPaint2) { //general tab
  2224. g.drawImage(img1, -2, 310, null);
  2225. g.setFont(font1);
  2226. g.setColor(color1);
  2227. g.drawString("Ores/hr: " + oreHr, 264, 443);
  2228. g.drawString("Ores Collected: " + oreCollected, 262, 428);
  2229. g.drawString("Run Time: " + hours + ":" + minutes + ":" + seconds, 263, 413);
  2230. g.setColor(color2);
  2231. g.drawString("Version: " + ver, 91, 385);
  2232. g.setFont(font2);
  2233. g.drawString("Status: " + status, 78, 473);
  2234. g.setFont(font1);
  2235. g.setColor(color1);
  2236. g.drawString("Mouse Speed: " + MouseSpeed, 16, 416);
  2237. //g.drawString("World Hops: " + hopped, 16, 431);
  2238. g.drawString("Time to Switch: " + Timer.format(timer.getRemaining()), 15, 446);
  2239. g.setColor(color6);
  2240. g.draw(genTab);
  2241. g.fillRect(446, 315, 70, 24);
  2242. g.setFont(font2);
  2243. g.setColor(color1);
  2244. g.drawString("General Tab", 453, 332);
  2245. g.setColor(color4);
  2246. g.draw(monTab);
  2247. g.fillRect(376, 315, 70, 24);
  2248. g.setColor(color1);
  2249. g.drawString("Money Tab", 381, 333);
  2250. g.setColor(color5);
  2251. g.draw(hide);
  2252. g.fillRect(5, 315, 70, 24);
  2253. g.setColor(color1);
  2254. g.drawString("Close Paint", 14, 331);// </editor-fold>
  2255.  
  2256. // <editor-fold defaultstate="collapsed" desc="moneyTab">
  2257. } else if (showPaint3) { //money tab
  2258. g.drawImage(img1, -2, 310, null);
  2259. g.setFont(font1);
  2260. g.setColor(color1);
  2261. g.drawString("Run Time: " + hours + ":" + minutes + ":" + seconds, 264, 422);
  2262. g.setColor(color2);
  2263. g.drawString("Version: " + ver, 91, 385);
  2264. g.setFont(font2);
  2265. g.drawString("Status: " + status, 78, 473);
  2266. g.setFont(font1);
  2267. g.setColor(color1);
  2268. g.drawString("Total Money Made: " + Price, 22, 419);
  2269. g.drawString("Total Money per/hr: " + pricePH, 22, 443);
  2270. g.drawString("Ores Collected: " + oreCollected, 262, 448);
  2271. g.setColor(color4);
  2272. g.draw(genTab);
  2273. g.fillRect(446, 315, 70, 24);
  2274. g.setFont(font2);
  2275. g.setColor(color1);
  2276. g.drawString("General Tab", 453, 332);
  2277. g.setColor(color6);
  2278. g.draw(monTab);
  2279. g.fillRect(376, 315, 70, 24);
  2280. g.setColor(color1);
  2281. g.drawString("Money Tab", 381, 333);
  2282. g.setColor(color5);
  2283. g.draw(hide);
  2284. g.fillRect(5, 315, 70, 24);
  2285. g.setColor(color1);
  2286. g.drawString("Close Paint", 14, 331);// </editor-fold>
  2287. }
  2288. if (resting()) {
  2289. g.setColor(restCol1);
  2290. g.fillRoundRect(349, 311, 165, 25, 16, 16);
  2291. g.setColor(restCol2);
  2292. g.setStroke(stroke1);
  2293. g.drawRoundRect(349, 311, 165, 25, 16, 16);
  2294. g.setFont(restFont);
  2295. g.setColor(restCol3);
  2296. g.drawString("Resting until: "+tempRestLength+" Energy", 357, 330);
  2297.  
  2298. }
  2299.  
  2300. // <editor-fold defaultstate="collapsed" desc="worldHopperPaint">
  2301. }
  2302. Mouse.drawMouse(g);
  2303. }
  2304. //END: Code generated using Enfilade's Easel
  2305.  
  2306. // <editor-fold defaultstate="collapsed" desc="MouseStuff">
  2307. @Override
  2308. public void mouseClicked(MouseEvent e) {
  2309. p = e.getPoint();
  2310. if (hide.contains(p) && !showPaint1) {
  2311. showPaint1 = true;
  2312. showPaint2 = false;
  2313. showPaint3 = false;
  2314. } else if (hide.contains(p) && showPaint1) {
  2315. showPaint1 = false;
  2316. showPaint2 = true;
  2317. showPaint3 = false;
  2318. }
  2319. if (genTab.contains(p) && !showPaint2) {
  2320. showPaint2 = true;
  2321. showPaint1 = false;
  2322. showPaint3 = false;
  2323. }
  2324. if (monTab.contains(p) && !showPaint3) {
  2325. showPaint3 = true;
  2326. showPaint2 = false;
  2327. showPaint1 = false;
  2328. }
  2329.  
  2330. }
  2331.  
  2332. // <editor-fold defaultstate="collapsed" desc="UNUSED">
  2333. @Override
  2334. public void mouseEntered(MouseEvent e) {
  2335. // TODO Auto-generated method stub
  2336. }
  2337.  
  2338. @Override
  2339. public void mouseExited(MouseEvent e) {
  2340. // TODO Auto-generated method stub
  2341. }
  2342.  
  2343. @Override
  2344. public void mousePressed(MouseEvent e) {
  2345. Point mp = e.getPoint();
  2346. final Rectangle toggleRectangle = new Rectangle(493, Mouse.absoluteY + 3, 16,
  2347. 15);
  2348. if (toggleRectangle.contains(mp)) {
  2349. Mouse.pressed = !Mouse.pressed;
  2350. }
  2351. }
  2352.  
  2353. @Override
  2354. public void mouseReleased(MouseEvent e) {
  2355. // TODO Auto-generated method stub
  2356. }
  2357. // </editor-fold>
  2358.  
  2359. // </editor-fold>
  2360.  
  2361. //</editor-fold>
  2362. //</editor-fold>
  2363.  
  2364. // <editor-fold defaultstate="collapsed" desc="System Tray">
  2365.  
  2366. private void goUpdate() {
  2367. JOptionPane pane = new JOptionPane();
  2368. JOptionPane.showConfirmDialog(null, "There is an update!\nClick OK to go to the download link\n"
  2369. + "or cancel to remove this dialog!"
  2370. , "An Update was found!", pane.OK_CANCEL_OPTION, pane.INFORMATION_MESSAGE);
  2371. pane.setOptionType(JOptionPane.OK_CANCEL_OPTION);
  2372. pane.setMessage("You are about to restart your script.");
  2373. pane.createDialog("Do you wish to continue?");
  2374. pane.setValue(JOptionPane.OK_OPTION);
  2375. if (pane.getValue() != null) {
  2376. g.sendToURL("http://tinyurl.com/linktodownload");
  2377. }
  2378. }
  2379. public void doHop() {
  2380. hop.changeWorld(freeWorlds[random(1, 60)]);
  2381. if (wHop) {
  2382. timer.reset();
  2383. }
  2384. }
  2385. private void systemTray() {
  2386. //Check the SystemTray support
  2387. if (!SystemTray.isSupported()) {
  2388. System.out.println("SystemTray is not supported");
  2389. return;
  2390. }
  2391. final PopupMenu popup = new PopupMenu();
  2392.  
  2393. // Create a popup menu components
  2394. final MenuItem aboutItem = new MenuItem("About");
  2395. final MenuItem checkUpdate = new MenuItem("Check for updates");
  2396. final java.awt.Menu optionsMenu = new java.awt.Menu("Options");
  2397. final MenuItem switchMode = new MenuItem("Switch Pickup Style");
  2398. final MenuItem hopWorld = new MenuItem("Hop worlds now");
  2399. final MenuItem screenOnEnd = new MenuItem("Screenshot on end");
  2400. final java.awt.Menu displayMenu = new java.awt.Menu("Links");
  2401. final MenuItem errorItem = new MenuItem("Fuser Scripts");
  2402. final MenuItem warningItem = new MenuItem("Powerbot");
  2403. final MenuItem infoItem = new MenuItem("Powerbot Thread");
  2404. final MenuItem noneItem = new MenuItem("Fuser Scripts Thread");
  2405. final MenuItem exitItem = new MenuItem("Exit");
  2406.  
  2407. //Add components to popup menu
  2408. popup.add(aboutItem);
  2409. popup.add(checkUpdate);
  2410. popup.addSeparator();
  2411. popup.add(displayMenu);
  2412. displayMenu.add(errorItem);
  2413. displayMenu.add(warningItem);
  2414. displayMenu.add(infoItem);
  2415. displayMenu.add(noneItem);
  2416. popup.add(optionsMenu);
  2417. optionsMenu.add(switchMode);
  2418. optionsMenu.add(hopWorld);
  2419. optionsMenu.add(screenOnEnd);
  2420. popup.add(exitItem);
  2421.  
  2422. icon.setToolTip("Iron Pick Up");
  2423. icon.setPopupMenu(popup);
  2424.  
  2425. try {
  2426. tray.add(icon);
  2427. if (currVer > ver) {
  2428. checkUpdate.setLabel("Update Available");
  2429. }
  2430. icon.displayMessage("Iron Pick Up Control Panel",
  2431. "This is used as a Control Panel!\n Use as you wish!", TrayIcon.MessageType.INFO);
  2432. } catch (AWTException e) {
  2433. System.out.println("TrayIcon could not be added.");
  2434. return;
  2435. }
  2436.  
  2437. switchMode.addActionListener(new ActionListener() {
  2438.  
  2439. public void actionPerformed(ActionEvent e) {
  2440. switch (mode) {
  2441. case 0: log("NO MODE SELECTED"); stopScript(); break;
  2442. case 1: mode = 1; break;
  2443. case 2: mode = 2; break;
  2444. }
  2445. }
  2446. });
  2447.  
  2448. hopWorld.addActionListener(new ActionListener() {
  2449.  
  2450. public void actionPerformed(ActionEvent e) {
  2451. doHop();
  2452. }
  2453. });
  2454.  
  2455. screenOnEnd.addActionListener(new ActionListener() {
  2456.  
  2457. public void actionPerformed(ActionEvent e) {
  2458. shot = true;
  2459. }
  2460. });
  2461.  
  2462. icon.addActionListener(new ActionListener() {
  2463.  
  2464. public void actionPerformed(ActionEvent e) {
  2465. JOptionPane.showMessageDialog(null,
  2466. "This dialog box is run from System Tray");
  2467. }
  2468. });
  2469.  
  2470. aboutItem.addActionListener(new ActionListener() {
  2471.  
  2472. public void actionPerformed(ActionEvent e) {
  2473. JOptionPane.showMessageDialog(null, "Current Iron Pick Up Version: " + ver,
  2474. "About Iron Pick Up", JOptionPane.PLAIN_MESSAGE);
  2475. }
  2476. });
  2477.  
  2478. checkUpdate.addActionListener(new ActionListener() {
  2479.  
  2480. public void actionPerformed(ActionEvent e) {
  2481. if (checkUpdate.getLabel().equals("Update Available")) {
  2482. g.sendToURL("http://tinyurl.com/linktodownload");
  2483. return;
  2484. }
  2485. currVer = checkVer();
  2486. if (currVer > ver) {
  2487. //JOptionPane.showMessageDialog(null, "There is an update available!\n"
  2488. // + "Go to the thread, to download it!",
  2489. // "Update has been found!", JOptionPane.PLAIN_MESSAGE);
  2490. goUpdate();
  2491. } else {
  2492. JOptionPane.showMessageDialog(null, "There is no update available!",
  2493. "No update was found", JOptionPane.PLAIN_MESSAGE);
  2494. }
  2495. }
  2496. });
  2497.  
  2498. ActionListener listener = new ActionListener() {
  2499.  
  2500. public void actionPerformed(ActionEvent e) {
  2501. MenuItem item = (MenuItem) e.getSource();
  2502. //TrayIcon.MessageType type = null;
  2503. System.out.println(item.getLabel());
  2504. if ("Fuser Scripts".equals(item.getLabel())) {
  2505. g.sendToURL("http://www.fuserscripts.org/");
  2506.  
  2507. } else if ("Powerbot".equals(item.getLabel())) {
  2508. g.sendToURL("http://www.powerbot.org/");
  2509.  
  2510. } else if ("Powerbot Thread".equals(item.getLabel())) {
  2511. g.sendToURL("http://www.powerbot.org/community/topic/491328-deww1s-iron-pick-up-400-oreshr/");
  2512.  
  2513. } else if ("Fuser Scripts Thread".equals(item.getLabel())) {
  2514. g.sendToURL("http://fuserscripts.org/community/index.php?/topic/35-dews-iron-pick-up-400-oreshr/");
  2515.  
  2516. }
  2517. }
  2518. };
  2519. ActionListener listener1 = new ActionListener() {
  2520.  
  2521. public void actionPerformed(ActionEvent e) {
  2522. MenuItem item = (MenuItem) e.getSource();
  2523. //TrayIcon.MessageType type = null;
  2524. System.out.println(item.getLabel());
  2525. if ("Error".equals(item.getLabel())) {
  2526. //type = TrayIcon.MessageType.ERROR;
  2527. icon.displayMessage("Sun TrayIcon Demo",
  2528. "This is an error message", TrayIcon.MessageType.ERROR);
  2529.  
  2530. } else if ("Warning".equals(item.getLabel())) {
  2531. //type = TrayIcon.MessageType.WARNING;
  2532. icon.displayMessage("Sun TrayIcon Demo",
  2533. "This is a warning message", TrayIcon.MessageType.WARNING);
  2534.  
  2535. } else if ("Info".equals(item.getLabel())) {
  2536. //type = TrayIcon.MessageType.INFO;
  2537. icon.displayMessage("Sun TrayIcon Demo",
  2538. "This is an info message", TrayIcon.MessageType.INFO);
  2539.  
  2540. } else if ("None".equals(item.getLabel())) {
  2541. //type = TrayIcon.MessageType.NONE;
  2542. icon.displayMessage("Sun TrayIcon Demo",
  2543. "This is an ordinary message", TrayIcon.MessageType.NONE);
  2544. }
  2545. }
  2546. };
  2547.  
  2548.  
  2549. errorItem.addActionListener(listener);
  2550. warningItem.addActionListener(listener);
  2551. infoItem.addActionListener(listener);
  2552. noneItem.addActionListener(listener);
  2553.  
  2554. exitItem.addActionListener(new ActionListener() {
  2555.  
  2556. public void actionPerformed(ActionEvent e) {
  2557. tray.remove(icon);
  2558. }
  2559. });
  2560. }
  2561. // </editor-fold>
  2562.  
  2563. // <editor-fold defaultstate="collapsed" desc="Mouse">
  2564. public class Mouse {
  2565.  
  2566. private final Color MOUSE_COLOR = new Color(132, 198, 99),
  2567. MOUSE_BORDER_COLOR = new Color(225, 200, 25),
  2568. MOUSE_CENTER_COLOR = new Color(168, 9, 9);
  2569. private boolean pressed = false;
  2570. private int absoluteY = 0;
  2571.  
  2572. private void drawMouse(Graphics g) {
  2573. ((Graphics2D) g).setRenderingHints(new RenderingHints(
  2574. RenderingHints.KEY_ANTIALIASING,
  2575. RenderingHints.VALUE_ANTIALIAS_ON));
  2576. Point p = mouse.getLocation();
  2577. Graphics2D spinG = (Graphics2D) g.create();
  2578. Graphics2D spinGRev = (Graphics2D) g.create();
  2579. Graphics2D spinG2 = (Graphics2D) g.create();
  2580. spinG.setColor(MOUSE_BORDER_COLOR);
  2581. spinGRev.setColor(MOUSE_COLOR);
  2582. spinG.rotate(System.currentTimeMillis() % 2000d / 2000d * (360d) * 2
  2583. * Math.PI / 180.0, p.x, p.y);
  2584. spinGRev.rotate(System.currentTimeMillis() % 2000d / 2000d * (-360d)
  2585. * 2 * Math.PI / 180.0, p.x, p.y);
  2586. final int outerSize = 20;
  2587. final int innerSize = 12;
  2588. spinG.setStroke(new BasicStroke(1.0f, BasicStroke.CAP_ROUND,
  2589. BasicStroke.JOIN_ROUND));
  2590. spinGRev.setStroke(new BasicStroke(1.0f, BasicStroke.CAP_ROUND,
  2591. BasicStroke.JOIN_ROUND));
  2592. spinG.drawArc(p.x - (outerSize / 2), p.y - (outerSize / 2), outerSize,
  2593. outerSize, 100, 75);
  2594. spinG.drawArc(p.x - (outerSize / 2), p.y - (outerSize / 2), outerSize,
  2595. outerSize, -100, 75);
  2596. spinGRev.drawArc(p.x - (innerSize / 2), p.y - (innerSize / 2),
  2597. innerSize, innerSize, 100, 75);
  2598. spinGRev.drawArc(p.x - (innerSize / 2), p.y - (innerSize / 2),
  2599. innerSize, innerSize, -100, 75);
  2600. g.setColor(MOUSE_CENTER_COLOR);
  2601. g.fillOval(p.x, p.y, 2, 2);
  2602. spinG2.setColor(MOUSE_CENTER_COLOR);
  2603. spinG2.rotate(System.currentTimeMillis() % 2000d / 2000d * 360d
  2604. * Math.PI / 180.0, p.x, p.y);
  2605. spinG2.setStroke(new BasicStroke(1.0f, BasicStroke.CAP_ROUND,
  2606. BasicStroke.JOIN_ROUND));
  2607. spinG2.drawLine(p.x - 5, p.y, p.x + 5, p.y);
  2608. spinG2.drawLine(p.x, p.y - 5, p.x, p.y + 5);
  2609. }
  2610. }
  2611. // </editor-fold>
  2612.  
  2613. // <editor-fold defaultstate="collapsed" desc="useTracker">
  2614. public class userTracker {
  2615.  
  2616. public String urlToRead = "http://dayscripts.co.cc/ipu/usercount/v"+trackNum+"/ro_count.php";
  2617. public String urlToWrite = "http://dayscripts.co.cc/ipu/usercount/"+trackNum+"/count.php";
  2618. public String theText = "-1";
  2619.  
  2620. public void getUses(String url1) {
  2621. try {
  2622. URL url = new URL(url1);
  2623. if (url != null) {
  2624. InputStreamReader in = new InputStreamReader(url.openStream());
  2625. if (in != null) {
  2626. BufferedReader read = new BufferedReader(in);
  2627. if (read != null) {
  2628. theText = read.readLine();
  2629. }
  2630. }
  2631. }
  2632. } catch (IOException e) {
  2633. log("IOException Occured: \n"+e);
  2634. }
  2635. }
  2636.  
  2637. }
  2638. // </editor-fold>
  2639.  
  2640. private class FailSafes {
  2641. public static final int MEM_PAGE_INTERFACE = 1066;
  2642.  
  2643. }
  2644.  
  2645. }
  2646.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement