hubeb

Yew 'N' Fletch (Shortbow Edition) + Bank

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