Advertisement
Guest User

Untitled

a guest
Sep 19th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.78 KB | None | 0 0
  1. import impsoft.bots.ColorBot;
  2. import impsoft.bots.input.MouseCommand;
  3. import impsoft.bots.reflection.GroundItem;
  4. import impsoft.bots.reflection.NPC;
  5. import impsoft.bots.reflection.NPCIterator;
  6. import impsoft.bots.reflection.PhysicalObject;
  7. import impsoft.bots.reflection.Player;
  8. import impsoft.bots.reflection.WorldObject;
  9. import impsoft.painting.PaintJob;
  10. import impsoft.scripting.ibot.builtin.itemrec.ItemSlot;
  11. import impsoft.scripting.ibot.enums.BotStates;
  12. import impsoft.scripting.ibot.enums.Skill;
  13. import impsoft.scripting.ibot.interfaces.AutoPaint;
  14. import impsoft.scripting.ibot.interfaces.ChatListener;
  15. import impsoft.scripting.ibot.itemrec.ItemIdExact;
  16. import impsoft.scripting.ibot.itemrec.ItemNameExact;
  17. import impsoft.scripting.ibot.structs.AryanTile;
  18. import impsoft.scripting.ibot.structs.AryanTileZone;
  19. import impsoft.scripting.ibot.structs.RGB;
  20. import impsoft.scripting.ibot.structs.XY;
  21. import impsoft.scripting.types.ColorScript;
  22. import impsoft.scripting.types.ColorSkeltonScriptable;
  23. import impsoft.scripting.types.parallel.scriptjobs.WorldObjectClickingScriptJob;
  24. import impsoft.utils.general.Timer;
  25. import impsoft.utils.ibot.Pixel;
  26. import impsoft.utils.ruler.RulerClickOptions;
  27. import impsoft.utils.ruler.RulerScriptUtils;
  28. import impsoft.utils.uber.UberScriptUtils;
  29. import impsoft.values.constant.Areas;
  30.  
  31. import java.awt.BasicStroke;
  32. import java.awt.Color;
  33. import java.awt.Dimension;
  34. import java.awt.Font;
  35. import java.awt.GradientPaint;
  36. import java.awt.Graphics;
  37. import java.awt.Graphics2D;
  38. import java.awt.Image;
  39. import java.awt.Point;
  40. import java.awt.Polygon;
  41. import java.awt.Rectangle;
  42. import java.awt.event.ActionEvent;
  43. import java.awt.event.ActionListener;
  44. import java.awt.geom.Ellipse2D;
  45. import java.awt.geom.RoundRectangle2D;
  46. import java.io.BufferedReader;
  47. import java.io.BufferedWriter;
  48. import java.io.File;
  49. import java.io.FileNotFoundException;
  50. import java.io.FileReader;
  51. import java.io.FileWriter;
  52. import java.io.IOException;
  53. import java.net.URL;
  54. import java.util.ArrayList;
  55. import java.util.Collections;
  56. import java.util.EnumSet;
  57. import java.util.Iterator;
  58. import java.util.regex.Pattern;
  59.  
  60. import javax.imageio.ImageIO;
  61. import javax.swing.BorderFactory;
  62. import javax.swing.DefaultListModel;
  63. import javax.swing.JButton;
  64. import javax.swing.JCheckBox;
  65. import javax.swing.JComboBox;
  66. import javax.swing.JComponent;
  67. import javax.swing.JFrame;
  68. import javax.swing.JLabel;
  69. import javax.swing.JList;
  70. import javax.swing.JPanel;
  71. import javax.swing.JScrollPane;
  72. import javax.swing.JSlider;
  73. import javax.swing.JSpinner;
  74. import javax.swing.JTabbedPane;
  75. import javax.swing.JTextField;
  76. import javax.swing.ListSelectionModel;
  77. import javax.swing.SpinnerModel;
  78. import javax.swing.SpinnerNumberModel;
  79. import javax.swing.UIManager;
  80. import javax.swing.UnsupportedLookAndFeelException;
  81. import javax.swing.event.ChangeEvent;
  82. import javax.swing.event.ChangeListener;
  83.  
  84. import bergCoder.BergUtils;
  85.  
  86. public class ZFungi extends ColorScript implements AutoPaint, ChatListener {
  87.  
  88. public ZFungi(ColorBot c) {
  89. super(c);
  90.  
  91. }
  92.  
  93. BergUtils util = new BergUtils(this);
  94.  
  95. Timer Time = new Timer(0);
  96. Timer t = new Timer((random(15, 32)) * (1000 * 60));
  97. Timer Tabs = new Timer((random(4, 25)) * (1000 * 60));
  98. Timer HourPic = new Timer(60 * (1000 * 60));
  99. Timer f = new Timer((random(15, 54)) * (1000 * 60));
  100. long scriptStartTIME = System.currentTimeMillis();
  101.  
  102. public static String author = "ZBUBBLEZ";
  103. public static String description = "Picks Fungi 500k/h";
  104. public static String Version = "1.60";
  105. public static String Credits = "ZBUBBLEZ";
  106.  
  107. int currentXp = 0;
  108. int startXp = 0;
  109. int moneyMade = 0;
  110. int logid = 3508;
  111. int fungusid = 3509;
  112. int picked = 0;
  113. int pouchId = 0;
  114.  
  115. String Status = "Starting";
  116. String nameOfBob = "";
  117. String food = "";
  118.  
  119. AryanTile home;
  120.  
  121. boolean full = false;
  122. boolean summoning = false;
  123. boolean sumUp = false;
  124. boolean sumFull = false;
  125. boolean StartScript = false;
  126.  
  127. AryanTileZone fence = new AryanTileZone(new AryanTile(3443, 3458),
  128. new AryanTile(3446, 3464));
  129. AryanTileZone obZone = new AryanTileZone(new AryanTile(3451, 3490),
  130. new AryanTile(3454, 3489));
  131. AryanTileZone insideFence = new AryanTileZone(new AryanTile(3442, 3457),
  132. new AryanTile(3444, 3455));
  133. AryanTileZone bankZone = new AryanTileZone(new AryanTile(3509, 3480),
  134. new AryanTile(3511, 3479));
  135.  
  136. public int[] exptolevel = { 0, 83, 174, 276, 388, 512, 650, 801, 969, 1154,
  137. 1358, 1584, 1833, 2107, 2411, 2746, 3115, 3523, 3973, 4470, 5018,
  138. 5624, 6291, 7028, 7842, 8740, 9730, 10824, 12031, 13363, 14833,
  139. 16456, 18247, 20224, 22406, 24815, 27473, 30408, 33648, 37224,
  140. 41171, 45529, 50339, 55649, 61512, 67983, 75127, 83014, 91721,
  141. 101333, 111945, 123660, 136594, 150872, 166636, 184040, 203254,
  142. 224466, 247886, 273742, 302288, 333804, 368599, 407015, 449428,
  143. 496254, 547953, 605032, 668051, 737627, 814445, 899257, 992895,
  144. 1096278, 1210421, 1336443, 1475581, 1629200, 1798808, 1986068,
  145. 2192818, 2421087, 2673114, 2951373, 3258594, 3597792, 3972294,
  146. 4385776, 4842295, 5346332, 5902831, 6517253, 7195629, 7944614,
  147. 8771558, 9684577, 10692629, 11805606, 13034431, 200000001 };
  148.  
  149. public void script() throws InterruptedException, Exception {
  150.  
  151. while (!isLoggedIn()) {
  152. sleep(1000);
  153. log("Not Logged In");
  154. }
  155.  
  156. log("WELCOME!");
  157. log("Welcome to ZFungi!");
  158. log("Version Number: " + Version);
  159. log("Laste Update: 6/25/11");
  160. sleep(1000);
  161.  
  162. log("Home Tile: " + getLocation());
  163. home = getLocation();
  164.  
  165. JFrame Settings = new ZFungiGUI();
  166. Settings.setVisible(true);
  167. while (StartScript != true)
  168. sleep(100, 200);
  169. StartScript = false;
  170. Settings.setVisible(false);
  171.  
  172. while (true) {
  173.  
  174. switch (random(1, 55)) {
  175. case 1:
  176. AntiBan();
  177. }
  178.  
  179. if (theMiniMapIndicators.getEnergy() > (random(35, 55))) {
  180. util.setFastRun(true);
  181. }
  182.  
  183. Check();
  184. }
  185. }
  186.  
  187. public void Check() throws InterruptedException, Exception {
  188.  
  189. if (summoning == true && sumUp == false) {
  190. if (theTabs.Inventory.count(new ItemIdExact(pouchId)) != 0) {
  191. log("Clicking Summoning Pouch (" + pouchId + ")");
  192. theTabs.Inventory.doAction(new ItemIdExact(pouchId), "Summon",
  193. 1, false);
  194. sleep(2000, 3000);
  195. } else {
  196. log("Summoning Pouch not found");
  197. theWorldMap.walkTo(bankZone.random());
  198. this.SleepTillStill();
  199. theBank.open();
  200. theBank.doDepositAll();
  201. theBank.doWithDraw1(new ItemIdExact(pouchId), false);
  202. theBank.exit();
  203. theWorldMap.walkTo(home);
  204. this.SleepTillStill();
  205. }
  206. }
  207.  
  208. if (theMiniMapIndicators.getPrayerPoints() != 0
  209. && !theTabs.Inventory.isFull() && full == false) {
  210. PhysicalObject fungi = this.getPhysicalObjectByInt(fungusid);
  211. if (fungi == null
  212. || getLocation().distanceTo(fungi.getLocation()) > 5) {
  213. Status = "Click Home Tile";
  214. if (getLocation().distanceTo(home) > 0) {
  215. util.clickTile(home, null, "Walk here");
  216. sleep(200, 1000);
  217. } else if (getLocation().distanceTo(home) > 15) {
  218. theWorldMap.walkTo(fence.random());
  219. this.SleepTillStill();
  220. while (fence.isInZone(getLocation())) {
  221. RulerScriptUtils.clickWorldObject(this, null, this
  222. .getPhysicalObjectByInt(3507), null, Pattern
  223. .compile(".*Gate.*"), Pattern.compile(".*Open.*"), EnumSet
  224. .of(RulerClickOptions.GOAL_NORMAL_CLICK,
  225. RulerClickOptions.WALK_USING_ANY,
  226. RulerClickOptions.PAINT_GAMESCREEN_WALKING,
  227. RulerClickOptions.PAINT_PREDICTION_POLYGON));
  228. sleep(4000, 6000);
  229. }
  230.  
  231. theWorldMap.walkTo(home);
  232. this.SleepTillStill();
  233.  
  234. }
  235. Status = "Blessing";
  236. if (!theTabs.Equipment.isSelected()) {
  237. theTabs.Equipment.click();
  238. }
  239. theTabs.Equipment.doActionOnAll("sickle", "Bloom");
  240. sleep(1000, 2000);
  241. while (getAnimation() != -1) {
  242. sleep(25);
  243. log("Blessing");
  244. }
  245. } else {
  246. if (fungi != null
  247. && getLocation().distanceTo(fungi.getLocation()) < 5) {
  248. Status = "Picking Fungi";
  249. //util.doInteractiveObject(fungi, "Fungi", "Pick", null);
  250. RulerScriptUtils.clickWorldObject(this, null, fungi, null, Pattern
  251. .compile(".*Fungi.*"), Pattern.compile(".*Pick.*"), EnumSet
  252. .of(RulerClickOptions.GOAL_NORMAL_CLICK,
  253. RulerClickOptions.WALK_USING_ANY,
  254. RulerClickOptions.PAINT_GAMESCREEN_WALKING,
  255. RulerClickOptions.PAINT_PREDICTION_POLYGON));
  256. moneyMade = moneyMade + 1185;
  257. sleep(500, 1000);
  258. fungi = this.getPhysicalObjectByInt(fungusid);
  259. }
  260. }
  261. } else {
  262. if (theTabs.Inventory.isFull() || full == true) {
  263. if (sumFull == false && sumUp == true && summoning == true) {
  264. depositSum();
  265. } else {
  266. Bank();
  267. }
  268. } else {
  269. if (theTabs.Inventory.count("Prayer potion") == 0) {
  270. Bank();
  271. } else {
  272. theTabs.Inventory.doAction("Prayer potion", null, 1, false);
  273. sleep(300, 600);
  274. }
  275. }
  276. }
  277.  
  278. TabSelector();
  279.  
  280. sleep(400, 800);
  281. }
  282.  
  283. public void depositSum() throws InterruptedException, Exception {
  284. while (!theTopText.getTopText().contains("Continue")) {
  285. mouseClickRight(new Rectangle(713, 150, -14, -14));
  286. theMenuFinder.doMenu("Interact");
  287. mouseMove(new Rectangle(230, 438, 57, -10));
  288. }
  289. if (theTopText.getTopText().contains("Continue")) {
  290. mouseClickLeft(getCurrentMouseXY());
  291. }
  292.  
  293. theTabs.Inventory.doAction("fungus", "All", 1, false);
  294. sleep(1000, 2000);
  295.  
  296. mouseClickLeft(new Rectangle(417, 42, 10, -6));
  297. sumFull = true;
  298. }
  299.  
  300. public void Bank() throws InterruptedException, Exception {
  301. Status = "Banking";
  302.  
  303.  
  304. Status = "Banking";
  305. theWorldMap.walkTo(bankZone.random());
  306. this.SleepTillStill();
  307. theBank.open();
  308. while (theTabs.Inventory.countEmptySlots() != 28) {
  309. theBank.doDepositAll();
  310. sleep(500, 1200);
  311. }
  312. if (summoning == true) {
  313. mouseClickLeft(new Rectangle(458, 313, 27, -12));
  314. mouseClickLeft(new Rectangle(458, 313, 27, -12));
  315. switch (random(0, 20)) {
  316. case 6:
  317. mouseClickLeft(new Rectangle(458, 313, 27, -12));
  318. break;
  319. case 18:
  320. mouseClickLeft(new Rectangle(458, 313, 27, -12));
  321. break;
  322. }
  323. }
  324. while (theTabs.Inventory.count("Prayer pot") == 0) {
  325. theBank.doWithDrawX(new ItemNameExact("Prayer potion (3)"), 2, true);
  326. sleep(2000, 3000);
  327. }
  328. theBank.exit();
  329. if (theTabs.Inventory.count("Prayer pot") != 0) {
  330. ItemSlot it = theTabs.Inventory.getSlot(new ItemNameExact(
  331. "Prayer potion (3)"));
  332. while (it.getItem().getItemName().contains("Prayer")) {
  333. theTabs.Inventory.doAction(it, null, false);
  334. sleep(200, 1200);
  335. }
  336. }
  337. if (theTabs.Inventory.count("Vial") != 0) {
  338. theTabs.Inventory.doAction("Vial", "Drop", 1, false);
  339. }
  340. theBank.exit();
  341. full = false;
  342. sumFull = false;
  343.  
  344. Status = "Checking Summoning Time";
  345.  
  346. if (summoning == true) {
  347.  
  348. if (getFamiliarTime() <= 2.5) {
  349. theBank.open();
  350. theBank.doWithDraw1(new ItemIdExact(pouchId), true);
  351. theBank.exit();
  352. while (theTabs.Inventory.count(new ItemIdExact(pouchId)) != 0
  353. && sumUp == true) {
  354. mouseClickRight(new Rectangle(713, 150, -14, -14));
  355. theMenuFinder.doMenu("Renew");
  356. sleep(1000, 2000);
  357. }
  358. }
  359. }
  360.  
  361. if (theMiniMapIndicators.getHealthPoints() < random(20, 35)) {
  362. theBank.open();
  363. theBank.doWithDraw10(food, true);
  364. theBank.exit();
  365. while (theTabs.Inventory.count(food) != 0) {
  366. theTabs.Inventory.doAction(food, null, 1, false);
  367. sleep(0, 900);
  368. }
  369. }
  370.  
  371. Status = "Walking to Home";
  372.  
  373. if (summoning == true) {
  374. if (theMiniMapIndicators.getSummoningPoints() < random(17, 25)) {
  375. theWorldMap.walkTo(obZone.random());
  376. this.SleepTillStill();
  377.  
  378. PhysicalObject oby = this.getPhysicalObjectByInt(29992);
  379.  
  380. while (theMiniMapIndicators.getSummoningPoints() < 16
  381. && oby != null) {
  382. util.doInteractiveObject(oby, "Small obelisk",
  383. "Renew-points", null);
  384. sleep(2000, 3000);
  385. oby = this.getPhysicalObjectByInt(29992);
  386. }
  387. }
  388. }
  389.  
  390. theWorldMap.walkTo(home);
  391. this.SleepTillStill();
  392.  
  393. }
  394.  
  395. public void AntiBan() throws InterruptedException, Exception {
  396. Status = "Antiban";
  397. switch (random(0, 250)) {
  398. case 12:
  399. theCamera.setYawRandom();
  400. break;
  401. case 18:
  402. mouseMove(Areas.GAME);
  403. break;
  404. case 24:
  405. theCamera.setYawRandom();
  406. break;
  407. case 35:
  408. mouseMove(Areas.GAME);
  409. mouseMove(Areas.INVENTORY);
  410. break;
  411. case 67:
  412. theCamera.setYawRandom();
  413. break;
  414. case 77:
  415. mouseMove(Areas.GAME);
  416. break;
  417. case 86:
  418. theCamera.setYawRandom();
  419. break;
  420. case 96:
  421. mouseMove(Areas.ENTIRE);
  422. break;
  423. case 103:
  424. theCamera.setYawRandom();
  425. break;
  426. case 134:
  427. theCamera.setYawRandom();
  428. break;
  429. case 155:
  430. theCamera.setYawRandom();
  431. break;
  432. case 173:
  433. mouseMove(Areas.GAME);
  434. break;
  435. case 200:
  436. theCamera.setYawRandom();
  437. break;
  438. }
  439. }
  440.  
  441. public void TabSelector() throws InterruptedException, Exception {
  442. if (Tabs.isUp()) {
  443. switch (random(0, 5)) {
  444. case 0:
  445. mouseClickLeft(new Rectangle(525, 171, 233, 30));
  446. break;
  447. case 1:
  448. mouseClickLeft(new Rectangle(526, 469, 234, 29));
  449. break;
  450. case 2:
  451. mouseClickLeft(new Rectangle(525, 171, 233, 30));
  452. break;
  453. case 3:
  454. mouseClickLeft(new Rectangle(526, 469, 234, 29));
  455. break;
  456. case 4:
  457. mouseClickLeft(new Rectangle(525, 171, 233, 30));
  458. break;
  459. case 5:
  460. mouseClickLeft(new Rectangle(526, 469, 234, 29));
  461. break;
  462. }
  463. Tabs.reset();
  464. log("RandomTabSelector = Action Complete");
  465. } else {
  466.  
  467. }
  468. }
  469.  
  470. public void mMove() throws InterruptedException, Exception {
  471. switch (random(1, 20)) {
  472. case 2:
  473. mouseMove(Areas.ENTIRE);
  474. log("MouseMovement = true");
  475. break;
  476. case 3:
  477. mouseMove(Areas.INVENTORY);
  478. log("MouseMovement = true");
  479. break;
  480. case 8:
  481. mouseMove(Areas.GAME);
  482. log("MouseMovement = true");
  483. break;
  484. case 13:
  485. mouseMove(Areas.GAME);
  486. log("MouseMovement = true");
  487. break;
  488. case 17:
  489. mouseMove(getMyPlayer().getRecommendPointToClick());
  490. log("MouseMovement = true");
  491. break;
  492. case 20:
  493. mouseMove(Areas.ENTIRE);
  494. log("MouseMovement = true");
  495. break;
  496. }
  497. }
  498.  
  499. /** RANDOM METHODS **/
  500.  
  501. public void SleepTillStill() throws InterruptedException, Exception {
  502. boolean Done = false;
  503. int Count = 0;
  504. while (Done == false) {
  505. sleep(700);
  506. if (!getMyPlayer().isMoving()) {
  507. Count++;
  508. }
  509. if (Count > 2) {
  510. Done = true;
  511. }
  512. }
  513. }
  514.  
  515. public NPC getNearestNpcByName(String npcname) {
  516. NPC closest = null;
  517. double closeDistance = 800;
  518. AryanTile here = getLocation();
  519. for (NPCIterator po = getNPCIterator(); po.hasNext();) {
  520. NPC npc = po.next();
  521. String name = npc.getName();
  522. if (name.contains(npcname)) {
  523. double distance = npc.getLocation().distanceToPrecise(here);
  524. if (npc.inCombat() && npc.isInteractingWithMyPlayer())
  525. distance = -1;
  526. if (npc.inCombat() && npc.isInteractingWithOtherPlayer())
  527. distance = 1000000000;
  528. if (distance < closeDistance) {
  529. closest = npc;
  530. closeDistance = distance;
  531. }
  532. }
  533.  
  534. }
  535. return closest;
  536. }
  537.  
  538. public PhysicalObject getPhysicalObjectByInt(int poid) {
  539. PhysicalObject closest = null;
  540. double closeDistance = 800;
  541. AryanTile here = getLocation();
  542. for (PhysicalObject po : getAllPhysicalObjects()) {
  543. int ID = po.getID();
  544. if (ID == poid) {
  545. double distance = po.getLocation().distanceToPrecise(here);
  546. if (distance < closeDistance) {
  547. closest = po;
  548. closeDistance = distance;
  549. }
  550. }
  551.  
  552. }
  553. return closest;
  554. }
  555.  
  556. @Override
  557. public void paint(Graphics g) {
  558. final StringBuilder ggg = new StringBuilder();
  559. final long runtime = Time.timePassed();
  560. final long TotalSec = runtime / 1000;
  561. final long TotalMin = TotalSec / 60;
  562. final long TotalHour = TotalMin / 60;
  563. final int second = (int) TotalSec % 60;
  564. final int minute = (int) TotalMin % 60;
  565. final int hour = (int) TotalHour % 60;
  566. long runTime = 0;
  567. runTime = System.currentTimeMillis() - scriptStartTIME;
  568.  
  569. int PerHour = 0;
  570. if ((runTime / 1000) > 0) {
  571. PerHour = (int) ((3600000.0 / (double) runTime) * ((currentXp - startXp)));
  572. }
  573.  
  574. int mPerHour = 0;
  575. if ((runTime / 1000) > 0) {
  576. mPerHour = (int) ((3600000.0 / (double) runTime) * ((moneyMade)));
  577. }
  578.  
  579. if (hour < 10)
  580. ggg.append("0");
  581. ggg.append(hour);
  582. ggg.append(" : ");
  583. if (minute < 10)
  584. ggg.append("0");
  585. ggg.append(minute);
  586. ggg.append(" : ");
  587. if (second < 10)
  588. ggg.append("0");
  589. ggg.append(second);
  590.  
  591. g.setColor(new Color(0, 255, 0, 125));
  592. for (PhysicalObject po : getAllPhysicalObjects()) {
  593. int ID = po.getID();
  594. if (ID == fungusid) {
  595. if (po != null
  596. && getLocation().distanceTo(po.getLocation()) < 5
  597. && po.getGameScreenLocation() != null) {
  598. g.drawPolygon(po.getGameScreenLocation());
  599. }
  600. }
  601.  
  602. }
  603.  
  604. // START: Code generated using Enfilade's Easel
  605. final Color color1 = new Color(0, 102, 0);
  606. final Color color2 = new Color(0, 0, 0);
  607.  
  608. final BasicStroke stroke1 = new BasicStroke(1);
  609.  
  610. final Font font1 = new Font("MV Boli", 1, 20);
  611. final Font font2 = new Font("MV Boli", 0, 10);
  612. final Font font3 = new Font("MV Boli", 0, 12);
  613.  
  614. g.setColor(color1);
  615. g.fillRect(2, 342, 512, 135);
  616. g.setColor(color2);
  617. g.drawRect(2, 342, 512, 135);
  618. g.setColor(Color.WHITE);
  619. g.setFont(font1);
  620. g.drawString("ZFungi V"+Version, 335, 362);
  621. g.setFont(font2);
  622. g.drawString("zbubblez", 472, 473);
  623. g.setFont(font3);
  624.  
  625. int X = 5;
  626. int Y = 355;
  627.  
  628. g.drawString("Time Running: " + String.valueOf(ggg.toString()), X, Y);
  629. g.drawString("Money Made: " + moneyMade + " (" + mPerHour + "/H)", X,
  630. Y + 15);
  631. g.drawString("Home Tile: " + home, X, Y + 30);
  632. g.drawString("Inventory Full: " + full, X, Y + 45);
  633. g.drawString("Status: " + Status, X, Y + 60);
  634. g.drawString("Summoning Monster Up: " + sumUp, X, Y + 75);
  635. g.drawString("Summoning Time: " + getFamiliarTime(), X, Y + 90);
  636. g.drawString("Food Name: " + food, X, Y + 105);
  637.  
  638. if (summoning == true) {
  639.  
  640. NPC bob = this.getNearestNpcByName(nameOfBob);
  641. if (bob != null && bob.isInteractingWithMyPlayer()) {
  642. if (bob != null && bob.isInteractingWithMyPlayer()
  643. && bob.getGameScreenLocation() != null
  644. && bob.getGameScreenLocationSmaller() != null) {
  645. g.setColor(Color.CYAN);
  646. g.drawPolygon(bob.getGameScreenLocationSmaller());
  647. }
  648. } else {
  649.  
  650. }
  651. try {
  652. if (theClientScreen.getPixelColor(new XY(706, 155)) == 5343598) {
  653. sumUp = true;
  654. } else {
  655. sumUp = false;
  656. }
  657. } catch (InterruptedException e) {
  658. // TODO Auto-generated catch block
  659. e.printStackTrace();
  660. }
  661.  
  662. }
  663.  
  664. }
  665.  
  666.  
  667. @Override
  668. public void chat(String s) throws InterruptedException {
  669. if (s.contains("You have no more space in your inventory")) {
  670. full = true;
  671. }
  672. }
  673.  
  674. /*
  675. * To change this template, choose Tools | Templates and open the template
  676. * in the editor.
  677. */
  678.  
  679. /*
  680. * ZFungiGUI.java
  681. *
  682. * Created on Jun 10, 2011, 2:12:47 PM
  683. */
  684.  
  685. /**
  686. *
  687. * @author Dan
  688. */
  689. public class ZFungiGUI extends javax.swing.JFrame {
  690.  
  691. /** Creates new form ZFungiGUI */
  692. public ZFungiGUI() {
  693. initComponents();
  694. }
  695.  
  696. /**
  697. * This method is called from within the constructor to initialize the
  698. * form. WARNING: Do NOT modify this code. The content of this method is
  699. * always regenerated by the Form Editor.
  700. */
  701. @SuppressWarnings("unchecked")
  702. // <editor-fold defaultstate="collapsed" desc="Generated Code">
  703. private void initComponents() {
  704.  
  705. jLabel1 = new javax.swing.JLabel();
  706. foodName = new javax.swing.JTextField();
  707. useSum = new javax.swing.JRadioButton();
  708. bobName = new javax.swing.JComboBox();
  709. usePpot = new javax.swing.JRadioButton();
  710. usePOH = new javax.swing.JRadioButton();
  711. StartButton = new javax.swing.JButton();
  712.  
  713. setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
  714.  
  715. jLabel1.setFont(new java.awt.Font("MV Boli", 3, 36)); // NOI18N
  716. jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
  717. jLabel1.setText("ZFungi");
  718.  
  719. foodName.setHorizontalAlignment(javax.swing.JTextField.CENTER);
  720. foodName.setText("Food Name");
  721.  
  722. useSum.setText("Use BOB");
  723.  
  724. bobName.setModel(new javax.swing.DefaultComboBoxModel(new String[] {
  725. "Spirit terrorbird", "War tortoise" }));
  726.  
  727. usePpot.setText("Use PPots");
  728.  
  729. usePOH.setText("Use POH");
  730.  
  731. StartButton.setText("Start");
  732. StartButton.addActionListener(new java.awt.event.ActionListener() {
  733. public void actionPerformed(java.awt.event.ActionEvent evt) {
  734. StartButtonActionPerformed(evt);
  735. }
  736. });
  737.  
  738. javax.swing.GroupLayout layout = new javax.swing.GroupLayout(
  739. getContentPane());
  740. getContentPane().setLayout(layout);
  741. layout.setHorizontalGroup(layout
  742. .createParallelGroup(
  743. javax.swing.GroupLayout.Alignment.LEADING)
  744. .addGroup(
  745. layout.createSequentialGroup()
  746. .addContainerGap()
  747. .addGroup(
  748. layout.createParallelGroup(
  749. javax.swing.GroupLayout.Alignment.LEADING)
  750. .addComponent(
  751. jLabel1,
  752. javax.swing.GroupLayout.DEFAULT_SIZE,
  753. 380,
  754. Short.MAX_VALUE)
  755. .addGroup(
  756. layout.createSequentialGroup()
  757. .addGap(10,
  758. 10,
  759. 10)
  760. .addGroup(
  761. layout.createParallelGroup(
  762. javax.swing.GroupLayout.Alignment.LEADING)
  763. .addGroup(
  764. layout.createSequentialGroup()
  765. .addComponent(
  766. useSum)
  767. .addPreferredGap(
  768. javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  769. .addComponent(
  770. bobName,
  771. 0,
  772. 297,
  773. Short.MAX_VALUE))
  774. .addComponent(
  775. foodName,
  776. javax.swing.GroupLayout.DEFAULT_SIZE,
  777. 370,
  778. Short.MAX_VALUE)
  779. .addGroup(
  780. layout.createSequentialGroup()
  781. .addComponent(
  782. usePpot)
  783. .addPreferredGap(
  784. javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  785. .addComponent(
  786. usePOH))
  787. .addComponent(
  788. StartButton,
  789. javax.swing.GroupLayout.DEFAULT_SIZE,
  790. 370,
  791. Short.MAX_VALUE))))
  792. .addContainerGap()));
  793. layout.setVerticalGroup(layout
  794. .createParallelGroup(
  795. javax.swing.GroupLayout.Alignment.LEADING)
  796. .addGroup(
  797. layout.createSequentialGroup()
  798. .addContainerGap()
  799. .addComponent(
  800. jLabel1,
  801. javax.swing.GroupLayout.PREFERRED_SIZE,
  802. 55,
  803. javax.swing.GroupLayout.PREFERRED_SIZE)
  804. .addPreferredGap(
  805. javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  806. .addComponent(
  807. foodName,
  808. javax.swing.GroupLayout.PREFERRED_SIZE,
  809. javax.swing.GroupLayout.DEFAULT_SIZE,
  810. javax.swing.GroupLayout.PREFERRED_SIZE)
  811. .addPreferredGap(
  812. javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  813. .addGroup(
  814. layout.createParallelGroup(
  815. javax.swing.GroupLayout.Alignment.BASELINE)
  816. .addComponent(useSum)
  817. .addComponent(
  818. bobName,
  819. javax.swing.GroupLayout.PREFERRED_SIZE,
  820. javax.swing.GroupLayout.DEFAULT_SIZE,
  821. javax.swing.GroupLayout.PREFERRED_SIZE))
  822. .addPreferredGap(
  823. javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  824. .addGroup(
  825. layout.createParallelGroup(
  826. javax.swing.GroupLayout.Alignment.BASELINE)
  827. .addComponent(usePpot)
  828. .addComponent(usePOH))
  829. .addPreferredGap(
  830. javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  831. .addComponent(
  832. StartButton,
  833. javax.swing.GroupLayout.DEFAULT_SIZE,
  834. 50, Short.MAX_VALUE)
  835. .addContainerGap()));
  836.  
  837. pack();
  838. }// </editor-fold>
  839.  
  840. private void StartButtonActionPerformed(java.awt.event.ActionEvent evt) {
  841. if (foodName.getText() != null) {
  842. food = foodName.getText();
  843. } else {
  844. food = "Lobster";
  845. }
  846.  
  847. if (useSum.isSelected()) {
  848. summoning = true;
  849. if (bobName.getSelectedItem().toString().toLowerCase()
  850. .contains("terror")) {
  851. nameOfBob = "Spirit terrorbird";
  852. pouchId = 12007;
  853.  
  854. } else if (bobName.getSelectedItem().toString().toLowerCase()
  855. .contains("tortoise")) {
  856. nameOfBob = "War tortoise";
  857. pouchId = 12031;
  858. } else {
  859. log("Invalid Beast of Burden!");
  860. nameOfBob = null;
  861. pouchId = 0;
  862. }
  863. } else {
  864. summoning = false;
  865. }
  866. StartScript = true;
  867. }
  868.  
  869. /**
  870. * @param args
  871. * the command line arguments
  872. */
  873. public void main(String args[]) {
  874. java.awt.EventQueue.invokeLater(new Runnable() {
  875. public void run() {
  876. new ZFungiGUI().setVisible(true);
  877. }
  878. });
  879. }
  880.  
  881. // Variables declaration - do not modify
  882. private javax.swing.JButton StartButton;
  883. private javax.swing.JComboBox bobName;
  884. private javax.swing.JTextField foodName;
  885. private javax.swing.JLabel jLabel1;
  886. private javax.swing.JRadioButton usePOH;
  887. private javax.swing.JRadioButton usePpot;
  888. private javax.swing.JRadioButton useSum;
  889. // End of variables declaration
  890.  
  891. }
  892.  
  893. public double getFamiliarTime() {
  894. return ((this.getSettingArray()[1176] >> 6) / 2.0D);
  895. }
  896.  
  897. }// END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement