Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.65 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. import java.awt.Point;
  7. import java.util.Map;
  8.  
  9. import org.rsbot.bot.Bot;
  10. import org.rsbot.event.events.ServerMessageEvent;
  11. import org.rsbot.event.listeners.PaintListener;
  12. import org.rsbot.event.listeners.ServerMessageListener;
  13. import org.rsbot.script.Script;
  14. import org.rsbot.script.ScriptManifest;
  15. import org.rsbot.script.methods.Game;
  16. import org.rsbot.script.methods.Skills;
  17. import org.rsbot.script.wrappers.RSComponent;
  18. import org.rsbot.script.wrappers.RSInterface;
  19.  
  20. @ScriptManifest(authors = { "Boolean & Extinct" }, keywords = "Crafting", name = "Glass Blower", description = "Make sure you scroll the interface all the way over to the right")
  21. public class EGlassOrbs extends Script implements PaintListener,
  22. ServerMessageListener {
  23. public int orb = 567, glass = 1775, pipe = 1785;
  24. public long startTime = 0, millis = 0, hours = 0, minutes = 0, seconds = 0,
  25. tri = 0;
  26. public int currentLevel, craft = 0;
  27. public int startExp = 0, startLevel = 0;
  28. public double expGained = 0, expPerOrb = 52.5, expPerHour = 0;
  29. public int count = 0, countPerHour = 0;
  30. public int orbCheck = -1, currentOrbs = 0;
  31.  
  32. public boolean onStart() {
  33. log.info("Getting data for script...");
  34. startTime = System.currentTimeMillis();
  35. craft = Skills.CRAFTING;
  36. startLevel = skills.getCurrentLevel(craft);
  37. startExp = skills.getCurrentExp(craft);
  38. camera.setPitch(true);
  39. log.info("Done, starting!");
  40. return true;
  41. }
  42.  
  43. public void antiBan() {
  44. int randomNum = random(1, 45);
  45. int r = random(1, 50);
  46. if (randomNum == 6) {
  47. if (r == 1) {
  48. try {
  49. Thread.sleep(random(2000, 6000));
  50. } catch (InterruptedException e) {
  51. e.printStackTrace();
  52. }
  53. }
  54. if (r == 2) {
  55. game.openTab(random(1, 14));
  56. }
  57. if (r == 3) {
  58. mouse.moveRandomly(250);
  59. }
  60. if (r == 4) {
  61. mouse.moveRandomly(300);
  62. }
  63. if (r == 5) {
  64. mouse.moveRandomly(350);
  65. }
  66. if (r == 6) {
  67. mouse.moveRandomly(200);
  68. }
  69. if (r == 7) {
  70. camera.setAngle(random(100, 360));
  71. }
  72. if (r == 8) {
  73. camera.setAngle(random(100, 360));
  74. }
  75. if (r == 9) {
  76. camera.setAngle(random(100, 360));
  77. }
  78. if (r == 10) {
  79. camera.setAngle(random(100, 360));
  80. }
  81. if (r == 11) {
  82. if (game.getCurrentTab() != Game.TAB_INVENTORY) {
  83. game.openTab(Game.TAB_INVENTORY);
  84. } else
  85. return;
  86. }
  87. if (r == 35) {
  88. if (game.getCurrentTab() != Game.TAB_STATS) {
  89. game.openTab(Game.TAB_STATS);
  90. mouse.move(random(680, 730), random(355, 370));
  91. sleep(random(1500, 5000));
  92. }
  93. }
  94. }
  95. }
  96.  
  97. public boolean doOrbs() {
  98. if (inventory.contains(pipe) && inventory.contains(glass)) {
  99. if (!bank.isOpen()) {
  100. if (System.currentTimeMillis() - tri > 4500) {
  101. sleep(random(2000, 2800));
  102. inventory.getItem(pipe).doClick(true);
  103. sleep(random(350, 400));
  104. if (inventory.isItemSelected()) {
  105. inventory.getItem(glass).doClick(true);
  106. sleep(random(2500, 3000));
  107. mouse.move(random(250, 305), random(452, 448));
  108. mouse.click(true);
  109. sleep(random(5500,7400)); {
  110. }
  111. }
  112. } else {
  113. antiBan();
  114. }
  115. } else {
  116. bank.close();
  117. }
  118. }
  119. return false;
  120. }
  121.  
  122. public boolean manageBanking() {
  123. if (!inventory.contains(glass)) {
  124. if (bank.isOpen()) {
  125. if (inventory.contains(pipe)) {
  126. if (inventory.contains(orb)) {
  127. bank.depositAllExcept(pipe);
  128. sleep(random(1800, 2100));
  129. } else {
  130. if (bank.getCount(glass) > 0) {
  131. bank.withdraw(glass, 0);
  132. sleep(random(1400, 1600));
  133. } else {
  134. log.info("No more glass in bank. Stopping.");
  135. stopScript();
  136. }
  137. }
  138. } else {
  139. if (bank.getCount(pipe) > 0) {
  140. bank.withdraw(pipe, 1);
  141. sleep(random(1500, 2000));
  142. } else {
  143. log.info("No pipe in inventory or in bank. Stopping.");
  144. stopScript();
  145. }
  146. }
  147. } else {
  148. bank.open();
  149. sleep(random(2000, 2600));
  150. }
  151. }
  152. return false;
  153. }
  154.  
  155. @Override
  156. public int loop() {
  157. doOrbs();
  158. manageBanking();
  159. return 100;
  160. }
  161.  
  162. private final Color color1 = new Color(255, 204, 0, 180);
  163. private final Color color2 = new Color(0, 0, 0);
  164.  
  165. private final BasicStroke stroke1 = new BasicStroke(1);
  166.  
  167. private final Font font1 = new Font("Gill Sans MT", 1, 12);
  168. private final Font font2 = new Font("Gisha", 0, 11);
  169.  
  170. public void onRepaint(Graphics g1) {
  171. Graphics2D g = (Graphics2D) g1;
  172. count = (int) (expGained / expPerOrb);
  173. currentLevel = skills.getCurrentLevel(craft);
  174. expGained = skills.getCurrentExp(craft) - startExp;
  175. millis = System.currentTimeMillis() - startTime;
  176. hours = millis / (1000 * 60 * 60);
  177. millis -= hours * (1000 * 60 * 60);
  178. minutes = millis / (1000 * 60);
  179. millis -= minutes * (1000 * 60);
  180. seconds = millis / 1000;
  181. countPerHour = (int) ((count) * 3600000D / (System.currentTimeMillis() - startTime));
  182. expPerHour = (int) ((expGained) * 3600000D / (System
  183. .currentTimeMillis() - startTime));
  184.  
  185. g.setColor(color1);
  186. g.fillRoundRect(4, 5, 146, 180, 16, 16);
  187. g.setColor(color2);
  188. g.setStroke(stroke1);
  189. g.drawRoundRect(4, 5, 146, 180, 16, 16);
  190. g.setFont(font1);
  191. g.drawString("Glass Blower - Boolean", 15, 25);
  192. g.setFont(font2);
  193. g.drawString("Exp. gained: " + (int) (expGained), 10, 50);
  194. g.drawString("Exp. p/h: " + (int) (expPerHour), 10, 70);
  195. g.drawString("Glass blowed: " + count, 10, 90);
  196. g.drawString("Blowed p/h: " + countPerHour, 10, 110);
  197. g.drawString("Exp TNL: " + skills.getExpToNextLevel(craft), 10, 130);
  198. g.drawLine(4, 155, 150, 155);
  199. g.drawLine(4, 164, 150, 164);
  200. g.drawString("Blows TNL: "
  201. + (int) (skills.getExpToNextLevel(craft) / expPerOrb), 10, 150);
  202. g.drawString("Time running: " + hours + ":" + minutes + ":" + seconds,
  203. 10, 180);
  204. }
  205.  
  206. public void onFinish() {
  207. env.saveScreenshot(true);
  208. expGained = skills.getCurrentExp(craft) - startExp;
  209. long millis = System.currentTimeMillis() - startTime;
  210. long hours = millis / (1000 * 60 * 60);
  211. millis -= hours * (1000 * 60 * 60);
  212. long minutes = millis / (1000 * 60);
  213. millis -= minutes * (1000 * 60);
  214. long seconds = millis / 1000;
  215. log.info("Thanks for using.");
  216. log.info("Runtime: " + hours + ":" + minutes + ":" + seconds);
  217. log.info("Glass blowed: " + count);
  218. log.info("Experience earned: " + expGained);
  219. }
  220.  
  221. @Override
  222. public void serverMessageRecieved(ServerMessageEvent e) {
  223. String m = e.getMessage().toLowerCase();
  224. if (m.contains("make an orb")) {
  225. count++;
  226. tri = System.currentTimeMillis();
  227. }
  228. }
  229. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement