Advertisement
Guest User

Untitled

a guest
Mar 2nd, 2011
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.71 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.  
  7. import org.rsbot.script.Script;
  8. import org.rsbot.script.ScriptManifest;
  9. import org.rsbot.script.wrappers.*;
  10. import org.rsbot.event.events.MessageEvent;
  11. import org.rsbot.event.listeners.MessageListener;
  12. import org.rsbot.event.listeners.PaintListener;
  13.  
  14. @ScriptManifest(authors = "Elite92", keywords = "Power chops willows", name = "EliteChopper", version = 1, description = "Power chops willows")
  15.  
  16. public class EliteChopper extends Script implements PaintListener, MessageListener{
  17.  
  18. public int[] hatchets = {1349, 1351, 13523, 1355, 1357, 1359, 6739};
  19. public int[] willowTree = {5551, 5552, 5553};
  20. public int willowLog = 1519;
  21.  
  22. long startTime;
  23. int startXp = 0;
  24. int expGained = 0;
  25. int logsCut = 0;
  26.  
  27. public boolean onStart() {
  28. startTime = System.currentTimeMillis();
  29. startXp = skills.getCurrentExp(skills.WOODCUTTING);
  30. log("Welcome to Test.");
  31. return true;
  32. }
  33. public int loop() {
  34. if(inventory.isFull()) {
  35. inventory.dropAllExcept(hatchets);
  36. }else{
  37. if(getMyPlayer().getAnimation() != 867){
  38. RSObject tree = objects.getNearest(willowTree);
  39. if(tree != null){
  40. tree.doAction("Chop");
  41. sleep(500, 800);
  42. }
  43. }
  44. }
  45. return random(500, 800);
  46. }
  47. public void onFinish() {
  48. log("You gained:" + expGained + " exp");
  49. log("Goodbye");
  50. }
  51. @Override
  52. public void onRepaint(final Graphics g) {
  53. //START: Code generated using Enfilade's Easel
  54. final Color color1 = new Color(102, 0, 102, 185);
  55. final Color color2 = new Color(0, 0, 0);
  56.  
  57. final BasicStroke stroke1 = new BasicStroke(1);
  58.  
  59. final Font font1 = new Font("Lucida Handwriting", 1, 19);
  60. final Font font2 = new Font("Arial", 1, 14);
  61.  
  62. long expGained = skills.getCurrentExp(skills.WOODCUTTING) - startXp;
  63. int xpTilLevel = skills.getExpToNextLevel(skills.WOODCUTTING);
  64.  
  65. long millis = System.currentTimeMillis() - startTime;
  66. long hours = millis / (1000 * 60 * 60);
  67. millis -= hours * (1000 * 60 *60);
  68. long minutes = millis / (1000 * 60);
  69. millis -= minutes * (1000 * 60);
  70. long seconds = millis / 1000;
  71.  
  72. float xpsec = 0;
  73. if((minutes > 0 || hours > 0 || seconds > 0) && expGained > 0) {
  74. xpsec = ((float)expGained)/(float)(seconds + (minutes * 60)+ hours * 60 *60);
  75. }
  76. float xpmin = xpsec * 60;
  77. float xpHour = xpmin * 60;
  78.  
  79. float logsec = 0;
  80. if((minutes > 0 || hours > 0 || seconds > 0) && logsCut > 0) {
  81. xpsec = ((float)logsCut)/(float)(seconds + (minutes * 60)+ hours * 60 *60);
  82. }
  83. float logmin = xpsec * 60;
  84. float logHour = xpmin * 60;
  85.  
  86. Graphics2D g1 = (Graphics2D)g;
  87. g1.setColor(color1);
  88. g1.fillRect(9, 347, 486, 110);
  89. g1.setColor(color2);
  90. g1.setStroke(stroke1);
  91. g1.drawRect(9, 347, 486, 110);
  92. g1.setFont(font1);
  93. g1.drawString("Elite Bots ", 11, 368);
  94. g1.setFont(font2);
  95. g1.drawString("Runtime:" + hours + ":" + minutes + ":" + seconds, 40, 391);
  96. g1.drawString("Exp Gained:" + (int)expGained, 39, 410);
  97. g1.drawString("Exp/h:" + (int)xpHour, 40, 429);
  98. g1.drawString("Logs Cut:" + (int)logsCut, 194, 390);
  99. g1.drawString("Logs/h:" + (int)logHour, 195, 408);
  100. g1.drawString("Xp Til Level:" + xpTilLevel, 193, 428);
  101. }
  102. //END: Code generated using Enfilade's Easel
  103. @Override
  104. public void messageReceived(MessageEvent e) {
  105. String txt = e.getMessage();
  106. if(txt.contains("logs")){
  107. logsCut++;
  108. }
  109. }
  110. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement