Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.65 KB | None | 0 0
  1. import org.rsbot.script.Script;
  2. import org.rsbot.script.ScriptManifest;
  3. import org.rsbot.script.wrappers.RSArea;
  4. import org.rsbot.script.wrappers.RSObject;
  5. import org.rsbot.script.wrappers.RSTile;
  6.  
  7. //What happens when script stops.
  8. @ScriptManifest(authors = "Themanhunt", name = "AirCrafter", version = 1.0, description = "AirCrafter")
  9. public class airCrafter extends Script {
  10.  
  11. // Object ID's
  12. public int ruinID = 2452; // Ruin id.
  13. public int bankBoothID = 11402; // Bank booth id
  14. public int airAltarID = 2478; // Altar id.
  15. public int portalID = 2465; // Portal id.
  16. RSObject ruin = objects.getNearest(2452);
  17.  
  18. // Item ID's
  19. public int airTalismonID = 1438;
  20. public int airRuneID = 556;
  21. public int essenceID = 1436;
  22.  
  23. // Area and Tile
  24. public RSArea bankArea = new RSArea(new RSTile(3179, 3432), new RSTile(3196, 3446)); // The bank area
  25. public RSTile bankToRuin[] = new RSTile[] { new RSTile(3180, 3430),new RSTile(3172, 3429), new RSTile(3165, 3425),new RSTile(3158, 3419), new RSTile(3149, 3416), new RSTile(3141, 3410), new RSTile(3134, 3408), new RSTile(3128, 3407) }; // Bank to altar path
  26. public RSArea ruinArea = new RSArea(new RSTile(3123, 3402), new RSTile(3130, 3409)); // The ruin area
  27.  
  28. // Misc
  29.  
  30.  
  31. public enum State {
  32. WALKTORUINS, ENTERINGRUIN, STOPSCRIPT;
  33. }
  34.  
  35. private State getState() {
  36. if (atRuins() && inventory.contains(essenceID)) {
  37. return State.ENTERINGRUIN;
  38. } else if (atBank() && inventory.contains(essenceID)) {
  39. return State.WALKTORUINS;
  40. }
  41. return State.STOPSCRIPT;
  42. }
  43.  
  44. //Walking
  45.  
  46.  
  47. // Walk randomly to the bank.
  48. private void bankToAir() {
  49. log("Walking to airaltar");
  50. walking.walkPathMM(bankToRuin);
  51. sleep(100);
  52. }
  53.  
  54. // At the bank
  55. private boolean atBank() {
  56. return (bankArea.contains(getMyPlayer().getLocation()));
  57. }
  58.  
  59. private boolean atRuins() {
  60. return (ruinArea.contains(getMyPlayer().getLocation()));
  61. }
  62.  
  63. // What happens when the script start.
  64. public boolean onStart() {
  65. log("Welcome to AirCrafter.");
  66. return true;
  67.  
  68. }
  69.  
  70. private void openBank() {
  71. RSObject bankBooth = objects.getNearest(bankBoothID);
  72.  
  73. if (bankBooth.isOnScreen()) {
  74. bankBooth.doAction("Use-quickly");
  75. }
  76. sleep(100);
  77. }
  78.  
  79. private void depositItemsAndClose() {
  80. if (bank.isOpen() && inventory.isFull()) {
  81. bank.depositAllExcept(essenceID);
  82. bank.close();
  83. } else if (bank.isOpen() && !inventory.isFull()) {
  84. bank.close();
  85. }
  86. }
  87.  
  88. private void bank() {
  89. openBank();
  90. depositItemsAndClose();
  91. }
  92.  
  93. public void onFinish() {
  94. log("Air Crafter stopped.");
  95. }
  96.  
  97. public int loop() {
  98. switch (getState()) {
  99. case WALKTORUINS:
  100. bankToAir();
  101. case ENTERINGRUIN:
  102. ruin.doAction("Enter");
  103. case STOPSCRIPT:
  104. log("Script stopped.");
  105. }
  106. return 100;
  107. }
  108. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement