Advertisement
Guest User

Untitled

a guest
Sep 1st, 2020
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 49.28 KB | None | 0 0
  1. import java.lang.reflect.InvocationTargetException;
  2. import java.util.ArrayList;
  3. import java.util.Collections;
  4. import javax.swing.SwingUtilities;
  5. import org.osbot.rs07.api.Magic;
  6. import org.osbot.rs07.api.Quests;
  7. import org.osbot.rs07.api.map.Area;
  8. import org.osbot.rs07.api.map.constants.Banks;
  9. import org.osbot.rs07.api.model.Item;
  10. import org.osbot.rs07.api.model.NPC;
  11. import org.osbot.rs07.api.ui.EquipmentSlot;
  12. import org.osbot.rs07.api.ui.Message;
  13. import org.osbot.rs07.api.ui.RS2Widget;
  14. import org.osbot.rs07.api.ui.Skill;
  15. import org.osbot.rs07.api.ui.Spells;
  16. import org.osbot.rs07.api.ui.Tab;
  17. import org.osbot.rs07.event.WebWalkEvent;
  18. import org.osbot.rs07.script.Script;
  19. import org.osbot.rs07.script.ScriptManifest;
  20. import org.osbot.rs07.utility.Condition;
  21. import org.osbot.rs07.utility.ConditionalSleep;
  22. import java.awt.*;
  23.  
  24. @ScriptManifest(name = "Slayer", author = "Pandy", version = 1.0, info = "Slays Shit", logo = "")
  25. public class SlayerScript extends Script {
  26.  
  27. int pid = -10;
  28. int mIndex = 0;
  29. String[] TuraelMonsters = {"banshee", "giant bat", "chicken", "bear", "cave bug", "cave crawler", "cave slime", "cow", "crawling hand",
  30. "desert lizard", "jackal", "dwarf", "ghost", "goblin", "icefiend", "kalphite worker", "minotaur", "monkey", "giant rat", "scorpion",
  31. "skeleton", "giant spider", "wolf", "zombie", "none"};
  32. int[] styles = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
  33.  
  34.  
  35. String SlayerMonster = "";
  36. String Paint = "";
  37.  
  38. int monNumber = 0;
  39.  
  40. ArrayList<String> Setup = new ArrayList<String>();
  41. ArrayList<String> Inventory = new ArrayList<String>();
  42.  
  43. Shantay shantayShop = new Shantay(this);
  44. Attackit attack = new Attackit(this);
  45. Eat eat = new Eat(this);
  46. Pot pot = new Pot(this);
  47. Loot loot = new Loot(this);
  48. ToBank tobank = new ToBank(this);
  49.  
  50. private GUI gui = new GUI();
  51. private Areas sArea = new Areas();
  52. Area slayerArea = null;
  53. Area slayerBank = null;
  54. Area desertBank = new Area(3298, 3126, 3310, 3117);
  55. Area rogueBank = new Area(3035, 4975, 3046, 4961).setPlane(1);
  56.  
  57. Area Turael = new Area(2930, 3538, 2933, 3535);
  58.  
  59. boolean canHomeTP = false;
  60. boolean neededItem = false;
  61. boolean canTP = false;
  62. boolean swampRope = true;
  63. boolean hasIce = false;
  64. boolean hasFood = true;
  65. boolean canReach = true;
  66. boolean isPoisoned = false;
  67. boolean isUnder = false;
  68.  
  69.  
  70. @Override
  71. public void onStart() {
  72.  
  73. try {
  74. SwingUtilities.invokeAndWait(() -> {
  75. gui = new GUI();
  76. gui.open();
  77. });
  78. } catch (InterruptedException | InvocationTargetException e) {
  79. e.printStackTrace();
  80. stop();
  81. return;
  82. }
  83.  
  84. // If the user closed the dialog and didn't click the Start button
  85.  
  86. pid = gui.getStatus();
  87.  
  88.  
  89. }
  90.  
  91.  
  92.  
  93. public void onMessage(Message message)
  94. {
  95. String text = message.getMessage().toLowerCase();
  96.  
  97. if (text.contains(";"))
  98. {
  99. SlayerMonster = text.substring(24, text.indexOf(";") -1);
  100. monNumber = Integer.parseInt(text.substring(text.indexOf(";") +7).substring(0, text.substring(text.indexOf(";") +7).indexOf(" ")));
  101.  
  102.  
  103. if(SlayerMonster.contains("dwarve")) SlayerMonster = "dwarf";
  104. if(SlayerMonster.contains("wolve")) SlayerMonster = "wolf";
  105. if(SlayerMonster.contains("dog")) SlayerMonster = "jackal";
  106. if(SlayerMonster.contains("bird")) SlayerMonster = "chicken";
  107.  
  108. for(int i = 0; i< TuraelMonsters.length; i++)
  109. {
  110. if (TuraelMonsters[i].toLowerCase().contains(SlayerMonster))
  111. {
  112. mIndex = i;
  113. slayerArea = sArea.getArea(mIndex);
  114. slayerBank = sArea.getBank(mIndex);
  115. break;
  116. }
  117. }
  118. Paint = SlayerMonster;
  119. }
  120. if (text.toLowerCase().contains("minutes to cast this spell"))
  121. {
  122. canHomeTP = false;
  123. }
  124. if (text.toLowerCase().contains("before you can use the minigame teleports.") ||
  125. text.toLowerCase().contains("you can't use that teleport at the moment"))
  126. {
  127. canTP = false;
  128. }
  129.  
  130. if (text.equalsIgnoreCase("You need something new to hunt.") || text.equalsIgnoreCase("you've completed "))
  131. {
  132. SlayerMonster = "None";
  133. monNumber = 0;
  134. Paint = SlayerMonster;
  135.  
  136. }
  137. if (text.toLowerCase().contains("return to a slayer master"))
  138. {
  139. SlayerMonster = "None";
  140. Paint = SlayerMonster;
  141. pid = 0;
  142. }
  143. if (text.toLowerCase().contains("i can't reach that!"))
  144. {
  145. canReach = false;
  146. }
  147. if (text.toLowerCase().contains("you have been poisoned!"))
  148. {
  149. isPoisoned = true;
  150. }
  151. if (text.toLowerCase().contains("you drink some of your antipoison potion"))
  152. {
  153. isPoisoned = false;
  154. }
  155. if (text.toLowerCase().contains("already under attack"))
  156. {
  157. isUnder = true;
  158. }
  159. }
  160.  
  161.  
  162. @Override
  163. public void onExit() {
  164.  
  165.  
  166. }
  167.  
  168. @Override
  169. public int onLoop() {
  170. RS2Widget Inv = getWidgets().get(164,63);
  171.  
  172.  
  173. if(pid == -99){ if(shantayShop.store("Waterskin(4)",27)) pid=2; }
  174.  
  175. if(pid < 0 && gui.getCStatus())
  176. {
  177. pid = gui.getStatus();
  178. }
  179. if(pid == -9)
  180. {
  181. gui.setStatus(false);
  182.  
  183. Item[] items = getEquipment().getItems();
  184. Item[] itemsInv = getInventory().getItems();
  185.  
  186.  
  187. for (int i = 0; i<items.length;i++) {
  188. if(items[i] != null && !Setup.contains(items[i])){
  189. Setup.add(items[i].getName());
  190. log("Equipment Item Added: " + items[i].getName());
  191. }
  192.  
  193. }
  194. for (int i = 0; i<itemsInv.length;i++) {
  195. if(itemsInv[i] != null){
  196. Inventory.add(itemsInv[i].getName());
  197. log("Inventory Item Added: " + itemsInv[i].getName());
  198. }
  199.  
  200. }
  201. pid = -1000;
  202.  
  203. }
  204. if(pid == -8)
  205. {
  206.  
  207. if(true)
  208. {
  209. if(slayerBank == Banks.AL_KHARID || slayerBank == desertBank)
  210. {
  211. if(getEquipment().contains("Ring of dueling") &&
  212. getEquipment().getItemInSlot(EquipmentSlot.RING.slot).getName().contains("("))
  213. {
  214. getEquipment().getItemInSlot(EquipmentSlot.RING.slot).interact("");
  215. } else
  216. {
  217. getWalking().webWalk(desertBank, Banks.DRAYNOR,Banks.AL_KHARID,Banks.ARCEUUS_HOUSE,Banks.ARDOUGNE_NORTH,Banks.ARDOUGNE_SOUTH,
  218. Banks.CAMELOT, Banks.CANIFIS, Banks.CASTLE_WARS, Banks.CATHERBY, Banks.DUEL_ARENA, Banks.EDGEVILLE,
  219. Banks.FALADOR_EAST, Banks.FALADOR_WEST, Banks.GNOME_STRONGHOLD, Banks.GRAND_EXCHANGE, Banks.HOSIDIUS_HOUSE,
  220. Banks.LOVAKENGJ_HOUSE, Banks.LOVAKITE_MINE, Banks.LUMBRIDGE_LOWER, Banks.LUMBRIDGE_UPPER, Banks.PEST_CONTROL,
  221. Banks.PISCARILIUS_HOUSE, Banks.SHAYZIEN_HOUSE, Banks.TZHAAR, Banks.VARROCK_EAST, Banks.VARROCK_WEST, Banks.YANILLE);
  222. }
  223. }
  224. }
  225. }
  226. if(pid == -7)
  227. {
  228. Area areaV = new Area(2760, 3126, 2772, 3116);
  229. Paint = "Going to buy Antipoison";
  230. if(getBank().isOpen()) getBank().depositAll();
  231.  
  232. if(!getInventory().contains("Coins"))
  233. {
  234. getBank().withdraw("Coins", 20000);
  235. getBank().close();
  236. } else if(!getBank().isOpen() && !areaV.contains(myPosition()))
  237. {
  238. getWalking().webWalk(areaV);
  239. } else if(areaV.contains(myPosition()) && !getStore().isOpen())
  240. {
  241. if(getNpcs().closestThatContains("jiminua") !=null) getNpcs().closestThatContains("jiminua").interact("Trade");
  242. } else if(getStore().isOpen() && !getInventory().isFull() &&
  243. getInventory().getItemInSlot(getInventory().getSlot("Coins")).getAmount() >= 500)
  244. {
  245. getStore().buy("Antipoison(3)", 10);
  246. if(getStore().getItem("Antipoison(3)").getAmount() == 0)
  247. {
  248. getStore().close();
  249. worlds.hopToP2PWorld();
  250. }
  251. }else if(getInventory().isFull() || getInventory().getItemInSlot(getInventory().getSlot("Coins")).getAmount() <= 500)
  252. {
  253. pid = 2;
  254. }
  255.  
  256.  
  257. }
  258. if(pid == -6)
  259. {
  260. if (!bank.isOpen() && getObjects().closest("Bank chest") != null &&
  261. getObjects().closest("Bank chest").interact("Use")) {
  262. new ConditionalSleep(5000) {
  263. @Override
  264. public boolean condition() {
  265. return getBank().isOpen();
  266. }
  267. }.sleep();
  268. }
  269. if(bank.isOpen() && getBank().contains("Ice cooler"))
  270. {
  271. pid = 2;
  272. hasIce = true;
  273. }
  274. if(bank.isOpen() && !hasIce)
  275. {
  276. if (!getInventory().contains("Coins") && getInventory().isFull()) getBank().deposit(getInventory().getItemInSlot(27).getName(), 2);
  277. if (getInventory().contains("Coins")) getBank().depositAll("Coins");
  278. getBank().withdraw("Coins", 1000);
  279. if (getInventory().getItemInSlot(getInventory().getSlot("Coins")).getAmount() >= 1000) getBank().close();
  280. } else if (getInventory().contains("Coins") && !Turael.contains(myPosition()) && !hasIce)
  281. {
  282. getWalking().webWalk(Turael);
  283. }
  284. if(!getStore().isOpen() && getNpcs().closest("Turael") != null && getNpcs().closest("Turael").interact("Trade"))
  285. {
  286. new ConditionalSleep(5000) {
  287. @Override
  288. public boolean condition() {
  289. return getStore().isOpen();
  290. }
  291. }.sleep();
  292. }
  293. if(getStore().isOpen())
  294. {
  295.  
  296. getStore().buy("Ice cooler", 50);
  297. if(getInventory().getItemInSlot(getInventory().getSlot("Ice cooler")) != null &&
  298. getInventory().getItemInSlot(getInventory().getSlot("Ice cooler")).getAmount() >= 850) {
  299. getStore().close();
  300. hasIce = true;
  301. pid = 2;
  302. }
  303. }
  304. }
  305. if(pid == -5)
  306. {
  307. Paint = "Need Candle / Swamp Rope";
  308. Area areaCandle = new Area(3165, 3179, 3176, 3168);
  309. if (getInventory().contains("Lit candle")) pid = 2;
  310. if (!areaCandle.contains(myPosition()) && getWalking().webWalk(areaCandle)) {
  311. new ConditionalSleep(5000) {
  312. @Override
  313. public boolean condition() {
  314. return areaCandle.contains(myPosition());
  315. }
  316. }.sleep();
  317. }
  318. if(getInventory().contains("Rope") && getInventory().getItem("Rope").interact())
  319. {
  320. getObjects().closest("Dark hole").interact();
  321. new ConditionalSleep(5000) {
  322. @Override
  323. public boolean condition() {
  324. return !getInventory().contains("Rope") || getDialogues().inDialogue();
  325. }
  326. }.sleep();
  327. swampRope = true;
  328. }
  329. if(dialogues.inDialogue())
  330. {
  331. if(dialogues.isPendingOption())
  332. dialogues.selectOption(1);
  333. else
  334. dialogues.clickContinue();
  335.  
  336. }
  337. if(!dialogues.inDialogue() && getNpcs().closest("Candle seller") != null &&
  338. getNpcs().closest("Candle seller").interact("Talk-to") && !getInventory().contains("Lit candle"))
  339. {
  340. new ConditionalSleep(5000) {
  341. @Override
  342. public boolean condition() {
  343. return getInventory().contains("Lit candle");
  344. }
  345. }.sleep();
  346. }
  347. }
  348. if(pid == -4)
  349. {
  350. Paint = "Need Rope";
  351. if (!getStore().isOpen() && getNpcs().closest("Ned") != null && getNpcs().closest("Ned").interact("Trade")) {
  352. new ConditionalSleep(5000) {
  353. @Override
  354. public boolean condition() {
  355. return getStore().isOpen();
  356. }
  357. }.sleep();
  358. }
  359. if(getStore().isOpen())
  360. {
  361. getStore().buy("Rope", 5);
  362.  
  363. new ConditionalSleep(5000) {
  364. @Override
  365. public boolean condition() {
  366. return getInventory().contains("Rope");
  367. }
  368. }.sleep();
  369.  
  370. pid = 2;
  371. }
  372. }
  373. if(pid == -3)
  374. {
  375. Paint = "Need Shantay Pass";
  376. if (!getStore().isOpen() && getNpcs().closest("Shantay") != null && getNpcs().closest("Shantay").interact("Trade")) {
  377. new ConditionalSleep(5000) {
  378. @Override
  379. public boolean condition() {
  380. return getStore().isOpen();
  381. }
  382. }.sleep();
  383. } else
  384. {
  385. getStore().buy("Shantay pass", 100);
  386. pid = 5;
  387. }
  388. }
  389.  
  390. if(pid == -1)
  391. {
  392. Paint = "Traveling to slayer master.";
  393. RS2Widget miniButton = getWidgets().get(629, 13);
  394. RS2Widget miniTab = getWidgets().get(76, 1);
  395. RS2Widget miniBox = getWidgets().get(76, 8);
  396. RS2Widget grChoice = getWidgets().get(76, 18,3);
  397. RS2Widget miniTP = getWidgets().get(76, 28);
  398. RS2Widget questTab = getWidgets().get(164,62);
  399.  
  400. if(canTP && npcs.closest("Turael") == null)
  401. {
  402. if(!tabs.isOpen(Tab.QUEST) && questTab.interact())
  403.  
  404. if(miniTab == null && miniButton.interact())
  405. {
  406. new ConditionalSleep(5000) {
  407. @Override
  408. public boolean condition() {
  409. return miniTab.isVisible();
  410. }
  411. }.sleep();
  412. }
  413. if(miniBox != null && !miniBox.getMessage().contains("Burthorpe Games Room"))
  414. {
  415. if(grChoice == null && miniBox.interact())
  416. {
  417. new ConditionalSleep(5000) {
  418. @Override
  419. public boolean condition() {
  420. return grChoice.isVisible();
  421. }
  422. }.sleep();
  423. }
  424. if(grChoice != null && grChoice.interact())
  425. {
  426. new ConditionalSleep(5000) {
  427. @Override
  428. public boolean condition() {
  429. return miniBox.getMessage().contains("Burthorpe Games Room");
  430. }
  431. }.sleep();
  432. }
  433. } else if(miniBox != null && miniBox.getMessage().contains("Burthorpe Games Room") && miniTP.interact())
  434. {
  435. new ConditionalSleep(15000) {
  436. @Override
  437. public boolean condition() {
  438. return getNpcs().closest("Sam") != null || canTP == false;
  439. }
  440. }.sleep();
  441. if(getNpcs().closest("Sam") != null || myPlayer().isHitBarVisible()) canTP = false;
  442. }
  443. } else
  444. {
  445. log(tobank.gethasFood());
  446. if(tobank.gethasFood() != -1)
  447. {
  448. if(npcs.closest("Turael") == null)
  449. {
  450. tobank.bank(Turael,null);
  451. new ConditionalSleep(5000) {
  452. @Override
  453. public boolean condition() {
  454. return npcs.closest("Turael") != null;
  455. }
  456. }.sleep();
  457.  
  458.  
  459. }
  460. log(npcs.closest("Turael") != null);
  461. if(npcs.closest("Turael") != null)
  462. {
  463. pid=1;
  464. }
  465. } else if(tobank.gethasFood() == -1)
  466. tobank.bank(Banks.CAMELOT, Banks.EDGEVILLE);
  467. pid = 3;
  468.  
  469.  
  470. }
  471.  
  472. }
  473.  
  474. if(pid==0)
  475. {
  476. gui.setStatus(false);
  477. neededItem = false;
  478. canTP = true;
  479. if(Inv != null) Inv.interact();
  480. if (!getInventory().contains("Enchanted gem") && !bank.isOpen())
  481. {
  482. Paint = "Finding Slayer Gem";
  483. if (npcs.closest("Banker") != null && npcs.closest("Banker").interact("Bank")) {
  484. new ConditionalSleep(5000) {
  485. @Override
  486. public boolean condition() {
  487. return getBank().isOpen();
  488. }
  489. }.sleep();
  490. } else if (getObjects().closest("Bank chest") != null && getObjects().closest("Bank chest").interact("use")) {
  491. new ConditionalSleep(5000) {
  492. @Override
  493. public boolean condition() {
  494. return getBank().isOpen();
  495. }
  496. }.sleep();
  497. } else if (getObjects().closest("Bank booth") != null && getObjects().closest("Bank booth").interact("Bank")) {
  498. new ConditionalSleep(5000) {
  499. @Override
  500. public boolean condition() {
  501. return getBank().isOpen();
  502. }
  503. }.sleep();
  504. }
  505. else
  506. {
  507. getWalking().webWalk(Banks.DRAYNOR,Banks.AL_KHARID,Banks.ARCEUUS_HOUSE,Banks.ARDOUGNE_NORTH,Banks.ARDOUGNE_SOUTH,
  508. Banks.CAMELOT, Banks.CANIFIS, Banks.CASTLE_WARS, Banks.CATHERBY, Banks.DUEL_ARENA, Banks.EDGEVILLE,
  509. Banks.FALADOR_EAST, Banks.FALADOR_WEST, Banks.GNOME_STRONGHOLD, Banks.GRAND_EXCHANGE, Banks.HOSIDIUS_HOUSE,
  510. Banks.LOVAKENGJ_HOUSE, Banks.LOVAKITE_MINE, Banks.LUMBRIDGE_LOWER, Banks.LUMBRIDGE_UPPER, Banks.PEST_CONTROL,
  511. Banks.PISCARILIUS_HOUSE, Banks.SHAYZIEN_HOUSE, Banks.TZHAAR, Banks.VARROCK_EAST, Banks.VARROCK_WEST, Banks.YANILLE);
  512.  
  513. }
  514. //if (!inventory.isEmpty()) bank.depositAll();
  515. if(getBank().isOpen() && !bank.contains("Enchanted gem"))
  516. {
  517. bank.withdraw("Coins", 1);
  518. bank.close();
  519. pid = -1;
  520. } else if(getBank().isOpen() && bank.contains("Enchanted gem"))
  521. {
  522. bank.withdraw("Enchanted gem",1);
  523. bank.close();
  524. pid = 1;
  525. }
  526.  
  527.  
  528. } else if (getInventory().contains("Enchanted gem"))
  529. {
  530. pid = 1;
  531. }
  532. }
  533.  
  534. if(pid==1)
  535. {
  536.  
  537. if(!dialogues.inDialogue() && SlayerMonster == "None" && npcs.closest("Turael") != null && npcs.closest("Turael").interact("Assignment"))
  538. {
  539. new ConditionalSleep(5000)
  540. {
  541. @Override
  542. public boolean condition()
  543. {
  544. return dialogues.inDialogue();
  545. }
  546. }.sleep();
  547. }
  548.  
  549.  
  550. if(dialogues.inDialogue())
  551. {
  552. if(dialogues.isPendingOption())
  553. dialogues.selectOption(1);
  554. else
  555. dialogues.clickContinue();
  556.  
  557. }
  558. if (getInventory().getItem("Enchanted Gem") != null && getInventory().getItem("Enchanted Gem").interact("Check")) {
  559. new ConditionalSleep(5000) {
  560. @Override
  561. public boolean condition() {
  562. return SlayerMonster != "None" || SlayerMonster != "";
  563. }
  564. }.sleep();
  565. SlayerMonster = "Pending...";
  566. if (SlayerMonster == "Pending...") {
  567. new ConditionalSleep(5000) {
  568. @Override
  569. public boolean condition() {
  570. return SlayerMonster != "Pending...";
  571. }
  572. }.sleep();
  573. }
  574.  
  575. }
  576. Paint = SlayerMonster;
  577. if (npcs.closest("Turael") == null && SlayerMonster == "" || SlayerMonster == "None" && pid == 1) pid=-1;
  578. if (SlayerMonster != "None")
  579. {
  580. if(getInventory().contains("Ice cooler")) hasIce =true;
  581. if(hasIce || !SlayerMonster.contains("lizard"))
  582. pid = 2;
  583. else if (!hasIce && SlayerMonster.contains("lizard"))
  584. {
  585. getWalking().webWalk(rogueBank, desertBank);
  586. Paint = "Need Ice Cooler";
  587. pid = -6;
  588. }
  589. }
  590.  
  591. }
  592.  
  593. if(pid == 2)
  594. {
  595. Paint = "Walking to nearest " + SlayerMonster + " area.";
  596.  
  597. if(slayerArea.contains(myPosition()))
  598. pid=5;
  599. if (pid == 2 && ((slayerBank == Banks.LUMBRIDGE_UPPER || slayerBank == Banks.AL_KHARID || slayerBank == desertBank)))
  600. {
  601. canHomeTP = true;
  602. if(!myPlayer().isAnimating() && !Banks.LUMBRIDGE_UPPER.contains(myPosition()) &&
  603. !slayerBank.contains(myPosition()) && canHomeTP && getMagic().getCurrentBook() == Magic.Book.NORMAL
  604. && getMagic().castSpell(Spells.NormalSpells.HOME_TELEPORT))
  605. {
  606. Area Lumbridge = new Area(3217, 3225, 3226, 3211);
  607.  
  608. new ConditionalSleep(15000) {
  609. @Override
  610. public boolean condition() {
  611. return Lumbridge.contains(myPosition());
  612. }
  613. }.sleep();
  614. if(Lumbridge.contains(myPosition())) canHomeTP = false;
  615. }
  616. if((slayerBank == Banks.AL_KHARID || slayerBank == desertBank) && !getQuests().isComplete(Quests.Quest.PRINCE_ALI_RESCUE))
  617. {
  618. Paint = "Need Coins For Gate";
  619. neededItem = false;
  620. if (getInventory().contains("Coins"))
  621. {
  622. if (getInventory().getItemInSlot(getInventory().getSlot("Coins")).getAmount() >= 10)
  623. {
  624. if(pid == 2 && getWalking().webWalk(slayerBank, slayerArea))
  625. pid = 3;
  626. }
  627. } else
  628. {
  629. getWalking().webWalk(Banks.LUMBRIDGE_UPPER);
  630. if(getBank().isOpen())
  631. {
  632. if (getInventory().isFull()) getBank().deposit(getInventory().getItemInSlot(27).getName(), 1);
  633.  
  634. if (getBank().isOpen() && getBank().withdraw("Coins",10)) {
  635. new ConditionalSleep(5000) {
  636. @Override
  637. public boolean condition() {
  638. return getInventory().getItemInSlot(getInventory().getSlot("Coins")).getAmount() >= 10;
  639. }
  640. }.sleep();
  641. neededItem = true;
  642. }
  643. } else
  644. {
  645. if (npcs.closest("Banker") != null && npcs.closest("Banker").interact("Bank"))
  646. {
  647. new ConditionalSleep(5000)
  648. {
  649. @Override
  650. public boolean condition()
  651. {
  652. return getBank().isOpen();
  653. }
  654. }.sleep();
  655. }
  656. }
  657.  
  658. }
  659.  
  660. }else neededItem =true;
  661. } else neededItem =true;
  662.  
  663. if(neededItem == true && pid == 2 && !canHomeTP)
  664. {
  665. tobank.bank(slayerBank, slayerArea);
  666. neededItem = false;
  667. if(slayerBank.contains(myPosition()))
  668. pid = 3;
  669.  
  670. }
  671.  
  672.  
  673. }
  674. if(pid == 3)
  675. {
  676. Paint = "Withdrawing Items";
  677.  
  678. if (styles[mIndex] == 1)
  679. {
  680. getBank().depositAll();
  681. for (int i = 0; i < Setup.size(); i++)
  682. {
  683. if(bank.isOpen() && !getEquipment().contains(Setup.get(i)))
  684. {
  685. bank.withdraw(Setup.get(i), 1);
  686. }
  687. }
  688. if(SlayerMonster != "None")
  689. pid=4;
  690. else pid=-1;
  691. }
  692. }
  693. if(pid == 4)
  694. {
  695. Paint = "Equipping Armor";
  696. int count = 1;
  697.  
  698. if(getEquipment().isEmpty())
  699. {
  700. for (int i = 0; i < Setup.size(); i++)
  701. {
  702. if(getInventory().getItem(Setup.get(i)) != null && !getInventory().isEmpty())
  703. {
  704. if (getInventory().getItem(Setup.get(i)).hasAction("Wear"))
  705. getInventory().getItem(Setup.get(i)).interact("Wear");
  706. else if (getInventory().getItem(Setup.get(i)).hasAction("Wield"))
  707. getInventory().getItem(Setup.get(i)).interact("Wield");
  708. } else
  709. break;
  710. }
  711. } else
  712. {
  713. getBank().depositAll();
  714. for (int i = 0; i < Inventory.size(); i++)
  715. {
  716. if(Inventory.get(i) != null && !getInventory().contains(Inventory.get(i)))
  717. {
  718. if (getBank().contains(Inventory.get(i)))
  719. getBank().withdraw(Inventory.get(i), Collections.frequency(Inventory, Inventory.get(i)));
  720.  
  721. }
  722. }
  723. pid = 5;
  724. }
  725.  
  726.  
  727. }
  728. if(pid == 5)
  729. {
  730. Paint = "Moving to " + SlayerMonster;
  731.  
  732. if(!bank.isOpen())
  733. {
  734. if (npcs.closest("Banker") != null && npcs.closest("Banker").interact("Bank")) {
  735. new ConditionalSleep(5000) {
  736. @Override
  737. public boolean condition() {
  738. return getBank().isOpen();
  739. }
  740. }.sleep();
  741. } else if (getObjects().closest("Bank chest") != null && getObjects().closest("Bank chest").interact("use")) {
  742. new ConditionalSleep(5000) {
  743. @Override
  744. public boolean condition() {
  745. return getBank().isOpen();
  746. }
  747. }.sleep();
  748. } else if (getObjects().closest("Bank booth") != null && getObjects().closest("Bank booth").interact("Bank")) {
  749. new ConditionalSleep(5000) {
  750. @Override
  751. public boolean condition() {
  752. return getBank().isOpen();
  753. }
  754. }.sleep();
  755. }
  756. } else if (bank.isOpen())
  757. {
  758. if(SlayerMonster.contains("monkey"))
  759. {
  760. if (getInventory().isFull()) getBank().deposit(getInventory().getItemInSlot(27).getName(), 1);
  761. if (!getInventory().contains("Coins")) getBank().withdraw("Coins", 60);
  762. if (getInventory().getItemInSlot(getInventory().getSlot("Coins")).getAmount() >= 60) neededItem = true;
  763. } else if (SlayerMonster.contains("kalphit") || SlayerMonster.contains("lizard") || SlayerMonster.contains("jackal"))
  764. {
  765. if (getInventory().contains("Shantay pass") && getInventory().getItem("Shantay pass").getAmount() > 1) getBank().depositAll("Shantay pass");
  766. if(getBank().contains("Shantay pass"))
  767. {
  768. if (getInventory().isFull()) getBank().deposit(getInventory().getItemInSlot(27).getName(), 1);
  769. if (!getInventory().contains("Shantay pass")) getBank().withdraw("Shantay pass", 1);
  770. if (getInventory().contains("Shantay pass")) neededItem = true;
  771. if(SlayerMonster.contains("lizard") || SlayerMonster.contains("jackal"))
  772. {
  773. neededItem = false;
  774. if(getBank().contains("Waterskin(4)"))
  775. {
  776. if (getInventory().isFull()) getBank().deposit(getInventory().getItemInSlot(27).getName(), 6);
  777. if (!getInventory().contains("Waterskin(4)")) getBank().withdraw("Waterskin(4)", 6);
  778. if (getInventory().contains("Waterskin(4)") && SlayerMonster.contains("lizard"))
  779. {
  780. if (getInventory().isFull()) getBank().deposit(getInventory().getItemInSlot(27).getName(), 1);
  781. if (!getInventory().contains("Ice cooler")) getBank().withdrawAll("Ice cooler");
  782. if (getInventory().contains("Ice cooler"))
  783. neededItem = true;
  784. } else if (getInventory().contains("Waterskin(4)") && SlayerMonster.contains("jackal"))
  785. neededItem = true;
  786.  
  787. }else if (!getBank().contains("Waterskin(4)"))
  788. {
  789. Paint = "Buying Waterskin(4)";
  790. pid = -99;
  791. }
  792. }
  793. } else
  794. {
  795. if (getInventory().isFull()) getBank().deposit(getInventory().getItemInSlot(27).getName(), 1);
  796. if (!getInventory().contains("Coins")) getBank().withdraw("Coins", 500);
  797. if (getInventory().getItemInSlot(getInventory().getSlot("Coins")).getAmount() >= 500 && getBank().close()) pid = -3;
  798. }
  799. } else if (SlayerMonster.contains("cave sli") || SlayerMonster.contains("cave bu"))
  800. {
  801. if(swampRope && getInventory().contains("Rope")) getBank().depositAll("Rope");
  802. if((!getInventory().contains("Rope") || swampRope) && (!getInventory().contains("Candle") ||
  803. !getInventory().contains("Lit candle")))
  804. neededItem = false;
  805. if(getInventory().contains("Rope")) getBank().depositAll("Rope");
  806. if (getBank().contains("Rope") && !swampRope)
  807. {
  808. if (getInventory().isFull()) getBank().deposit(getInventory().getItemInSlot(27).getName(), 1);
  809. getBank().withdraw("Rope",1);
  810. } else if (!getBank().contains("Rope") && !swampRope)
  811. {
  812. if (getInventory().isFull()) getBank().deposit(getInventory().getItemInSlot(27).getName(), 3);
  813. if (getInventory().contains("Coins") && getInventory().getItemInSlot(getInventory().getSlot("Coins")).getAmount() < 40) getBank().depositAll("Coins");
  814. if (!getInventory().contains("Coins")) getBank().withdraw("Coins", 40);
  815. if (getInventory().getItemInSlot(getInventory().getSlot("Coins")).getAmount() >= 40 && getBank().close())
  816. if(pid == 5 && getWalking().webWalk(new Area(3096, 3260, 3100, 3256)))
  817. pid = -4;
  818. }
  819. if(getInventory().contains("Rope") || swampRope)
  820. {
  821. if(getInventory().contains("Candle")) getBank().depositAll("Candle");
  822. if(getInventory().contains("Lit candle")) getBank().depositAll("Lit candle");
  823. if (getInventory().isFull()) getBank().deposit(getInventory().getItemInSlot(27).getName(), 1);
  824.  
  825. if (getBank().contains("Candle") && !getInventory().contains("Lit candle") && !getInventory().contains("Candle"))
  826. {
  827. getBank().withdraw("Candle",1);
  828. }
  829. if (getBank().contains("Lit candle") && !getInventory().contains("Candle") && !getInventory().contains("Lit candle"))
  830. {
  831. getBank().withdraw("Lit candle",1);
  832.  
  833. }
  834. if(getInventory().contains("Candle") || getInventory().contains("Lit candle") || SlayerMonster.contains("cave craw"))
  835. {
  836. if(SlayerMonster.contains("cave sli"))
  837. {
  838. Paint = "Need Antipoison";
  839. if(getBank().getItem("Antipoison(3)") != null)
  840. {
  841. if (getInventory().isFull()) getBank().deposit(getInventory().getItemInSlot(27).getName(), 2);
  842. getBank().withdraw("Antipoison(3)",2);
  843. if (getInventory().contains("Antipoison(3)")) neededItem = true;
  844. } else pid = -7;
  845. } else
  846. neededItem = true;
  847. }
  848. if (getInventory().isFull()) getBank().deposit(getInventory().getItemInSlot(27).getName(), 1);
  849. if (getBank().contains("Tinderbox") && !getInventory().contains("Tinderbox")) getBank().withdraw("Tinderbox",1);
  850.  
  851. if (neededItem == false && !getInventory().contains("Candle") && !getInventory().contains("Lit candle"))
  852. {
  853. if (!getInventory().contains("Coins") && getInventory().isFull()) getBank().deposit(getInventory().getItemInSlot(27).getName(), 2);
  854. if (getInventory().contains("Coins")) getBank().depositAll("Coins");
  855. getBank().withdraw("Coins", 1000);
  856. if (getInventory().getItemInSlot(getInventory().getSlot("Coins")).getAmount() >= 1000 && getBank().close())
  857. pid=-5;
  858. } else if ((getInventory().contains("Candle") || getInventory().contains("Lit candle")) && !swampRope)
  859. pid=-5;
  860. }
  861. }
  862. else if(SlayerMonster.contains("cave craw"))
  863. {
  864. Paint = "Need Antipoison";
  865. if(getBank().getItem("Antipoison(3)") != null)
  866. {
  867. if (getInventory().isFull()) getBank().deposit(getInventory().getItemInSlot(27).getName(), 4);
  868. getBank().withdraw("Antipoison(3)",4);
  869. if (getInventory().contains("Antipoison(3)")) neededItem = true;
  870. } else pid = -7;
  871. } else if(isPoisoned)
  872. {
  873. if(getInventory().getSlotForNameThatContains("Antipoison") != -1)
  874. {
  875. Paint = "Need Antipoison";
  876. if(getBank().getItemInSlot(getBank().getSlotForNameThatContains("Antipoison")) != null)
  877. {
  878. if (getInventory().isFull()) getBank().deposit(getInventory().getItemInSlot(27).getName(), 1);
  879. getBank().withdraw(getBank().getSlotForNameThatContains("Antipoison"),1);
  880. } else pid = -7;
  881. } else
  882. {
  883. if(getBank().isOpen()) getBank().close();
  884. getInventory().getItemInSlot(getInventory().getSlotForNameThatContains("Antipoison")).interact("Drink");
  885. neededItem = true;
  886. }
  887. }
  888. else neededItem = true;
  889. }
  890.  
  891.  
  892. if (pid == 5 && neededItem == true)
  893. {
  894. tobank.bank(null, slayerArea);
  895. if(slayerArea.contains(myPosition())) pid = 6;
  896. }
  897. }
  898. if(pid == 6)
  899. {
  900. Paint = "Attacking " + SlayerMonster;
  901. Area drops = attack.getDead();
  902. if(drops != null)
  903. if(loot.lootItems(drops)) pid = 7;
  904.  
  905. if(getInventory().getSelectedItemId() != -1)
  906. getInventory().deselectItem();
  907. monNumber = attack.Combat(TuraelMonsters[mIndex], styles[mIndex], slayerArea, monNumber, isUnder);
  908. if (monNumber <=0) pid = 0;
  909. pot.potUp();
  910. if(isPoisoned && getInventory().getSlotForNameThatContains("Antipoison") == -1) pid = 7;
  911. if(myPlayer().getHealthPercent() < 50)
  912. {
  913. if(!eat.doEat())
  914. {
  915. pid = 7;
  916. log("3");
  917. }
  918. }
  919. isUnder = attack.underAttack;
  920. if(isPoisoned) pot.poison();
  921. if(getInventory().getItem("Waterskin(4)") == null && getInventory().getItem("Waterskin(3)") == null &&
  922. getInventory().getItem("Waterskin(2)") == null && getInventory().getItem("Waterskin(1)") == null &&
  923. getInventory().getItem("Waterskin(0)") != null) pid = 7;
  924. }
  925.  
  926.  
  927. if(pid == 7)
  928. {
  929. hasFood = false;
  930. Paint = "Banking";
  931.  
  932. if(tobank.bank(slayerBank, null)) pid = 3;
  933.  
  934. }
  935. return 700; //The amount of time in milliseconds before the loop starts over
  936.  
  937.  
  938. }
  939.  
  940.  
  941. @Override
  942. public void onPaint(Graphics2D g) {
  943. RS2Widget Chatbox = getWidgets().get(162,59);
  944. g.setColor(Color.GREEN);
  945. g.drawString(Paint, Chatbox.getWidth() +25, Chatbox.getAbsY()+15);
  946. g.drawString(monNumber + " " + SlayerMonster + " left", Chatbox.getWidth()+25, Chatbox.getAbsY()+25);
  947. g.drawString(String.valueOf(pid), Chatbox.getWidth()+25, Chatbox.getAbsY()+35);
  948. }
  949.  
  950.  
  951.  
  952.  
  953.  
  954.  
  955. }
  956.  
  957. public class Loot
  958. {
  959. private final MethodProvider methods;
  960. String[] itemList = {"Coins", "Bones", "Bronze boots", "Nature rune", "Grimy ranarr", "White berry"};
  961. boolean full = false;
  962.  
  963. public Loot(final MethodProvider methods)
  964. {
  965. this.methods = methods;
  966. }
  967.  
  968. public boolean lootItems(Area dead)
  969. {
  970. GroundItem item = null;
  971. if (dead != null)
  972. {
  973. if(methods.getInventory().isFull())
  974. {
  975. full = true;
  976. for (int x = 0; x < 28; x++)
  977. {
  978. if(methods.getInventory().getItemInSlot(x) !=null && methods.getInventory().getItemInSlot(x).hasAction("Bury")
  979. && methods.getInventory().isFull() && methods.getInventory().getItemInSlot(x).interact("Bury"))
  980. {
  981. new ConditionalSleep(5000) {
  982. @Override
  983. public boolean condition() {
  984. return !methods.getInventory().isFull();
  985. }
  986. }.sleep();
  987. full = false;
  988. }
  989. else if(methods.getInventory().getItemInSlot(x) !=null && methods.getInventory().getItemInSlot(x).hasAction("Eat")
  990. && methods.getInventory().isFull() && methods.getInventory().getItemInSlot(x).interact("Eat"))
  991. {
  992. new ConditionalSleep(5000) {
  993. @Override
  994. public boolean condition() {
  995. return !methods.getInventory().isFull();
  996. }
  997. }.sleep();
  998. full = false;
  999. }
  1000. else if(methods.getInventory().getItemInSlot(x) !=null && methods.getInventory().getItemInSlot(x).getName() == "Vial"
  1001. && methods.getInventory().isFull() && methods.getInventory().getItemInSlot(x).interact("Drop"))
  1002. {
  1003. new ConditionalSleep(5000) {
  1004. @Override
  1005. public boolean condition() {
  1006. return !methods.getInventory().isFull();
  1007. }
  1008. }.sleep();
  1009. full = false;
  1010. }
  1011. }
  1012. }
  1013. for (int i = 0; i < itemList.length; i++)
  1014. {
  1015. if(methods.getGroundItems().closest(dead, itemList[i]) != null)
  1016. {
  1017. item = closestItemInArea(dead, itemList[i]).get();
  1018. }
  1019. if(!methods.getInventory().isFull() && item !=null)
  1020. item.interact("Take");
  1021. }
  1022. }
  1023. return full;
  1024. }
  1025.  
  1026. final Optional<GroundItem> closestItemInArea(final Area area, final String itemName)
  1027. {
  1028. return Optional.ofNullable(methods.getGroundItems().closest(new AreaFilter<>(area), new NameFilter<>(itemName)));
  1029. }
  1030. }
  1031.  
  1032. import org.osbot.rs07.api.map.Area;
  1033. import org.osbot.rs07.event.WebWalkEvent;
  1034. import org.osbot.rs07.script.MethodProvider;
  1035. import org.osbot.rs07.utility.Condition;
  1036. import org.osbot.rs07.utility.ConditionalSleep;
  1037.  
  1038. public class ToBank
  1039. {
  1040. private final MethodProvider methods;
  1041. boolean hasfood = true;
  1042.  
  1043. public ToBank(final MethodProvider methods) {
  1044. this.methods = methods;
  1045. }
  1046. public boolean bank(Area slayerBank, Area slayerArea)
  1047. {
  1048. if (slayerArea == null) slayerArea = slayerBank;
  1049. if (slayerBank == null) slayerBank = slayerArea;
  1050. if (!slayerBank.contains(methods.myPosition()) || !slayerArea.contains(methods.myPosition())) {
  1051. if (methods.myPlayer().getHealthPercent() < 50)
  1052. {
  1053. if(gethasFood() != -1)
  1054. {
  1055. methods.getInventory().getItemInSlot(gethasFood()).interact("Eat");
  1056. bank(slayerBank, slayerArea);
  1057. hasfood = true;
  1058. new ConditionalSleep(1000) {
  1059. @Override
  1060. public boolean condition() {
  1061. return methods.myPlayer().isAnimating();
  1062. }
  1063. }.sleep();
  1064. }
  1065.  
  1066. }
  1067. final WebWalkEvent webWalkEvent = new WebWalkEvent(slayerBank, slayerArea);
  1068. webWalkEvent.setBreakCondition(new Condition()
  1069. {
  1070. @Override
  1071. public boolean evaluate()
  1072. {
  1073. return methods.myPlayer().getHealthPercent() < 50 && hasfood;
  1074. }
  1075.  
  1076. });
  1077. if (methods.myPlayer().getHealthPercent() > 50 || !hasfood || methods.myPlayer().isHitBarVisible()) methods.execute(webWalkEvent);
  1078. }
  1079.  
  1080. if(!methods.getBank().isOpen())
  1081. {
  1082. if ((methods.npcs.closest("Banker") != null && methods.npcs.closest("Banker").interact("Bank"))
  1083. || (methods.getObjects().closest("Bank chest") != null && methods.getObjects().closest("Bank chest").interact("use"))
  1084. || (methods.getObjects().closest("Bank booth") != null && methods.getObjects().closest("Bank booth").interact("Bank"))) {
  1085. new ConditionalSleep(5000) {
  1086. @Override
  1087. public boolean condition() {
  1088. return methods.getBank().isOpen();
  1089. }
  1090. }.sleep();
  1091. }
  1092. } else if (methods.getBank().isOpen())
  1093. {
  1094. methods.getBank().depositAll();
  1095. }
  1096. if(methods.getBank().isOpen()) return true;
  1097. else return false;
  1098. }
  1099. public int gethasFood()
  1100. {
  1101. int slot = -1;
  1102. for (int i = 0; i < 28; i++)
  1103. {
  1104. if (methods.getInventory().getItemInSlot(i) != null && methods.getInventory().getItemInSlot(i).hasAction("Eat"))
  1105. slot = i;
  1106. else if (i == 27) slot = -1;
  1107. }
  1108. return slot;
  1109. }
  1110. }
  1111.  
  1112. import org.osbot.rs07.api.ui.Skill;
  1113. import org.osbot.rs07.script.MethodProvider;
  1114. import org.osbot.rs07.utility.ConditionalSleep;
  1115.  
  1116. public class Pot
  1117. {
  1118. private final MethodProvider methods;
  1119.  
  1120. public Pot(final MethodProvider methods) {
  1121. this.methods = methods;
  1122. }
  1123. public void potUp()
  1124. {
  1125. if (methods.getSkills().getDynamic(Skill.ATTACK) == methods.getSkills().getStatic(Skill.ATTACK))
  1126. {
  1127. for (int i = 0; i < 28; i++)
  1128. {
  1129. if (methods.getInventory().getItemInSlot(i) != null &&
  1130. methods.getInventory().getItemInSlot(i).hasAction("Drink"))
  1131. {
  1132. if (methods.getInventory().getItemInSlot(i).getName().contains("attack")
  1133. || methods.getInventory().getItemInSlot(i).getName().contains("combat"))
  1134. {
  1135. methods.getInventory().getItemInSlot(i).interact("Drink");
  1136. new ConditionalSleep(5000)
  1137. {
  1138. @Override
  1139. public boolean condition()
  1140. {
  1141. return methods.getSkills().getDynamic(Skill.ATTACK) > methods.getSkills().getStatic(Skill.ATTACK);
  1142. }
  1143. }.sleep();
  1144. break;
  1145. }
  1146. }
  1147. }
  1148. }
  1149. if (methods.getSkills().getDynamic(Skill.STRENGTH) == methods.getSkills().getStatic(Skill.STRENGTH))
  1150. {
  1151.  
  1152. for (int i = 0; i < 28; i++)
  1153. {
  1154. if (methods.getInventory().getItemInSlot(i) != null && methods.getInventory().getItemInSlot(i).hasAction("Drink"))
  1155. {
  1156. if (methods.getInventory().getItemInSlot(i).getName().contains("strength")
  1157. || methods.getInventory().getItemInSlot(i).getName().contains("combat"))
  1158. {
  1159. methods.getInventory().getItemInSlot(i).interact("Drink");
  1160. new ConditionalSleep(5000)
  1161. {
  1162. @Override
  1163. public boolean condition()
  1164. {
  1165. return methods.getSkills().getDynamic(Skill.STRENGTH) > methods.getSkills().getStatic(Skill.STRENGTH);
  1166. }
  1167. }.sleep();
  1168. break;
  1169. }
  1170.  
  1171. }
  1172. }
  1173. }
  1174. if (methods.getSkills().getDynamic(Skill.DEFENCE) == methods.getSkills().getStatic(Skill.DEFENCE))
  1175. {
  1176. for (int i = 0; i < 28; i++)
  1177. {
  1178. if (methods.getInventory().getItemInSlot(i) != null && methods.getInventory().getItemInSlot(i).hasAction("Drink"))
  1179. {
  1180. if (methods.getInventory().getItemInSlot(i).getName().contains("defence") || methods.getInventory().getItemInSlot(i).getName().contains("combat"))
  1181. {
  1182. methods.getInventory().getItemInSlot(i).interact("Drink");
  1183. new ConditionalSleep(5000)
  1184. {
  1185. @Override
  1186. public boolean condition()
  1187. {
  1188. return methods.getSkills().getDynamic(Skill.DEFENCE) > methods.getSkills().getStatic(Skill.DEFENCE);
  1189. }
  1190. }.sleep();
  1191. break;
  1192. }
  1193. }
  1194. }
  1195. }
  1196. }
  1197. public void poison()
  1198. {
  1199. for (int i = 0; i < 28; i++)
  1200. {
  1201. if (methods.getInventory().getItemInSlot(i) != null && methods.getInventory().getItemInSlot(i).hasAction("Drink"))
  1202. {
  1203. if (methods.getInventory().getItemInSlot(i).getName().toLowerCase().contains("antipoison"))
  1204. {
  1205. methods.getInventory().getItemInSlot(i).interact("Drink");
  1206. new ConditionalSleep(5000)
  1207. {
  1208. @Override
  1209. public boolean condition()
  1210. {
  1211. return methods.myPlayer().isAnimating();
  1212. }
  1213. }.sleep();
  1214. break;
  1215. }
  1216. }
  1217. }
  1218.  
  1219. }
  1220.  
  1221. }
  1222.  
  1223. import org.osbot.rs07.api.map.Area;
  1224. import org.osbot.rs07.script.MethodProvider;
  1225. import org.osbot.rs07.utility.ConditionalSleep;
  1226.  
  1227. public class Eat
  1228. {
  1229. boolean hasFood = true;
  1230. private final MethodProvider methods;
  1231.  
  1232. public Eat(final MethodProvider methods) {
  1233. this.methods = methods;
  1234. }
  1235. public boolean doEat()
  1236. {
  1237. if (hasFood)
  1238. {
  1239.  
  1240. for (int i = 0; i < 28; i++)
  1241. {
  1242. if (methods.getInventory().getItemInSlot(i) != null && methods.getInventory().getItemInSlot(i).hasAction("Eat"))
  1243. {
  1244. int preEat = methods.myPlayer().getHealthPercent();
  1245. if (methods.getInventory().getItemInSlot(i).interact("Eat"))
  1246. new ConditionalSleep(5000)
  1247. {
  1248. @Override
  1249. public boolean condition()
  1250. {
  1251. return preEat < methods.myPlayer().getHealthPercent();
  1252. }
  1253. }.sleep();
  1254. hasFood = true;
  1255. break;
  1256. }
  1257. else if (i == 27) hasFood = false;
  1258. }
  1259. }
  1260. if(hasFood) return true;
  1261. else return false;
  1262. }
  1263. }
  1264.  
  1265. import org.osbot.rs07.api.map.Area;
  1266. import org.osbot.rs07.api.model.NPC;
  1267. import org.osbot.rs07.api.ui.Skill;
  1268. import org.osbot.rs07.script.MethodProvider;
  1269. import org.osbot.rs07.utility.ConditionalSleep;
  1270.  
  1271. public class Attackit
  1272. {
  1273. private final MethodProvider methods;
  1274.  
  1275. NPC target = null;
  1276. NPC prevMonster = null;
  1277. int xpTracker = 0;
  1278.  
  1279.  
  1280. boolean underAttack = false;
  1281. boolean canReach = true;
  1282.  
  1283. Areas areas = new Areas();
  1284. int lastHP = 0;
  1285.  
  1286.  
  1287. public Attackit(final MethodProvider methods) {
  1288. this.methods = methods;
  1289. }
  1290.  
  1291. public int Combat(String monster, int x, Area slayerArea, int monNumber, boolean isUnder)
  1292. {
  1293.  
  1294. if (x == 1 )
  1295. {
  1296. if (slayerArea.contains(methods.myPosition()))
  1297. {
  1298. if(isUnder)
  1299. {
  1300. target = methods.getNpcs().closestThatContains(monster);
  1301. underAttack = false;
  1302. }
  1303. if(target == null && (monster.contains("cave bug"))) target = methods.getNpcs().closest(monster);
  1304. else if(target == null) target = methods.getNpcs().closestThatContains(monster);
  1305. lastHP = methods.myPlayer().getHealthPercent();
  1306. if(target != null)
  1307. {
  1308. if(target != null && target.getHealthPercent() == 0)
  1309. {
  1310. if( methods.getInventory().contains("Ice cooler") && methods.getInventory().getItem("Ice cooler").interact())
  1311. {
  1312. target.interact();
  1313.  
  1314. }else methods.getInventory().deselectItem();
  1315.  
  1316. if (prevMonster != target && target.getHealthPercent() == 0)
  1317. {
  1318. monNumber -=1;
  1319. prevMonster = target;
  1320. target = null;
  1321. }
  1322.  
  1323. }
  1324. if (target != null && !target.isHitBarVisible())
  1325. {
  1326. if(target != null && !slayerArea.contains(target))
  1327. {
  1328. methods.log("flee unreachable");
  1329. methods.getWalking().webWalk(target.getPosition());
  1330. target = methods.getNpcs().closestThatContains(monster);
  1331. }
  1332. if (!isUnder && target.interact("Attack"))
  1333. {
  1334. new ConditionalSleep(5000)
  1335. {
  1336. @Override
  1337. public boolean condition()
  1338. {
  1339. return target.isHitBarVisible() || methods.myPlayer().isUnderAttack();
  1340. }
  1341. }.sleep();
  1342.  
  1343.  
  1344.  
  1345. } else target = null;
  1346. if (target != null && !target.isHitBarVisible() && methods.myPlayer().getHealthPercent() < lastHP)
  1347. {
  1348. underAttack = true;
  1349. methods.log("flee danger");
  1350. target = null;
  1351. methods.getWalking().walk( methods.myPosition().translate( methods.random(1,5), methods.random(1,5)));
  1352. }
  1353. }
  1354. }
  1355.  
  1356.  
  1357. } else methods.getWalking().webWalk(slayerArea);
  1358.  
  1359.  
  1360. }
  1361. return monNumber;
  1362. }
  1363. public Area getDead()
  1364. {
  1365. if (prevMonster != null)
  1366. {
  1367. Area area = new Area(prevMonster.getX()-2, prevMonster.getY()-2, prevMonster.getX()+2, prevMonster.getY()+2);
  1368. return area;
  1369. }
  1370. else return null;
  1371. }
  1372. }
  1373.  
  1374. import org.osbot.rs07.script.MethodProvider;
  1375. import org.osbot.rs07.utility.ConditionalSleep;
  1376.  
  1377. public class Shantay {
  1378. private final MethodProvider methods;
  1379.  
  1380. public Shantay(final MethodProvider methods) {
  1381. this.methods = methods;
  1382. }
  1383.  
  1384. int selectedPrice = 0;
  1385. int buyInc = 0;
  1386.  
  1387. boolean withdrew = false;
  1388. boolean purchased = false;
  1389.  
  1390. public boolean store(String item , int x)
  1391. {
  1392. if(x >= methods.getInventory().getEmptySlots()) buyInc = 50;
  1393. if(x >= 10) buyInc = 10;
  1394. if(x >= 5 && x <=10) buyInc = 5;
  1395. if(x <= 5) buyInc = 1;
  1396.  
  1397.  
  1398. if(item == "Waterskin(4)")
  1399. {
  1400. selectedPrice = 40*x;
  1401. }else if (item == "Shantay pass")
  1402. {
  1403. selectedPrice = 7*x;
  1404. }
  1405. if(methods.getBank().isOpen())
  1406. {
  1407. if (methods.getInventory().contains("Waterskin(4)")) methods.getBank().depositAll();
  1408. if (methods.getBank().contains("Waterskin(4)")) return true;
  1409. if (methods.getInventory().getEmptySlots() < x) methods.getBank().depositAll();
  1410. if (!methods.getInventory().contains("Coins") || (methods.getInventory().contains("Coins")
  1411. && methods.getInventory().getItemInSlot(methods.getInventory().getSlot("Coins")).getAmount() < selectedPrice))
  1412. methods.getBank().withdraw("Coins", selectedPrice);
  1413. if (methods.getInventory().getItemInSlot(methods.getInventory().getSlot("Coins")) != null &&
  1414. methods.getInventory().getItemInSlot(methods.getInventory().getSlot("Coins")).getAmount() >= selectedPrice
  1415. && methods.getBank().close()) withdrew = true;
  1416.  
  1417. } else if (!withdrew)
  1418. {
  1419. if (methods.getObjects().closest("Bank chest") != null &&
  1420. methods.getObjects().closest("Bank chest").interact("Use")) {
  1421. new ConditionalSleep(5000) {
  1422. @Override
  1423. public boolean condition() {
  1424. return methods.getBank().isOpen();
  1425. }
  1426. }.sleep();
  1427. }
  1428. }
  1429.  
  1430.  
  1431. if (!methods.getStore().isOpen() && withdrew && !purchased && methods.getNpcs().closest("Shantay") != null
  1432. && methods.getNpcs().closest("Shantay").interact("Trade")) {
  1433. new ConditionalSleep(5000) {
  1434. @Override
  1435. public boolean condition() {
  1436. return methods.getStore().isOpen();
  1437. }
  1438. }.sleep();
  1439. } else if(methods.getStore().isOpen())
  1440. {
  1441. new ConditionalSleep(5000) {
  1442. @Override
  1443. public boolean condition() {
  1444. return methods.getStore().buy(item, buyInc);
  1445. }
  1446. }.sleep();
  1447. }
  1448. if((methods.getInventory().getItemInSlot(methods.getInventory().getSlot(item)) !=null &&
  1449. methods.getInventory().getItemInSlot(methods.getInventory().getSlot(item)).getAmount() >= x
  1450. || methods.getInventory().getItemInSlot(methods.getInventory().getSlot("Coins")).getAmount() <= 50) ||
  1451. methods.getInventory().isFull())
  1452. {
  1453. withdrew = false;
  1454. } else
  1455. withdrew = true;
  1456.  
  1457. return false;
  1458. }
  1459.  
  1460. }
  1461.  
  1462. import org.osbot.rs07.api.map.Area;
  1463. import org.osbot.rs07.api.map.constants.Banks;
  1464.  
  1465. public class Areas
  1466. {
  1467. Area[] tmAreas = {new Area(3432, 3533, 3448, 3567), //banshee
  1468. new Area(2898, 9823, 2927, 9841), //bat
  1469. new Area(3014, 3297, 3020, 3282), //bird
  1470. new Area(2688, 3349, 2718, 3324), //bear
  1471. new Area(3142, 9580, 3158, 9554), //cave bug
  1472. new Area(2774, 10005, 2811, 9989), //cave crawler
  1473. new Area(3142, 9568, 3161, 9537), //cave slime
  1474. new Area(3253, 3255, 3265, 3287), // Cows
  1475. new Area(3405, 3530, 3431, 3552), //Hands
  1476. new Area(3394, 3046, 3447, 3009), //Lizard
  1477. new Area(3374, 2890, 3394, 2939), //jackals
  1478. new Area(3013, 9853, 3041, 9819), //Dwarf
  1479. new Area(3236, 9919, 3245, 9911), //ghosts
  1480. new Area(1855, 5233, 1867, 5213), //goblin
  1481. new Area(2992, 3466, 3023, 3489), //Ice fiend
  1482. new Area(3314,9492,3335,9517), //Kalphite
  1483. new Area(1870, 5223, 1882, 5208), //minotaur
  1484. new Area(2866, 3183, 2888, 3138), //Monkeys
  1485. new Area(3215, 9875, 3242, 9857), //Rats
  1486. new Area(3295, 3275, 3303, 3315), //Scorpions
  1487. new Area(3093, 9915, 3103, 9887), //Skeletons
  1488. new Area(3156, 3252, 3180, 3219), //Spider
  1489. new Area(1868, 5224, 1875, 5245), //wolves
  1490. new Area(3138, 9881, 3151, 9904)}; //Zombies
  1491.  
  1492.  
  1493. Area[] tmBanks = {Banks.CANIFIS, //banshee
  1494. Banks.FALADOR_WEST, //bats
  1495. Banks.FALADOR_EAST, //bird
  1496. Banks.ARDOUGNE_SOUTH, //bear
  1497. Banks.DRAYNOR, //cave bug
  1498. Banks.CAMELOT, // cave crawler
  1499. Banks.DRAYNOR, //cave slime
  1500. Banks.LUMBRIDGE_UPPER, // Cows
  1501. Banks.CANIFIS, //Hands
  1502. new Area(3298, 3126, 3310, 3117), //Lizards (Desert Bank)
  1503. new Area(3298, 3126, 3310, 3117), //dogs (Desert Bank)
  1504. Banks.EDGEVILLE, //dwarf
  1505. Banks.VARROCK_EAST, //ghosts
  1506. Banks.EDGEVILLE, //goblin
  1507. Banks.EDGEVILLE, //Icefiend
  1508. new Area(3298, 3126, 3310, 3117), //Kalphites (Desert Bank)
  1509. Banks.EDGEVILLE, //minotaur
  1510. Banks.PEST_CONTROL, //Monkeys
  1511. Banks.VARROCK_EAST, //Rats
  1512. Banks.AL_KHARID, // Scorpions
  1513. Banks.EDGEVILLE, //Skeletons
  1514. Banks.LUMBRIDGE_UPPER, //Spider
  1515. Banks.EDGEVILLE, //Wolves
  1516. Banks.EDGEVILLE}; //Zombies
  1517.  
  1518. public Area getArea(int x)
  1519. {
  1520. return tmAreas[x];
  1521. }
  1522. public Area getBank(int x)
  1523. {
  1524. return tmBanks[x];
  1525. }
  1526.  
  1527. }
  1528.  
  1529.  
  1530. import javax.swing.*;
  1531. import javax.swing.border.EmptyBorder;
  1532. import java.awt.*;
  1533.  
  1534. public class GUI {
  1535. private final JFrame mainDialog;
  1536. private final JComboBox<Masters> MasterSelector;
  1537. int status = -10;
  1538. boolean CStatus = false;
  1539.  
  1540. private boolean started;
  1541.  
  1542. public GUI() {
  1543.  
  1544. mainDialog = new JFrame();
  1545. mainDialog.setTitle("Slayer");
  1546.  
  1547. JPanel mainPanel = new JPanel();
  1548. mainPanel.setLayout(new GridBagLayout());
  1549. mainPanel.setBorder(new EmptyBorder(20, 20, 20, 20));
  1550. mainDialog.getContentPane().add(mainPanel);
  1551.  
  1552. JPanel SlayerPanel = new JPanel();
  1553. SlayerPanel.setLayout(new GridBagLayout());
  1554. GridBagConstraints c = new GridBagConstraints();
  1555.  
  1556.  
  1557. JLabel SlayerSelectionLabel = new JLabel("Select Slayer Master: ");
  1558. c.fill = GridBagConstraints.BOTH;
  1559. c.gridx = 0;
  1560. c.gridy = 0;
  1561. c.weightx = 0.5;
  1562. SlayerPanel.add(SlayerSelectionLabel,c);
  1563.  
  1564.  
  1565. MasterSelector = new JComboBox<>(Masters.values());
  1566. SlayerPanel.add(MasterSelector);
  1567. c.fill = GridBagConstraints.BOTH;
  1568. c.gridx = 1;
  1569. c.gridy = 0;
  1570. c.weighty = 0.5;
  1571. mainPanel.add(SlayerPanel,c);
  1572.  
  1573.  
  1574. JLabel meleeSelectionLabel = new JLabel("Select Melee Gear Including Food:");
  1575. c.gridx = 0;
  1576. c.gridy = 2;
  1577. c.anchor = GridBagConstraints.LINE_END;
  1578. SlayerPanel.add(meleeSelectionLabel,c);
  1579.  
  1580.  
  1581. JButton MeleeButton = new JButton("Melee");
  1582. MeleeButton.addActionListener(e -> {
  1583. started = true;
  1584. CStatus = true;
  1585. status = -9;
  1586. });
  1587. c.gridx = 1;
  1588. c.gridy =2;
  1589. SlayerPanel.add(MeleeButton,c);
  1590.  
  1591. JLabel rangedSelectionLabel = new JLabel("Select Ranged Gear:");
  1592. c.gridx = 0;
  1593. c.gridy = 4;
  1594. SlayerPanel.add(rangedSelectionLabel,c);
  1595.  
  1596.  
  1597. JButton rangeButton = new JButton("Range");
  1598. rangeButton.addActionListener(e -> {
  1599. started = true;
  1600. CStatus = true;
  1601. status = -8;
  1602. });
  1603. c.gridx = 1;
  1604. c.gridy =4;
  1605. SlayerPanel.add(rangeButton,c);
  1606.  
  1607. JLabel mageSelectionLabel = new JLabel("Select Mage Gear:");
  1608. c.gridx = 0;
  1609. c.gridy =5;
  1610. SlayerPanel.add(mageSelectionLabel,c);
  1611.  
  1612.  
  1613. JButton mageButton = new JButton("Mage");
  1614. mageButton.addActionListener(e -> {
  1615. started = true;
  1616. CStatus = true;
  1617. status = -7;
  1618. });
  1619. c.gridx = 1;
  1620. c.gridy =5;
  1621. SlayerPanel.add(mageButton,c);
  1622.  
  1623. JButton startButton = new JButton("Start");
  1624. startButton.addActionListener(e -> {
  1625. started = true;
  1626. CStatus = true;
  1627. status = 0;
  1628. close();
  1629. });
  1630.  
  1631. c.gridx = 0;
  1632. c.gridy =6;
  1633. SlayerPanel.add(startButton,c);
  1634.  
  1635. mainDialog.pack();
  1636. }
  1637.  
  1638. public boolean isStarted() {
  1639. return started;
  1640. }
  1641.  
  1642. public int getStatus() {
  1643. return status;
  1644. }
  1645.  
  1646. public boolean getCStatus() {
  1647. return CStatus;
  1648. }
  1649.  
  1650. public int setStatus(boolean x) {
  1651. CStatus = x;
  1652. return status;
  1653. }
  1654.  
  1655. public void open() {
  1656. mainDialog.setVisible(true);
  1657. }
  1658.  
  1659. public void close() {
  1660. mainDialog.setVisible(false);
  1661. mainDialog.dispose();
  1662. }
  1663. }
  1664.  
  1665. enum Masters {
  1666. Turael,
  1667. a,
  1668. b,
  1669. c;
  1670.  
  1671. @Override
  1672. public String toString() {
  1673. return name().toLowerCase();
  1674. }
  1675. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement