Advertisement
Guest User

Untitled

a guest
Apr 16th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.08 KB | None | 0 0
  1. package jaclib.runtime_exception;
  2.  
  3. import java.awt.Graphics;
  4. import java.util.concurrent.TimeUnit;
  5.  
  6. import javax.swing.JOptionPane;
  7.  
  8. import jaclib.hardware_heap.Bot;
  9. import jdk.internal.dynalink.support.BottomGuardingDynamicLinker;
  10.  
  11. import com.Class360;
  12. import com.Class63;
  13. import com.client;
  14.  
  15. import bot.utils.Item;
  16. import bot.utils.Tile;
  17.  
  18. /**
  19. *
  20. * @author Milkshakeboy22 Script: Woodcutting
  21. *
  22. */
  23.  
  24. public class Woodcutting extends Script {
  25.  
  26. private String username; // remembers username login
  27. private String password; // remembers password login
  28.  
  29. private static long timeBegan; // used for total-time run on script
  30. private static long timeRan; // used for total-time run on script
  31.  
  32. @Override
  33. public boolean onStart() {
  34. timeBegan = System.currentTimeMillis();
  35. this.username = Class360.username;
  36. this.password = Class360.password;
  37.  
  38. /**
  39. * JOptionPane for tree selection
  40. */
  41. JOptionPane.showMessageDialog(null,
  42. "Please note: you will need to be in the area of the tree before starting the script.");
  43. String[] selectionValues = { "Willow" };
  44. String initialSelection = "Willow";
  45. String selection = (String) JOptionPane.showInputDialog(null, "Select the tree you would like to cut?",
  46. "Milkshakeboy22s Woodcutting Bot", JOptionPane.QUESTION_MESSAGE, null, selectionValues,
  47. initialSelection);
  48. return started;
  49. }
  50.  
  51. public void run() {
  52. super.run();
  53. try {
  54. setTimeRan(System.currentTimeMillis() - this.timeBegan);
  55. /**
  56. * Auto-login if kicked/disconnected
  57. */
  58. if (client.WINDOW_PANE_ID * -257444687 == 744) {
  59. Bot.sendConsoleMessage("Oh dear, something went wrong! We are attempting to log back in.");
  60. login();
  61. }
  62.  
  63. /**
  64. * Check to see if user has correct woodcutting level to chop tree selected
  65. */
  66. if (Bot.WOODCUTTING < 29) {
  67. Bot.sendConsoleMessage("You do not have the requirements to woodcut: Willow");
  68. Thread.sleep(8000);
  69. } else {
  70. if (Bot.WOODCUTTING > 29);
  71. Bot.sendConsoleMessage("We are clicking the tree: Willow");
  72. Bot.clickObject(38616, new Tile(3082, 3238, 1), 1);
  73. }
  74.  
  75. private final void login() {
  76. Class63.method741(username, password, 2101690439);
  77. }
  78.  
  79. public static String ft(long duration) {
  80. String res = "";
  81. long days = TimeUnit.MILLISECONDS.toDays(duration);
  82. long hours = TimeUnit.MILLISECONDS.toHours(duration)
  83. - TimeUnit.DAYS.toHours(TimeUnit.MILLISECONDS.toDays(duration));
  84. long minutes = TimeUnit.MILLISECONDS.toMinutes(duration)
  85. - TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS.toHours(duration));
  86. long seconds = TimeUnit.MILLISECONDS.toSeconds(duration)
  87. - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(duration));
  88. if (days == 0) {
  89. res = (hours + ":" + minutes + ":" + seconds);
  90. } else {
  91. res = (days + ":" + hours + ":" + minutes + ":" + seconds);
  92. }
  93. return res;
  94. }
  95.  
  96. @Override
  97. public void onRepaint(Graphics g) {
  98. }
  99.  
  100. public static long getTimeRan() {
  101. return timeRan;
  102. }
  103.  
  104. public void setTimeRan(long timeRan) {
  105. this.timeRan = timeRan;
  106. }
  107. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement