Guest User

Untitled

a guest
Jul 20th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.25 KB | None | 0 0
  1. import java.awt.Color;
  2. import java.awt.Font;
  3. import java.awt.Graphics;
  4. import java.awt.Point;
  5. import java.util.Map;
  6. import org.rsbot.bot.Bot;
  7. import org.rsbot.event.events.ServerMessageEvent;
  8. import org.rsbot.event.listeners.PaintListener;
  9. import org.rsbot.event.listeners.ServerMessageListener;
  10. import org.rsbot.script.GEItemInfo;
  11. import org.rsbot.script.*;
  12. import org.rsbot.script.ScriptManifest;
  13. import org.rsbot.script.wrappers.RSItemTile;
  14. import org.rsbot.script.wrappers.RSTile;
  15. import org.rsbot.script.wrappers.*;
  16. import org.rsbot.script.Bank;
  17. import org.rsbot.util.ScreenshotUtil;
  18. @ScriptManifest(authors = { "xXNoiceXx & Preston" }, category = "Other", name = "Epic Vial Filler", version = 1.0, description =
  19. "<html><head>" +
  20. "</head><body>" +
  21. "<center><h2>Epic Vial Filler</h2></center>" +
  22. "<center> </center>" +
  23. "<center>Start This Script in The West Bank of Varock With Empty Vials in The First Slot of Your Bank!</center>" +
  24. "<center> </center>" +
  25. "<center> </center>" +
  26. "<center>Great For Getting Vials Filled For Herblore!</center>" +
  27. "<center> </center>" +
  28. "<center> </center>" +
  29. "<center>This Script Fills Vials at The Varrock Main Fountain and Banks at The West Varrock Bank!</center>" +
  30. "<center> </center>" +
  31. "<center><strong>Created by xXNoiceXx & Preston!</strong></center>" +
  32. "</body></html>")
  33. public class EpicVialFiller extends Script implements PaintListener {
  34. final ScriptManifest properties = getClass().getAnnotation(ScriptManifest.class);
  35. //OTHER VARIABLES
  36. private int runEnergy = random(25, 90);
  37. public long startTime = System.currentTimeMillis();
  38. private String status = "";
  39. public int loads = 0;
  40.  
  41. public void onRepaint(Graphics g) {
  42. if (isLoggedIn()) {
  43. long millis = System.currentTimeMillis() - startTime;
  44. long hours = millis / (1000 * 60 * 60);
  45. millis -= hours * (1000 * 60 * 60);
  46. long minutes = millis / (1000 * 60);
  47. millis -= minutes * (1000 * 60);
  48. long seconds = millis / 1000;
  49. long minutes2 = minutes + (hours * 60);
  50. g.setColor(Color.black.darker());
  51. g.fillRoundRect(553, 211, 180,100, 15, 15);
  52. g.setFont(new Font("Comic Sans", Font.BOLD, 16));
  53. g.setColor(Color.green);
  54. g.drawString("Noice's Vial Filler v1.0" , 560, 242);
  55. g.setColor(Color.red);
  56. g.setFont(new Font("Times New Roman", Font.BOLD, 12));
  57. g.drawString("Time running: " + hours + ":" + minutes + ":" + seconds , 558, 265);
  58. g.setColor(Color.white);
  59. g.drawString("Status : " + status , 558, 280);
  60. g.setColor(Color.cyan);
  61. g.drawString("Loads Filled/Banked : " + loads, 558, 295);
  62.  
  63. }
  64. }
  65. private void startRunning(final int energy) {
  66. if (getEnergy() >= energy && !isRunning()) {
  67. runEnergy = random(35, 70);
  68. setRun(true);
  69. wait(random(500, 750));
  70. }
  71. }
  72. //ITEM ID
  73. public int[] emptyvial = { 229 };
  74. public int[] emptyvials = { 229 };
  75. public int[] waterviaal = { 227 };
  76. public int[] watervial = { 227 };
  77. public int[] fountain = { 24265 };
  78.  
  79. //PATHS
  80. RSTile[] toBank = { new RSTile(3206, 3429), new RSTile(3212, 3428), new RSTile(3208, 3428), new RSTile(3202, 3429), new RSTile(3195, 3429), new RSTile(3186, 3435)};
  81. RSTile[] toWater = { new RSTile(3186, 3435), new RSTile(3193, 3429), new RSTile(3200, 3429), new RSTile(3209, 3429)};
  82. //TILES
  83. RSTile atfount = new RSTile(3212, 3429);
  84. RSTile atbank = new RSTile(3187, 3463);
  85. //NPC
  86. public int bank = 11402;
  87.  
  88. public boolean onStart(Map<String, String>args) {
  89. startTime = System.currentTimeMillis();
  90. openTab(4);
  91. return true;
  92. }
  93. public boolean withdraw() {
  94. if (RSInterface.getInterface(762).isValid()){
  95. //bank.atItem(emptyvial, "Withdraw-All");
  96. moveMouse(new Point(52, 108), 5, 5);
  97. wait(random(500,1000));
  98. clickMouse(false);
  99. wait(random(100,200));
  100. atMenu("Withdraw-All");
  101. wait(random(100,150));
  102. moveMouse(489, 35);
  103. wait(random(500, 1000));
  104. clickMouse(true);
  105. }
  106. return true;
  107. }
  108. public void onFinish(){
  109. log("Thank You For Using My Script!");
  110. return;
  111. }
  112. public boolean openBank() {
  113. final RSNPC bank = getNearestFreeNPCByID(6533);
  114. if (bank == null) {
  115. return false;
  116. }
  117. if (!tileOnScreen(bank.getLocation())) {
  118. turnToTile(bank.getLocation(), 10);
  119. }
  120. return atTile(bank.getLocation(), "Bank Banker");
  121. }
  122. public boolean bankopen() {
  123. RSObject bankbooth = getNearestObjectByID(11402);
  124. atObject(bankbooth, "Use-quickly");
  125. wait(random(1000, 2000));
  126. status = "Opening Bank";
  127. return(true);
  128. }
  129. public boolean usevial() {
  130. openTab(4);
  131. moveMouse(705, 454);
  132. clickMouse(true);
  133. wait(random(500, 800));
  134. RSObject fountain = getNearestObjectByID(24265);
  135. atObject(fountain, "Use Vial");
  136. status = "Filling Vials";
  137. return true;
  138. }
  139. public boolean usevialw() {
  140. openTab(4);
  141. moveMouse(705, 454);
  142. clickMouse(true);
  143. wait(random(500, 800));
  144. RSObject fountain = getNearestObjectByID(24265);
  145. atObject(fountain, "Use Vial");
  146. wait(random(2000, 4000));
  147. status = "Filling Vials";
  148. return true;
  149. }
  150. public boolean isIdle() {
  151. return !getMyPlayer().isMoving() && getMyPlayer().getAnimation() == -1;
  152. }
  153. public boolean animationIs() {
  154. if (getMyPlayer().getAnimation() == 832) {
  155. }
  156. return true;
  157. }
  158. public boolean atfountain() {
  159. return (distanceTo(atfount) < 5);
  160. }
  161. public boolean atbank() {
  162. return (distanceTo(getNearestObjectByID(bank)) <= 5);
  163. }
  164. public boolean needtobank() {
  165. return (getMyPlayer().isInCombat() == true);
  166. }
  167. public boolean isInventoryFull() {
  168. return getInventoryCount(watervial) == 28;
  169. }
  170. public boolean need2bank() {
  171. return (getInventoryCount(watervial) == 28);
  172. }
  173. public boolean stabledeposit() {
  174. if(getInventoryCount(watervial) == 28) {
  175. if(RSInterface.getInterface(762).isValid()) {
  176. moveMouse(399, 311);
  177. clickMouse(true);
  178. loads++;
  179. }
  180. }
  181. return true;
  182. }
  183. public void stableclose() {
  184. if (RSInterface.getInterface(762).isValid()){
  185. atInterface(762, 37);
  186. wait(random(500, 800));
  187. }
  188. }
  189. public int loop() {
  190. if (getMyPlayer().isInCombat()) {
  191. log("We are in combat, banking with what we got!");
  192. stopScript();
  193. }
  194. if (isInventoryFull()) {
  195. startRunning(runEnergy);
  196. walkPathMM(toBank);
  197. status = "Running to Bank";
  198. }
  199. if (atbank()) {
  200. if(getInventoryCount(watervial) == 28) {
  201. wait(random(500, 1000));
  202. }
  203. }
  204. if (atfountain()) {
  205. if(getInventoryCount(emptyvial) == 28) {
  206. if (isIdle()) {
  207. usevial();
  208. status = "Filling Vials";
  209. }
  210. }
  211. }
  212. if (animationIs()) {
  213. wait(random(2000, 4000));
  214. status = "Filling and Waiting";
  215. }
  216. if (getInventoryCount(emptyvial) == 0) {
  217. if (atbank()) {
  218. wait(random(500, 1000));
  219. bankopen();
  220. stabledeposit();
  221. withdraw();
  222. stableclose();
  223. status = "All Banking";
  224. }
  225. }
  226. if (getInventoryCount(emptyvial) == 28) {
  227. startRunning(runEnergy);
  228. walkPathMM(toWater);
  229. status = "Walking to Fountain";
  230. }
  231. return(10);
  232. }
  233. }
Add Comment
Please, Sign In to add comment