Advertisement
Guest User

Untitled

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