Advertisement
Guest User

PigeonClaySoftener

a guest
Jun 23rd, 2018
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.19 KB | None | 0 0
  1. import org.osbot.rs07.api.map.Area;
  2. import org.osbot.rs07.api.model.RS2Object;
  3. import org.osbot.rs07.api.ui.RS2Widget;
  4. import org.osbot.rs07.script.Script;
  5. import org.osbot.rs07.script.ScriptManifest;
  6. import org.osbot.rs07.utility.ConditionalSleep;
  7.  
  8. import java.awt.*;
  9.  
  10.  
  11. @ScriptManifest(name = "PigeonClaySoftener", version = 6.9, author = "datpigeon", logo = "https://i.imgur.com/03YTrCy.jpg", info = "gz kys")
  12. public class PigeonClaySoftener extends Script {
  13.  
  14. private long startTime;
  15. private Font font = new Font("Arial", Font.BOLD, 14);
  16. private String status = "NULL";
  17. private final Area botArea = new Area(3260, 3414, 3235, 3438);
  18. private final Area fountainArea = new Area(3237,3436,3240,3433);
  19. private final Area bankArea = new Area(3251,3420,3256,3420);
  20. private final Area bankBoothArea = new Area(3253,3419,3254,3419);
  21. private int antiBan;
  22.  
  23. public final String formatTime(final long time) {
  24. long s = time / 1000, m = s / 60, h = m / 60;
  25. s %= 60;
  26. m %= 60;
  27. h %= 24;
  28. return String.format("%02d:%02d:%02d", h, m, s);
  29. }
  30.  
  31. public void logoutNow() {
  32. if (getLogoutTab().logOut()) {
  33. stop();
  34. }
  35. }
  36.  
  37. @Override
  38. public void onStart() throws InterruptedException {
  39. log("Starting Script");
  40. startTime = System.currentTimeMillis();
  41. }
  42.  
  43. @Override
  44. public int onLoop() throws InterruptedException {
  45. if(botArea.contains(myPosition())) {
  46. antiBan = random(1,100);
  47. if (antiBan > 95) {
  48. if (getMouse().moveOutsideScreen()) {
  49. sleep(random(2000,6000));
  50. }
  51. }
  52. if (bankArea.contains(myPosition())) {
  53. if (!getBank().isOpen()) {
  54. if (getInventory().getAmount("Clay") > 0 && getInventory().getAmount("Bucket of water") > 0) {
  55. status = "Making Soft Clay";
  56. long tempNumOfClay = getInventory().getAmount("Clay");
  57. if (getMouse().moveOutsideScreen()) {
  58. sleep(random(2500, 3500));
  59. }
  60. if (getInventory().getAmount("Clay") == tempNumOfClay) {
  61. if (getInventory().interact("Use", "Bucket of water")) {
  62. if (getInventory().interact("Use", "Clay")) {
  63. sleep(random(1250, 2250));
  64. if (getWidgets().get(270,14) != null) {
  65. RS2Widget makeClay = getWidgets().get(270,14);
  66. makeClay.interact("Make");
  67. }
  68. }
  69. }
  70. }
  71. } else if (getInventory().getAmount("Clay") == 14 && getInventory().getAmount("Bucket") == 14) {
  72. status = "Walking to fountain";
  73. getWalking().webWalk(fountainArea);
  74. } else {
  75. if (getObjects().closest("Bank booth") != null) {
  76. RS2Object bankBooth = getObjects().closest(bankBoothArea,"Bank booth");
  77. if (bankBooth.interact("Bank")) {
  78. new ConditionalSleep(3000, 500) {
  79. @Override
  80. public boolean condition() throws InterruptedException {
  81. return getBank().isOpen();
  82. }
  83. }.sleep();
  84. }
  85. }
  86. }
  87. } else { //bank is open
  88. status = "Banking";
  89. if (getBank().getAmount("Clay") > 0 && getInventory().getAmount("Bucket") == 14) {
  90. if (getInventory().getAmount("Clay") != 14) {
  91. if (getInventory().getAmount("Soft Clay") > 0) {
  92. getBank().depositAll("Soft Clay");
  93. } else {
  94. getBank().withdrawAll("Clay");
  95. }
  96. } else {
  97. status = "Walking to fountain";
  98. getWalking().webWalk(fountainArea);
  99. }
  100. } else {
  101. status = "Logging out and ending script";
  102. log("Ran out of Clay or you didn't have exactly 14 buckets in your inventory");
  103. logoutNow();
  104. }
  105. }
  106. } else { //not in bankArea but could be in fountain area
  107. if (getInventory().getAmount("Bucket") == 0) {
  108. status = "Walking to Bank";
  109. getWalking().webWalk(bankArea);
  110. } else {
  111. if (fountainArea.contains(myPosition())) {
  112. status = "Getting Buckets of water";
  113. if (getObjects().closest("Fountain") != null) {
  114. RS2Object fountain = getObjects().closest("Fountain");
  115. if (getInventory().interact("Use","Bucket")) {
  116. if (fountain.interact("Use")) {
  117. antiBan = random(1,100);
  118. if (antiBan > 25) {
  119. getMouse().moveOutsideScreen();
  120. }
  121. new ConditionalSleep(10000,1000) {
  122. @Override
  123. public boolean condition() throws InterruptedException {
  124. return !getInventory().contains("Bucket");
  125. }
  126. }.sleep();
  127. }
  128. }
  129. }
  130. } else {
  131. status = "Walking to fountain";
  132. getWalking().webWalk(fountainArea);
  133. }
  134. }
  135. }
  136. } else {
  137. status = "Walking to Varrock east";
  138. getWalking().webWalk(botArea);
  139. }
  140. return random(200,600);
  141. }
  142.  
  143. @Override
  144. public void onExit() throws InterruptedException {
  145. long exitRunTime = System.currentTimeMillis() - startTime;
  146. log("Script ended, runtime: " + formatTime(exitRunTime));
  147. }
  148.  
  149. @Override
  150. public void onPaint(Graphics2D g) {
  151. Point mP = getMouse().getPosition();
  152. long runTime = System.currentTimeMillis() - startTime;
  153. g.setColor(Color.white);
  154. g.setFont(font);
  155. g.drawLine(mP.x, mP.y - 10, mP.x, mP.y + 10);
  156. g.drawLine(mP.x - 10, mP.y, mP.x + 10, mP.y);
  157. g.drawString("PigeonClaySoftener", 10, 170);
  158. g.drawString("Runtime: " + formatTime(runTime), 10, 190);
  159. g.drawString("Status: " + status, 10, 210);
  160. }
  161.  
  162. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement