Advertisement
Guest User

Cutter Source

a guest
Jan 14th, 2019
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.49 KB | None | 0 0
  1. package core;
  2.  
  3. import java.awt.Color;
  4. import java.awt.Font;
  5. import java.awt.Graphics2D;
  6.  
  7. import org.osbot.rs07.api.map.constants.Banks;
  8. import org.osbot.rs07.api.map.Area;
  9. import org.osbot.rs07.api.model.RS2Object;
  10. import org.osbot.rs07.api.ui.Skill;
  11. import org.osbot.rs07.script.Script;
  12. import org.osbot.rs07.script.ScriptManifest;
  13.  
  14. @ScriptManifest(author = "Sus", info = "Basic Tree Script", name = "Basic Log Chopper", version = 0.1, logo = "https://i.ibb.co/xgbRfTv/rsz-logger.png")
  15.  
  16. public class Main extends Script {
  17.  
  18. public int treeCount = 0;
  19. public int woodcuttingXP = 0;
  20. public int treeCountHour = 0;
  21. public int woodcuttingXPHR = 0;
  22. public long totalElapsed = 0;
  23. public long totalElapsedFixed = 0;
  24.  
  25. public Area grandExchange = new Area(3142, 3468, 3187, 3515);
  26.  
  27. public String botStatus;
  28.  
  29. @Override
  30. public void onStart() {
  31. log("Sus's Logger Started");
  32. getExperienceTracker().start(Skill.WOODCUTTING);
  33. }
  34.  
  35. public void statTracker() {
  36. // XP
  37. woodcuttingXP = getExperienceTracker().getGainedXP(Skill.WOODCUTTING);
  38. woodcuttingXPHR = getExperienceTracker().getGainedXPPerHour(Skill.WOODCUTTING);
  39.  
  40. // Total Logs
  41. treeCount = woodcuttingXP / 25;
  42. treeCountHour = woodcuttingXPHR / 25;
  43.  
  44. // Timings
  45. totalElapsed = getExperienceTracker().getElapsed(Skill.WOODCUTTING);
  46. totalElapsedFixed = totalElapsed / 1000;
  47. }
  48. public void grandExchangeArea() {
  49.  
  50. if (grandExchange.contains(myPlayer())) {
  51. } else {
  52. getWalking().webWalk(grandExchange);
  53. }
  54. }
  55. public void botStatus() {
  56. if(getInventory().isFull() && myPlayer().isMoving()) {
  57. botStatus = "Walking to Bank";
  58. } else if (myPlayer().isAnimating() && !getInventory().isFull()) {
  59. botStatus = "Chopping Tree";
  60. } else if (myPlayer().isMoving() || !myPlayer().isMoving() && !getInventory().isFull()) {
  61. botStatus = "Locating Tree";
  62. }
  63. }
  64.  
  65. public void underAttack() {
  66. if (myPlayer().isUnderAttack()) {
  67. getSettings().setRunning(true);
  68. getWalking().webWalk(Banks.GRAND_EXCHANGE);
  69. } else {
  70.  
  71. }
  72. }
  73.  
  74. public void runRandomiser() {
  75. if (getSettings().isRunning() == false && getSettings().getRunEnergy() == random(45, 100)) {
  76. getSettings().setRunning(true);
  77. }
  78. }
  79.  
  80. public void completeBank() throws InterruptedException {
  81. bank.open();
  82. bank.depositAll("Logs");
  83. bank.close();
  84. sleep(random(300, 750));
  85. }
  86.  
  87.  
  88. @Override
  89. public int onLoop() throws InterruptedException {
  90. RS2Object regTree = getObjects().closest(grandExchange, "Tree");
  91.  
  92. if(grandExchange.contains(myPlayer())) {
  93. // If under attack. Script will retreat to GE.
  94. underAttack();
  95.  
  96. // Main Function of the Script.
  97. if (getInventory().contains("Logs") && getInventory().isFull()) {
  98. getWalking().webWalk(Banks.GRAND_EXCHANGE);
  99. sleep(random(500,850));
  100. completeBank();
  101. sleep(random(500, 900));
  102. } else if (regTree != null && !myPlayer().isAnimating()) {
  103. regTree.interact("Chop Down");
  104. sleep(random(500, 1500));
  105. }
  106. runRandomiser();
  107. statTracker();
  108. botStatus();
  109. } else {
  110. getWalking().webWalk(grandExchange);
  111. }
  112. return random(700, 1500);
  113. }
  114.  
  115. @Override
  116. public void onExit() {
  117. log("========================================");
  118. log("Thank you for chopping with Sus Tree Chooper!");
  119. log("========================================");
  120. }
  121.  
  122. @Override
  123. public void onPaint(Graphics2D title) {
  124.  
  125. title.setFont(new Font("arial", Font.ITALIC, 12));
  126. title.setColor(Color.PINK);
  127.  
  128. title.drawString("Sus's Tree Cutter", 30, 40);
  129. title.drawString("Total Logs Cut: " + treeCount, 30, 60);
  130. title.drawString("Logs Per Hour: " + treeCountHour, 30, 80);
  131. title.drawString("Total XP Gained: " + woodcuttingXP, 30, 100);
  132. title.drawString("XP Per Hour: " + woodcuttingXPHR, 30, 120);
  133.  
  134. title.drawString("Total Time Ran: " + totalElapsedFixed + " Seconds", 30, 150);
  135. title.drawString("Bot Status: " + botStatus, 30, 170);
  136. }
  137. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement