brookshirek

RS WoodCutter

Jan 18th, 2019
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1. import org.dreambot.api.input.Mouse;
  2. import org.dreambot.api.methods.Calculations;
  3. import org.dreambot.api.methods.container.impl.bank.BankLocation;
  4. import org.dreambot.api.methods.map.Area;
  5. import org.dreambot.api.script.AbstractScript;
  6. import org.dreambot.api.script.ScriptManifest;
  7. import org.dreambot.api.script.Category;
  8. import org.dreambot.api.wrappers.interactive.GameObject;
  9.  
  10. @ScriptManifest(category = Category.WOODCUTTING, name = "Cosmic's Woodcutter", author = "Cosmic", version = 3.1)
  11. public class WoodCut extends AbstractScript{
  12. int[] worlds = {301, 326, 393};
  13. public static final String TREE = "Tree";
  14. public static final String AXE = " axe";
  15. Area cutArea = new Area(3280,3442, 3274, 3457);
  16.  
  17.  
  18. @Override
  19. public void onStart() {
  20. log("Welcome to Cosmic's Wootcutter");
  21. }
  22.  
  23. @Override
  24. public int onLoop() {
  25.  
  26. if(!getLocalPlayer().isAnimating()) {
  27. if(getInventory().isFull()) {
  28. if(getBank().isOpen()) {
  29. getBank().depositAllExcept(item -> item != null && item.getName().contains(AXE));
  30. sleep(Calculations.random(10000, 60000));
  31. }else {
  32. getBank().open(BankLocation.VARROCK_EAST);
  33. }
  34. }else if(cutArea.contains(getLocalPlayer())){
  35. GameObject tree = getGameObjects().closest(TREE);
  36. if(tree != null) {
  37. tree.interact("Chop Down");
  38. int ran = Calculations.random(0,10);
  39. if (ran == 0) {
  40. getSkills().open();
  41. }else if(ran == 1) {
  42. getWorldHopper().openWorldHopper();
  43. sleep(Calculations.random(1000,5000));
  44. int ranr = Calculations.random(0,25);
  45. if(ranr == 22) {
  46. getWorldHopper().hopWorld(worlds[Calculations.random(0,2)]);
  47. }else {
  48. getWorldHopper().closeWorldHopper();
  49. }
  50. }
  51. sleep(Calculations.random(1500,2000));
  52. }
  53. }else {
  54. getWalking().walk(cutArea.getRandomTile());
  55. }
  56. }
  57. return Calculations.random(1000, 5000);
  58. }
  59.  
  60. @Override
  61. public void onExit() {
  62. super.onExit();
  63. }
  64.  
  65.  
  66.  
  67. }
Advertisement
Add Comment
Please, Sign In to add comment