Advertisement
Guest User

Untitled

a guest
Aug 12th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.68 KB | None | 0 0
  1. import org.rsbot.script.*;
  2. import org.rsbot.script.Script;
  3. import org.rsbot.script.wrappers.*;
  4. import java.awt.*;
  5. import java.awt.event.*;
  6. import javax.swing.*;
  7. import org.rsbot.event.listeners.PaintListener;
  8. import org.rsbot.event.events.MessageEvent;
  9. import org.rsbot.event.listeners.MessageListener;
  10.  
  11. @ScriptManifest(authors = "Havefunpeeps", keywords = "", name = "Sheller", version = 1.00, description = "Makes Shells out of Dishes and Dough")
  12. public class Sheller extends Script implements PaintListener, MessageListener {
  13.  
  14. int Dough = 1953;
  15. int Shell = 2315;
  16. int Dish = 2313;
  17. public long startTime = 0;
  18. public long millis = 0;
  19. public long hours = 0;
  20. public long minutes = 0;
  21. public long seconds = 0;
  22. public long last = 0;
  23. private int profit;
  24. private int profitHour;
  25. private int shellsMade;
  26. private int shellsHour;
  27. private int PiePrice;
  28. private int ShellPrice;
  29. private int DoughPrice;
  30.  
  31. public boolean onStart(){
  32. mouse.setSpeed(random(8, 14));
  33. PiePrice = grandExchange.lookup(Pie).getGuidePrice();
  34. ShellPrice = grandExchange.lookup(Shell).getGuidePrice();
  35. DoughPrice = grandExchange.lookup(Dough).getGuidePrice();
  36. startTime = System.currentTimeMillis();
  37. return true;
  38. }
  39.  
  40. public int loop() {
  41. if(inventory.getCount(Dish) == 14) {
  42. MakeShells();
  43. }
  44. if(inventory.getCount(Shell) == 14) {
  45. Bank();
  46. }
  47. if(inventory.contains(Shell) && inventory.contains(Dough)) {
  48. antiBan();
  49. }
  50. if(inventory.contains(Dough) && inventory.getCount() == 14) {
  51. FailSafe1();
  52. }
  53. if(!bank.isOpen() && inventory.getCount() == 0) {
  54. FailSafe2();
  55. }
  56. if(!bank.isOpen() && inventory.getCount(Dough) == 28) {
  57. FailSafe3();
  58. }
  59. if(!bank.isOpen() && inventory.contains(Dish) && inventory.getCount() == 14) {
  60. FailSafe4();
  61. }
  62. return(random(100, 200));
  63. }
  64.  
  65. public void FailSafe4() {
  66. log("FailSafe4");
  67. bank.open();
  68. bank.depositAll();
  69. bank.withdraw(Dish, 14);
  70. bank.withdraw(Dough, 14);
  71. if(inventory.isFull() && inventory.getCount(Dish) == 14 && inventory.getCount(Dough) == 14) {
  72. log("Script Meltdown should have been averted");
  73. }
  74. bank.close();
  75. }
  76.  
  77. public void FailSafe3() {
  78. log("FailSafe3");
  79. bank.open();
  80. bank.depositAll();
  81. bank.withdraw(Dish, 14);
  82. bank.withdraw(Dough, 14);
  83. if(inventory.isFull() && inventory.getCount(Dish) == 14 && inventory.getCount(Dough) == 14) {
  84. log("Script Meltdown should have been averted");
  85. }
  86. bank.close();
  87. }
  88.  
  89. public void FailSafe2() {
  90. log("FailSafe2");
  91. bank.open();
  92. bank.withdraw(Dish, 14);
  93. bank.withdraw(Dough, 14);
  94. if(inventory.isFull() && inventory.getCount(Dish) == 14 && inventory.getCount(Dough) == 14) {
  95. log("Script Meltdown should have been averted");
  96. }
  97. bank.close();
  98. }
  99.  
  100. public void FailSafe1() {
  101. log("FailSafe1");
  102. if(!bank.isOpen()) {
  103. bank.open();
  104. }
  105. bank.depositAll();
  106. bank.withdraw(Dish, 14);
  107. bank.withdraw(Dough, 14);
  108. if(inventory.isFull() && inventory.getCount(Dish) == 14 && inventory.getCount(Dough) == 14) {
  109. log("Script Meltdown should have been averted");
  110. }
  111. bank.close();
  112. }
  113.  
  114.  
  115. public void Bank() {
  116. bank.open();
  117. bank.depositAll();
  118. bank.withdraw(Dish, 14);
  119. bank.withdraw(Dough, 14);
  120. bank.close();
  121. }
  122.  
  123. public void MakeShells() {
  124. RSItem DishA = inventory.getItem(Dish);
  125. RSItem DoughA = inventory.getItem(Dough);
  126. inventory.useItem(Dish, Dough);
  127. sleep(1000, 1500);
  128. if(interfaces.getComponent(905, 14).isValid()) {
  129. interfaces.getComponent(905, 14).doClick();
  130. sleep(random(600, 900));
  131. }
  132. }
  133.  
  134. public void antiBanMouse() {
  135. int randomNum1 = random(1, 50);
  136. if (randomNum1 == 1 || randomNum1 == 2 || randomNum1 == 3) {
  137. mouse.moveSlightly();
  138. mouse.moveSlightly();
  139. }
  140. if (randomNum1 == 4 || randomNum1 == 5 || randomNum1 == 6) {
  141. mouse.move(random(175, 325), random(75, 225));
  142. }
  143. if (randomNum1 == 7) {
  144. mouse.moveRandomly(10, 150);
  145. }
  146. if (randomNum1 == 10 || randomNum1 == 11 || randomNum1 == 12
  147. || randomNum1 == 13) {
  148.  
  149. mouse.moveSlightly();
  150. mouse.moveRandomly(random(30, 39), random(40, 60));
  151. }
  152. if (randomNum1 == 14) {
  153. mouse.moveOffScreen();
  154. }
  155. if (randomNum1 == 15) {
  156. mouse.moveSlightly();
  157. mouse.move(random(350, 700), random(50, 300));
  158. }
  159. if (randomNum1 == 16) {
  160. mouse.moveSlightly();
  161. mouse.moveSlightly();
  162. mouse.moveSlightly();
  163. mouse.moveSlightly();
  164. }
  165. if (randomNum1 > 16) {
  166. int randomNum2 = random(1, 3);
  167. if (randomNum2 == 1) {
  168. mouse.moveSlightly();
  169. }
  170. if (randomNum2 == 2) {
  171. mouse.moveRandomly(30, 50);
  172. }
  173. if (randomNum2 == 3) {
  174. mouse.moveSlightly();
  175. mouse.moveRandomly(30, 50);
  176. }
  177. }
  178. sleep(random(100, 400));
  179. }
  180.  
  181. public void antiBanCamera() {
  182. int randomNumber3 = random(1, 40);
  183. if (randomNumber3 == 1 || randomNumber3 == 2 || randomNumber3 == 3) {
  184. camera.setPitch(random(40, 68));
  185. }
  186. if (randomNumber3 == 4 || randomNumber3 == 5 || randomNumber3 == 6) {
  187. camera.moveRandomly(random(800, 1200));
  188. }
  189. if (randomNumber3 == 7 || randomNumber3 == 8 || randomNumber3 == 9) {
  190. camera.setAngle(random(10, 50));
  191. }
  192. if (randomNumber3 == 10 || randomNumber3 == 11) {
  193. camera.setPitch(true);
  194. }
  195. if (randomNumber3 == 12 || randomNumber3 == 13) {
  196. camera.setPitch(false);
  197. }
  198. if (randomNumber3 == 14) {
  199. camera.moveRandomly(random(400, 800));
  200. }
  201. if (randomNumber3 == 15) {
  202. camera.setAngle(random(5, 40));
  203. sleep(random(200, 300));
  204. }
  205. if (randomNumber3 > 15 && randomNumber3 < 30) {
  206. camera.setPitch(true);
  207. }
  208. if (randomNumber3 > 29) {
  209. camera.moveRandomly(random(200, 800));
  210. }
  211. }
  212.  
  213. public void antiBan(){
  214. int randomNumber123 = random(1, 3);
  215. if(randomNumber123 == 1) {
  216. antiBanMouse();
  217. }
  218. if(randomNumber123 == 2) {
  219. antiBanCamera();
  220. }
  221. }
  222.  
  223. public void messageReceived(MessageEvent e) {
  224. String x = e.getMessage().toLowerCase();
  225. if (x.contains("dough into the pie")){
  226. shellsMade++;
  227. }
  228. }
  229. //START: Code generated using Enfilade's Easel
  230. private final Color color1 = new Color(0, 255, 0, 104);
  231. private final Color color2 = new Color(0, 0, 0);
  232.  
  233. private final BasicStroke stroke1 = new BasicStroke(1);
  234.  
  235. private final Font font1 = new Font("Arial", 0, 9);
  236.  
  237. public void onRepaint(Graphics g1) {
  238. Graphics2D g = (Graphics2D)g1;
  239. profit = (ShellPrice - (DoughPrice + PiePrice)) * shellsMade;
  240. profitHour = (int) ((profit) * 3600000D / (System.currentTimeMillis() - startTime));
  241. shellsHour = (int) ((shellsMade) * 3600000 / (System.currentTimeMillis() - startTime));
  242. millis = System.currentTimeMillis() - startTime;
  243. hours = millis / (1000 * 60 * 60);
  244. millis -= hours * (1000 * 60 * 60);
  245. minutes = millis / (1000 * 60);
  246. millis -= minutes * (1000 * 60);
  247. seconds = millis / 1000;
  248. g.setColor(color1);
  249. g.fillRect(375, 211, 141, 126);
  250. g.setColor(color2);
  251. g.setStroke(stroke1);
  252. g.drawRect(375, 211, 141, 126);
  253. g.setFont(font1);
  254. g.drawString("Time Running: "+ hours +":"+ minutes + ":" + seconds, 385, 234);
  255. g.drawString("Profit: " +profit, 385, 262);
  256. g.drawString("Profit Per Hour: " +profitHour, 385, 294);
  257. g.drawString("Shells p/h: " +shellsHour, 385, 310);
  258. g.drawString("Shells Made: " +shellsMade, 385, 327);
  259. g.setColor(color1);
  260. g.fillRect(578, 41, 101, 94);
  261. g.setColor(color2);
  262. g.setStroke(stroke1);
  263. g.drawRect(578, 41, 101, 94);
  264. g.setFont(font1);
  265. g.drawString("Shell Price: " +ShellPrice, 589, 63);
  266. g.drawString("Pie Price: " +PiePrice, 590, 88);
  267. g.drawString("Dough Price: "+DoughPrice, 589, 116);
  268. }
  269. //END: Code generated using Enfilade's Easel
  270. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement