Advertisement
Guest User

Progressive GE Fletcher

a guest
Jul 19th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.97 KB | None | 0 0
  1. import com.sun.org.apache.bcel.internal.generic.GOTO;
  2. import org.osbot.rs07.api.GrandExchange;
  3. import org.osbot.rs07.api.model.Entity;
  4. import org.osbot.rs07.api.model.Item;
  5. import org.osbot.rs07.api.model.RS2Object;
  6. import org.osbot.rs07.api.ui.Skill;
  7. import org.osbot.rs07.script.Script;
  8. import org.osbot.rs07.script.ScriptManifest;
  9.  
  10.  
  11. import java.awt.*;
  12.  
  13. import static com.sun.activation.registries.LogSupport.log;
  14.  
  15. @ScriptManifest(author = "Impensus", info = "A Progressive Grand Exchange Fletcher", name = "Progressive GE Fletcher22", version = 1.0, logo = "")
  16. public class Main extends Script {
  17. private String LogName;
  18. private String knifename;
  19. private String toMakeInv;
  20.  
  21. @Override
  22. public void onStart() {
  23. log("Welcome to my Progressive GE Fletcher.");
  24. this.knifename = "Knife";
  25. }
  26.  
  27. private enum State {
  28. SHAFTS, SHORTBOWS, LONGBOWS, OAKSHORT, OAKLONG, WILLOWSHORT, WILLOWLONG, MAPLESHORT, MAPLELONG, BANK, GOLDFARM,
  29. }
  30.  
  31.  
  32.  
  33. private State getState() {
  34. if (skills.getDynamic(Skill.FLETCHING) >= 1 && skills.getDynamic(Skill.FLETCHING) < 5)
  35. return State.SHAFTS;
  36. if (skills.getDynamic(Skill.FLETCHING) >= 5 && skills.getDynamic(Skill.FLETCHING) < 10)
  37. return State.SHORTBOWS;
  38. if (skills.getDynamic(Skill.FLETCHING) >= 10 && skills.getDynamic(Skill.FLETCHING) < 20)
  39. return State.LONGBOWS;
  40. if (skills.getDynamic(Skill.FLETCHING) >= 20 && skills.getDynamic(Skill.FLETCHING) < 25)
  41. return State.OAKSHORT;
  42. if (skills.getDynamic(Skill.FLETCHING) >= 25 && skills.getDynamic(Skill.FLETCHING) < 35)
  43. return State.OAKLONG;
  44. if (skills.getDynamic(Skill.FLETCHING) >= 35 && skills.getDynamic(Skill.FLETCHING) < 40)
  45. return State.WILLOWSHORT;
  46. if (skills.getDynamic(Skill.FLETCHING) >= 40 && skills.getDynamic(Skill.FLETCHING) < 50)
  47. return State.WILLOWLONG;
  48. if (skills.getDynamic(Skill.FLETCHING) >= 50 && skills.getDynamic(Skill.FLETCHING) < 55)
  49. return State.MAPLESHORT;
  50. if (skills.getDynamic(Skill.FLETCHING) >= 55)
  51. return State.GOLDFARM;
  52. return State.BANK;
  53.  
  54.  
  55. }
  56.  
  57.  
  58. @Override
  59. public int onLoop() throws InterruptedException {
  60. switch (getState()) {
  61. case SHAFTS:
  62. this.LogName = "Logs";
  63. this.toMakeInv = "Arrow Shaft";
  64. if (inventory.isEmpty() || (!inventory.contains("Knife"))) {
  65. log("Materials not found, Banking");
  66. if (!getBank().isOpen()) {
  67. getBank().open();
  68. sleep(500);
  69. if (!getBank().contains("Logs")) ;
  70. logoutTab.logOut();
  71. sleep(500);
  72. stop(true);
  73.  
  74. } else {
  75. getBank().withdraw("Knife", 1);
  76. getBank().withdraw("Logs", 27);
  77. getBank().close();
  78. sleep(500);
  79. }
  80. }
  81. if (inventory.contains(this.toMakeInv) && (!inventory.contains(this.LogName))) {
  82. if (!getBank().isOpen()) {
  83. getBank().open();
  84. sleep(500);
  85. } else {
  86. getBank().deposit("Arrow Shaft", 405);
  87. sleep(500);
  88. getBank().close();
  89. }
  90. }
  91.  
  92.  
  93. if (getInventory().contains("Logs") && getInventory().contains("Knife")) {
  94. if (myPlayer().isAnimating()) {
  95. log("Fletching");
  96. sleep(5000);
  97. } else {
  98. inventory.interact("Use", "Knife");
  99. sleep(random(440, 1230));
  100. getInventory().interact("Use", "Logs");
  101. sleep(random(440, 1230));
  102. widgets.interact(270, 14, "Make");
  103. sleep(random(440, 1230));
  104.  
  105. }
  106. }
  107.  
  108.  
  109. case SHORTBOWS:
  110. this.LogName = "Logs";
  111. this.toMakeInv = "Shortbow (u)";
  112. if (inventory.isEmpty() || (!inventory.contains("Knife"))) {
  113. log("Materials not found, Banking");
  114. if (!getBank().isOpen()) {
  115. getBank().open();
  116. sleep(500);
  117. if (!getBank().contains("Logs")) ;
  118. logoutTab.logOut();
  119. sleep(500);
  120. stop(true);
  121.  
  122. } else {
  123. getBank().withdraw("Knife", 1);
  124. getBank().withdraw("Logs", 27);
  125. getBank().close();
  126. sleep(500);
  127. }
  128. }
  129. if (inventory.contains(this.toMakeInv) && (!inventory.contains(this.LogName))) {
  130. if (!getBank().isOpen()) {
  131. getBank().open();
  132. sleep(500);
  133. } else {
  134. getBank().deposit("Shortbow (u)", 27);
  135. sleep(500);
  136. getBank().close();
  137. }
  138. }
  139.  
  140.  
  141. if (getInventory().contains("Logs") && getInventory().contains("Knife")) {
  142. if (myPlayer().isAnimating()) {
  143. log("Fletching");
  144. sleep(5000);
  145. } else {
  146. inventory.interact("Use", "Knife");
  147. sleep(random(440, 1230));
  148. getInventory().interact("Use", "Logs");
  149. sleep(random(440, 1230));
  150. widgets.interact(270, 16, "Make");
  151. sleep(random(440, 1230));
  152.  
  153. }
  154. }
  155.  
  156. break;
  157.  
  158. case LONGBOWS:
  159. this.LogName = "Logs";
  160. this.toMakeInv = "Longbow (u)";
  161. if (inventory.isEmpty() || (!inventory.contains("Knife"))) {
  162. log("Materials not found, Banking");
  163. if (!getBank().isOpen()) {
  164. getBank().open();
  165. sleep(500);
  166. if (!getBank().contains("Logs")) ;
  167. logoutTab.logOut();
  168. sleep(500);
  169. stop(true);
  170.  
  171. } else {
  172. getBank().withdraw("Knife", 1);
  173. getBank().withdraw("Logs", 27);
  174. getBank().close();
  175. sleep(500);
  176. }
  177. }
  178. if (inventory.contains(this.toMakeInv) && (!inventory.contains(this.LogName))) {
  179. if (!getBank().isOpen()) {
  180. getBank().open();
  181. sleep(500);
  182. } else {
  183. getBank().deposit("Longbow (u)", 27);
  184. sleep(500);
  185. getBank().close();
  186. }
  187. }
  188.  
  189.  
  190. if (getInventory().contains("Logs") && getInventory().contains("Knife")) {
  191. if (myPlayer().isAnimating()) {
  192. log("Fletching");
  193. sleep(5000);
  194. } else {
  195. inventory.interact("Use", "Knife");
  196. sleep(random(440, 1230));
  197. getInventory().interact("Use", "Logs");
  198. sleep(random(440, 1230));
  199. widgets.interact(270, 17, "Make");
  200. sleep(random(440, 1230));
  201.  
  202. }
  203. }
  204. break;
  205.  
  206. case OAKSHORT:
  207. this.LogName = "Oak logs";
  208. this.toMakeInv = "Oak Shortbow (u)";
  209. if (inventory.isEmpty() || (!inventory.contains("Knife"))) {
  210. log("Materials not found, Banking");
  211. if (!getBank().isOpen()) {
  212. getBank().open();
  213. sleep(500);
  214. if (!getBank().contains("Oak logs")) ;
  215. logoutTab.logOut();
  216. sleep(500);
  217. stop(true);
  218.  
  219. } else {
  220. getBank().withdraw("Knife", 1);
  221. getBank().withdraw("Oak logs", 27);
  222. getBank().close();
  223. sleep(500);
  224. }
  225. }
  226. if (inventory.contains(this.toMakeInv) && (!inventory.contains(this.LogName))) {
  227. if (!getBank().isOpen()) {
  228. getBank().open();
  229. sleep(500);
  230. } else {
  231. getBank().deposit("Oak shortbow (u)", 27);
  232. sleep(500);
  233. getBank().close();
  234. }
  235. }
  236.  
  237.  
  238. if (getInventory().contains("Oak logs") && getInventory().contains("Knife")) {
  239. if (myPlayer().isAnimating()) {
  240. log("Fletching");
  241. sleep(5000);
  242. } else {
  243. inventory.interact("Use", "Knife");
  244. sleep(random(440, 1230));
  245. getInventory().interact("Use", "Oak logs");
  246. sleep(random(440, 1230));
  247. widgets.interact(270, 15, "Make");
  248. sleep(random(440, 1230));
  249.  
  250. }
  251. }
  252. break;
  253.  
  254. case OAKLONG:
  255. this.LogName = "Oak logs";
  256. this.toMakeInv = "Oak Longbow (u)";
  257. if (inventory.isEmpty() || (!inventory.contains("Knife"))) {
  258. log("Materials not found, Banking");
  259. if (!getBank().isOpen()) {
  260. getBank().open();
  261. sleep(500);
  262. if (!getBank().contains("Oak logs")) ;
  263. logoutTab.logOut();
  264. sleep(500);
  265. stop(true);
  266.  
  267. } else {
  268. getBank().withdraw("Knife", 1);
  269. getBank().withdraw("Oak logs", 27);
  270. getBank().close();
  271. sleep(500);
  272. }
  273. }
  274. if (inventory.contains(this.toMakeInv) && (!inventory.contains(this.LogName))) {
  275. if (!getBank().isOpen()) {
  276. getBank().open();
  277. sleep(500);
  278. } else {
  279. getBank().deposit("Oak longbow (u)", 27);
  280. sleep(500);
  281. getBank().close();
  282. }
  283. }
  284.  
  285.  
  286. if (getInventory().contains("Oak logs") && getInventory().contains("Knife")) {
  287. if (myPlayer().isAnimating()) {
  288. log("Fletching");
  289. sleep(5000);
  290. } else {
  291. inventory.interact("Use", "Knife");
  292. sleep(random(440, 1230));
  293. getInventory().interact("Use", "Oak logs");
  294. sleep(random(440, 1230));
  295. widgets.interact(270, 16, "Make");
  296. sleep(random(440, 1230));
  297.  
  298. }
  299. }
  300. break;
  301.  
  302. case WILLOWSHORT:
  303. this.LogName = "Willow logs";
  304. this.toMakeInv = "Willow shortbow (u)";
  305. if (inventory.isEmpty() || (!inventory.contains("Knife"))) {
  306. log("Materials not found, Banking");
  307. if (!getBank().isOpen()) {
  308. getBank().open();
  309. sleep(500);
  310. if (!getBank().contains("Willow logs")) ;
  311. logoutTab.logOut();
  312. sleep(500);
  313. stop(true);
  314.  
  315. } else {
  316. getBank().withdraw("Knife", 1);
  317. getBank().withdraw("Willow logs", 27);
  318. getBank().close();
  319. sleep(500);
  320. }
  321. }
  322. if (inventory.contains(this.toMakeInv) && (!inventory.contains(this.LogName))) {
  323. if (!getBank().isOpen()) {
  324. getBank().open();
  325. sleep(500);
  326. } else {
  327. getBank().deposit("Willow shortbow (u)", 27);
  328. sleep(500);
  329. getBank().close();
  330. }
  331. }
  332.  
  333.  
  334. if (getInventory().contains("Willow logs") && getInventory().contains("Knife")) {
  335. if (myPlayer().isAnimating()) {
  336. log("Fletching");
  337. sleep(5000);
  338. } else {
  339. inventory.interact("Use", "Knife");
  340. sleep(random(440, 1230));
  341. getInventory().interact("Use", "Willow logs");
  342. sleep(random(440, 1230));
  343. widgets.interact(270, 15, "Make");
  344. sleep(random(440, 1230));
  345.  
  346. }
  347. }
  348. break;
  349.  
  350. case WILLOWLONG:
  351. this.LogName = "Willow logs";
  352. this.toMakeInv = "Willow longbow (u)";
  353. if (inventory.isEmpty() || (!inventory.contains("Willow logs"))) {
  354. log("Materials not found, Banking");
  355. if (!getBank().isOpen()) {
  356. getBank().open();
  357. sleep(1500);
  358. if (!getBank().contains("Willow logs")) {
  359. logoutTab.logOut();
  360. sleep(500);
  361. stop(true);
  362. }
  363.  
  364. } else {
  365. getBank().withdraw("Knife", 1);
  366. getBank().withdraw("Willow logs", 27);
  367. getBank().close();
  368. sleep(1500);
  369. }
  370. }
  371. if (inventory.contains(this.toMakeInv) && (!inventory.contains(this.LogName))) {
  372. if (!getBank().isOpen()) {
  373. getBank().open();
  374. sleep(500);
  375. } else {
  376. getBank().deposit("Willow longbow (u)", 27);
  377. sleep(500);
  378.  
  379. }
  380. }
  381.  
  382.  
  383. if (getInventory().contains("Willow logs") && getInventory().contains("Knife")) {
  384. if (myPlayer().isAnimating()) {
  385. log("Fletching");
  386. sleep(5000);
  387. } else {
  388. inventory.interact("Use", "Knife");
  389. sleep(random(740, 1230));
  390. getInventory().interact("Use", "Willow logs");
  391. sleep(random(640, 1230));
  392. widgets.interact(270, 16, "Make");
  393. sleep(random(740, 1230));
  394.  
  395. }
  396. }
  397. break;
  398.  
  399. case MAPLESHORT:
  400. this.LogName = "Maple logs";
  401. this.toMakeInv = "Maple shortbow (u)";
  402. if (inventory.isEmpty() || (!inventory.contains("Maple logs"))) {
  403. log("Materials not found, Banking");
  404. if (!getBank().isOpen()) {
  405. getBank().open();
  406. sleep(1500);
  407. if (!getBank().contains("Maple logs")) {
  408. logoutTab.logOut();
  409. sleep(500);
  410. stop(true);
  411. }
  412.  
  413. } else {
  414. getBank().withdraw("Knife", 1);
  415. getBank().withdraw("Maple logs", 27);
  416. getBank().close();
  417. sleep(1500);
  418. }
  419.  
  420. if (inventory.contains(this.toMakeInv) && (!inventory.contains(this.LogName))) {
  421. if (!getBank().isOpen()) {
  422. getBank().open();
  423. sleep(500);
  424. } else {
  425. getBank().deposit("Maple shortbow (u)", 27);
  426. sleep(500);
  427.  
  428. }
  429. }
  430.  
  431.  
  432. if (getInventory().contains("Maple logs") && getInventory().contains("Knife")) {
  433. if (myPlayer().isAnimating()) {
  434. log("Fletching");
  435. sleep(5000);
  436. } else {
  437. inventory.interact("Use", "Knife");
  438. sleep(random(740, 1230));
  439. getInventory().interact("Use", "Maple logs");
  440. sleep(random(640, 1230));
  441. widgets.interact(270, 15, "Make");
  442. sleep(random(740, 1230));
  443.  
  444. }
  445. }
  446. }
  447. break;
  448.  
  449. case MAPLELONG:
  450. this.LogName = "Maple logs";
  451. this.toMakeInv = "Maple longbow (u)";
  452. if (inventory.isEmpty() || (!inventory.contains("Maple logs"))) {
  453. log("Materials not found, Banking");
  454. if (!getBank().isOpen()) {
  455. getBank().open();
  456. sleep(1500);
  457. if (!getBank().contains("Maple logs")) {
  458. logoutTab.logOut();
  459. sleep(500);
  460. stop(true);
  461. }
  462.  
  463. } else {
  464. getBank().withdraw("Knife", 1);
  465. getBank().withdraw("Maple logs", 27);
  466. getBank().close();
  467. sleep(1500);
  468. }
  469. }
  470. if (inventory.contains(this.toMakeInv) && (!inventory.contains(this.LogName))) {
  471. if (!getBank().isOpen()) {
  472. getBank().open();
  473. sleep(500);
  474. } else {
  475. getBank().deposit("Maple longbow (u)", 27);
  476. sleep(500);
  477.  
  478. }
  479. }
  480.  
  481.  
  482. if (getInventory().contains("Maple logs") && getInventory().contains("Knife")) {
  483. if (myPlayer().isAnimating()) {
  484. log("Fletching");
  485. sleep(5000);
  486. } else {
  487. inventory.interact("Use", "Knife");
  488. sleep(random(740, 1230));
  489. getInventory().interact("Use", "Maple logs");
  490. sleep(random(640, 1230));
  491. widgets.interact(270, 16, "Make");
  492. sleep(random(740, 1230));
  493.  
  494. }
  495. }
  496.  
  497. break;
  498.  
  499. case GOLDFARM:
  500. if (skills.getDynamic(Skill.FLETCHING) >= 55 && skills.getDynamic(Skill.FLETCHING) < 65) {
  501. this.LogName = "Bow string";
  502. this.toMakeInv = "Maple longbow";
  503. if (inventory.isEmpty()) {
  504. log("Materials not found, Banking");
  505. if (!getBank().isOpen()) {
  506. getBank().open();
  507. sleep(500);
  508. }
  509. if (!getBank().contains("Bow string") && (!getBank().contains("Maple longbow (u)"))) {
  510. getBank().depositAll();
  511. sleep(random(240, 532));
  512. getBank().withdrawAllButOne("Coins");
  513. sleep(random(240, 1637));
  514. getBank().close();
  515. sleep(random(240, 832));
  516. long money = getInventory().getAmount("Coins");
  517. ItemResource BowString = new ItemResource("Bow String", 1777);
  518. ItemResource MapleLong = new ItemResource("Maple Longbow (u)", 62);
  519. String BowStringConvertor = BowString.toString();
  520. int BowStringPrice = Integer.parseInt(BowStringConvertor);
  521. String UnstrungConverter = MapleLong.toString();
  522. int UnstrungPrice = Integer.parseInt(UnstrungConverter);
  523. long AmountAffordBowstring = money - 100_000 / BowStringPrice;
  524. long AmountAffordUnstrung = money - 100_000 / UnstrungPrice;
  525. long amountToBuyStrings = AmountAffordBowstring / 2;
  526. long amountToBuyUnstrung = AmountAffordUnstrung / 2;
  527. Math.round(amountToBuyStrings);
  528. Math.round(amountToBuyUnstrung);
  529. if (!grandExchange.isOpen()) {
  530. int stringamount = (int) amountToBuyStrings;
  531. int unstrungamount = (int) amountToBuyUnstrung;
  532. npcs.closest("Grand Exchange Clerk").interact("Exchange");
  533. grandExchange.buyItem(1777, "Bow String", BowStringPrice, stringamount);
  534. sleep(500);
  535. grandExchange.buyItem(62, "Maple Longbow (u)", UnstrungPrice, unstrungamount);
  536. sleep(random(15_000, 35_000));
  537. if (grandExchange.getStatus(GrandExchange.Box.BOX_1) == GrandExchange.Status.FINISHED_BUY && (grandExchange.getStatus(GrandExchange.Box.BOX_2) == GrandExchange.Status.FINISHED_BUY)) {
  538. getGrandExchange().collect();
  539.  
  540. grandExchange.close();
  541. sleep(random(240, 832));
  542. getBank().open();
  543. sleep(random(240, 832));
  544. getBank().depositAll();
  545. sleep(random(240, 832));
  546. getBank().close();
  547. }
  548. } else {
  549. getBank().withdraw("Bow String", 14);
  550. getBank().withdraw("Maple longbow (u)", 14);
  551. getBank().close();
  552. sleep(500);
  553. }
  554. }
  555. if (inventory.contains(this.toMakeInv) && (!inventory.contains(this.LogName))) {
  556. if (!getBank().isOpen()) {
  557. getBank().open();
  558. sleep(500);
  559. } else {
  560. getBank().deposit("Maple longbow", 14);
  561. sleep(500);
  562. getBank().close();
  563. }
  564. }
  565.  
  566.  
  567. if (getInventory().contains("Maple longbow (u)") && getInventory().contains("Bow string")) {
  568. if (myPlayer().isAnimating()) {
  569. log("Fletching");
  570. sleep(5000);
  571. } else {
  572. inventory.interact("Use", "Bow String");
  573. sleep(random(440, 1230));
  574. getInventory().interact("Use", "Maple longbow (u)");
  575. sleep(random(440, 1230));
  576. widgets.interact(270, 16, "Make");
  577. sleep(random(440, 1230));
  578.  
  579. }
  580. }
  581.  
  582.  
  583. }
  584. return random(200, 300);
  585. }
  586. }
  587. return random(200, 300);
  588. }
  589. @Override
  590. public void onExit () {
  591. log("Thanks for running my Tea Thiever!"); }
  592.  
  593. @Override
  594. public void onPaint (Graphics2D g){
  595.  
  596. }
  597.  
  598. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement