Advertisement
Tezlaz

Fountain

Aug 6th, 2016
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.54 KB | None | 0 0
  1. package scripts.tasks;
  2.  
  3. import org.tribot.api.General;
  4. import org.tribot.api.Timing;
  5. import org.tribot.api.input.Mouse;
  6. import org.tribot.api2007.Player;
  7. import org.tribot.api2007.Projection;
  8. import org.tribot.api2007.ChooseOption;
  9. import org.tribot.api2007.Game;
  10. import org.tribot.api2007.Inventory;
  11. import org.tribot.api2007.NPCChat;
  12. import org.tribot.api2007.Objects;
  13. import org.tribot.api2007.WebWalking;
  14. import org.tribot.api2007.types.RSItem;
  15. import org.tribot.api2007.types.RSNPC;
  16. import org.tribot.api2007.types.RSObject;
  17. import org.tribot.api2007.types.RSTile;
  18.  
  19. import scripts.data.Conditions;
  20. import scripts.data.Vars;
  21.  
  22. /* This class has the required functions to talk to Romeo
  23. * and to wet the clay at the varrock water fountain.
  24. */
  25.  
  26. /* This class has the required functions to talk to Romeo
  27. * and to wet the clay at the varrock water fountain.
  28. */
  29.  
  30. public class Fountain {
  31.  
  32. public static boolean isBucketFull = false;
  33. public static RSItem[] bucketCondition;
  34. private static int clayAmount;
  35. public static boolean isClaySoft = false;
  36. private static boolean hasTalkedToRomeo = false;
  37.  
  38. // Checks for if the player is within the fountain area.
  39. public static boolean IsNearFountain() {
  40. return Vars.VARROCK_FOUNTAIN_AREA.contains(Player.getPosition());
  41. }
  42.  
  43. // Walks the player to the fountain
  44. public static void WalkToFountain() {
  45. System.out.println(Vars.accountName + " is walking to the water fountain...");
  46. // Turns on run
  47. WebWalking.setUseRun(true);
  48. WebWalking.walkTo(Vars.VARROCK_WATER_FOUNTAIN);
  49. Timing.waitCondition(Conditions.nearFountain, General.random(40000, 60000));
  50. General.sleep(3031, 3541);
  51. // Talks to Romeo to get rid of him
  52. FuckOffRomeo();
  53. if (!IsNearFountain()) {
  54. WalkToFountain();
  55. }
  56. }
  57.  
  58. private static boolean ClickNPC(RSNPC npc, String option) {
  59. // Mouse.setSpeed(General.random(100,120));
  60. RSTile loc = null;
  61. if (npc != null && npc.isOnScreen()) {
  62. loc = npc.getPosition();
  63. Mouse.move(Projection.tileToScreen(loc, 10));
  64. if (Game.isUptext(option)) {
  65. Mouse.click(1);
  66. return true;
  67. } else {
  68. Mouse.click(3);
  69. if (ChooseOption.isOpen()) {
  70. ChooseOption.select(option);
  71. }
  72. }
  73. }
  74. return false;
  75. }
  76.  
  77. // Function to start Romeo & Juliet quest.
  78. public static void FuckOffRomeo() {
  79. RSNPC[] remeo = org.tribot.api2007.NPCs.find(5037);
  80. if (ClickNPC(remeo[0], "Talk-to Romeo")) {
  81. Timing.waitCondition(Conditions.isTalkingToNPC, General.random(4000, 6000));
  82. if (NPCChat.clickContinue(true) && hasTalkedToRomeo == false) {
  83. General.sleep(1000, 1500);
  84. if (NPCChat.selectOption("Perhaps I could help to find her for you?", true)) {
  85. General.sleep(1000, 1500);
  86. if (NPCChat.clickContinue(true)) {
  87. General.sleep(1000, 1500);
  88. if (NPCChat.clickContinue(true))
  89. General.sleep(1000, 1500);
  90. if (NPCChat.clickContinue(true))
  91. General.sleep(1000, 1500);
  92. if (NPCChat.clickContinue(true))
  93. General.sleep(1000, 1500);
  94. if (NPCChat.clickContinue(true))
  95. General.sleep(1000, 1500);
  96. if (NPCChat.clickContinue(true))
  97. General.sleep(1000, 1500);
  98. if (NPCChat.clickContinue(true))
  99. General.sleep(1000, 1500);
  100. if (NPCChat.clickContinue(true))
  101. General.sleep(1000, 1500);
  102. if (NPCChat.clickContinue(true))
  103. General.sleep(1000, 1500);
  104. if (NPCChat.clickContinue(true))
  105. General.sleep(1000, 1500);
  106. if (NPCChat.selectOption("Yes, ok, I'll let her know.", true)) {
  107. General.sleep(1000, 1500);
  108. if (NPCChat.clickContinue(true))
  109. ;
  110. General.sleep(1000, 1500);
  111. if (NPCChat.clickContinue(true))
  112. ;
  113. General.sleep(1000, 1500);
  114. hasTalkedToRomeo = true;
  115.  
  116. }
  117.  
  118. }
  119. }
  120. }
  121. }
  122. }
  123.  
  124. // Wets all the clay in the player's inventory
  125. public static void WetClay() {
  126. System.out.println(Vars.accountName + " has arrived at the fountain. Will now wet clay.");
  127.  
  128. // This is a check to make sure player finishes entire inventory
  129. while (HasClayLeft() == true) {
  130.  
  131. RSObject[] fountain = Objects.findNearest(6, "Fountain");
  132. clayAmount = Inventory.find(434).length;
  133. String uptext = Game.getUptext();
  134.  
  135. for (int i = 0; i < clayAmount; i++) {
  136.  
  137. RSItem[] bucket = Inventory.find("Bucket");
  138. bucketCondition = bucket.clone();
  139. RSItem[] clay = Inventory.find(434);
  140. if (fountain != null && fountain.length > 0 && bucket != null && bucket.length > 0) {
  141. bucket[0].click();
  142. uptext = Game.getUptext();
  143.  
  144. if (uptext != null && uptext.contains("Use Bucket")) {
  145. fountain[0].click("Use");
  146. bucket[0].hover();
  147. Timing.waitCondition(Conditions.fillingBucket, General.random(1000, 1300));
  148. } else {
  149. fountain[0].click("Use");
  150. General.random(300, 500);
  151. Timing.waitCondition(Conditions.fillingBucket, General.random(1000, 1300));
  152. }
  153. }
  154.  
  155. RSItem[] fullBucket = Inventory.find("Bucket of Water");
  156. if (fullBucket != null && fullBucket.length > 0) {
  157. fullBucket[0].click();
  158. uptext = Game.getUptext();
  159.  
  160. if (uptext != null && uptext.contains("Use Bucket of water")) {
  161. clay[0].click("Use");
  162. fullBucket[0].hover();
  163. Timing.waitCondition(Conditions.hasWetClay, General.random(2000, 2200));
  164. }
  165. }
  166. }
  167.  
  168. }
  169. }
  170.  
  171. private static boolean HasClayLeft() {
  172. if (Inventory.find(1761).toString().contains("types.RSItem") && Inventory.find("Clay").length > 0) {
  173. return true;
  174. } else {
  175. return ((Inventory.find(1761).length) < (clayAmount));
  176. }
  177. }
  178.  
  179. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement