Guest User

Untitled

a guest
Jul 16th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.24 KB | None | 0 0
  1. //AIOWcer V0.1
  2.  
  3. import java.awt.*;
  4. import java.util.Map;
  5.  
  6. import org.rsbot.event.events.ServerMessageEvent;
  7. import org.rsbot.event.listeners.PaintListener;
  8. import org.rsbot.event.listeners.ServerMessageListener;
  9. import org.rsbot.script.Script;
  10. import org.rsbot.script.wrappers.RSObject;
  11. import org.rsbot.script.wrappers.RSTile;
  12.  
  13. @org.rsbot.script.ScriptManifest(authors = { "Indaface" }, category = "Woodcutting", name = "aio Wcer", version = 0.1, description = "<html><head></head><body bgcolor='#222222'><center><table><tr><td width='350' valign='top'><center><div style='font-family:Calibri, Arial;color:#FF3300; font-size:36px'>aioWcer</div><div style='font-family:Calibri, Arial;color:#FFFFFF; font-size:16px'>v0.1 by Indaface <br /></a></div><div style='font-family:Calibri, Arial;color:#FF3300; font-size:16px'>Quick Select</div><div><table bordercolor='#FF3300' border='1' cellpadding='0' cellspacing='0' ><tr><td align='center' style='font-family:Calibri, Arial;color:#FFFFFF; font-size:12px'><b>Tree Locations</b> <br /><select name='trees'><option>WestVarrock RegularLogs<option>EastVarrock Oaks<option>Draynor Willows</select>")
  14. public class AIOWcer extends Script implements PaintListener, ServerMessageListener {
  15.  
  16. public enum actions {
  17. WALKING_TO_TREES, CHOPPING, BANKING, WALKING_TO_BANK, WAIT //add pickup nests and dropping in future update
  18. }
  19.  
  20. public String bankAt = "";
  21. public String chopAt = "";
  22. public long startTime = System.currentTimeMillis();
  23. public int[] axes = { 1349, 1351, 1353, 1355, 1357, 1359, 1361, 6739 };
  24. public int[] treeID;
  25. public int[] logsID = { 1511, 1521, 1519 };
  26. public int StartingExp;
  27. public int ExpGained;
  28.  
  29. public int[] bankBooths = {2213};
  30. public int[] nestIDs = { 5070, 5071, 5072, 5073, 5074, 5075, 7413 };
  31.  
  32. public RSTile[] toBank, toTrees;
  33. public int price;
  34. public int profit;
  35. public int nestzFound;
  36. public int cut;
  37. public int startExp;
  38.  
  39. public int[] NormalTree = { 5004, 5005, 5045, 3879, 3881, 3882, 3883,
  40. 3885, 3886, 3887, 3888, 3889, 3890, 3891, 3892, 3893, 3928, 3967,
  41. 3968, 4048, 4049, 4050, 4051, 4052, 4053, 4054, 3033, 3034, 3035,
  42. 3036, 2409, 2447, 2448, 1330, 1331, 1332, 1310, 1305, 1304, 1303,
  43. 1301, 1276, 1277, 1278, 1279, 1280, 8742, 8743, 8973, 8974, 1315,
  44. 1316 };
  45.  
  46. public int[] OakTree = { 1281, 3037, 8462, 8463, 8464, 8465, 8466, 8467 };
  47.  
  48. public int[] WillowTree = { 1308, 5551, 5552, 5553, 8481, 8482, 8483,
  49. 8484, 8485, 8486, 8487, 8488 };
  50.  
  51. public int[] YewTree = { 1309, 8503, 8504, 8505, 8506, 8507, 8508, 8509,
  52. 8510, 8511, 8512, 8513 };
  53.  
  54. // /////////LOCATIONS///////////////
  55. public boolean onStart(Map<String, String> args) {
  56. log("aioWcer Initialized!");
  57. log("I hope you Enjoy the script");
  58. log("Check my thread to make sure that your version of this script is up to date..");
  59.  
  60. if (args.get("trees").equals("WestVarrock RegularLogs")) {
  61. price = 36;
  62. treeID = new int[] { 1278 };
  63. toTrees = new RSTile[] { new RSTile(3184, 3444),
  64. new RSTile(3173, 3456), new RSTile(3157, 3459) };
  65. toBank = reversePath(toTrees);
  66. }
  67.  
  68. if (args.get("trees").equals("EastVarrock Oaks")) {
  69. price = 48;
  70. treeID = new int[] { 1281 };
  71. toTrees = new RSTile[] { new RSTile(3253, 3420),
  72. new RSTile(3265, 3428), new RSTile(3279, 3429) };
  73. toBank = reversePath(toTrees);
  74. }
  75.  
  76. if (args.get("trees").equals("Draynor Willows")) {
  77. bankAt = "Draynor Bank";
  78. chopAt = "Draynor Willows";
  79. price = 8;
  80. logsID = new int[] {1519};
  81. treeID = new int[] { 5553, 5551, 5552 };
  82. toTrees = new RSTile[] { new RSTile(3087, 3243), new RSTile(3087, 3235)};
  83. toBank = new RSTile[] { new RSTile(3087, 3242), new RSTile(3094, 3243)};
  84. }
  85. return true;
  86. }
  87.  
  88. public void serverMessageRecieved(ServerMessageEvent e) {
  89. String message = e.getMessage();
  90. if (message.contains("YOU GET SOME LOGS")) {
  91. cut += 1;
  92. }
  93. }
  94.  
  95. public actions getAction() {
  96. if(inArea(bankAt) && !inventoryContains(logsID) && !bank.isOpen()) {
  97. return actions.WALKING_TO_TREES;
  98. }
  99. if(inArea(bankAt) && isInventoryFull()) {
  100. return actions.BANKING;
  101. }
  102. if(inArea(chopAt) && isInventoryFull() && !inArea(bankAt)) {
  103. return actions.WALKING_TO_BANK;
  104. }
  105. if(inArea(chopAt) && !getMyPlayer().isMoving() && !isInventoryFull()) {
  106. return actions.CHOPPING;
  107. }
  108. return actions.WAIT;
  109. }
  110. ///////LOOP/////////
  111. public int loop() {
  112. actions act = getAction();
  113. switch (act) {
  114. case WALKING_TO_TREES:
  115. continueWalk(toTrees);
  116. break;
  117. case WALKING_TO_BANK:
  118. walkPathMM(toBank);
  119. break;
  120. case BANKING:
  121. walkPathMM(toBank);
  122. if(!bank.isOpen()) {
  123. RSObject bankBooth = getNearestObjectByID(bankBooths);
  124. if(bankBooth != null) {
  125. atObject(bankBooth, "se-Quickly");
  126. return random(500, 1000);
  127. }
  128. }
  129. if(bank.isOpen()) {
  130. bank.depositAllExcept(axes);
  131. bank.close();
  132. return random(400, 600);
  133. }
  134. break;
  135. case CHOPPING:
  136. if (getMyPlayer().getAnimation() != 867) {
  137. RSObject tree = getNearestObjectByID(treeID);
  138. if(tree != null) {
  139. atObject(tree, "chop");
  140. if(treeID == null){
  141. return (random(500,1000));
  142. }
  143. if (treeID == null) {
  144. log("Tree is null");
  145. return 500;
  146. }
  147. }
  148. }
  149. }
  150. return(random(500, 1000));
  151. }
  152.  
  153. public void continueWalk(RSTile[] path) {
  154. if(!getMyPlayer().isMoving() && distanceTo(getDestination()) <= random(3, 6)) {
  155. walkPathMM(randomizePath(path, 2, 2));
  156. }
  157. }
  158.  
  159. public boolean inArea(String area) {
  160.  
  161. int x = getMyPlayer().getLocation().getX();
  162. int y = getMyPlayer().getLocation().getY();
  163. if(area.equals("Draynor Bank")) {
  164. return x >= 3092 && x <= 3097 && y >= 3240 && y <= 3245;
  165. }
  166. if(area.equals("Draynor Willows")) {
  167. return x >= 3081 && x <= 3091 && y >= 3226 && y <= 3238;
  168. }
  169.  
  170. return x >= 1 && x <= 1 && y >= 1 && y <= 1;
  171. }
  172.  
  173. public void onRepaint(Graphics render) {
  174. if (isLoggedIn()) {
  175.  
  176. render.setColor(new Color(128, 0, 128));
  177.  
  178. long millis = System.currentTimeMillis() - startTime;
  179. long hours = millis / (1000 * 60 * 60);
  180. millis -= hours * (1000 * 60 * 60);
  181. long minutes = millis / (1000 * 60);
  182. millis -= minutes * (1000 * 60);
  183. long seconds = millis / 1000;
  184.  
  185. render.drawString("Time Running: " + hours + ":" + minutes + ":"
  186. + seconds, 240, 356);
  187.  
  188. if (StartingExp == 0) {
  189. StartingExp = skills.getCurrentSkillExp(STAT_WOODCUTTING);
  190. ExpGained = skills.getCurrentSkillExp(STAT_WOODCUTTING);
  191. }
  192.  
  193. render.setColor(new Color(255, 0, 0));
  194. render.drawString("Exp Gained: ", ExpGained, ExpGained);
  195. }
  196. }
  197. }
Add Comment
Please, Sign In to add comment