Thondar

AIO Net Fisher 1.00

Jun 29th, 2012
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.68 KB | None | 0 0
  1. import java.awt.*;
  2. import java.text.DecimalFormat;
  3.  
  4. import org.powerbot.concurrent.Task;
  5. import org.powerbot.concurrent.strategy.Condition;
  6. import org.powerbot.concurrent.strategy.Strategy;
  7. import org.powerbot.game.api.ActiveScript;
  8. import org.powerbot.game.api.Manifest;
  9. import org.powerbot.game.api.methods.Tabs;
  10. import org.powerbot.game.api.methods.Walking;
  11. import org.powerbot.game.api.methods.interactive.NPCs;
  12. import org.powerbot.game.api.methods.interactive.Players;
  13. import org.powerbot.game.api.methods.tab.Inventory;
  14. import org.powerbot.game.api.methods.tab.Skills;
  15. import org.powerbot.game.api.methods.widget.Camera;
  16. import org.powerbot.game.api.util.Random;
  17. import org.powerbot.game.api.util.Time;
  18. import org.powerbot.game.api.wrappers.Area;
  19. import org.powerbot.game.api.wrappers.Tile;
  20. import org.powerbot.game.api.wrappers.node.Item;
  21. import org.powerbot.game.bot.event.listener.PaintListener;
  22.  
  23.  
  24. @Manifest(name = "AIO Net Fisher", description = "Powerfishes Shrimps and Anchovies at any net fishing spot!", version = 1.00, authors = {"Thondar"})
  25. public class AIONetFisher extends ActiveScript implements PaintListener {
  26.  
  27. int Shrimp = 317;
  28. int Anchovies = 321;
  29. int FishingSpot[] = {4908, 327};
  30. long startXP;
  31. int startLVL;
  32. long startTime;
  33. long runTime, xpTime;
  34. long hr, min, sec, xphr, xpmin, xpsec;
  35. long xpGain;
  36.  
  37. String time;
  38. String status;
  39. String xptime;
  40.  
  41. Tile FishTile = new Tile(3239, 3155, 0);
  42.  
  43. DecimalFormat format = new DecimalFormat("#.##");
  44.  
  45. boolean start = false;
  46.  
  47. Area FishArea = new Area(new Tile(3225, 3139, 0), new Tile(3247, 3172, 0));
  48.  
  49.  
  50. @Override
  51. protected void setup() {
  52. log.info("Welcome to Net Fisher 1.11");
  53. log.info("Made by Tarth and Thondar");
  54. start = true;
  55.  
  56. startTime = System.currentTimeMillis();
  57.  
  58. startXP = Skills.getExperience(Skills.FISHING);
  59. startLVL = Skills.getLevel(Skills.FISHING);
  60.  
  61. Fish fish = new Fish();
  62. Strategy fishStrategy = new Strategy(fish, fish);
  63. provide(fishStrategy);
  64.  
  65. Drop drop = new Drop();
  66. Strategy dropStrategy = new Strategy(drop, drop);
  67. provide(dropStrategy);
  68.  
  69. AntiBan ab = new AntiBan();
  70. Strategy abStrategy = new Strategy(ab, ab);
  71. provide(abStrategy);
  72.  
  73. Tabs.INVENTORY.open(false);
  74.  
  75. }
  76.  
  77.  
  78. private class Fish implements Task, Condition {
  79.  
  80. @Override
  81. public void run() {
  82. Camera.turnTo(NPCs.getNearest(FishingSpot));
  83. Fish();
  84. Time.sleep(Random.nextInt(500, 1000));
  85.  
  86. }
  87.  
  88. @Override
  89. public boolean validate() {
  90. return !Inventory.isFull() && (Players.getLocal().getAnimation() == -1);
  91. }
  92.  
  93. }
  94.  
  95.  
  96. private class Drop implements Task, Condition {
  97.  
  98. @Override
  99. public void run() {
  100. drop();
  101.  
  102. }
  103.  
  104. @Override
  105. public boolean validate() {
  106. return Inventory.isFull() ;
  107. }
  108.  
  109. }
  110.  
  111.  
  112.  
  113. private class AntiBan implements Task, Condition {
  114.  
  115. @Override
  116. public void run() {
  117. switch(Random.nextInt(1, 100)){
  118. case 3:
  119. Camera.setAngle(Random.nextInt(1, 150));
  120. case 33:
  121. Camera.setAngle(Random.nextInt(1, 310));
  122. case 75:
  123. Camera.setAngle(Random.nextInt(1, 210));
  124. default:
  125. }
  126. Time.sleep(Random.nextInt(500, 1000));
  127. }
  128.  
  129. @Override
  130. public boolean validate() {
  131. return start;
  132. }
  133.  
  134. }
  135.  
  136.  
  137. public void Fish() {
  138. log.info("Fishing");
  139. status = ("Fishing");
  140. Tabs.INVENTORY.open(false);
  141. if (!(NPCs.getNearest(FishingSpot).isOnScreen()));
  142. NPCs.getNearest(FishingSpot).interact("Net");
  143. }
  144.  
  145. public void drop() {
  146. log.info("Dropping");
  147. status = ("Dropping");
  148. Tabs.INVENTORY.open(false);
  149. for(Item elite:Inventory.getItems()){
  150. if(elite !=null){
  151. elite.getWidgetChild().interact("Drop");
  152. }
  153.  
  154. }
  155.  
  156. }
  157.  
  158.  
  159. private AlphaComposite makeComposite(float alpha) {
  160. int type = AlphaComposite.SRC_OVER;
  161.  
  162. return(AlphaComposite.getInstance(type, alpha));
  163. }
  164.  
  165.  
  166. private final Font font1 = new Font("Verdana", 0, 16);
  167. private final Font font2 = new Font("Verdana", 0, 12);
  168. private final Font font3 = new Font("Verdana", 0, 13);
  169. private final Font font4 = new Font("Verdana", 0, 9);
  170.  
  171.  
  172. @Override
  173. public void onRepaint(Graphics g) {
  174. Graphics2D g2d = (Graphics2D) g;
  175.  
  176. runTime = System.currentTimeMillis() - startTime;
  177. time = "";
  178. hr = runTime / (1000 * 60 * 60);
  179. min = (runTime % (1000 * 60 * 60)) / (1000 * 60);
  180. sec = ((runTime % (1000 * 60 * 60)) % (1000 * 60)) / 1000;
  181.  
  182. xpGain = (Skills.getExperience(Skills.FISHING) - startXP);
  183.  
  184. int xpHour = (int) ((xpGain) * 3600000D / (System
  185. .currentTimeMillis() - startTime));
  186.  
  187. int level = Skills.getLevel(Skills.FISHING);
  188. int startXP = Skills.getExperienceRequired(level);
  189. int nextXP = Skills.getExperienceRequired(level + 1);
  190. double rangeXP = nextXP-startXP;
  191. double currentRelativeXP = Skills.getExperience(Skills.FISHING) - startXP;
  192. double currentXPleft = nextXP - Skills.getExperience(Skills.FISHING);
  193. double percentA = currentRelativeXP/rangeXP;
  194. double percentToLvl = ((percentA) * 100D);
  195.  
  196. double percent = (int) ((percentA) * 160D);
  197.  
  198. xpTime = (long) ((currentXPleft / xpHour) * 3600000D);
  199. xptime = "";
  200. xphr = xpTime / (1000 * 60 * 60);
  201. xpmin = (xpTime % (1000 * 60 * 60)) / (1000 * 60);
  202. xpsec = ((xpTime % (1000 * 60 * 60)) % (1000 * 60)) / 1000;
  203.  
  204. Rectangle bg = new Rectangle(10, 10, 160, 230);
  205. g2d.setComposite(makeComposite(.5f));
  206. g2d.setColor(Color.LIGHT_GRAY);
  207. g2d.fill(bg);
  208.  
  209. g2d.setComposite(makeComposite(.5f));
  210. g2d.setColor(Color.BLACK);
  211. g2d.drawRect(10, 10, 160, 230);
  212.  
  213. g2d.setFont(font1);
  214. g2d.setComposite(makeComposite(1f));
  215. g2d.setColor(Color.BLUE);
  216. g2d.drawString("AIO Net Fisher", 35, 30);
  217. g2d.setFont(font3);
  218. g2d.drawString("by Thondar", 55, 45);
  219.  
  220. g2d.setFont(font4);
  221. g2d.setComposite(makeComposite(.8f));
  222. g2d.setColor(Color.BLUE);
  223. g2d.drawString("Version 1.00", 60, 55);
  224.  
  225. g2d.setComposite(makeComposite(.5f));
  226. g2d.setColor(Color.BLACK);
  227. g2d.drawLine(20, 110, 160, 110);
  228. g2d.drawLine(20, 160, 160, 160);
  229. g2d.drawLine(20, 210, 160, 210);
  230.  
  231.  
  232. g2d.setFont(font2);
  233. g2d.setComposite(makeComposite(.8f));
  234. g2d.setColor(new Color (0x00, 0x33, 0xff));
  235. g2d.drawString("Time Run: " + hr + ":" + min + ":" + sec, 30, 80);
  236.  
  237. g2d.setComposite(makeComposite(.8f));
  238. g2d.setColor(new Color (0x00, 0x33, 0xff));
  239. g2d.drawString("Status: " + status, 30, 100);
  240.  
  241. g2d.setComposite(makeComposite(.8f));
  242. g2d.setColor(new Color (0x00, 0x33, 0xff));
  243. g2d.drawString("XP/H: " + xpHour, 30, 130);
  244.  
  245. g2d.setComposite(makeComposite(.8f));
  246. g2d.setColor(new Color (0x00, 0x33, 0xff));
  247. g2d.drawString("XP Gained: " + xpGain, 30, 150);
  248.  
  249. g2d.setComposite(makeComposite(.8f));
  250. g2d.setColor(new Color (0x00, 0x33, 0xff));
  251. g2d.drawString("Levels Gained: " + (Skills.getLevel(Skills.FISHING) - startLVL), 30, 180);
  252.  
  253. g2d.setComposite(makeComposite(.8f));
  254. g2d.setColor(new Color (0x00, 0x33, 0xff));
  255. g2d.drawString("Current Level: " + (Skills.getLevel(Skills.FISHING)), 30, 200);
  256.  
  257. g2d.setComposite(makeComposite(.8f));
  258. g2d.setColor(new Color (0x00, 0x33, 0xff));
  259. g2d.drawString("Time to lvl: " + xphr + ":" + xpmin + ":" + xpsec, 30, 230);
  260.  
  261. g2d.setComposite(makeComposite(.5f));
  262. g2d.setColor(Color.BLACK);
  263. g2d.drawRect(10, 240, 160, 15);
  264.  
  265. g2d.setComposite(makeComposite(.5f));
  266. g2d.setColor(Color.LIGHT_GRAY);
  267. g2d.fillRect(11, 241, 158, 13);
  268.  
  269. g2d.setComposite(makeComposite(.6f));
  270. g2d.setColor(Color.GREEN);
  271. g2d.fillRect(11, 241,(int) (percent), 13);
  272.  
  273. g2d.setComposite(makeComposite(.8f));
  274. g2d.setColor(Color.BLUE);
  275. g2d.drawString (String.format("%.2f", percentToLvl) + "%" , 75, 251);
  276.  
  277.  
  278. }
  279.  
  280.  
  281.  
  282. }
Advertisement
Add Comment
Please, Sign In to add comment