Guest User

Untitled

a guest
Jun 18th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.38 KB | None | 0 0
  1. import java.awt.*;
  2. import java.util.*;
  3. import com.speljohan.rsbot.script.*;
  4. import com.speljohan.rsbot.bot.*;
  5. import com.speljohan.rsbot.script.wrappers.*;
  6. import com.speljohan.rsbot.event.listeners.*;
  7. import com.speljohan.rsbot.event.events.*;
  8. public class SorsaCutter extends Script{
  9. public int axeid = 6739;
  10. public int yewid = 1309;
  11. public int BankBoothID = 25808;
  12. RSTile[] banktoyews = new RSTile[] {new RSTile(2726, 3486), new
  13. RSTile(2728, 3472),
  14. new RSTile(2726, 3460), new RSTile(2731, 3449), new
  15. RSTile(2742, 3443)};
  16. public RSTile[] yewstobank = new RSTile[] {new RSTile(2735, 3444),
  17. new RSTile(2727, 3453),
  18. new RSTile(2727, 3465), new RSTile(2727, 3479), new
  19. RSTile(2726, 3492)};
  20. public String getName(){
  21. return "Yew Cutter";
  22. }
  23. public String getAuthor(){
  24. return "Sorsa";
  25. }
  26. public String getScriptCategory(){return "Cutting";
  27. }
  28. public double getVersion(){
  29. return 1.0;
  30. }
  31. public boolean onStart(Map<String, String> args) {
  32. return true;
  33. }
  34. public void onFinish(){
  35. return;
  36. }
  37. public boolean needToBank(){
  38. return isInventoryFull();
  39. }
  40. public boolean atyews() {
  41. RSObject yew = getNearestObjectByID(yewid);
  42. if(yew == null) return false;
  43. return tileOnScreen(yew.getLocation());
  44. }
  45. public boolean atBank() {
  46. RSObject bank = getNearestObjectByID(BankBoothID);
  47. if(bank == null) return false;
  48. return tileOnScreen(bank.getLocation());
  49. }
  50. public boolean handleBank(){
  51. RSObject bankBooth = getNearestObjectByID(BankBoothID);
  52. if(bank == null)
  53. return false; //We cannot find a bank booth.
  54. if(bank.isOpen()){
  55. bank.depositAll();
  56. }else{
  57. atObject(bankBooth, "quickly");
  58. }
  59. return true;
  60. }
  61. public boolean walkToBank(){
  62. RSTile[] randomizedPath = randomizePath(yewstobank, 2, 2);
  63. // We want to randomize the path. 2, 2 = max x deviation and y deviation.
  64. return walkPathMM(randomizedPath, 25);
  65. //always use 25 or higher here. Don't worry about what it does.
  66. }
  67. public boolean cutyew(){
  68. RSObject yew = getNearestObjectByID(yewid);
  69. if(yew == null)
  70. return false;
  71. return atObject(yew, "Chop down");
  72. }
  73. public int loop() {
  74. if(getMyPlayer().isMoving()) return random(800, 1600);
  75. if(needToBank()){
  76. if(atBank()){
  77. if(handleBank())
  78. return random(800, 1000);
  79. }else{
  80. if(walkToBank())
  81. return random(800, 1000);
  82. }
  83. }else{
  84. if(atyews()){
  85. if(cutyew())
  86. return random(800, 1000);
  87. }else{
  88. if(walktoyews())
  89. return random(800, 1000);
  90. }
  91. }
  92. return random(800, 1000);
  93. }
  94. public boolean walktoyews(){
  95. RSTile[] randomizedPath = randomizePath(banktoyews, 2, 2);
  96. return walkPathMM(randomizedPath, 25);
  97. }
  98. public int loop() {
  99. if(getMyPlayer().isMoving()) return random(800, 1600);
  100. if(needToBank()){
  101. if(atBank()){
  102. if(handleBank())
  103. return random(800, 1000);
  104. }else{
  105. if(walkToBank())
  106. return random(800, 1000);
  107. }
  108. }else{
  109. if(atyews()){
  110. if(cutyew())
  111. return random(800, 1000);
  112. }else{
  113. //we are not at the yew trees.
  114. //we need to walk there
  115. }
  116. }
  117. return random(800, 1000);
  118. }
  119. public int loop() {
  120. if(getMyPlayer().isMoving()) return random(800, 1600);
  121. if(needToBank()){
  122. if(atBank()){
  123. if(handleBank())
  124. return random(800, 1000);}else{
  125. if(walkToBank())
  126. return random(800, 1000);
  127. //if we walk, we want to stop
  128. }
  129. }else{
  130. //We dont need to bank.
  131. if(atyews()){
  132. //we are at the yew trees.
  133. //you cut some logs..
  134. }else{
  135. //we are not at the yew trees.
  136. //we need to walk there.
  137. }
  138. }
  139. return random(800, 1000);
  140. }
  141. public int loop() {
  142. if(needToBank()){
  143. //We need to bank. Anything past this point
  144. //Until the closing brackets is banking.
  145. if(atBank()){
  146. if(handleBank())
  147. return random(800, 1000);
  148. // If we successfully open the
  149. // bank, we want to start the loop
  150. // over.
  151. }else{
  152. //we need to walk to the bank.
  153. //because we are not inside the
  154. //bank
  155. }
  156. }else{
  157. //We dont need to bank.
  158. if(atyews()){
  159. //we are at the yews.
  160. //you cut some logs.
  161. }else{
  162. //we are not at the catherby yews.
  163. //we need to walk there}
  164. }
  165. return random(800, 1000); }}
  166. public int loop() {
  167. if(needToBank()){
  168. //We need to bank.
  169. if(atBank()){
  170. //we are inside the bank, and
  171. //we deposit everything we have except our axe.
  172. }else{
  173. //we need to walk to the bank.
  174. //because we are not inside the
  175. //bank
  176. }
  177. }else{
  178. //We dont need to bank.
  179. if(atyews()){
  180. //we are at the catherby yews
  181. //you cut some logs.
  182. }else{//we are not in the yew trees
  183. //we need to walk there
  184. }
  185. }
  186. return random(800, 1000);
  187. }
  188. }
Add Comment
Please, Sign In to add comment