Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.59 KB | None | 0 0
  1. import java.awt.Color;
  2. import java.awt.Graphics;
  3. import java.awt.Point;
  4. import java.util.HashSet;
  5. import java.util.Iterator;
  6. import java.util.Set;
  7. import java.awt.*;
  8. import org.rsbot.event.events.MessageEvent;
  9. import org.rsbot.event.listeners.MessageListener;
  10. import org.rsbot.script.*;
  11. import org.rsbot.script.methods.Game;
  12. import org.rsbot.script.methods.Skills;
  13. import org.rsbot.script.wrappers.*;
  14. import org.rsbot.script.util.Timer;
  15. import org.rsbot.event.listeners.PaintListener;
  16. import org.rsbot.script.methods.GrandExchange;
  17.  
  18.  
  19. @ScriptManifest(authors = "Havefunpeeps", keywords = "Bones", name = "Al-Khared Item Awesomer", version = 1.04, description = "Picks and banks Bones and other items")
  20. public class ItemAwesomer extends Script implements PaintListener {
  21.  
  22. int BonesID = 526;
  23. public long startTime = 0;
  24. public long millis = 0;
  25. public long hours = 0;
  26. public long minutes = 0;
  27. public long seconds = 0;
  28. public long last = 0;
  29. private int BonesPicked = 0;
  30. private int BonePrice;
  31. private int profit;
  32. private int profitHour;
  33. private int BonesHour;
  34. private int Banks;
  35.  
  36. public final RSArea BankArea = new RSArea(new RSTile[] {
  37. new RSTile(3264, 3161), new RSTile(3264, 3173),
  38. new RSTile(3273, 3174), new RSTile(3272, 3160)
  39. });
  40. public final RSArea PalaceArea = new RSArea(new RSTile[] {
  41. new RSTile(3280, 3157), new RSTile(3305, 3157),
  42. new RSTile(3305, 3180), new RSTile(3280, 3180)
  43. });
  44. public final RSTile[] ToPalace = {
  45. new RSTile(3269, 3166), new RSTile(3274, 3167),
  46. new RSTile(3276, 3172), new RSTile(3278, 3177),
  47. new RSTile(3282, 3180), new RSTile(3287, 3181),
  48. new RSTile(3292, 3180), new RSTile(3292, 3175),
  49. new RSTile(3292, 3170), new RSTile(3293, 3167)
  50. };
  51. public final RSTile[] ToBank = {
  52. new RSTile(3293, 3168), new RSTile(3293, 3173),
  53. new RSTile(3294, 3178), new RSTile(3291, 3182),
  54. new RSTile(3286, 3181), new RSTile(3281, 3181),
  55. new RSTile(3279, 3176), new RSTile(3276, 3172),
  56. new RSTile(3272, 3169), new RSTile(3268, 3167)
  57. };
  58.  
  59. public boolean onStart(){
  60. mouse.setSpeed(random(8, 14));
  61. BonePrice = grandExchange.lookup(BonesID).getGuidePrice();
  62. startTime = System.currentTimeMillis();
  63. return true;
  64. }
  65.  
  66. public void antiBanMouse() {
  67. int randomNum1 = random(1, 50);
  68. if (randomNum1 == 1 || randomNum1 == 2 || randomNum1 == 3) {
  69. mouse.moveSlightly();
  70. mouse.moveSlightly();
  71. }
  72. if (randomNum1 == 4 || randomNum1 == 5 || randomNum1 == 6) {
  73. mouse.move(random(175, 325), random(75, 225));
  74. }
  75. if (randomNum1 == 7) {
  76. mouse.moveRandomly(10, 150);
  77. }
  78. if (randomNum1 == 10 || randomNum1 == 11 || randomNum1 == 12
  79. || randomNum1 == 13) {
  80.  
  81. mouse.moveSlightly();
  82. mouse.moveRandomly(random(30, 39), random(40, 60));
  83. }
  84. if (randomNum1 == 14) {
  85. mouse.moveOffScreen();
  86. }
  87. if (randomNum1 == 15) {
  88. mouse.moveSlightly();
  89. mouse.move(random(350, 700), random(50, 300));
  90. }
  91. if (randomNum1 == 16) {
  92. mouse.moveSlightly();
  93. mouse.moveSlightly();
  94. mouse.moveSlightly();
  95. mouse.moveSlightly();
  96. }
  97. if (randomNum1 > 16) {
  98. int randomNum2 = random(1, 3);
  99. if (randomNum2 == 1) {
  100. mouse.moveSlightly();
  101. }
  102. if (randomNum2 == 2) {
  103. mouse.moveRandomly(30, 50);
  104. }
  105. if (randomNum2 == 3) {
  106. mouse.moveSlightly();
  107. mouse.moveRandomly(30, 50);
  108. }
  109. }
  110. sleep(random(100, 400));
  111. }
  112.  
  113. public void antiBanCamera() {
  114. int randomNumber3 = random(1, 40);
  115. if (randomNumber3 == 1 || randomNumber3 == 2 || randomNumber3 == 3) {
  116. camera.setPitch(random(40, 68));
  117. }
  118. if (randomNumber3 == 4 || randomNumber3 == 5 || randomNumber3 == 6) {
  119. camera.moveRandomly(random(800, 1200));
  120. }
  121. if (randomNumber3 == 7 || randomNumber3 == 8 || randomNumber3 == 9) {
  122. camera.setAngle(random(10, 50));
  123. }
  124. if (randomNumber3 == 10 || randomNumber3 == 11) {
  125. camera.setPitch(true);
  126. }
  127. if (randomNumber3 == 12 || randomNumber3 == 13) {
  128. camera.setPitch(false);
  129. }
  130. if (randomNumber3 == 14) {
  131. camera.moveRandomly(random(400, 800));
  132. }
  133. if (randomNumber3 == 15) {
  134. camera.setAngle(random(5, 40));
  135. sleep(random(200, 300));
  136. }
  137. if (randomNumber3 > 15 && randomNumber3 < 30) {
  138. camera.setPitch(true);
  139. }
  140. if (randomNumber3 > 29) {
  141. camera.moveRandomly(random(200, 800));
  142. }
  143. }
  144.  
  145. public void antiBan(){
  146. int randomNumber123 = random(1, 3);
  147. if(randomNumber123 == 1) {
  148. antiBanMouse();
  149. }
  150. if(randomNumber123 == 2) {
  151. antiBanCamera();
  152. }
  153. }
  154.  
  155. public void PickUpBones() {
  156. RSGroundItem Bones = groundItems.getNearest(BonesID);
  157. if ((groundItems.getNearest(BonesID) != null) && getMyPlayer().isIdle() && (calc.tileOnScreen(Bones.getLocation()))) {
  158. Bones.doAction("Take");
  159. sleep(random(250, 500));
  160. } else if ((groundItems.getNearest(BonesID) != null)
  161. && (!calc.tileOnScreen(Bones.getLocation()))) {
  162. walking.walkTileMM(groundItems.getNearest(BonesID).getLocation());
  163. }
  164. if(Bones == null) {
  165. sleep(random(250,500));
  166. }
  167. if (!walking.isRunEnabled() && walking.getEnergy() >= 50) {
  168. walking.setRun(true);
  169. sleep(200, 400);
  170. }
  171. }
  172.  
  173. private boolean walkPath(RSTile[] path) {
  174. if (calc.distanceTo(path[path.length - 1]) > 4) {
  175. RSTile n = getNext(path);
  176. if(n!=null){
  177. walking.walkTileMM(n.randomize(2, 2));
  178. if(random(1,6) != 2){
  179. mouse.moveRandomly(20);
  180. }
  181. }
  182. }
  183. return false;
  184. }
  185.  
  186. private RSTile getNext(RSTile[] path) {
  187. boolean found = false;
  188. for (int a = 0; a < path.length&&!found; a++) {
  189. if(calc.tileOnMap(path[path.length-1-a])){
  190. found = true;
  191. return path[path.length-1-a];
  192. }
  193. }
  194. return null;
  195. }
  196.  
  197. public int loop() {
  198. if(BankArea.contains(getMyPlayer().getLocation())){
  199. if(inventory.isFull()){
  200. bank.open();
  201. bank.depositAll();
  202. bank.close();
  203. Banks++;
  204. }
  205. }else{
  206. if(inventory.isFull()){
  207. walkPath(ToBank);
  208. sleep(500, 700);
  209. }
  210. }
  211. if(PalaceArea.contains(getMyPlayer().getLocation())){
  212. if(!inventory.isFull()){
  213. PickUpBones();
  214. }
  215. }else{
  216. if(!inventory.isFull()){
  217. walkPath(ToPalace);
  218. sleep(500, 700);
  219. }
  220. }
  221. return(random(100, 200));
  222. }
  223.  
  224. //START: Code generated using Enfilade's Easel
  225. private final Color color1 = new Color(0, 0, 255, 75);
  226. private final Color color2 = new Color(0, 0, 0);
  227.  
  228. private final BasicStroke stroke1 = new BasicStroke(1);
  229.  
  230. private final Font font1 = new Font("Arial", 0, 9);
  231.  
  232. public void onRepaint(Graphics g1) {
  233. Graphics2D g = (Graphics2D)g1;
  234. profit = BonePrice * BonesPicked;
  235. BonesPicked = Banks * 28;
  236. profitHour = (int) ((profit) * 3600000D / (System.currentTimeMillis() - startTime));
  237. BonesHour = (int) ((BonesPicked) * 3600000D / (System.currentTimeMillis() - startTime));
  238. millis = System.currentTimeMillis() - startTime;
  239. hours = millis / (1000 * 60 * 60);
  240. millis -= hours * (1000 * 60 * 60);
  241. minutes = millis / (1000 * 60);
  242. millis -= minutes * (1000 * 60);
  243. seconds = millis / 1000;
  244. g.setColor(color1);
  245. g.fillRect(371, 185, 147, 155);
  246. g.setColor(color2);
  247. g.setStroke(stroke1);
  248. g.drawRect(371, 185, 147, 155);
  249. g.setFont(font1);
  250. g.drawString("Time Running: " + hours +":"+ minutes + ":" + seconds, 382, 215);
  251. g.drawString("Items Picked Up: " +BonesPicked, 383, 230);
  252. g.drawString("Items per Hour: "+BonesHour , 383, 245);
  253. g.drawString("Banks: " +Banks, 383, 260);
  254. }
  255. //END: Code generated using Enfilade's Easel
  256. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement