Advertisement
Guest User

Untitled

a guest
May 31st, 2016
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.55 KB | None | 0 0
  1. @ScriptManifest(name = "Spooky_Fletcher", author = "SP00k", version = 1.0, info = "nigger", logo = "http://i.imgur.com/7k74Br4.png" )
  2.  
  3. public class Fletcher extends Script {
  4.  
  5. private String bowName;
  6. private int bowID;
  7. private int stringID;
  8. private String bowString;
  9. private String toMakeInv;
  10.  
  11. public void onStart() {
  12. this.bowName = "Yew longbow (u)";
  13. this.bowID = 66;
  14. this.bowString = "Bow string";
  15. this.stringID = 1777;
  16. this.toMakeInv = "Yew longbow";
  17. this.log("Start");
  18.  
  19.  
  20. }
  21.  
  22. public int onLoop() throws InterruptedException{
  23. State current = this.getState();
  24. this.log(current.toString());
  25. switch(current) {
  26. case DEPOSIT:
  27. this.deposit();;
  28. break;
  29. case WITHDRAW:
  30. this.withdraw();
  31. break;
  32. case FLETCH:
  33.  
  34. break;
  35. case FLETCHING:
  36.  
  37. break;
  38. case IDLE:
  39.  
  40. }
  41. return gRandom(700,50);
  42. }
  43.  
  44. public void onExit() {
  45. this.log("Stop");
  46.  
  47.  
  48. }
  49. public void deposit() throws InterruptedException {
  50. if (this.openBank()) {
  51. sleep(random(500,1000));
  52. this.getBank().depositAll(); {
  53. sleep(random(400,1000));
  54. }
  55. }
  56. }
  57.  
  58. public boolean withdraw() throws InterruptedException {
  59. if (this.openBank()) {
  60. while (!this.getInventory().contains(this.bowName)) {
  61. this.getBank().withdraw(14, bowID);
  62. while (!this.getInventory().contains(this.bowString)) {
  63. this.getBank().withdraw(14, stringID);
  64.  
  65. sleep(random(500, 700));
  66. }
  67. this.closeBank();
  68. }
  69.  
  70. }
  71.  
  72.  
  73. public boolean openBank() throws InterruptedException {
  74. if (this.getBank().isOpen()) {
  75. return true;
  76. }
  77. RS2Object bank = this.objects.closest("Bank booth");
  78. if (bank != null) {
  79. while (this.getBank().isOpen()) {
  80. bank.interact("Bank");
  81. sleep(gRandom(500, 800));
  82.  
  83. }
  84. return true;
  85.  
  86. }
  87. return false;
  88.  
  89. }
  90.  
  91. public void closeBank() throws InterruptedException {
  92. while(this.getBank().isOpen()) {
  93. this.getBank().close();
  94. sleep(gRandom(500,700));
  95. }
  96.  
  97. }
  98. public State getState() {
  99. if (this.getInventory().contains(this.bowName) && !this.myPlayer().isAnimating()) {
  100. return getState().FLETCH;
  101. } else if (this.myPlayer().isAnimating() && this.getInventory().contains(this.bowString)) {
  102. return State.FLETCHING;
  103. } else if (this.getInventory().contains(this.toMakeInv) && !this.getInventory().contains(this.bowString)) {
  104. return State.DEPOSIT;
  105. } else if (!this.getInventory().contains(this.toMakeInv) && !this.getInventory().contains(this.bowString)) {
  106. return State.WITHDRAW;
  107.  
  108. }
  109.  
  110.  
  111.  
  112.  
  113. return State.IDLE;
  114.  
  115. }
  116. public enum State {
  117. DEPOSIT, WITHDRAW, FLETCH, FLETCHING, IDLE
  118. }
  119.  
  120.  
  121. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement