Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.54 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. import org.rsbot.script.wrappers.RSTilePath;
  7.  
  8. @ScriptManifest(authors = { "Snotboy808" }, version = 1.00, keywords = { "Clay Softener" }, description = "Start In Varrock East Bank.", name = "ClaySoftener")
  9. public class ClaySoftener extends Script {
  10.  
  11. // ID's
  12.  
  13. int clay = 434;
  14. int softClay = 1761;
  15. int bucket = 1925;
  16. int filledBucket = 1929;
  17. int fountainID = 24214;
  18.  
  19. RSObject fountain;
  20.  
  21. // Tiles
  22.  
  23. RSTile[] TilesToFountain = { new RSTile(3253, 3421),
  24. new RSTile(3245, 3430), new RSTile(3240, 3434) };
  25.  
  26. RSTilePath PathToFountain;
  27. RSTilePath PathToBank;
  28.  
  29. // Path 1 void
  30. public void PathToFountain() {
  31. PathToFountain.traverse();
  32. }
  33.  
  34. // Path 2 void
  35. public void PathToBank() {
  36. PathToFountain.reverse();
  37. }
  38.  
  39. // Areas
  40. RSArea fountainArea = new RSArea(new RSTile(3236, 3431), new RSTile(3241,
  41. 3438));
  42. RSArea bankArea = new RSArea(new RSTile(3246, 3413), new RSTile(3261, 3426));
  43.  
  44. public boolean onStart() {
  45. mouse.setSpeed(random(6, 8));
  46. PathToFountain = walking.newTilePath(TilesToFountain);
  47. PathToBank = walking.newTilePath(TilesToFountain).reverse();
  48.  
  49. log("Enjoy :D");
  50.  
  51. return true;
  52. }
  53.  
  54. // Different Situations
  55. public boolean case1() {
  56. if (bankArea.contains(getMyPlayer().getLocation())) {
  57. return true;
  58. }
  59. return false;
  60. }
  61.  
  62. public boolean case2() {
  63. if (!bankArea.contains(getMyPlayer().getLocation())) {
  64. return true;
  65. }
  66. return false;
  67. }
  68.  
  69. public boolean case3() {
  70. if (fountainArea.contains(getMyPlayer().getLocation())) {
  71. return true;
  72. }
  73. return false;
  74. }
  75.  
  76. public boolean case4() {
  77. if (!fountainArea.contains(getMyPlayer().getLocation())) {
  78. return true;
  79. }
  80. return false;
  81.  
  82. }
  83.  
  84. // Voids
  85.  
  86. private void doBank() {
  87. final RSTile[] bankTiles = bankArea.getTileArray();
  88. if (bankArea.contains(bankTiles)) {
  89. if (bank.isOpen()) {
  90. bank.depositAllExcept(clay, bucket);
  91. sleep(600, 800);
  92. bank.withdraw(clay, 14);
  93. sleep(300, 500);
  94. bank.close();
  95.  
  96. } else
  97. bank.open();
  98. }
  99. }
  100.  
  101. private void soften() {
  102. if (inventory.getCount(filledBucket) == 14
  103. && inventory.getCount(clay) == 14) {
  104. inventory.useItem(inventory.getItem(filledBucket),
  105. (inventory.getItem(clay)));
  106. sleep(1500, 1800);
  107. mouse.move(266, 420);
  108. mouse.click(256, 410, isRunning());
  109. }
  110. }
  111.  
  112. private void fill() {
  113. RSObject fountain = objects.getNearest(fountainID);
  114. if (inventory.getCount(bucket) == 14 && inventory.getCount(clay) == 14) {
  115. sleep(600, 800);
  116. mouse.setSpeed(12);
  117. inventory.useItem(inventory.getItem(bucket), fountain);
  118. }
  119. sleep(2000, 2400);
  120. }
  121.  
  122. public void onFinish() {
  123. log("Thank you for using Snotboy808's ClaySoftener");
  124. }
  125.  
  126. @Override
  127. public int loop() {
  128. if (inventory.getCount(softClay) == 14 && case3()
  129. && inventory.getCount(bucket) == 14) {
  130. PathToBank();
  131. }
  132. if (inventory.getCount(softClay) == 14 && case1()
  133. && inventory.getCount(bucket) == 14) {
  134. doBank();
  135.  
  136. }
  137.  
  138. if (inventory.getCount(clay) == 14 && case1()
  139. && inventory.getCount(bucket) == 14) {
  140. PathToFountain();
  141. }
  142. if (inventory.getCount(softClay) == 0 && case4()
  143. && inventory.getCount(bucket) == 14) {
  144. PathToFountain();
  145. }
  146. if (inventory.getCount(clay) != 14 && case3()
  147. && getMyPlayer().getAnimation() == -1) {
  148. fill();
  149. soften();
  150.  
  151. }
  152.  
  153. return random(300, 500);
  154. }
  155. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement