Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.79 KB | None | 0 0
  1. import java.awt.BasicStroke;
  2. import java.awt.Color;
  3. import java.awt.Font;
  4. import java.awt.Graphics;
  5. import java.awt.Graphics2D;
  6.  
  7. import com.rsbuddy.event.events.MessageEvent;
  8. import com.rsbuddy.event.listeners.MessageListener;
  9. import com.rsbuddy.event.listeners.PaintListener;
  10. import com.rsbuddy.script.ActiveScript;
  11. import com.rsbuddy.script.Manifest;
  12. import com.rsbuddy.script.methods.Bank;
  13.  
  14. import com.rsbuddy.script.methods.Calculations;
  15. import com.rsbuddy.script.methods.Inventory;
  16. import com.rsbuddy.script.methods.Objects;
  17. import com.rsbuddy.script.methods.Players;
  18. import com.rsbuddy.script.methods.Skills;
  19. import com.rsbuddy.script.methods.Walking;
  20. import com.rsbuddy.script.wrappers.Area;
  21. import com.rsbuddy.script.wrappers.GameObject;
  22. import com.rsbuddy.script.wrappers.Tile;
  23. import com.rsbuddy.script.wrappers.TilePath;
  24.  
  25. @Manifest(name = "WaterCrafter", description = "Crafts water runes P2P and F2P", authors = "skutr3")
  26. public class WaterCrafter extends ActiveScript implements
  27. PaintListener {
  28.  
  29. long startExp;
  30. long gainedExp;
  31. long currentExp;
  32. int[] essenceID = {7936, 1436};
  33. int ruinsID = 2454;
  34. int altarID = 2480;
  35. int waterRuneID = 555;
  36. int portalID = 7389;
  37. int boothID = 2213;
  38. Tile entranceTile = (new Tile(3183, 3164));
  39. Tile altarTile = (new Tile(3491, 4832));
  40. Tile portalTile = (new Tile(3492, 4833));
  41. Area bankArea = new Area(new Tile(3092, 3240), new Tile(3095, 3246));
  42. Area altarArea = new Area(new Tile(3494, 4831), new Tile(3479, 4839));
  43. Area ruinsArea = new Area(new Tile(3175, 3156), new Tile(3191, 3170));
  44. TilePath altarWalk = Walking.newTilePath(new Tile[]{new Tile(3092, 3247),
  45. new Tile(3101, 3250), new Tile(3104, 3238), new Tile(3110, 3228),
  46. new Tile(3121, 3226), new Tile(3134, 3218), new Tile(3144, 3210),
  47. new Tile(3153, 3200), new Tile(3156, 3188), new Tile(3160, 3175),
  48. new Tile(3167, 3164), new Tile(3176, 3160), new Tile(3183, 3164)});
  49.  
  50. TilePath walking = Walking.newTilePath(new Tile[]{new Tile(3490, 4833),
  51. new Tile(3486, 4385)});
  52.  
  53. public enum State {
  54. WALK_TO_ALTAR, WALK_TO_BANK, BANKING, CRAFTING_RUNES, ENTER_RUINS, EXIT_RUINS, WAITING
  55. }
  56.  
  57. private State getState() {
  58. if (needBank() && atBank()) {
  59. return State.BANKING;
  60. } else if (Inventory.getCount(essenceID) > 0) {
  61. if (!atAltar() && Inventory.getCount(essenceID) > 0) {
  62. return State.WALK_TO_ALTAR;
  63. } else if (ruinsArea.contains(Players.getLocal().getLocation())) {
  64. return State.ENTER_RUINS;
  65. } else if (altarArea.contains(Players.getLocal().getLocation())) {
  66. return State.CRAFTING_RUNES;
  67. }
  68. } else {
  69. if (altarArea.contains(Players.getLocal().getLocation())) {
  70. return State.EXIT_RUINS;
  71. } else if (!atBank() && Inventory.contains(waterRuneID)) {
  72. return State.WALK_TO_BANK;
  73. }
  74. }
  75. return State.WAITING;
  76. }
  77.  
  78. public boolean onStart() {
  79. startExp = Skills.getCurrentExp(Skills.RUNECRAFTING);
  80. log("Hello. This script is in alpha stages. That is the one before Beta. Please Report bugs.....");
  81. log("Start at Draynor bank with essence you want in a separate bank tab");
  82. return true;
  83. }
  84.  
  85. boolean needBank() {
  86. return Inventory.contains(waterRuneID)
  87. || Inventory.getCount(essenceID) == 0;
  88. }
  89.  
  90.  
  91. boolean atBank() {
  92. return bankArea.contains(Players.getLocal().getLocation());
  93. }
  94.  
  95. boolean atAltar() {
  96. return altarArea.contains(Players.getLocal().getLocation());
  97.  
  98. }
  99.  
  100.  
  101. public void craftRune() {
  102. log("Crafting");
  103. sleep(150, 200);
  104. GameObject altar = Objects.getNearest(altarID);
  105. altar.interact("Craft-rune");
  106.  
  107. }
  108.  
  109. public void enterRuins() {
  110. log("Entering Ruins");
  111. GameObject ruins = Objects.getNearest(ruinsID);
  112. ruins.interact("Enter");
  113.  
  114. }
  115.  
  116. public void PortalTravel() {
  117. log("Exiting Ruins");
  118. GameObject portal = Objects.getNearest(portalID);
  119. portal.interact("Enter");
  120. sleep(2000, 3000);
  121. }
  122.  
  123. public void Bank() {
  124. log("Banking");
  125. GameObject booth = Objects.getNearest(boothID);
  126. if (booth.isOnScreen() && booth != null) {
  127. booth.interact("Use-Quickly");
  128. sleep(150, 200);
  129. Bank.depositAll();
  130. sleep(100, 250);
  131. Bank.withdraw(7936, 28);
  132. Bank.withdraw(1436, 28);
  133. sleep(100, 250);
  134. Bank.close();
  135. }
  136. }
  137.  
  138. public void setRun() {
  139. Walking.setRun(true);
  140. }
  141.  
  142. public void walkToAltar() {
  143.  
  144. altarWalk.traverse();
  145. sleep(600, 950);
  146. }
  147.  
  148. @Override
  149. public int loop() {
  150. switch (getState()) {
  151.  
  152. case BANKING:
  153. Bank();
  154.  
  155. break;
  156. case WALK_TO_ALTAR:
  157. log("To Altar");
  158. walkToAltar();
  159. break;
  160. case ENTER_RUINS:
  161. enterRuins();
  162. break;
  163. case CRAFTING_RUNES:
  164. log("Hello Altar");
  165. walking.traverse();
  166. sleep(150, 200);
  167. craftRune();
  168. break;
  169. case EXIT_RUINS:
  170. log("Goodbye altar");
  171. walking.reverse().traverse();
  172. sleep(150, 250);
  173. PortalTravel();
  174. break;
  175. case WALK_TO_BANK:
  176. log("To bank");
  177. altarWalk.reverse().traverse();
  178. sleep(600, 950);
  179. break;
  180. }
  181. return 590;
  182.  
  183. }
  184.  
  185.  
  186. private final Color color1 = new Color(18, 16, 16, 129);
  187. private final Color color2 = new Color(232, 231, 236);
  188. private final Color color3 = new Color(238, 234, 234);
  189.  
  190. private final BasicStroke stroke1 = new BasicStroke(1);
  191.  
  192. private final Font font1 = new Font("Bitstream Charter", 0, 16);
  193. private final Font font2 = new Font("Bitstream Charter", 0, 15);
  194.  
  195. public void onRepaint(Graphics g1) {
  196.  
  197. currentExp = Skills.getCurrentExp(Skills.RUNECRAFTING);
  198. gainedExp = (currentExp - startExp);
  199.  
  200. Graphics2D g = (Graphics2D) g1;
  201. g.setColor(color1);
  202. g.fillRoundRect(550, 207, 182, 255, 16, 16);
  203. g.setColor(color2);
  204. g.setStroke(stroke1);
  205. g.drawRoundRect(550, 207, 182, 255, 16, 16);
  206. g.setFont(font1);
  207. g.setColor(color3);
  208. g.drawString("WaterCrafter by skutr3", 559, 225);
  209. g.setFont(font2);
  210. g.drawString("Xp gained:" + gainedExp, 563, 263);
  211. }
  212.  
  213. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement