Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.Color;
- import java.awt.Desktop.Action;
- import java.awt.Font;
- import java.awt.Graphics;
- import java.awt.Graphics2D;
- import java.awt.RenderingHints;
- 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.Widgets;
- import org.powerbot.game.api.methods.node.Locations;
- import org.powerbot.game.api.methods.tab.Inventory;
- import org.powerbot.game.api.methods.tab.Skills;
- import org.powerbot.game.api.util.Filter;
- import org.powerbot.game.api.util.Random;
- import org.powerbot.game.api.util.Time;
- import org.powerbot.game.api.wrappers.node.Item;
- import org.powerbot.game.api.wrappers.node.Location;
- import org.powerbot.game.bot.event.listener.PaintListener;
- @Manifest(authors = { "Zomah2" }, name = "[HClean]", description = "The best cleaner around nowadays! (theres no others :p)", version = 0.1)
- public class HClean extends ActiveScript implements PaintListener {
- private final static int GRIMY_AVANTOE_ID = 211;
- private final static int CLEAN_AVANTOE_ID = 261;
- private int startXP;
- private int expGained;
- public long startTime = 0;
- public long millis = 0;
- public long hours = 0;
- public long minutes = 0;
- public long seconds = 0;
- public long last = 0;
- public int expHour = 0;
- public boolean guiInitialized;
- @Override
- protected void setup() {
- startXP = Skills.getExperiences()[15];
- startTime = System.currentTimeMillis();
- bank banker = new bank();
- Strategy BANKACTION = new Strategy((Condition) banker, banker);
- provide(BANKACTION);
- clean cleaner = new clean();
- Strategy CLEANACTION = new Strategy((Condition) cleaner, cleaner);
- provide(CLEANACTION);
- }
- private class bank implements Task, Condition {
- @Override
- public void run() {
- final Location bankChest = Locations.getNearest(new Filter<Location>() {
- public boolean accept(final Location loc) {
- return loc.getId() == 42192;
- }
- });
- if (bankChest != null) {
- if (Random.nextInt(0, 200) < 10) {
- bankChest.interact("use");
- Time.sleep(1000);
- } else {
- bankChest.click(true);
- Time.sleep(1000);
- }
- }
- if (Inventory.getItems().length == 0) {
- Widgets.get(762, 99).interact("Withdraw-All");
- Time.sleep(Random.nextInt(137, 241));
- } else {
- Widgets.get(762, 34).click(true);
- Widgets.get(762, 99).interact("Withdraw-All");
- Time.sleep(Random.nextInt(337, 447));
- Widgets.get(762, 45).click(true);
- }
- if (!cont() && Inventory.getItems().length > 0) {
- log.info("out of herbs.");
- stop();
- }
- }
- @Override
- public boolean validate() {
- return Widgets.get(762, 1).isOnScreen() && guiInitialized;
- }
- public boolean cont() {
- for (Item i : Inventory.getItems()) {
- if (i.getId() == GRIMY_AVANTOE_ID) {
- return true;
- }
- }
- return false;
- }
- }
- private class clean implements Task, Condition {
- @Override
- public void run() {
- for (Item i : Inventory.getItems()) {
- if (i.getId() == GRIMY_AVANTOE_ID) {
- i.getWidgetChild().interact("Clean");
- }
- }
- }
- @Override
- public boolean validate() {
- if (Inventory.getCount() >= 1) {
- for (Item i : Inventory.getItems()) {
- if (i.getId() == GRIMY_AVANTOE_ID) {
- return true;
- }
- }
- return false;
- }
- return false;
- }
- }
- public void onRepaint(Graphics graphics) {
- Graphics2D g = (Graphics2D) graphics;
- expHour = (int) ((expGained) * 3600000D / (System
- .currentTimeMillis()- startTime));
- millis = System.currentTimeMillis() - startTime;
- hours = millis / (1000 * 60 * 60);
- millis -= hours * (1000 * 60 * 60);
- minutes = millis / (1000 * 60);
- millis -= minutes * (1000 * 60);
- seconds = millis / 1000;
- expGained = Skills.getExperiences()[15] - startXP;
- g.setRenderingHints(new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF));
- g.setColor(new Color(0, 102, 51));
- g.fillRoundRect(6, 344, 507, 129, 5, 5);
- g.setColor(new Color(102, 255, 102));
- g.setFont(new Font("Arial", 0, 10));
- g.drawString("Time Running: " + hours + ":" + minutes + ":" + seconds, 19, 378);
- g.setColor(new Color(102, 255, 102));
- g.setFont(new Font("Arial", 0, 10));
- g.drawString("XP Gained: "+expGained, 20, 411);
- g.setColor(new Color(102, 255, 102));
- g.setFont(new Font("Arial", 0, 10));
- g.drawString("XP/HR: "+ expHour, 19, 430);
- g.setColor(new Color(102, 255, 102));
- g.setFont(new Font("Arial", 0, 25));
- g.drawString("HClean by Zomah2", 248, 452);
- g.setColor(new Color(153, 0, 0));
- }
- public boolean cont() {
- // TODO Auto-generated method stub
- return false;
- }
- public void withdraw(int i, int j) {
- // TODO Auto-generated method stub
- }
Add Comment
Please, Sign In to add comment