Guest User

Untitled

a guest
Dec 10th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.20 KB | None | 0 0
  1. import java.awt.Graphics;
  2.  
  3. import org.rsbuddy.tabs.Equipment;
  4. import org.rsbuddy.tabs.Inventory;
  5.  
  6. import com.rsbuddy.event.events.MessageEvent;
  7. import com.rsbuddy.event.listeners.MessageListener;
  8. import com.rsbuddy.event.listeners.PaintListener;
  9. import com.rsbuddy.script.ActiveScript;
  10. import com.rsbuddy.script.Manifest;
  11. import com.rsbuddy.script.methods.Calculations;
  12. import com.rsbuddy.script.methods.Camera;
  13. import com.rsbuddy.script.methods.Game;
  14. import com.rsbuddy.script.methods.Mouse;
  15. import com.rsbuddy.script.methods.Objects;
  16. import com.rsbuddy.script.methods.Players;
  17. import com.rsbuddy.script.methods.Walking;
  18. import com.rsbuddy.script.util.Random;
  19. import com.rsbuddy.script.wrappers.GameObject;
  20.  
  21. @Manifest(name = "Oak Woodcutter", description = "Description", authors = "me")
  22. public class OakWc extends ActiveScript implements MessageListener, PaintListener {
  23.  
  24. int OakTree = 38732;
  25. int axeIds[] = {1359,1357,1355,1361,1349,1353,1351};
  26.  
  27.  
  28. public boolean onStart() {
  29. Game.isLoggedIn();
  30. CheckHatchet();
  31.  
  32. return true;
  33. }
  34.  
  35. @Override
  36. public int loop() {
  37.  
  38. GameObject Tree = Objects.getNearest(OakTree);
  39. if( !Inventory.isFull()){
  40.  
  41. if(Tree != null){
  42. if(!Tree.isOnScreen()){
  43. if(Calculations.distanceTo(Tree) > 7){
  44. if (!Players.getLocal().isMoving()){
  45. Walking.stepTowards(Tree.getLocation());
  46. }
  47. }
  48.  
  49. }
  50. if(Tree != null){
  51. Camera.turnTo(Tree);
  52. if(Tree.isOnScreen()){
  53. if (!isChopping()) {
  54. Chop();
  55.  
  56. }
  57. antiban();
  58. }
  59.  
  60. }
  61. }
  62. }
  63. if( Inventory.isFull()){
  64. Inventory.dropAllExcept(axeIds);
  65.  
  66. }
  67.  
  68. return 590;
  69.  
  70. }
  71.  
  72.  
  73. public boolean CheckHatchet() {
  74. if(!Inventory.containsOneOf(axeIds)){
  75. if(!Equipment.appearanceContainsOneOf(axeIds)){
  76. Game.logout(true);
  77.  
  78. }
  79. }
  80. return false;
  81. }
  82.  
  83.  
  84. public void Chop() {
  85. GameObject Tree = Objects.getNearest(OakTree);
  86. Tree.interact("Chop down");
  87.  
  88. sleep(1200, 1700);
  89.  
  90. }
  91.  
  92. private boolean isChopping(){
  93. if (Players.getLocal().getAnimation() != -1
  94. || Players.getLocal().isMoving()){
  95. return true;
  96. }
  97. return false;
  98.  
  99. }
  100.  
  101. private void antiban() {
  102. if (Random.nextInt(0, 5) > 3) {
  103. switch (Random.nextInt(1, 10)) {
  104. case 1:
  105. Camera.moveRandomly(Random.nextInt(300, 800));
  106. sleep(100,1000);
  107. break;
  108. case 2:
  109. Mouse.moveRandomly(500, 900);
  110. sleep(100,2870);
  111. break;
  112. case 3:
  113. Game.openTab(Game.TAB_STATS);
  114. sleep(1300,5000);
  115. Mouse.moveRandomly(200, 150);
  116. sleep(200,300);
  117. break;
  118. case 4:
  119. Game.openTab(Random.nextInt(0, 16));
  120. sleep(1300,5000);
  121. Mouse.moveRandomly(200, 500);
  122. sleep(100,300);
  123. if (Random.nextInt(0, 6) > 3) {
  124. Camera.moveRandomly(Random.nextInt(200, 500));
  125. }
  126. Game.openTab(Game.TAB_INVENTORY);
  127.  
  128. break;
  129. case 5:
  130. if (Random.nextInt(0, 6) > 3) {
  131. Mouse.moveRandomly(130, 145);
  132. } else {
  133. Camera.moveRandomly(Random.nextInt(300, 800));
  134. }
  135. break;
  136. }
  137. }
  138. }
  139. @Override
  140. public void messageReceived(MessageEvent e) {
  141.  
  142. }
  143.  
  144. @Override
  145. public void onRepaint(Graphics g) {
  146.  
  147. }
  148.  
  149. }
Add Comment
Please, Sign In to add comment