Advertisement
Guest User

Untitled

a guest
May 28th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 34.00 KB | None | 0 0
  1. import java.awt.Color;
  2. import java.awt.Graphics;
  3. import java.awt.Point;
  4. import java.text.NumberFormat;
  5. import java.util.Map;
  6.  
  7. import org.rsbot.bot.Bot;
  8. import org.rsbot.event.listeners.PaintListener;
  9. import org.rsbot.script.Calculations;
  10. import org.rsbot.script.Script;
  11. import org.rsbot.script.ScriptManifest;
  12. import org.rsbot.script.Skills;
  13. import org.rsbot.script.wrappers.RSTile;
  14. import org.rsbot.event.events.ServerMessageEvent;
  15. import org.rsbot.event.listeners.ServerMessageListener;
  16. import org.rsbot.script.wrappers.RSInterface;
  17. import org.rsbot.script.wrappers.RSInterfaceChild;
  18. import org.rsbot.script.wrappers.RSInterfaceComponent;
  19. import java.awt.Rectangle;
  20.  
  21. @ScriptManifest(authors = { "Garrett" }, category = "Runecraft", name = "Garrett's Astral Runecrafter", version = 1.3, description =
  22. "<html><head>" +
  23. "</head><body>" +
  24. "<center><strong><h2>Garrett's Astral Runecrafter</h2></strong><br /><br />" +
  25. "Recommended: Wear a ring of life & turn off auto retaliate<br />" +
  26. "Start the script anywhere along the runecrafting process<br />" +
  27. "For Teleport: Wear Staff of Earth and have Laws in Inventory</center><br />" +
  28. "Food ID: <input name='FOODID' type='text' size='5' value='7946' /> 7946 for Monkfish<br /> " +
  29. "you will Eat Randomly from 500 to 600 HP<br />" +
  30. "See script Lines 151 & 264 If You Want To Change It<br />" +
  31. "<br />"+
  32.  
  33. "</body></html>")
  34.  
  35. public class GarrettsAstralRunecrafter extends Script implements PaintListener, ServerMessageListener {
  36.  
  37. final ScriptManifest properties = getClass().getAnnotation(ScriptManifest.class);
  38.  
  39. private long scriptStartTIME = 0;
  40. int runEnergy = random(101, 102);
  41. int randomDrink = 100;
  42. int healthPercent = 0;
  43. int drinkVars[] = new int[2];
  44. int randomHealth[] = new int[2];
  45. int failCount = 0;
  46. int fatalCount = 0;
  47. int startLVL = 0;
  48. int startXP = 0;
  49. boolean setAltitude = false;
  50. //delete from here if needed
  51. int smPouch = 5509;
  52. int medPouch = 5510;
  53. int medPouchd = 5511;
  54. int largePouch = 5512;
  55. int largePouchd = 5513;
  56. int giantPouch = 5514;
  57. int giantPouchd = 5515;
  58. int airRune = 556;
  59. int cosmicRune = 564;
  60. public boolean checkPouch = true;
  61. public boolean fullPouch = true;
  62. public int pouchCheck = 0;
  63. public int numPouches = 0;
  64. public boolean decayedPouch = false;
  65. public boolean giantFull=false;
  66. public int pouchesFixxed = 0;
  67. public boolean craftUp=false;
  68. public boolean emptyInv=false;
  69. public boolean smFull=false;
  70. public boolean medFull=false;
  71. public boolean largeFull=false;
  72. public int moneyBanked=0;
  73. public int moneyUsed=0;
  74. public int profitMade=0;
  75. public int essPrice=129;
  76. public int astralPrice=214;
  77. public int lawPrice=334;
  78. public boolean craftSinceProfit=false;
  79. public int tCashUsed = 0;
  80.  
  81. boolean useFood = true;
  82. boolean usePots = true;
  83.  
  84. final int pureEssence = 7936;
  85. final int astralRune = 9075;
  86. final int lawRune = 563;
  87. final int energyPots[] = {3014, 3012, 3010, 3008, 3022, 3020, 3018, 3016};
  88. int foodID = 0;
  89.  
  90. public RSTile PathToBank[] = { new RSTile(2113,3916), new RSTile(2106,3915), new RSTile(2100,3918)};
  91. final RSTile bankBooth = new RSTile(2099, 3920);
  92. final RSTile bankTile = new RSTile(2101, 3914);
  93. final RSTile altar = new RSTile(2158, 3864);
  94. final RSTile[] path = {new RSTile(2099, 3918), new RSTile(2104, 3915), new RSTile(2112, 3915), new RSTile(2113, 3901),
  95. new RSTile(2113, 3897), new RSTile(2115,3885), new RSTile(2123, 3879), new RSTile(2128, 3874),
  96. new RSTile(2134, 3864), new RSTile(2142, 3860), new RSTile(2147, 3863),
  97. new RSTile(2153, 3864), new RSTile(2156, 3864)};
  98.  
  99.  
  100. private enum State { walkToAltar, walkToBank, craftRunes, teleport, drinkPotion, eatFood, bank, checkPouches, emptyPouch, repairPouches, error };
  101.  
  102. private State getState() {
  103. if (fatalCount > 20)
  104. return State.error;
  105. if (usePots)
  106. if (getEnergy() < randomDrink)
  107. if (inventoryContainsOneOf(energyPots))
  108. return State.drinkPotion;
  109. if (tileOnMap(bankTile)) {
  110. if (useFood)
  111. if (getHPpercent() < healthPercent)
  112. if (inventoryContains(foodID))
  113. return State.eatFood;
  114. if (usePots)
  115. if (!inventoryContainsOneOf(energyPots) && !isInventoryFull())
  116. return State.bank;
  117. if (decayedPouch)
  118. return State.repairPouches;
  119. if (checkPouch)
  120. return State.checkPouches;
  121. if (!inventoryContains(pureEssence))
  122. return State.bank;
  123. if (!isInventoryFull())
  124. return State.bank;
  125. }
  126. if (tileOnMap(altar)){
  127. if (inventoryContains(pureEssence)){
  128. craftSinceProfit=true;
  129. return State.craftRunes;
  130. }
  131. if(craftUp){
  132. craftUp=false;
  133. return State.craftRunes;
  134. }
  135. if (fullPouch)
  136. return State.emptyPouch;
  137. }
  138. if (inventoryContains(pureEssence))
  139. return State.walkToAltar;
  140. else {
  141. wait(random(500, 800));
  142. if (inventoryContains(lawRune) && distanceTo(bankTile) > 40)
  143. return State.teleport;
  144. else
  145. return State.walkToBank;
  146. }
  147. }
  148.  
  149. public boolean onStart( Map<String,String> args ) {
  150. scriptStartTIME = System.currentTimeMillis();
  151. usePots = args.get("USEPOTS") != null ? true : false;
  152. drinkVars[0] = 40;
  153. drinkVars[1] = 70;
  154. randomDrink = random(drinkVars[0], drinkVars[1]);
  155. healthPercent = random(500, 600);
  156. foodID = Integer.parseInt(args.get("FOODID"));
  157. return true;
  158. }
  159.  
  160. public int loop() {
  161. if (!isLoggedIn())
  162. return 1;
  163.  
  164. if(!setAltitude) {
  165. setCameraAltitude(true);
  166. wait(random(250, 500));
  167. setAltitude = true;
  168. return 1;
  169. }
  170.  
  171. startRunning(runEnergy);
  172. antiBan();
  173.  
  174. switch (getState()) {
  175. case walkToAltar:
  176. walkPath(path);
  177. return 1;
  178. case walkToBank:
  179. walkPath(reversePath(path));
  180. return 1;
  181. case craftRunes:
  182. int invCount = getInventoryCount(astralRune);
  183. if (onTile(altar, "Craft", random(-0.25, 1.25), random(-0.25, 1.25), 0)) {
  184. fatalCount = 0;
  185. wait(random(200, 400));
  186. failCount = 0;
  187. while (invCount == getInventoryCount(astralRune) && failCount < 40) {
  188. wait(random(50, 100));
  189. failCount++;
  190. }
  191. }
  192. return 1;
  193. case teleport:
  194. if (getCurrentTab() != TAB_MAGIC) {
  195. openTab(TAB_MAGIC);
  196. failCount = 0;
  197. while (getCurrentTab() != TAB_MAGIC && failCount < 10) {
  198. wait(random(250, 350));
  199. failCount++;
  200. log(Integer.toString(getHPpercent()));
  201. }
  202. }
  203. RSTile location = getMyPlayer().getLocation();
  204. if (atInterface(430, 42)) {
  205. wait(random(500, 750));
  206. failCount = 0;
  207. while (location == getMyPlayer().getLocation() && failCount < 40) {
  208. wait(random(50, 100));
  209. failCount++;
  210. }
  211. while (getMyPlayer().getAnimation() != -1) {
  212. wait(random(50, 100));
  213. }
  214. wait(random(400, 600));
  215. moneyUsed= moneyUsed+lawPrice;
  216. } else {
  217. onTile(altar, "Pray", random(-0.25, 1.25), random(-0.25, 1.25), 0);
  218. wait(random(800, 1200));
  219. }
  220. return 1;
  221. case drinkPotion:
  222. if (bank.isOpen()) {
  223. if (bank.close()) {
  224. wait(random(200, 200));
  225. failCount = 0;
  226. while (bank.isOpen() && failCount < 20) {
  227. wait(random(50, 100));
  228. failCount++;
  229. }
  230. }
  231. return 1;
  232. }
  233. for (int i = 0; i < energyPots.length; i++) {
  234. try {
  235. if (atInventoryItem(energyPots[i], "Drink")) {
  236. wait(random(100, 200));
  237. failCount = 0;
  238. while (inventoryContains(energyPots[i]) && failCount < 20) {
  239. wait(random(50, 100));
  240. failCount++;
  241. }
  242. randomDrink = random(drinkVars[0], drinkVars[1]);
  243. break;
  244. }
  245. } catch(Exception e) { }
  246. }
  247. return 1;
  248. case eatFood:
  249. if (inventoryContains(foodID)) {
  250. if (bank.isOpen()) {
  251. if (bank.close()) {
  252. wait(random(100, 200));
  253. failCount = 0;
  254. while (bank.isOpen() && failCount < 20) {
  255. wait(random(50, 100));
  256. failCount++;
  257. }
  258. }
  259. return 1;
  260. }
  261. if (atInventoryItem(foodID, "Eat")) {
  262. wait(random(100, 200));
  263. failCount = 0;
  264. while (inventoryContains(foodID) && failCount < 30) {
  265. wait(random(50, 100));
  266. failCount++;
  267. }
  268. healthPercent = random(500, 600);
  269. }
  270. }
  271. return 1;
  272. case repairPouches:
  273. if(bank.isOpen()&&inventoryContains(airRune)&&inventoryContains(cosmicRune)&&inventoryContains(astralRune)){
  274. if (bank.close()) {
  275. wait(random(100, 200));
  276. failCount = 0;
  277. while (bank.isOpen() && failCount < 20) {
  278. wait(random(50, 100));
  279. failCount++;
  280. }
  281. return 1;
  282. }
  283. }
  284. if(inventoryContains(airRune)&&inventoryContains(cosmicRune)&&inventoryContains(astralRune)){
  285. if (getCurrentTab() != TAB_MAGIC) {
  286. openTab(TAB_MAGIC);
  287. failCount = 0;
  288. while (getCurrentTab() != TAB_MAGIC && failCount < 10) {
  289. wait(random(50, 100));
  290. failCount++;
  291. }
  292. }
  293.  
  294. atInterface(430, 26);
  295. wait(random(1500, 1750));
  296.  
  297. final RSInterfaceChild scrollBar = RSInterface.getChildInterface(88, 20);
  298. if (!scrollBar.isValid())
  299. return 1;
  300.  
  301. Rectangle pos = scrollBar.getArea();
  302. if (pos.x == -1 || pos.y == -1 || pos.width == -1 || pos.height == -1) {
  303. return 1;
  304. }
  305. moveMouse((int) random(458, 465), (int) random(257, 296));
  306. clickMouse(true);
  307. wait(random(500, 750));
  308. clickMouse(true);
  309.  
  310. final RSInterfaceChild darkMage = RSInterface.getChildInterface(88, 22);
  311. if (!darkMage.isValid())
  312. return 1;
  313. atComponent(darkMage,4,"Speak-to");
  314. //I know this looks a bit overkill but it seems to work out right... dont fix it if it ain't broke right?!?
  315. wait(random(500,1000));
  316. clickContinue();
  317. wait(random(500,1000));
  318. clickContinue();
  319. wait(random(500,1000));
  320. clickContinue();
  321. wait(random(500,1000));
  322. clickContinue();
  323. wait(random(500,1000));
  324. clickContinue();
  325. wait(random(500,1000));
  326. clickContinue();
  327. wait(random(500,1000));
  328. clickContinue();
  329. wait(random(500,1000));
  330. clickContinue();
  331. wait(random(500,1000));
  332. clickContinue();
  333. wait(random(500,1000));
  334. clickContinue();
  335. wait(random(500,1000));
  336. clickContinue();
  337. wait(random(500,1000));
  338. clickContinue();
  339. wait(random(500,1000));
  340. clickContinue();
  341. wait(random(500,1000));
  342. clickContinue();
  343. wait(random(500,1000));
  344. clickContinue();
  345. wait(random(500,1000));
  346. clickContinue();
  347. wait(random(500,1000));
  348. clickContinue();
  349. wait(random(500,1000));
  350. clickContinue();
  351. wait(random(500,1000));
  352. clickContinue();
  353. wait(random(500,1000));
  354. moveMouse((int) random(180, 350), (int) random(403, 407));
  355. clickMouse(true);
  356. moveMouse((int) random(180, 350), (int) random(403, 407));
  357. wait(random(500, 750));
  358. moveMouse((int) random(180, 350), (int) random(403, 407));
  359. clickMouse(true);
  360. wait(random(500,1000));
  361. clickContinue();
  362. wait(random(500,1000));
  363. clickContinue();
  364. wait(random(500,1000));
  365. clickContinue();
  366. wait(random(500,1000));
  367. clickContinue();
  368. wait(random(500,1000));
  369. clickContinue();
  370. wait(random(500,1000));
  371. clickContinue();
  372. wait(random(500,1000));
  373. clickContinue();
  374. wait(random(500,1000));
  375. }
  376. if(!inventoryContains(airRune)||!inventoryContains(cosmicRune)||!inventoryContains(astralRune)){
  377. if (getMyPlayer().isMoving())
  378. return 1;
  379. if (distanceTo(bankTile) > 10)
  380. walkTileMM(bankTile);
  381. if (!bank.isOpen()) {
  382. if (onTile(bankBooth, "Use-Quickly", 0.5, 0.5, 0)) {
  383. wait(random(100, 200));
  384. failCount = 0;
  385. while (!bank.isOpen() && failCount < 30) {
  386. wait(random(50, 100));
  387. if (getMyPlayer().isMoving())
  388. failCount = 0;
  389. failCount++;
  390. }
  391. }
  392. }
  393. if (atInventoryItem(pureEssence, "Deposit-All")) {
  394. wait(random(200, 400));
  395. failCount = 0;
  396. while (inventoryContains(pureEssence) && failCount < 30) {
  397. wait(random(50, 100));
  398. failCount++;
  399. }
  400. } else fatalCount++;
  401. if (bank.atItem(airRune, "Withdraw-10")) {
  402. wait(random(200, 400));
  403. failCount = 0;
  404. while (!inventoryContains(airRune) && failCount < 30) {
  405. wait(random(50, 100));
  406. failCount++;
  407. }
  408. } else fatalCount++;
  409. if (bank.atItem(cosmicRune, "Withdraw-10")) {
  410. wait(random(200, 400));
  411. failCount = 0;
  412. while (!inventoryContains(cosmicRune) && failCount < 30) {
  413. wait(random(50, 100));
  414. failCount++;
  415. }
  416. } else fatalCount++;
  417. if (bank.atItem(astralRune, "Withdraw-10")) {
  418. wait(random(200, 400));
  419. failCount = 0;
  420. while (!inventoryContains(astralRune) && failCount < 30) {
  421. wait(random(50, 100));
  422. failCount++;
  423. }
  424. } else fatalCount++;
  425. return 1;
  426. }
  427. if(!inventoryContains(medPouchd)&&!inventoryContains(largePouchd)&&!inventoryContains(giantPouchd)){
  428. if (getMyPlayer().isMoving())
  429. return 1;
  430. if (distanceTo(bankTile) > 10)
  431. walkTileMM(bankTile);
  432. if (!bank.isOpen()) {
  433. if (onTile(bankBooth, "Use-Quickly", 0.5, 0.5, 0)) {
  434. wait(random(100, 200));
  435. failCount = 0;
  436. while (!bank.isOpen() && failCount < 30) {
  437. wait(random(50, 100));
  438. if (getMyPlayer().isMoving())
  439. failCount = 0;
  440. failCount++;
  441. }
  442. }
  443. }
  444. bank.depositAllExcept(energyPots[0], energyPots[1], energyPots[2], energyPots[3], energyPots[4], energyPots[5], energyPots[6], energyPots[7], lawRune, pureEssence, smPouch, medPouch, largePouch, giantPouch);
  445. decayedPouch=false;
  446. checkPouch=true;
  447. pouchesFixxed++;
  448. giantFull=false;
  449. largeFull=false;
  450. medFull=false;
  451. smFull=false;
  452. return 1;
  453. }
  454. case emptyPouch:
  455. wait(random(500,1000));
  456. if (getMyPlayer().isMoving())
  457. return 1;
  458. if(inventoryContains(giantPouch)&&!isInventoryFull()&&giantFull){
  459. atInventoryItem(giantPouch,"Empty");
  460. giantFull=false;
  461. wait(random(200,500));
  462. craftUp=true;
  463. return 1;
  464. }
  465.  
  466. if(inventoryContains(smPouch)&&!isInventoryFull())
  467. atInventoryItem(smPouch,"Empty");
  468. wait(random(100,200));
  469. if(inventoryContains(medPouch)&&!isInventoryFull())
  470. atInventoryItem(medPouch,"Empty");
  471. wait(random(100,200));
  472. if(inventoryContains(largePouch)&&!isInventoryFull())
  473. atInventoryItem(largePouch,"Empty");
  474. wait(random(100,200));
  475. if(!isInventoryFull()){
  476. checkPouch=true;
  477. fullPouch=false;
  478. smFull=false;
  479. medFull=false;
  480. largeFull=false;
  481. return 1;
  482. }
  483. return 1;
  484. case checkPouches:
  485. emptyInv=false;
  486. if(inventoryContains(medPouchd)||inventoryContains(largePouchd)||inventoryContains(giantPouchd)){
  487. decayedPouch=true;
  488. return 1;
  489. }
  490. if(bank.isOpen()&&inventoryContains(pureEssence))
  491. if (bank.close()) {
  492. wait(random(100, 200));
  493. failCount = 0;
  494. while (bank.isOpen() && failCount < 20) {
  495. wait(random(50, 100));
  496. failCount++;
  497. }
  498. return 1;
  499. }
  500. if(!inventoryContains(pureEssence)){
  501. if (getMyPlayer().isMoving())
  502. return 1;
  503. if (distanceTo(bankTile) > 10)
  504. walkTileMM(bankTile);
  505. if (!bank.isOpen()) {
  506. if (onTile(bankBooth, "Use-Quickly", 0.5, 0.5, 0)) {
  507. wait(random(100, 200));
  508. failCount = 0;
  509. while (!bank.isOpen() && failCount < 30) {
  510. wait(random(50, 100));
  511. if (getMyPlayer().isMoving())
  512. failCount = 0;
  513. failCount++;
  514. }
  515. }
  516. }
  517. if(!isInventoryFull()&&!inventoryContains(astralRune)){
  518. if (bank.atItem(pureEssence, "Withdraw-All")) {
  519. wait(random(200, 400));
  520. failCount = 0;
  521. while (!inventoryContains(pureEssence) && failCount < 30) {
  522. wait(random(50, 100));
  523. failCount++;
  524. }
  525. } else fatalCount++;
  526. } else {
  527. if(craftSinceProfit){
  528. moneyBanked=moneyBanked+(getInventoryCount(astralRune)*astralPrice);
  529. craftSinceProfit=false;
  530. }
  531. bank.depositAllExcept(energyPots[0], energyPots[1], energyPots[2], energyPots[3], energyPots[4], energyPots[5], energyPots[6], energyPots[7], lawRune, pureEssence, smPouch, medPouch, largePouch, giantPouch);
  532. }
  533. return 1;
  534. }
  535. numPouches=0;
  536. pouchCheck=0;
  537. wait(random(1000,1100));
  538. if(inventoryContains(smPouch)&&!smFull){
  539. numPouches++;
  540. while(numPouches>pouchCheck&&!emptyInv){
  541. atInventoryItem(smPouch, "Fill");
  542. wait(random(1000,1100));
  543. }
  544. if(numPouches<=pouchCheck&&!emptyInv){
  545. smFull=true;
  546. }
  547. }
  548. wait(random(1000,1100));
  549. if(inventoryContains(medPouch)&&!medFull){
  550. numPouches++;
  551. while(numPouches>pouchCheck&&!emptyInv){
  552. atInventoryItem(medPouch, "Fill");
  553. wait(random(1000,1100));
  554. }
  555. if(numPouches<=pouchCheck&&!emptyInv){
  556. medFull=true;
  557. }
  558. }
  559. wait(random(1000,1100));
  560. if(inventoryContains(largePouch)&&!largeFull){
  561. numPouches++;
  562. while(numPouches>pouchCheck&&!emptyInv){
  563. atInventoryItem(largePouch, "Fill");
  564. wait(random(1000,1100));
  565. }
  566. if(numPouches<=pouchCheck&&!emptyInv){
  567. largeFull=true;
  568. }
  569. }
  570. wait(random(1000,1100));
  571. pouchCheck=0;
  572. if(inventoryContains(giantPouch)&&!giantFull){
  573. atInventoryItem(giantPouch, "Fill");
  574. wait(random(1000,1100));
  575. if(pouchCheck>=1)
  576. giantFull=true;
  577.  
  578. return 1;
  579. }
  580. wait(random(300,600));
  581. if(pouchCheck==numPouches&&!emptyInv){
  582. checkPouch=false;
  583. fullPouch=true;
  584. return 1;
  585. }
  586. if(numPouches<=0&&!emptyInv){
  587. checkPouch=false;
  588. fullPouch=false;
  589. return 1;
  590. }
  591. return 1;
  592. case bank:
  593. if (getMyPlayer().isMoving())
  594. return 1;
  595. if (distanceTo(bankTile) > 20)
  596. walkTileMM(bankTile);
  597. if (!bank.isOpen()) {
  598. if (onTile(bankBooth, "Use-Quickly", 0.5, 0.5, 0)) {
  599. wait(random(100, 200));
  600. failCount = 0;
  601. while (!bank.isOpen() && failCount < 30) {
  602. wait(random(50, 100));
  603. if (getMyPlayer().isMoving())
  604. failCount = 0;
  605. failCount++;
  606. }
  607. }
  608. return 1;
  609. }
  610. if (inventoryContains(astralRune)) {
  611. if(inventoryContains(lawRune) || inventoryContains(pureEssence))
  612. bank.depositAllExcept(energyPots[0], energyPots[1], energyPots[2], energyPots[3], energyPots[4], energyPots[5], energyPots[6], energyPots[7], lawRune, pureEssence, smPouch, medPouch, largePouch, giantPouch);
  613. else
  614. bank.depositAll();
  615. }
  616. if (getEnergy() < randomDrink) {
  617. if (!inventoryContainsOneOf(energyPots) && !isInventoryFull()) {
  618. int usePotion = 0;
  619. for (int i = 0; i < energyPots.length; i++) {
  620. try {
  621. if (bank.getItemByID((energyPots[i])).isValid()) {
  622. usePotion = energyPots[i];
  623. break;
  624. }
  625. } catch(Exception e) { }
  626. }
  627. if (bank.atItem(usePotion, "Withdraw-1")) {
  628. failCount = 0;
  629. while (!inventoryContains(usePotion) && failCount < 30) {
  630. wait(random(50, 100));
  631. failCount++;
  632. }
  633. }
  634. }
  635. }
  636.  
  637.  
  638.  
  639. if (getHPpercent() <= healthPercent) {
  640. if (!inventoryContains(foodID) && !isInventoryFull()) {
  641. if (bank.atItem(foodID, "Withdraw-1")) {
  642. failCount = 0;
  643. while (!inventoryContains(foodID) && failCount < 30) {
  644. wait(random(50, 100));
  645. failCount++;
  646. }
  647. } else fatalCount++;
  648. }
  649. return 1;
  650. }
  651.  
  652.  
  653. if (!inventoryContains(pureEssence) || !isInventoryFull()) {
  654. if (bank.atItem(pureEssence, "Withdraw-All")) {
  655. wait(random(200, 400));
  656. failCount = 0;
  657. while (!inventoryContains(pureEssence) && failCount < 30) {
  658. wait(random(50, 100));
  659. failCount++;
  660. }
  661. } else fatalCount++;
  662. }
  663. return 1;
  664. case error:
  665. return -1;
  666. }
  667.  
  668. return 1;
  669. }
  670.  
  671. public void serverMessageRecieved(final ServerMessageEvent arg0) {
  672. final String serverString = arg0.getMessage();
  673. if (serverString.toLowerCase().contains("full")) {
  674. pouchCheck++;
  675.  
  676. }
  677. if (serverString.toLowerCase().contains("fill")) {
  678.  
  679. pouchCheck++;
  680. }
  681. if (serverString.toLowerCase().contains("left")) {
  682.  
  683. pouchCheck++;
  684. }
  685. if (serverString.toLowerCase().contains("decayed")) {
  686.  
  687. decayedPouch=true;
  688. }
  689. if (serverString.toLowerCase().contains("have any more")) {
  690.  
  691. emptyInv=true;
  692. }
  693. }
  694.  
  695. private boolean onTile(final RSTile tile, final String action, final double dx, final double dy, final int height) {
  696. if (!tile.isValid())
  697. return false;
  698.  
  699. Point checkScreen = null;
  700.  
  701. try {
  702. checkScreen = Calculations.tileToScreen(tile, dx, dy, height);
  703. if (!pointOnScreen(checkScreen)) {
  704. if (getMyPlayer().isMoving())
  705. return false;
  706. if (walkTileMM(tile))
  707. wait(random(750, 1000));
  708. return false;
  709. }
  710. } catch(Exception e) { }
  711.  
  712. try {
  713. boolean stop = false;
  714. for (int i = 0; i <= 50; i++) {
  715. checkScreen = Calculations.tileToScreen(tile, dx, dy, height);
  716. if (!pointOnScreen(checkScreen))
  717. return false;
  718. moveMouse(checkScreen);
  719. final Object[] menuItems = getMenuItems().toArray();
  720. for (int a = 0; a < menuItems.length; a++) {
  721. if (menuItems[a].toString().toLowerCase().contains(action.toLowerCase())) {
  722. stop = true;
  723. break;
  724. }
  725. }
  726. if (stop)
  727. break;
  728. }
  729. } catch(Exception e) { }
  730.  
  731. try {
  732. return atMenu(action);
  733. } catch(Exception e) { }
  734. return false;
  735. }
  736.  
  737. private int getHPpercent() {
  738. final int health = GetHP();
  739. final int totalHealth = skills.getRealSkillLevel(Skills.getStatIndex("hitpoints"));
  740. return (int) (((double) health / (double) totalHealth) * 82.0);
  741. }
  742.  
  743. private int GetHP(){
  744. String Face = RSInterface.getInterface(748).getChild(8).getText();
  745. int HP = -1;
  746. try{
  747. HP = Integer.parseInt(Face);
  748. }catch(NumberFormatException e){
  749. return -1;
  750. }
  751. return HP;
  752. }
  753.  
  754.  
  755.  
  756.  
  757.  
  758. private void startRunning(final int energy) {
  759. if (getEnergy() >= energy && !isRunning()) {
  760. runEnergy = random(40, 95);
  761. setRun(true);
  762. wait(random(500, 750));
  763. }
  764. }
  765.  
  766. private boolean walkPath(RSTile[] path) {
  767. if(!getMyPlayer().isMoving() || distanceTo(getDestination()) <= 5)
  768. return walkPathMM(path, 17);
  769. return false;
  770. }
  771.  
  772. private void antiBan() {
  773. int random = random(1, 20);
  774. switch (random) {
  775. case 1:
  776. if (random(1, 10) != 1)
  777. return;
  778. moveMouse(random(10, 750), random(10, 495));
  779. return;
  780. case 2:
  781. if (random(1, 40) != 1)
  782. return;
  783. int angle = getCameraAngle() + random(-90, 90);
  784. if (angle < 0) {
  785. angle = random(0, 10);
  786. }
  787. if (angle > 359) {
  788. angle = random(0, 10);
  789. }
  790. setCameraRotation(angle);
  791. return;
  792. case 3:
  793. if (random(1, 3) != 1)
  794. return;
  795. moveMouseSlightly();
  796. return;
  797. default:
  798. return;
  799. }
  800. }
  801.  
  802.  
  803. public void onFinish() {
  804. Bot.getEventManager().removeListener( PaintListener.class, this );
  805. }
  806.  
  807. public void onRepaint(Graphics g) {
  808. if (!isLoggedIn())
  809. return;
  810.  
  811. if (startLVL == 0) {
  812. startXP = skills.getCurrentSkillExp(Skills.getStatIndex("runecrafting"));
  813. startLVL = skills.getCurrentSkillLevel(Skills.getStatIndex("runecrafting"));
  814. }
  815.  
  816. if(getCurrentTab() != TAB_INVENTORY)
  817. return;
  818.  
  819. long seconds = 0;
  820. long minutes = 0;
  821. long hours = 0;
  822. final NumberFormat nf = NumberFormat.getInstance();
  823. nf.setMinimumIntegerDigits(2);
  824. final long runTime = System.currentTimeMillis() - scriptStartTIME;
  825. seconds = runTime / 1000;
  826. if ( seconds >= 60 ) {
  827. minutes = seconds / 60;
  828. seconds -= (minutes * 60);
  829. }
  830. if ( minutes >= 60 ) {
  831. hours = minutes / 60;
  832. minutes -= (hours * 60);
  833. }
  834.  
  835. final int currentXP = skills.getCurrentSkillExp(Skills.getStatIndex("runecrafting"));
  836. final int currentLVL = skills.getCurrentSkillLevel(Skills.getStatIndex("runecrafting"));
  837. final int XPgained = currentXP - startXP;
  838. final int LVLgained = currentLVL - startLVL;
  839. final int xpTilNext = skills.getXPToNextLevel(Skills.getStatIndex("runecrafting"));
  840. final int percentTilNext = skills.getPercentToNextLevel(Skills.getStatIndex("runecrafting"));
  841. final int fillBar = (int) (1.65 * (double) percentTilNext);
  842. final int essUsed = (int) ((double) XPgained / 8.5);
  843. profitMade = moneyBanked - (moneyUsed + (essUsed * essPrice));
  844. tCashUsed = moneyUsed + (essUsed * essPrice);
  845. int essPerHour = 0;
  846. int XPperHour = 0;
  847. if ((runTime / 1000) > 0) {
  848. essPerHour = (int) ((3600000.0 / (double) runTime) * essUsed);
  849. XPperHour = (int) ((3600000.0 / (double) runTime) * XPgained);
  850. }
  851.  
  852. final int[] coords = new int[] {225, 240, 255, 270, 285, 300, 315, 330, 345, 360, 375, 390, 405, 420, 435, 450, 465, 480, 495, 510};
  853.  
  854. g.setColor(new Color(0, 0, 0, 175));
  855. g.fillRoundRect(555, 210, 175, 250, 10, 10);
  856. g.setColor(Color.WHITE);
  857. g.drawString(properties.name(), 561, coords[0]);
  858. g.drawString("Version: " + properties.version(), 561, coords[1]);
  859. g.drawString("Run Time: " + hours + ":" + nf.format(minutes) + ":" + nf.format(seconds), 561, coords[2]);
  860. g.drawString("Essence Used: " + essUsed, 561, coords[4]);
  861. g.drawString("EssUsed/Hour: " + essPerHour, 561, coords[5]);
  862. g.drawString("Lvls Gained: " + LVLgained, 561, coords[6]);
  863. g.drawString("XP Gained: " + XPgained, 561, coords[7]);
  864. g.drawString("XP/Hour: " + XPperHour, 561, coords[8]);
  865. g.drawString("XP To Next Level: " + xpTilNext, 561, coords[9]);
  866. g.setColor(new Color(255, 0, 0, 175));
  867. g.fillRect(560, coords[10] - 11, 165, 13);
  868. g.setColor(new Color(0, 255, 0, 200));
  869. g.fillRect(560, coords[10] - 11, fillBar, 13);
  870. g.setColor(Color.WHITE);
  871. g.drawString(percentTilNext + "%", 561, coords[10]);
  872. g.drawString("Pouches fixxed "+pouchesFixxed+ " times.", 561, coords[11]);
  873. g.drawString("Cash banked: " + moneyBanked, 561, coords[12]);
  874. g.drawString("Cash used: " + tCashUsed, 561, coords[13]);
  875. g.drawString("Profit made: " + profitMade, 561, coords[14]);
  876. }
  877. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement