Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.*;
- import java.text.DecimalFormat;
- import org.powerbot.concurrent.Task;
- import org.powerbot.concurrent.strategy.Condition;
- import org.powerbot.concurrent.strategy.Strategy;
- import org.powerbot.game.api.ActiveScript;
- import org.powerbot.game.api.Manifest;
- import org.powerbot.game.api.methods.Tabs;
- import org.powerbot.game.api.methods.Walking;
- import org.powerbot.game.api.methods.interactive.NPCs;
- import org.powerbot.game.api.methods.interactive.Players;
- import org.powerbot.game.api.methods.tab.Inventory;
- import org.powerbot.game.api.methods.tab.Skills;
- import org.powerbot.game.api.methods.widget.Camera;
- import org.powerbot.game.api.util.Random;
- import org.powerbot.game.api.util.Time;
- import org.powerbot.game.api.wrappers.Area;
- import org.powerbot.game.api.wrappers.Tile;
- import org.powerbot.game.api.wrappers.node.Item;
- import org.powerbot.game.bot.event.listener.PaintListener;
- @Manifest(name = "AIO Net Fisher", description = "Powerfishes Shrimps and Anchovies at any net fishing spot!", version = 1.00, authors = {"Thondar"})
- public class AIONetFisher extends ActiveScript implements PaintListener {
- int Shrimp = 317;
- int Anchovies = 321;
- int FishingSpot[] = {4908, 327};
- long startXP;
- int startLVL;
- long startTime;
- long runTime, xpTime;
- long hr, min, sec, xphr, xpmin, xpsec;
- long xpGain;
- String time;
- String status;
- String xptime;
- Tile FishTile = new Tile(3239, 3155, 0);
- DecimalFormat format = new DecimalFormat("#.##");
- boolean start = false;
- Area FishArea = new Area(new Tile(3225, 3139, 0), new Tile(3247, 3172, 0));
- @Override
- protected void setup() {
- log.info("Welcome to Net Fisher 1.11");
- log.info("Made by Tarth and Thondar");
- start = true;
- startTime = System.currentTimeMillis();
- startXP = Skills.getExperience(Skills.FISHING);
- startLVL = Skills.getLevel(Skills.FISHING);
- Fish fish = new Fish();
- Strategy fishStrategy = new Strategy(fish, fish);
- provide(fishStrategy);
- Drop drop = new Drop();
- Strategy dropStrategy = new Strategy(drop, drop);
- provide(dropStrategy);
- AntiBan ab = new AntiBan();
- Strategy abStrategy = new Strategy(ab, ab);
- provide(abStrategy);
- Tabs.INVENTORY.open(false);
- }
- private class Fish implements Task, Condition {
- @Override
- public void run() {
- Camera.turnTo(NPCs.getNearest(FishingSpot));
- Fish();
- Time.sleep(Random.nextInt(500, 1000));
- }
- @Override
- public boolean validate() {
- return !Inventory.isFull() && (Players.getLocal().getAnimation() == -1);
- }
- }
- private class Drop implements Task, Condition {
- @Override
- public void run() {
- drop();
- }
- @Override
- public boolean validate() {
- return Inventory.isFull() ;
- }
- }
- private class AntiBan implements Task, Condition {
- @Override
- public void run() {
- switch(Random.nextInt(1, 100)){
- case 3:
- Camera.setAngle(Random.nextInt(1, 150));
- case 33:
- Camera.setAngle(Random.nextInt(1, 310));
- case 75:
- Camera.setAngle(Random.nextInt(1, 210));
- default:
- }
- Time.sleep(Random.nextInt(500, 1000));
- }
- @Override
- public boolean validate() {
- return start;
- }
- }
- public void Fish() {
- log.info("Fishing");
- status = ("Fishing");
- Tabs.INVENTORY.open(false);
- if (!(NPCs.getNearest(FishingSpot).isOnScreen()));
- NPCs.getNearest(FishingSpot).interact("Net");
- }
- public void drop() {
- log.info("Dropping");
- status = ("Dropping");
- Tabs.INVENTORY.open(false);
- for(Item elite:Inventory.getItems()){
- if(elite !=null){
- elite.getWidgetChild().interact("Drop");
- }
- }
- }
- private AlphaComposite makeComposite(float alpha) {
- int type = AlphaComposite.SRC_OVER;
- return(AlphaComposite.getInstance(type, alpha));
- }
- private final Font font1 = new Font("Verdana", 0, 16);
- private final Font font2 = new Font("Verdana", 0, 12);
- private final Font font3 = new Font("Verdana", 0, 13);
- private final Font font4 = new Font("Verdana", 0, 9);
- @Override
- public void onRepaint(Graphics g) {
- Graphics2D g2d = (Graphics2D) g;
- runTime = System.currentTimeMillis() - startTime;
- time = "";
- hr = runTime / (1000 * 60 * 60);
- min = (runTime % (1000 * 60 * 60)) / (1000 * 60);
- sec = ((runTime % (1000 * 60 * 60)) % (1000 * 60)) / 1000;
- xpGain = (Skills.getExperience(Skills.FISHING) - startXP);
- int xpHour = (int) ((xpGain) * 3600000D / (System
- .currentTimeMillis() - startTime));
- int level = Skills.getLevel(Skills.FISHING);
- int startXP = Skills.getExperienceRequired(level);
- int nextXP = Skills.getExperienceRequired(level + 1);
- double rangeXP = nextXP-startXP;
- double currentRelativeXP = Skills.getExperience(Skills.FISHING) - startXP;
- double currentXPleft = nextXP - Skills.getExperience(Skills.FISHING);
- double percentA = currentRelativeXP/rangeXP;
- double percentToLvl = ((percentA) * 100D);
- double percent = (int) ((percentA) * 160D);
- xpTime = (long) ((currentXPleft / xpHour) * 3600000D);
- xptime = "";
- xphr = xpTime / (1000 * 60 * 60);
- xpmin = (xpTime % (1000 * 60 * 60)) / (1000 * 60);
- xpsec = ((xpTime % (1000 * 60 * 60)) % (1000 * 60)) / 1000;
- Rectangle bg = new Rectangle(10, 10, 160, 230);
- g2d.setComposite(makeComposite(.5f));
- g2d.setColor(Color.LIGHT_GRAY);
- g2d.fill(bg);
- g2d.setComposite(makeComposite(.5f));
- g2d.setColor(Color.BLACK);
- g2d.drawRect(10, 10, 160, 230);
- g2d.setFont(font1);
- g2d.setComposite(makeComposite(1f));
- g2d.setColor(Color.BLUE);
- g2d.drawString("AIO Net Fisher", 35, 30);
- g2d.setFont(font3);
- g2d.drawString("by Thondar", 55, 45);
- g2d.setFont(font4);
- g2d.setComposite(makeComposite(.8f));
- g2d.setColor(Color.BLUE);
- g2d.drawString("Version 1.00", 60, 55);
- g2d.setComposite(makeComposite(.5f));
- g2d.setColor(Color.BLACK);
- g2d.drawLine(20, 110, 160, 110);
- g2d.drawLine(20, 160, 160, 160);
- g2d.drawLine(20, 210, 160, 210);
- g2d.setFont(font2);
- g2d.setComposite(makeComposite(.8f));
- g2d.setColor(new Color (0x00, 0x33, 0xff));
- g2d.drawString("Time Run: " + hr + ":" + min + ":" + sec, 30, 80);
- g2d.setComposite(makeComposite(.8f));
- g2d.setColor(new Color (0x00, 0x33, 0xff));
- g2d.drawString("Status: " + status, 30, 100);
- g2d.setComposite(makeComposite(.8f));
- g2d.setColor(new Color (0x00, 0x33, 0xff));
- g2d.drawString("XP/H: " + xpHour, 30, 130);
- g2d.setComposite(makeComposite(.8f));
- g2d.setColor(new Color (0x00, 0x33, 0xff));
- g2d.drawString("XP Gained: " + xpGain, 30, 150);
- g2d.setComposite(makeComposite(.8f));
- g2d.setColor(new Color (0x00, 0x33, 0xff));
- g2d.drawString("Levels Gained: " + (Skills.getLevel(Skills.FISHING) - startLVL), 30, 180);
- g2d.setComposite(makeComposite(.8f));
- g2d.setColor(new Color (0x00, 0x33, 0xff));
- g2d.drawString("Current Level: " + (Skills.getLevel(Skills.FISHING)), 30, 200);
- g2d.setComposite(makeComposite(.8f));
- g2d.setColor(new Color (0x00, 0x33, 0xff));
- g2d.drawString("Time to lvl: " + xphr + ":" + xpmin + ":" + xpsec, 30, 230);
- g2d.setComposite(makeComposite(.5f));
- g2d.setColor(Color.BLACK);
- g2d.drawRect(10, 240, 160, 15);
- g2d.setComposite(makeComposite(.5f));
- g2d.setColor(Color.LIGHT_GRAY);
- g2d.fillRect(11, 241, 158, 13);
- g2d.setComposite(makeComposite(.6f));
- g2d.setColor(Color.GREEN);
- g2d.fillRect(11, 241,(int) (percent), 13);
- g2d.setComposite(makeComposite(.8f));
- g2d.setColor(Color.BLUE);
- g2d.drawString (String.format("%.2f", percentToLvl) + "%" , 75, 251);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment