Guest User

Untitled

a guest
Nov 24th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.79 KB | None | 0 0
  1. import org.rsbot.script.ScriptManifest;
  2. import org.rsbot.script.Script;
  3. import org.rsbot.script.methods.Skills;
  4. import org.rsbot.script.wrappers.*;
  5. import org.rsbot.event.listeners.PaintListener;
  6. import java.awt.*;
  7. import javax.imageio.ImageIO;
  8. import java.io.IOException;
  9. import java.net.URL;
  10. import org.rsbot.event.events.MessageEvent;
  11. import org.rsbot.event.listeners.MessageListener;
  12.  
  13. @ScriptManifest(authors = { "adwalvekar" }, keywords = { "MaplePowerCutter" }, name = "DaemonhiemMapleChopper", version = 1.0, description = "Daemonhiem Maple Tree Cutter. Only PowerCuts (Supports most hatchets)")
  14. public class DaemonhiemMapleChopper extends Script implements PaintListener, MessageListener {
  15.  
  16. private int mapleLogID = 1517;
  17. private int mapleTree = 1307;
  18. private int hatchets[] = {1349, 1351, 1353, 1355, 1357, 1359, 1361, 6739, 13470};
  19. private int startXP;
  20. public long startTime = System.currentTimeMillis();
  21. private int startLevel;
  22. private int gainedLevel;
  23. private int Percent;
  24. public int xpGained;
  25. public int logsLeft;
  26. public int logsCut;
  27. String status = "";
  28. private int profit =0;
  29. private int logprice;
  30.  
  31. public boolean onStart(){
  32. logprice = grandExchange.lookup(mapleLogID).getGuidePrice();
  33. startXP = skills.getCurrentExp(Skills.WOODCUTTING);
  34. return true;
  35. }
  36.  
  37. public void messageReceived(MessageEvent e) {
  38. if(e.getMessage().contains("some maple logs" )){
  39. logsCut++;
  40. }
  41. }
  42.  
  43. public void chop() {
  44.  
  45. if (getMyPlayer().getAnimation() == -1){
  46. RSObject tree = objects.getNearest(mapleTree);
  47. if (tree != null) {
  48. status = "Cutting tree";
  49. if (!tree.isOnScreen() && tree != null) {
  50. camera.turnTo(tree.getLocation());
  51. if (calc.distanceTo(tree) > 6) {
  52. walking.walkTileMM(tree.getLocation());
  53. }
  54. }
  55. tree.doAction("Chop down Maple");
  56. sleep(random(2000, 3000));
  57. }
  58. }else{
  59. antiban();
  60. }
  61. }
  62.  
  63. public void antiban(){
  64. int r = random(1,10);
  65.  
  66. if (r == 1){
  67. camera.setAngle (random (0, 200));
  68. sleep(random(400, 800));
  69. }
  70.  
  71. if (r == 2){
  72. camera.setPitch(random(0, 85));
  73. sleep(random(400, 800));
  74. }
  75.  
  76. if (r == 3){
  77. mouse.moveSlightly();
  78. sleep(random(400, 800));
  79. }
  80.  
  81. if (r == 4){
  82. mouse.moveSlightly();
  83. sleep(random(100, 200));
  84. mouse.moveSlightly();
  85. sleep(random(100, 200));
  86. mouse.moveSlightly();
  87. sleep(random(400, 800));
  88. }
  89.  
  90. if (r == 5){
  91. mouse.moveSlightly();
  92. mouse.moveSlightly();
  93. mouse.moveSlightly();
  94. sleep(random(400, 800));
  95. }
  96.  
  97. if (r == 6) {
  98. skills.doHover(Skills.INTERFACE_WOODCUTTING);
  99. sleep(random(0, 1500));
  100. }
  101.  
  102. if (r == 7) {
  103. skills.doHover(Skills.INTERFACE_CONSTITUTION);
  104. sleep(random(0, 1500));
  105. }
  106.  
  107. if (r == 8) {
  108. skills.doHover(Skills.INTERFACE_STRENGTH);
  109. sleep(random(0, 1500));
  110. }
  111.  
  112. if (r == 9) {
  113. skills.doHover(Skills.INTERFACE_ATTACK);
  114. sleep(random(0, 1500));
  115. }
  116. }
  117.  
  118. public int loop(){
  119. mouse.setSpeed(random(0, 2));
  120.  
  121. if (walking.getEnergy()> (random(50, 100))){
  122. walking.setRun(true);
  123. sleep(random(700, 800));
  124. }
  125.  
  126. if(inventory.isFull ()){
  127.  
  128. status = ("Dropping logs");
  129. inventory.dropAllExcept(hatchets);
  130.  
  131. }else{
  132.  
  133. chop();
  134.  
  135. }
  136. return (0);
  137. }
  138.  
  139.  
  140.  
  141. public void onFinish(){
  142. log("Thank You for Using.");
  143. }
  144.  
  145. private Image getImage(String url) {
  146. try {
  147.  
  148. return ImageIO.read(new URL(url));
  149.  
  150. } catch(IOException e) {
  151. return null;
  152. }
  153. }
  154.  
  155. private final Color color1 = new Color(0, 0, 0);
  156. private final Color color2 = new Color(0, 0, 0, 0);
  157. private final Color color3 = new Color(0,0,0);
  158. private final Color color4 = new Color(250,250,250);
  159. private final Font font1 = new Font("Impact", 0, 16);
  160. private final Font font2 = new Font("Impact" , 0,20);
  161. public void onRepaint(Graphics g1) {
  162.  
  163. long millis = System.currentTimeMillis() - startTime;
  164. long hours = millis / (1000 * 60 * 60);
  165. millis -= hours * (1000 * 60 * 60);
  166. long minutes = millis / (1000 * 60);
  167. millis -= minutes * (1000 * 60);
  168. long seconds = millis / 1000;
  169. final int percent = skills.getPercentToNextLevel(8);
  170. logsLeft = (skills.getExpToNextLevel(Skills.WOODCUTTING)/100);
  171. xpGained = ( skills.getCurrentExp(Skills.WOODCUTTING) - startXP);
  172.  
  173. Graphics2D g = (Graphics2D)g1;
  174. g.setColor(color1);
  175. g.fillRect(723, 27, 18, 15);
  176. g.fillRect(743, 67, 13, 14);
  177. g.fillRect(5, 457, 127, 17);
  178. g.setColor(color2);
  179. g.fillRoundRect(556, 213, 173, 144, 16, 16);
  180. g.setFont(font1);
  181. g.setColor(color3);
  182. g.drawString("Percent TNL: " +percent+ "%" ,562, 446);
  183. g.drawString("Time Running: " + hours + ":" + minutes + ":" + seconds , 562, 416);
  184. g.drawString("Logs To level: " + logsLeft ,562,386);
  185. g.drawString("XP Gained: " +xpGained ,562, 356);
  186. g.drawString("Logs Cut: " +logsCut ,562, 326);
  187. g.drawString("Status: " +status , 562, 296);
  188. g.setFont(font2);
  189. g.setColor(color4);
  190. g.drawString("Daemonhiem", 590,236);
  191. g.drawString("Maple Chopper", 590, 256);
  192.  
  193. g.setColor(Color.white);
  194. g.drawLine(0, (int)(mouse.getLocation().getY()), 800, (int)(mouse.getLocation().getY()));
  195. g.drawLine((int)(mouse.getLocation().getX()), 0, (int)(mouse.getLocation().getX()), 800);
  196. g.setColor(Color.white);
  197. g.drawLine(0, (int)(mouse.getLocation().getY()) +1, 800, (int)(mouse.getLocation().getY())+1);
  198. g.drawLine((int)(mouse.getLocation().getX()) +1, 0, (int)(mouse.getLocation().getX())+1, 800);
  199.  
  200. }
  201. }
Add Comment
Please, Sign In to add comment