Advertisement
Guest User

Untitled

a guest
Sep 3rd, 2015
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.22 KB | None | 0 0
  1. package BasicWoodcutter;
  2.  
  3. import org.dreambot.api.methods.map.Area;
  4. import org.dreambot.api.script.AbstractScript;
  5. import org.dreambot.api.script.Category;
  6. import org.dreambot.api.script.ScriptManifest;
  7. import org.dreambot.api.wrappers.interactive.GameObject;
  8. import org.dreambot.api.wrappers.interactive.NPC;
  9.  
  10. import java.awt.*;
  11.  
  12. @ScriptManifest(category = Category.WOODCUTTING,name = "Basic Woodcutter" ,author = "Maxime Clonen",version = 1.0)
  13. public class Mainclass extends AbstractScript {
  14.  
  15. Area bankArea = new Area(3092, 3241, 3097, 3246, 0);
  16.  
  17. @Override
  18. public void onStart(){
  19. log("Hi");
  20.  
  21. }
  22.  
  23. @Override
  24. public int onLoop() {
  25. GameObject tree = getGameObjects().closest(gameobject -> gameobject != null && gameobject.getName().equals("Tree"));
  26.  
  27. if (!getInventory().isFull() && tree.interact("chop down")){
  28. int countlogs = getInventory().count("Logs");
  29. int index = (int)(10 * Math.random() + 4);
  30. sleepUntil(() -> getInventory().count("Logs") > countlogs, index);
  31. }
  32.  
  33. if (getInventory().isFull()){
  34. if (bankArea.contains(getLocalPlayer())){
  35. NPC banker = getNpcs().closest(npc -> npc != null && npc.hasAction("Bank"));
  36. if(banker.interact("Bank")){
  37. int index = (int)(10 * Math.random() + 4);
  38. if(sleepUntil(() -> getBank().isOpen(), index)){
  39. if(getBank().depositAllExcept(item -> item != null && item.getName().contains("axe"))){
  40. int index1 = (int)(10 * Math.random() + 4);
  41. if (sleepUntil(() -> getInventory().isFull(), index1)){
  42. if(getBank().close()){
  43. int index2 = (int)(10 * Math.random() + 4);
  44. sleepUntil(() -> !getBank().isOpen(), index2);
  45. }
  46. }
  47. }
  48. }
  49. }
  50. }
  51. }
  52.  
  53. return 600;
  54. }
  55.  
  56. @Override
  57. public void onExit() {
  58.  
  59. }
  60.  
  61. @Override
  62. public void onPaint(Graphics graphics) {
  63.  
  64. }
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement