Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.*;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStreamReader;
- import java.net.URL;
- import java.net.URLConnection;
- import javax.swing.*;
- 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.Widgets;
- import org.powerbot.game.api.methods.input.Mouse;
- import org.powerbot.game.api.methods.interactive.NPCs;
- import org.powerbot.game.api.methods.interactive.Players;
- import org.powerbot.game.api.methods.node.GroundItems;
- import org.powerbot.game.api.methods.node.Menu;
- import org.powerbot.game.api.methods.node.SceneEntities;
- import org.powerbot.game.api.methods.tab.Inventory;
- 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.GroundItem;
- import org.powerbot.game.api.wrappers.widget.WidgetChild;
- import org.powerbot.game.bot.event.listener.PaintListener;
- @Manifest(name = "Asher", description = "Loots Ashes | 50-200k/h | Version 1.3 | Made by: Thondar", version = 1.3, authors = {"Thondar"})
- public class Asher extends ActiveScript implements PaintListener {
- int Ash = 592;
- int Fire[] = {70762, 70761, 70760, 70759, 70758, 70757, 70756, 70755};
- int Banker[] = {553, 3418};
- long startTime;
- long runTime;
- long hr, min, sec;
- long xpGain;
- int AshCount;
- int AshInv;
- int AshPrice;
- int AshHour;
- int Profit;
- int ProfitHour;
- int Location;
- int WorldHop = 0;
- Area LootArea;
- Area LootArea1 = new Area(new Tile(3166, 3425, 0), new Tile(3208, 3432, 0)); // West Varrock
- Area LootArea2 = new Area(new Tile(3167, 3469, 0), new Tile(3190, 3493, 0)); // GE
- Area LootArea3 = new Area(new Tile(3236, 3424, 0), new Tile(3267, 3436, 0)); // East Varrock
- Area BankArea;
- Area BankArea1 = new Area(new Tile(3181, 3431, 0), new Tile(3190, 3448, 0)); // West Varrock
- Area BankArea2 = new Area(new Tile(3175, 3474, 0), new Tile(3184, 3483, 0)); // GE
- Area BankArea3 = new Area(new Tile(3249, 3418, 0), new Tile(3258, 3424, 0)); // East Varrock
- private static WidgetChild Close;
- private static WidgetChild Lobby;
- private static WidgetChild skipEmail;
- private static WidgetChild worldSelect;
- private static WidgetChild highRisk;
- private static WidgetChild Play;
- private int getPrice(int id) throws IOException {
- URL url = new URL("http://open.tip.it/json/ge_single_item?item=" + 592);
- URLConnection con = url.openConnection();
- BufferedReader in = new BufferedReader(new InputStreamReader(
- con.getInputStream()));
- String line = "";
- String inputLine;
- while ((inputLine = in.readLine()) != null) {
- line += inputLine;
- }
- in.close();
- if (!line.contains("mark_price"))
- return -1;
- line = line.substring(line.indexOf("mark_price\":\"")
- + "mark_price\":\"".length());
- line = line.substring(0, line.indexOf("\""));
- return Integer.parseInt(line.replaceAll(",", ""));
- }
- GUI g;
- private boolean guiWait = true;
- String time;
- String status;
- Tile AshTile = new Tile(3186, 3429, 0);
- Tile EastFS1 = new Tile(3246, 3429, 0);
- Tile EastFS2 = new Tile(3259, 3429, 0);
- Tile WestFS1 = new Tile(3246, 3429, 0);
- Tile WestFS2 = new Tile(3246, 3429, 0);
- Tile GEFS1;
- Tile GEFS2;
- boolean start = false;
- @Override
- protected void setup() {
- log.info("Welcome to Asher 1.2");
- log.info("Made by Thondar");
- start = true;
- AshCount = 0;
- try {
- AshPrice = getPrice(592);
- } catch (IOException e) {
- e.printStackTrace();
- }
- g = new GUI();
- g.setVisible(true);
- startTime = System.currentTimeMillis();
- final WaitGui guiTask = new WaitGui();
- provide(new Strategy(guiTask, guiTask));
- provide(new Strategy(new WaitGui(), new WaitGui()));
- AntiBan ab = new AntiBan();
- Strategy abStrategy = new Strategy(ab, ab);
- provide(abStrategy);
- PickAsh pickash = new PickAsh();
- Strategy pickashStrategy = new Strategy(pickash, pickash);
- provide(pickashStrategy);
- Bank bank = new Bank();
- Strategy bankStrategy = new Strategy(bank, bank);
- provide(bankStrategy);
- BankOpen bankopen = new BankOpen();
- Strategy bankopenStrategy = new Strategy(bankopen, bankopen);
- provide(bankopenStrategy);
- BankWalk bankwalk = new BankWalk();
- Strategy bankwalkStrategy = new Strategy(bankwalk, bankwalk);
- provide(bankwalkStrategy);
- AshWalk ashwalk = new AshWalk();
- Strategy ashwalkStrategy = new Strategy(ashwalk, ashwalk);
- provide(ashwalkStrategy);
- Click click = new Click();
- Strategy clickStrategy = new Strategy(click, click);
- provide(clickStrategy);
- Run run = new Run();
- Strategy runStrategy = new Strategy(run, run);
- provide(runStrategy);
- Rest rest = new Rest();
- Strategy restStrategy = new Strategy(rest, rest);
- provide(restStrategy);
- Worldhop wh = new Worldhop();
- Strategy whStrategy = new Strategy(wh, wh);
- provide(whStrategy);
- FailSafe fs = new FailSafe();
- Strategy fsStrategy = new Strategy(fs, fs);
- provide(fsStrategy);
- Tabs.INVENTORY.open(false);
- }
- private class WaitGui implements Task, Condition {
- @Override
- public void run() {
- while (guiWait) {
- Time.sleep(500);
- }
- }
- public boolean validate() {
- return guiWait;
- }
- }
- private class AntiBan implements Task, Condition {
- @Override
- public void run() {
- switch(Random.nextInt(1, 1000)){
- 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(100, 200));
- }
- @Override
- public boolean validate() {
- return start;
- }
- }
- private class PickAsh implements Task, Condition {
- @Override
- public void run() {
- GroundItem Ashes = GroundItems.getNearest(Ash);
- if(Ashes == null){
- status = ("Looking for Ashes");
- Walking.walk(AshTile);
- }
- if(Ashes != null && !Ashes.isOnScreen()){
- status = ("Walking to Ash");
- Walking.walk(Ashes.getLocation());
- }
- if(Ashes.isOnScreen()){
- status = ("Looting Ashes");
- Ashes.interact("Take", "Ash");
- }
- if(!Walking.isRunEnabled()){
- Walking.setRun(true);
- }
- }
- @Override
- public boolean validate() {
- return !Inventory.isFull() && LootArea.contains(GroundItems.getNearest(Ash));
- }
- }
- private class Click implements Task, Condition {
- @Override
- public void run() {
- Mouse.click(true);
- }
- @Override
- public boolean validate() {
- return Menu.contains("Take Ashes");
- }
- }
- private class Run implements Task, Condition {
- @Override
- public void run() {
- Walking.setRun(true);
- }
- @Override
- public boolean validate() {
- return !Walking.isRunEnabled() && Walking.getEnergy() >= 50;
- }
- }
- private class Rest implements Task, Condition {
- @Override
- public void run() {
- if(!Players.getLocal().isMoving()){
- Widgets.get(750, 0).interact("Rest");
- }
- }
- @Override
- public boolean validate() {
- return Players.getLocal().getAnimation() == -1 && Walking.getEnergy() <= 30;
- }
- }
- private class BankWalk implements Task, Condition {
- @Override
- public void run() {
- status = ("Walking to Bank");
- Camera.setPitch(Random.nextInt(88, 96));
- Camera.setAngle(Random.nextInt(160, 200));
- Walking.walk(NPCs.getNearest(Banker).getLocation());
- }
- @Override
- public boolean validate() {
- return Inventory.isFull() && !BankArea.contains(Players.getLocal());
- }
- }
- private class AshWalk implements Task, Condition {
- @Override
- public void run() {
- Time.sleep(Random.nextInt(2000, 2600));
- if(GroundItems.getNearest(Ash) == null) {
- status = ("Looking for Ashes");
- Camera.setPitch(Random.nextInt(40, 80));
- Camera.setAngle(Random.nextInt(90, 270));
- Walking.walk(AshTile);
- Walking.setRun(true);
- }
- }
- @Override
- public boolean validate() {
- return !Inventory.isFull() && !(GroundItems.getNearest(Ash) == null) && SceneEntities.getNearest(Fire) != null;
- }
- }
- private class BankOpen implements Task, Condition {
- @Override
- public void run() {
- status = ("Banking");
- NPCs.getNearest(Banker).interact("Bank");
- Time.sleep(Random.nextInt(2000, 3500));
- }
- @Override
- public boolean validate() {
- return Inventory.isFull() && NPCs.getNearest(Banker).isOnScreen() && BankArea.contains(Players.getLocal()) && !Players.getLocal().isMoving() && !org.powerbot.game.api.methods.widget.Bank.isOpen();
- }
- }
- private class Bank implements Task, Condition {
- @Override
- public void run() {
- status = ("Banking");
- AshInv = Inventory.getCount(Ash);
- AshCount += AshInv;
- org.powerbot.game.api.methods.widget.Bank.depositInventory();
- Time.sleep(Random.nextInt(500, 900));
- org.powerbot.game.api.methods.widget.Bank.close();
- }
- @Override
- public boolean validate() {
- return Inventory.isFull() && org.powerbot.game.api.methods.widget.Bank.isOpen();
- }
- }
- private class FailSafe implements Task, Condition {
- @Override
- public void run() {
- if(Location == 1){
- Walking.walk(WestFS1);
- Time.sleep(200);
- Walking.walk(WestFS2);
- }else if(Location == 1){
- Walking.walk(EastFS1);
- Time.sleep(200);
- Walking.walk(EastFS2);
- }else{
- Walking.walk(GEFS1);
- Time.sleep(200);
- Walking.walk(GEFS2);
- }
- }
- @Override
- public boolean validate() {
- return Inventory.isFull() && !Players.getLocal().isMoving() && LootArea.contains(Players.getLocal());
- }
- }
- // Credit to Jadedtdt for Worldhopping //
- private class Worldhop implements Task, Condition {
- @Override
- public void run() {
- status = ("Changing World");
- Close = Widgets.get(548, 159);
- Close.click(true);
- Time.sleep(Random.nextInt(500, 1500));
- Lobby = Widgets.get(182, 2);
- Lobby.click(true);
- Time.sleep(Random.nextInt(5000, 7000));
- skipEmail = Widgets.get(906, 378);
- if (skipEmail.isOnScreen()) {
- skipEmail.click(true);
- }
- Time.sleep(Random.nextInt(3000, 5000));
- worldSelect = Widgets.get(906, 28);
- worldSelect.click(true);
- Time.sleep(Random.nextInt(1000, 2000));
- Mouse.move(177, 180);
- Mouse.click(true);
- Time.sleep(Random.nextInt(700, 1300));
- Mouse.move(563, 177);
- Mouse.click(true);
- Time.sleep(Random.nextInt(700, 1300));
- Mouse.move(375, 220);
- Mouse.click(true);
- Time.sleep(Random.nextInt(500, 1000));
- Play = Widgets.get(906, 186);
- Play.click(true);
- Time.sleep(Random.nextInt(200, 500));
- highRisk = Widgets.get(906, 119);
- highRisk.click(true);
- Time.sleep(Random.nextInt(21000, 26000));
- Mouse.click(499, 71, true);
- Time.sleep(Random.nextInt(700, 1100));
- }
- @Override
- public boolean validate() {
- return (SceneEntities.getNearest(Fire) == null) && WorldHop == 1;
- }
- }
- // Credit to Jadedtdt for Worldhopping //
- 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;
- g2d.setColor(Color.RED);
- g2d.drawLine((Mouse.getX() -3), Mouse.getY(), (Mouse.getX() +3), Mouse.getY());
- g2d.drawLine(Mouse.getX(), (Mouse.getY() - 3), Mouse.getX(), (Mouse.getY() + 3));
- g2d.drawLine((Mouse.getX() - 1), (Mouse.getY() - 1), (Mouse.getX() + 1), (Mouse.getY() + 1));
- g2d.drawLine((Mouse.getX() + 1), (Mouse.getY() - 1), (Mouse.getX() - 1), (Mouse.getY() + 1));
- int AshHour = (int) ((AshCount) * 3600000D / (System
- .currentTimeMillis() - startTime));
- Profit = AshCount * AshPrice;
- ProfitHour = AshHour * AshPrice;
- Rectangle bg = new Rectangle(0, 0, 800, 50);
- g2d.setComposite(makeComposite(1f));
- g2d.setColor(Color.BLACK);
- g2d.fill(bg);
- g2d.setFont(font1);
- g2d.setComposite(makeComposite(1f));
- g2d.setColor(Color.RED);
- g2d.drawString("Asher", 30, 20);
- g2d.setFont(font3);
- g2d.drawString("by Thondar", 15, 35);
- g2d.setFont(font4);
- g2d.drawString("Version 1.3", 20, 45);
- g2d.setFont(font2);
- g2d.setComposite(makeComposite(.8f));
- g2d.setColor(Color.WHITE);
- g2d.drawString("Time Run: " + timeRun(), 150, 20);
- g2d.setComposite(makeComposite(.8f));
- g2d.setColor(Color.WHITE);
- g2d.drawString("Status: " + status, 150, 40);
- g2d.setComposite(makeComposite(.8f));
- g2d.setColor(Color.WHITE);
- g2d.drawString("Ashes Banked: " + AshCount, 350, 20);
- g2d.setComposite(makeComposite(.8f));
- g2d.setColor(Color.WHITE);
- g2d.drawString("Ashes Banked/H: " + AshHour, 350, 40);
- g2d.setComposite(makeComposite(.8f));
- g2d.setColor(Color.WHITE);
- g2d.drawString("Profit: " + Profit, 550, 20);
- g2d.setComposite(makeComposite(.8f));
- g2d.setColor(Color.WHITE);
- g2d.drawString("Profit/H: " + ProfitHour, 550, 40);
- }
- public String timeRun() {
- 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;
- if (hr < 10)
- time += "0" + hr + ":";
- else
- time += hr + ":";
- if (min < 10)
- time += "0" + min + ":";
- else
- time += min + ":";
- if (sec < 10)
- time += "0" + sec;
- else
- time += sec;
- return time;
- }
- class GUI extends JFrame {
- public GUI() {
- initComponents();
- }
- private void StartButtonActionPerformed(ActionEvent e) {
- String u = LocationCB.getSelectedItem().toString(); {
- if (u.equals("Varrock West")) {
- Location = 1;
- AshTile = new Tile(3184, 3429, 0);
- LootArea = LootArea1;
- BankArea = BankArea1;
- }else if (u.equals("Varrock East")) {
- Location = 2;
- AshTile = new Tile(3253, 3428, 0);
- LootArea = LootArea3;
- BankArea = BankArea3;
- }else if (u.equals("Grand Exchange")) {
- Location = 3;
- AshTile = new Tile(3165, 3480, 0);
- LootArea = LootArea2;
- BankArea = BankArea2;
- }
- if (radioButton1.isSelected()) {
- WorldHop = 1;
- }
- }
- guiWait = false;
- g.dispose();
- }
- private void initComponents() {
- // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
- // Generated using JFormDesigner Evaluation license - Jonas Bill Jensen
- label1 = new JLabel();
- label2 = new JLabel();
- LocationCB = new JComboBox();
- StartButton = new JButton();
- radioButton1 = new JRadioButton();
- label3 = new JLabel();
- label4 = new JLabel();
- //======== this ========
- Container contentPane = getContentPane();
- contentPane.setLayout(null);
- //---- label1 ----
- label1.setText("Asher");
- label1.setHorizontalAlignment(SwingConstants.CENTER);
- label1.setFont(new Font("Segoe Print", Font.BOLD, 27));
- contentPane.add(label1);
- label1.setBounds(0, 0, 290, 60);
- //---- label2 ----
- label2.setText("Location?");
- label2.setHorizontalAlignment(SwingConstants.CENTER);
- label2.setFont(new Font("Verdana", Font.PLAIN, 12));
- contentPane.add(label2);
- label2.setBounds(0, 80, 290, 30);
- //---- LocationCB ----
- LocationCB.setModel(new DefaultComboBoxModel(new String[] {
- "Varrock West",
- "Varrock East",
- "Grand Exchange"
- }));
- contentPane.add(LocationCB);
- LocationCB.setBounds(90, 105, 110, 30);
- //---- StartButton ----
- StartButton.setText("Start");
- StartButton.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- StartButtonActionPerformed(e);
- }
- });
- contentPane.add(StartButton);
- StartButton.setBounds(5, 260, 280, 55);
- //---- radioButton1 ----
- radioButton1.setText("Use World hopping?");
- contentPane.add(radioButton1);
- radioButton1.setBounds(85, 170, 120, radioButton1.getPreferredSize().height);
- //---- label3 ----
- label3.setText("World hopping means it will change world");
- label3.setFont(new Font("Verdana", Font.PLAIN, 10));
- label3.setHorizontalAlignment(SwingConstants.CENTER);
- contentPane.add(label3);
- label3.setBounds(0, 195, 290, label3.getPreferredSize().height);
- //---- label4 ----
- label4.setText("if there arent any firemakes in your current world");
- label4.setFont(new Font("Verdana", Font.PLAIN, 10));
- label4.setHorizontalAlignment(SwingConstants.CENTER);
- contentPane.add(label4);
- label4.setBounds(5, 210, 280, label4.getPreferredSize().height);
- { // compute preferred size
- Dimension preferredSize = new Dimension();
- for(int i = 0; i < contentPane.getComponentCount(); i++) {
- Rectangle bounds = contentPane.getComponent(i).getBounds();
- preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
- preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
- }
- Insets insets = contentPane.getInsets();
- preferredSize.width += insets.right;
- preferredSize.height += insets.bottom;
- contentPane.setMinimumSize(preferredSize);
- contentPane.setPreferredSize(preferredSize);
- }
- pack();
- setLocationRelativeTo(getOwner());
- // JFormDesigner - End of component initialization //GEN-END:initComponents
- }
- // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
- // Generated using JFormDesigner Evaluation license - Jonas Bill Jensen
- private JLabel label1;
- private JLabel label2;
- private JComboBox LocationCB;
- private JButton StartButton;
- private JRadioButton radioButton1;
- private JLabel label3;
- private JLabel label4;
- // JFormDesigner - End of variables declaration //GEN-END:variables
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment