Advertisement
Guest User

tree

a guest
Jan 17th, 2017
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. import org.dreambot.api.methods.Calculations;
  2. import org.dreambot.api.methods.interactive.GameObjects;
  3. import org.dreambot.api.methods.map.Area;
  4. import org.dreambot.api.script.AbstractScript;
  5. import org.dreambot.api.script.ScriptManifest;
  6. import org.dreambot.api.script.Category;
  7. import org.dreambot.api.wrappers.interactive.GameObject;
  8. import org.dreambot.api.wrappers.interactive.Player;
  9.  
  10. @ScriptManifest(author = "themcpker", name = "woodcutter", version = 1.0, description = "chops only the dankest trees", category = Category.THIEVING)
  11. public class main extends AbstractScript {
  12.  
  13. public Area trees = new Area(3104, 3224, 3120, 3210);
  14. public Area bank = new Area(3092, 3240, 3093, 3245);
  15.  
  16. private enum State {
  17. BANK, CHOP, WALK, ERROR
  18. }
  19.  
  20. public void onStart() {
  21. log("script started ");
  22. }
  23.  
  24. public void onExit() {
  25. log("script has stopped thanks for using");
  26. }
  27.  
  28. public State getState() {
  29. if (getInventory().isFull() == true) {
  30. log("inventory is full going to bank");
  31. return State.BANK;
  32. } else {
  33. return State.CHOP;
  34. }
  35. }
  36.  
  37. @Override
  38. public int onLoop() {
  39. switch (getState()) {
  40. case WALK:
  41. log("walk to trees");
  42. getWalking().walk(trees.getRandomTile());
  43. sleep(Calculations.random(6000, 10000));
  44. break;
  45.  
  46. case CHOP:
  47. if (!trees.contains(getLocalPlayer())) {
  48. getWalking().walk(trees.getRandomTile());
  49. sleep(5000, 8000);
  50. } else if (!getLocalPlayer().isAnimating()) {
  51. GameObject tree = getGameObjects().closest("Tree");
  52. tree.interact("Chop down");
  53. sleep(Calculations.random(2000, 5000));
  54. }
  55.  
  56. break;
  57. case BANK:
  58. getWalking().walk(bank.getRandomTile());
  59. sleep(Calculations.random(6000, 10000));
  60. break;
  61. case ERROR:
  62. log("Script ran into error");
  63. break;
  64. default:
  65. break;
  66.  
  67. }
  68. return Calculations.random(500, 600);
  69. }
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement