Guest User

Untitled

a guest
Jul 16th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.04 KB | None | 0 0
  1. //aioWcer version 0.1
  2. //future updates will include-more places!!! and other requests
  3.  
  4. ///////IMPORTS//////
  5. import java.awt.Graphics;
  6. import java.util.Map;
  7.  
  8. import org.rsbot.event.events.ServerMessageEvent;
  9. import org.rsbot.event.listeners.PaintListener;
  10. import org.rsbot.event.listeners.ServerMessageListener;
  11. import org.rsbot.script.Bank;
  12. import org.rsbot.script.Script;
  13. import org.rsbot.script.wrappers.RSItemTile;
  14. import org.rsbot.script.wrappers.RSNPC;
  15. import org.rsbot.script.wrappers.RSObject;
  16. import org.rsbot.script.wrappers.RSTile;
  17.  
  18. @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>")
  19. public class aioWcer extends Script implements PaintListener, ServerMessageListener {
  20.  
  21. public enum actions { WALKING_TO_TREES, CHOPPING, BANKING, WALKING_TO_BANK,
  22. PICKUP_NEST , NULL
  23. }
  24.  
  25.  
  26. public int myx = getMyPlayer().getLocation().getX();
  27. public int myy = getMyPlayer().getLocation().getY();
  28. public String bankAt = "";
  29. public long startTime = System.currentTimeMillis();
  30. public boolean isNPC = false;
  31. public double x1;
  32. public int[] axes = { 1349, 1351, 1353, 1355, 1357, 1359, 1361, 6739 };
  33. public int[] treeID;
  34. public int[] logsID; //TODO: make new integers for this
  35. public int[] nestIDs = { 5070, 5071, 5072, 5073, 5074, 5075, 7413 };
  36.  
  37. public RSTile[] toBank, toTrees;
  38. public int price, bankID, wcanimation = 867, profit, banker, nestzFound,
  39. cut, startExp;
  40.  
  41. // /////////LOCATIONS///////////////
  42. public boolean onStart(Map<String, String> args) {
  43. log("aioWcer Initialized!");
  44. return true;
  45. }
  46.  
  47. public void serverMessageRecieved(ServerMessageEvent e) {
  48. String message = e.getMessage();
  49. if(message.contains("YOU GET SOME LOGS OR SOMETHING??")) {
  50. cut += 1;
  51. }
  52. }
  53.  
  54. public actions getAction() {
  55.  
  56. if(!inventoryContains(logsID) && isInBank(bankAt)) {
  57. return actions.WALKING_TO_TREES;
  58. }
  59. if(isInventoryFull()) {
  60. return actions.WALKING_TO_BANK;
  61. }
  62. if(isInventoryFull() && isInBank(bankAt)) {
  63. return actions.BANKING;
  64. }
  65. if(findLootItem(10, nestIDs)) {
  66. return actions.PICKUP_NEST;
  67. }
  68.  
  69. return actions.NULL;
  70. }
  71.  
  72. // /////LOOP/////////
  73. public int loop() {
  74.  
  75. actions act = getAction();
  76.  
  77. switch(act) {
  78.  
  79. case WALKING_TO_TREES:
  80. continueWalk(toTrees);
  81. break;
  82.  
  83. case WALKING_TO_BANK:
  84. continueWalk(toBank);
  85. break;
  86.  
  87. case BANKING:
  88. RSNPC banker = getNearestNPCByName("Banker");
  89.  
  90. if(banker != null) {
  91. atNPC(banker, "Bank");
  92. }
  93.  
  94. if(inventoryContains(logsID)) {
  95. bank.depositAllExcept(axes);
  96. } else {
  97. bank.close();
  98. log("Banked logs.");
  99. }
  100. break;
  101.  
  102. case CHOPPING:
  103. if(getMyPlayer().getAnimation() == - 1
  104. && !getMyPlayer().isMoving()) {
  105. RSObject tree = getNearestObjectByID(treeID);
  106. if(tree != null) {
  107. atObject(tree, "Chop");
  108. }
  109. }
  110. break;
  111. case PICKUP_NEST:
  112.  
  113. break;
  114.  
  115. case NULL:
  116. break;
  117. }
  118.  
  119. return random(500,800);
  120. }
  121.  
  122. public boolean hasAxe(int axeID) {
  123. for(int i=0; i < axes.length; i++ ) {
  124. return axes[i] == axeID;
  125. }
  126. return false;
  127. }
  128.  
  129. boolean findLootItem(final int range, final int[] ids) {
  130. int minX = myx - range; int minY = myy - range;
  131. int maxX = myx + range; int maxY = myy + range;
  132. for (int x = minX; x <= maxX; x++) {
  133. for (int y = minY; y <= maxY; y++) {
  134. final RSItemTile[] items = getGroundItemsAt(x, y);
  135. for (final RSItemTile item : items) {
  136. int itemID = item.getItem().getID();
  137. for (final int id : ids) {
  138. if (itemID == id) {
  139. return true;
  140. }
  141. }
  142. }
  143. }
  144. }
  145. return false;
  146. }
  147.  
  148. public void continueWalk(final RSTile[] path) {
  149. if (!getMyPlayer().isMoving() || distanceTo(getDestination()) < random(4, 6)) {
  150. walkPathMM(randomizePath(path, 2, 2), 16);
  151. }
  152. }
  153.  
  154. public boolean isInBank(String whatBank) {
  155. int x = getMyPlayer().getLocation().getX();
  156. int y = getMyPlayer().getLocation().getY();
  157. if(whatBank.equals("Varrock East"))
  158. if(whatBank.equals("Varrock West"))
  159. if(whatBank.equals("Draynor")) {
  160. return x < 100 && x > 100 && y < 100 && y > 100;
  161. }
  162. return false;
  163. }
  164.  
  165. @Override
  166. public void onRepaint(Graphics render) {
  167.  
  168. }
  169. }
Add Comment
Please, Sign In to add comment