Guest User

Untitled

a guest
Jul 18th, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.75 KB | None | 0 0
  1. //AIOWcer V0.1
  2. //by Indaface
  3.  
  4. import java.awt.*;
  5. import java.util.Map;
  6.  
  7. import org.rsbot.event.events.ServerMessageEvent;
  8. import org.rsbot.event.listeners.PaintListener;
  9. import org.rsbot.event.listeners.ServerMessageListener;
  10. import org.rsbot.script.Script;
  11. import org.rsbot.script.wrappers.RSObject;
  12. import org.rsbot.script.wrappers.RSTile;
  13.  
  14. @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>")
  15. public class AIOWCer extends Script implements PaintListener, ServerMessageListener {
  16.  
  17.  
  18. public enum actions {WALKING_TO_TREES, CHOPPING, BANKING, WALKING_TO_BANK, WAIT} //add pickup nests and dropping in future update
  19.  
  20. private static final actions WAIT = null;
  21.  
  22. public String bankAt = "";
  23. public String chopAt = "";
  24. private String status = "";
  25. public long startTime = System.currentTimeMillis();
  26. public int[] axes = { 1349, 1351, 1353, 1355, 1357, 1359, 1361, 6739 };
  27. public int[] treeID;
  28. public int[] logsID = { 1511, 1521, 1519 };
  29.  
  30. //public int[] NormalTree = { 5004, 5005, 5045, 3879, 3881, 3882, 3883,
  31. // 3885, 3886, 3887, 3888, 3889, 3890, 3891, 3892, 3893, 3928, 3967,
  32. //3968, 4048, 4049, 4050, 4051, 4052, 4053, 4054, 3033, 3034, 3035,
  33. //3036, 2409, 2447, 2448, 1330, 1331, 1332, 1310, 1305, 1304, 1303,
  34. //1301, 1276, 1277, 1278, 1279, 1280, 8742, 8743, 8973, 8974, 1315,
  35. //1316 };
  36.  
  37. //public int[] OakTree = { 1281, 3037, 8462, 8463, 8464, 8465, 8466, 8467 };
  38.  
  39. //public int[] WillowTree = { 1308, 5551, 5552, 5553, 8481, 8482, 8483,
  40. //8484, 8485, 8486, 8487, 8488 };
  41.  
  42. public int startExp;
  43. public int Chopped;
  44. public int LevelsGained;
  45. public int ExpGained;
  46.  
  47. public int[] bankBooths = {2213};
  48. public int[] nestIDs = { 5070, 5071, 5072, 5073, 5074, 5075, 7413 };
  49.  
  50. public RSTile[] toBank, toTrees;
  51.  
  52. RSTile banktile;
  53. public int price;
  54. public int profit;
  55. public int nestzFound;
  56.  
  57. // /////////LOCATIONS///////////////
  58. public boolean onStart(Map<String, String> args) {
  59. log("aioWcer Initialized!");
  60.  
  61. if (args.get("trees").equals("WestVarrock RegularLogs")) {
  62. price = 36;
  63. logsID = new int[] { 1511 };
  64. treeID = new int[] { 1278 };
  65. banktile = new RSTile(3182, 3444);
  66. toTrees = new RSTile[] { new RSTile(3184, 3444),
  67. new RSTile(3173, 3456), new RSTile(3157, 3459) };
  68. toBank = reversePath(toTrees);
  69. }
  70.  
  71. if (args.get("trees").equals("EastVarrock Oaks")) {
  72. price = 48;
  73. logsID = new int[] { 1521 };
  74. treeID = new int[] { 1281 };
  75. banktile = new RSTile(3185, 3443);
  76. toTrees = new RSTile[] { new RSTile(3175, 3451),
  77. new RSTile(3160, 3455)};
  78. toBank = new RSTile[] { new RSTile(3160, 3455),
  79. new RSTile(3175, 3450), new RSTile(3185, 3443)};
  80. }
  81.  
  82. if (args.get("trees").equals("Draynor Willows")) {
  83. price = 8;
  84. logsID = new int[] { 1519 };
  85. treeID = new int[] { 5551, 5552, 5553 };
  86. banktile = new RSTile(3094, 3243);
  87. toTrees = new RSTile[] { new RSTile(3087, 3243), new RSTile(3087, 3235)};
  88. toBank = new RSTile[] { new RSTile(3087, 3242), new RSTile(3094, 3243)};
  89. }
  90. return true;
  91. }
  92.  
  93. public void serverMessageRecieved(ServerMessageEvent e) {
  94. String message = e.getMessage();
  95. if (message.contains("YOU GET SOME LOGS")) {
  96. Chopped++;
  97. if (message.contains("YOU HAVE JUST GAINED")) {
  98. LevelsGained++;
  99. }
  100. }
  101. }
  102.  
  103. public void continueWalk(RSTile[] path) {
  104. if(!getMyPlayer().isMoving() && distanceTo(getDestination()) <= random(3, 6)) {
  105. walkPathMM(randomizePath(path, 1, 1));
  106. }
  107. }
  108.  
  109. public actions getAction() {
  110. if(isInventoryFull() && distanceTo(banktile)>4) {
  111. WalkingToBank();
  112. return actions.WALKING_TO_BANK;
  113. } else if(isInventoryFull()) {
  114. Banking();
  115. return actions.BANKING;
  116. }
  117. if(isInventoryFull()) {
  118. Banking();
  119. return actions.BANKING;
  120. }
  121. if(WalkingToTrees()) {
  122. return actions.WALKING_TO_TREES;
  123. }
  124. if(Chopping()) {
  125. return actions.CHOPPING;
  126. }
  127. return WAIT;
  128. }
  129.  
  130.  
  131. boolean WalkingToTrees(){
  132. continueWalk(toTrees);
  133. RSObject tree = getNearestObjectByID(treeID);
  134. if(tree != null){
  135. if(distanceTo(tree.getLocation()) < 9){
  136. return false;
  137. }
  138. if(getMyPlayer().isMoving()) {
  139. wait(random(300, 600));
  140. return true;
  141. }
  142. }
  143. return true;
  144. }
  145.  
  146. boolean WalkingToBank() {
  147. continueWalk(toBank);
  148. return true;
  149. }
  150. boolean Banking(){
  151. if(!bank.isOpen()) {
  152. RSObject bankBooth = getNearestObjectByID(bankBooths);
  153. if(bankBooth != null) {
  154. atObject(bankBooth, "Use-Quickly");
  155. return true;
  156. }
  157. if(bankBooth == null){
  158. return false;
  159. }
  160. if(getMyPlayer().isMoving()){
  161. return false;
  162. }
  163. }
  164.  
  165. if(bank.isOpen()) {
  166. bank.depositAllExcept(axes);
  167. bank.close();
  168. }
  169. return true;
  170. }
  171.  
  172. boolean Chopping(){
  173. while(getMyPlayer().getAnimation() != -1){
  174. wait(800);
  175. }
  176. if (getMyPlayer().getAnimation() == -1) {
  177. RSObject tree = getNearestObjectByID(treeID);
  178. if (tree == null) {
  179. log("tree = null");
  180. return false;
  181. }
  182. if(getMyPlayer().isMoving()){
  183. return false;
  184. }
  185. if(tree != null) {
  186. atTree(tree, "Chop down");
  187. if(getMyPlayer().getAnimation() != -1) {
  188. wait(random(500, 800));
  189. return(true);
  190. }
  191. }
  192. }
  193. return true;
  194. }
  195.  
  196.  
  197. ///////LOOP/////////
  198. public int loop(){
  199. if(getEnergy() > random(21, 100)) {
  200. setRun(true);
  201. }
  202. if(getMyPlayer().isMoving()){
  203. return(random(300, 600));
  204. }
  205.  
  206. switch (getAction()){
  207.  
  208. case WALKING_TO_TREES:
  209. log("walking to trees");
  210. WalkingToTrees();
  211. status = "WalkingToTrees";
  212. break;
  213.  
  214. case CHOPPING:
  215. log("chopping");
  216. Chopping();
  217. status = "Chopping";
  218. break;
  219.  
  220. case WALKING_TO_BANK:
  221. log("walking to bank");
  222. if(isInventoryFull()) {
  223. WalkingToBank();
  224. status = "WalkingToBank";
  225. break;
  226. }
  227.  
  228. case BANKING:
  229. log("banking");
  230. if (isInventoryFull()) {
  231. Banking();
  232. status = "Banking";
  233. break;
  234. }
  235.  
  236. }
  237. return(random(400, 600));
  238. }
  239. public void onFinish(){
  240. log("Script is stopping");
  241. }
  242.  
  243. public void onRepaint(Graphics render) {
  244. if (isLoggedIn()) {
  245.  
  246. Point m = getMouseLocation();
  247.  
  248. render.setColor(Color.MAGENTA);
  249. render.drawLine(m.x, 1, m.x, 1500);
  250. render.drawLine(1, m.y, 1500, m.y);
  251. }
  252. }
  253. }
Add Comment
Please, Sign In to add comment