Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.91 KB | None | 0 0
  1. import org.dreambot.api.methods.Calculations;
  2. import org.dreambot.api.script.AbstractScript;
  3. import org.dreambot.api.script.Category;
  4. import org.dreambot.api.script.ScriptManifest;
  5. import org.dreambot.api.wrappers.interactive.GameObject;
  6. import sun.font.Script;
  7.  
  8. import java.awt.geom.Area;
  9.  
  10.  
  11. @ScriptManifest(
  12. author = "8ishop",
  13. description = "Woodcutter",
  14. category = Category.WOODCUTTING,
  15. version = 0.01,
  16. name = "Woodcutter"
  17. )
  18.  
  19. public class Main extends AbstractScript {
  20.  
  21.  
  22. private int state = -1;
  23. private Wood currentLog;
  24. private boolean drop = false;
  25.  
  26. @Override
  27. public void onStart() {
  28. super.onStart();
  29. state = 0;
  30. currentLog = Wood.NORMAL;
  31. }
  32.  
  33. @Override
  34. public int onLoop() {
  35. if (state == 0) {
  36. cut();
  37. }else if (state == 1) {
  38. bank();
  39. }else if (state == 2) {
  40. drop();
  41. }
  42. return Calculations.random(300, 400);
  43. }
  44.  
  45. private void cut() {
  46. if (!getInventory().isFull()) {
  47. GameObject g0 = getGameObjects().closest(f -> f.getName().equals(currentLog.getTreeName()));
  48. if (getLocalPlayer().distance(g0) > 5) {
  49. getWalking().walk(g0);
  50. sleepUntil(() -> !getLocalPlayer().isMoving()
  51. || getLocalPlayer().distance(getClient().getDestination()) < 7, Calculations.random(4600, 5400));
  52. }else {
  53. if (g0.interact("Chop down")) {
  54. sleepUntil(() -> getInventory().contains("Logs"), Calculations.random(8000));
  55. }
  56. }
  57.  
  58. }else {
  59. if (drop) {
  60. state = 2;
  61. }else {
  62. state = 1;
  63. }
  64.  
  65. }
  66.  
  67. }
  68.  
  69. private void bank() {
  70. if (getBank().isOpen()) {
  71. getBank().depositAllExcept(f -> f.getName().contains("axe"));
  72. getBank().close();
  73. sleepUntil(() -> !getBank().isOpen(), Calculations.random(2000, 2800));
  74. state = 0;
  75. }else {
  76. if (getLocalPlayer().distance(getBank().getClosestBankLocation().getCenter()) > 5) {
  77. if (getWalking().walk(getBank().getClosestBankLocation().getCenter())) {
  78. sleepUntil(() -> !getLocalPlayer().isMoving()
  79. || getLocalPlayer().distance(getClient().getDestination()) < 8
  80. , Calculations.random(3500, 5000));
  81. }
  82. }else {
  83. getBank().open();
  84. sleepUntil(() -> getBank().isOpen(), Calculations.random(2000, 2800));
  85. }
  86. }
  87.  
  88. }
  89.  
  90. private void drop() {
  91. if (getInventory().contains(currentLog.getLogName())) {
  92. getInventory().dropAll(currentLog.getLogName());
  93. }else {
  94. state = 0;
  95. }
  96.  
  97. }
  98.  
  99. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement