hubeb

Yew 'N' Fletch (Stock Edition) + Bank

May 19th, 2011
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.03 KB | None | 0 0
  1. // Yew 'N' Fletch (Stock Edition) + Bank
  2. // Save As "YewFletcherST.java"
  3. // Made By HUBEB
  4. // Do Not Modify, or Repost This Script Without My Permission
  5. // Script Posted to "Hubeb.webs.com", and "Powerbot.org"
  6. import org.rsbot.script.methods.GrandExchange.GEItem;
  7. import org.rsbot.script.ScriptManifest;
  8. import org.rsbot.script.Script;
  9. import org.rsbot.script.wrappers.RSNPC;
  10. import org.rsbot.script.wrappers.RSObject;
  11. import org.rsbot.script.wrappers.RSTile;
  12. import org.rsbot.script.wrappers.RSArea;
  13. import org.rsbot.event.listeners.PaintListener;
  14. import org.rsbot.event.events.ServerMessageEvent;
  15. import java.awt.Graphics;
  16. import java.awt.Color;
  17. import org.rsbot.script.*;
  18. import org.rsbot.script.methods.*;
  19. import org.rsbot.script.wrappers.*;
  20. import java.awt.*;
  21. import org.rsbot.event.listeners.*;
  22.  
  23. @ScriptManifest(authors = { "HUBEB" }, keywords = { "YewNFletch+Bank" }, name = "YewFletcher (STOCK ED.)", version = 1.0, description = "Cuts Yew North of Varrock East Bank, fletches to Longs and Banks!")
  24. public class YewFletcherST extends Script implements PaintListener, ServerMessageListener {
  25.  
  26. private int anyMaple = 1309;
  27. private int anyPick = 6739;
  28. private int logID = 1515;
  29. private int knifeID[] = {946, 1349, 1357, 1361,
  30. 1351, 6739, 1355, 1359,
  31. 1353};
  32.  
  33. private RSTile[] walkingPath = {new RSTile(3246, 3472), new RSTile(3245, 3458),
  34. new RSTile(3245, 3444), new RSTile(3247, 3431),
  35. new RSTile(3252, 3421)};
  36. // Maple 2 Bank
  37. private RSArea bankArea = new RSArea(new RSTile(3257, 3423), new RSTile(3250, 3419));
  38. private RSArea mineArea = new RSArea(new RSTile(3251, 3475), new RSTile(3244, 3470));
  39. int[] bankerId = {553, 2759};
  40. public int startExp;
  41. public int startLevel;
  42. public int currentLevel;
  43. public int gainedLevels;
  44. public int expGained = 0;
  45. public int expHour = 0;
  46. public int exp;
  47. public int percent;
  48. private int logCount;
  49. public int woodCuttingLevel;
  50. public int antiBanSelect;
  51. public int randomSkill;
  52. public int SKILL;
  53. private String status = "";
  54. public long startTime = System.currentTimeMillis();
  55. public long timeRan;
  56. private int startTab;
  57. int nextScreenShot = 1;
  58. int SSHours = 0;
  59. //fletch
  60. public int startExpFl;
  61. public int startLevelFl;
  62. public int currentLevelFl;
  63. public int gainedLevelsFl;
  64. public int expGainedFl = 0;
  65. public int expHourFl = 0;
  66. public int expFl;
  67. public int percentFl;
  68. public int fletchingLevel;
  69. public int bowCount;
  70. private int bowID = 9452;
  71. public float bow;
  72. public float bowPrice;
  73. GEItem bowGE;
  74.  
  75.  
  76.  
  77. private final Color color1 = new Color(0, 0, 0);
  78. private final Color color2 = new Color(255, 255, 255);
  79. private final Color color3 = new Color(255, 255, 51);
  80. private final BasicStroke stroke1 = new BasicStroke(1);
  81. private final Font font1 = new Font("Arial", 1, 11);
  82.  
  83. public boolean onStart(){
  84. getPrices();
  85. startTime = System.currentTimeMillis();
  86. startLevel = skills.getRealLevel(Skills.WOODCUTTING);
  87. status = "Starting HUBEB's Yew 'N' Fletch + Bank (Stock Edition)";
  88. log("Start at Bank or Yew with Knife in Inventory (hatchet can be in inventory too)");
  89. startExp = 0;
  90. if ( startExp == 0) {
  91. startExp = skills.getCurrentExp(Skills.WOODCUTTING);
  92. }
  93. startLevelFl = skills.getRealLevel(Skills.FLETCHING);
  94. startExpFl = 0;
  95. if ( startExpFl == 0) {
  96. startExpFl = skills.getCurrentExp(Skills.FLETCHING);
  97. }
  98. log("Mouse Speed is: " + mouse.getSpeed());
  99. mouse.setSpeed(10);
  100. log("Starting level (WC): " + startLevel);
  101. log("Starting level (FL): " + startLevelFl);
  102. return true;
  103. }
  104. public void serverMessageRecieved(ServerMessageEvent e) {
  105. String msg = e.getMessage();
  106. if (msg.contains("You get some")) {
  107. logCount++;
  108. }
  109. e.getMessage();
  110. if (msg.contains("You carefully")) {
  111. bowCount++;
  112. }
  113. }
  114.  
  115. public void getPrices(){
  116. log("Getting the prices of the items from the GE. This can take a while.");
  117. bowGE = grandExchange.lookup(bowID);
  118. bowPrice = bowGE.getMarketPrice();
  119. }
  120.  
  121. public int loop(){
  122. if(inventory.isFull()){
  123.  
  124. if(bankArea.contains(getMyPlayer().getLocation())){
  125. Fletch();
  126. antiBan();
  127. RSNPC Banker = npcs.getNearest(bankerId);
  128. if (Banker.isOnScreen() && !bank.isOpen()) {
  129. Banker.doAction("Bank Banker");
  130. sleep(random(2000, 4000));
  131. if (bank.isOpen()) {
  132. bank.depositAllExcept(knifeID);
  133. }
  134. bank.close();
  135. antiBan();
  136. }
  137. }else{
  138. if(walking.getDestination() == null || calc.distanceTo(walking.getDestination()) < random(4, 6)){
  139. walking.walkPathMM(walkingPath);
  140. return random(1000, 1500);
  141. }
  142. antiBan();
  143. }
  144. }else{
  145. if(mineArea.contains(getMyPlayer().getLocation())){
  146. if(getMyPlayer().getAnimation() != 2846){
  147. RSObject tree = objects.getNearest(anyMaple);
  148. antiBan();
  149. if(tree != null){
  150. tree.doAction("Chop");
  151. antiBan();
  152. sleep(1800, 2800);
  153. }
  154. antiBan();
  155. }
  156. }else{
  157. if(walking.getDestination() == null || calc.distanceTo(walking.getDestination()) < random(4, 6)){
  158. walking.walkPathMM(walking.reversePath(walkingPath));
  159. return random(1000, 1500);
  160. }
  161. antiBan();
  162. }
  163. }
  164. return random(100, 200);
  165. }
  166.  
  167. public void Fletch() {
  168. RSItem knife = inventory.getItem(knifeID);
  169. RSItem log = inventory.getItem(logID);
  170.  
  171. knife.doClick(true);
  172. log.doClick(true);
  173. mouse.move(365, 416, 7, 7);
  174. sleep(500);
  175. mouse.click(true);
  176. antiBan();
  177. sleep(55000);
  178. }
  179.  
  180. // HUBEBs Anti-Ban START
  181. public void antiBan() {
  182. int b = random(0, 10);
  183. switch (b) {
  184. case 1: //Mouse off Screen
  185. log("AntiBan Move Mouse Off Screen");
  186. if (random(0,4) == 3) {
  187. mouse.moveOffScreen();
  188. sleep(random(2000, 5500));
  189. }
  190. break;
  191. case 2: //Move Mouse
  192. log("AntiBan Move Mouse Randomly");
  193. if (random(0,4) == 2) {
  194. mouse.moveSlightly();
  195. sleep(300, 700);
  196. mouse.moveRandomly(40, 860);
  197. }
  198. break;
  199. case 3: //Turn Screen
  200. log("Turn Screen/Camera Randomly");
  201. if (random(0, 4) == 1) {
  202. camera.setAngle(random(100, 359));
  203. sleep(500,1500);
  204. }
  205. break;
  206. default:
  207. break;
  208. }
  209. }
  210. // HUBEBs Anti-Ban FINISH
  211.  
  212. public void onFinish(){
  213. log("Script finished");
  214. }
  215. //START: Paint All
  216. public void onRepaint(Graphics g1) {
  217. //Timer
  218. long millis = System.currentTimeMillis() - startTime;
  219. long hours = millis / (1000 * 60 * 60);
  220. millis -= hours * (1000 * 60 * 60);
  221. long minutes = millis / (1000 * 60);
  222. millis -= minutes * (1000 * 60);
  223. long seconds = millis / 1000;
  224. long minutes2 = minutes + (hours * 60);
  225. //PaintNorm
  226. currentLevel = skills.getRealLevel(Skills.WOODCUTTING);
  227. gainedLevels = currentLevel - startLevel;
  228. expGained = skills.getCurrentExp(Skills.WOODCUTTING) - startExp;
  229. percent = skills.getPercentToNextLevel(Skills.WOODCUTTING);
  230. timeRan = System.currentTimeMillis() - startTime;
  231. //Fletching
  232. currentLevelFl = skills.getRealLevel(Skills.FLETCHING);
  233. gainedLevelsFl = currentLevelFl - startLevelFl;
  234. expGainedFl = skills.getCurrentExp(Skills.FLETCHING) - startExpFl;
  235. percentFl = skills.getPercentToNextLevel(Skills.FLETCHING);
  236. timeRan = System.currentTimeMillis() - startTime;
  237. Graphics2D g = (Graphics2D)g1;
  238. //Mouse
  239. g.setColor(Color.black);
  240. g.drawLine(0, (int)(mouse.getLocation().getY()), 800, (int)(mouse.getLocation().getY()));
  241. g.drawLine((int)(mouse.getLocation().getX()), 0, (int)(mouse.getLocation().getX()), 800);
  242. g.setColor(Color.black);
  243. g.drawLine(0, (int)(mouse.getLocation().getY()) +1, 800, (int)(mouse.getLocation().getY())+1);
  244. g.drawLine((int)(mouse.getLocation().getX()) +1, 0, (int)(mouse.getLocation().getX())+1, 800);
  245. //paint
  246. g.setColor(color1);
  247. g.fillRect(362, 7, 150, 121);
  248. g.setColor(color2);
  249. g.setStroke(stroke1);
  250. g.drawRect(362, 7, 150, 121);
  251. g.setFont(font1);
  252. g.drawString("Yews Cut: " + logCount, 374, 25);
  253. g.drawString("Stock made: " + bowCount, 374, 35);
  254. g.drawString("Exp Gained (WC): " + expGained, 374, 53);
  255. g.drawString("Exp Gained (FL): " + expGainedFl, 374, 63);
  256. g.drawString("" + percent + "% TNL (WC)", 384, 78);
  257. g.drawString("" + percentFl + "% TNL (FL)", 384, 88);
  258. g.drawString("Run Time: " + hours + ":" + minutes + ":" + seconds + ".",374, 103);
  259. g.drawString("Profit: approx. "+((int)(bowCount*bowPrice))+"gp",374,113);
  260. g.setColor(color3);
  261. g.drawString("Made By HUBEB", 385, 125);
  262. }
  263.  
  264.  
  265.  
  266.  
  267. //END: PaintAll
  268. }
Add Comment
Please, Sign In to add comment