- import java.awt.BasicStroke;
- import java.awt.Color;
- import java.awt.Font;
- import java.awt.Graphics;
- import java.awt.Graphics2D;
- 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.interactive.Players;
- import org.powerbot.game.api.methods.node.SceneEntities;
- import org.powerbot.game.api.methods.tab.Inventory;
- import org.powerbot.game.api.methods.tab.Skills;
- import org.powerbot.game.api.util.Random;
- import org.powerbot.game.api.util.Time;
- import org.powerbot.game.api.wrappers.node.SceneObject;
- import org.powerbot.game.api.wrappers.widget.Widget;
- import org.powerbot.game.bot.event.listener.PaintListener;
- @Manifest(authors = {"ExoMemphiz"}, name = "ExoArtisan", version = 1.0, description = "Does the Artisan Workshop Minigame!")
- public class ExoArtisan extends ActiveScript implements PaintListener {
- public int ironingotID = 20632;
- public int anvilID = 4046;
- public int furnaceID = 29395;
- public int chuteID = 29396;
- public int bootID = 20577;
- public int status = 0;
- public int i;
- public int t;
- public int x;
- public int y;
- public int xchange;
- public int a;
- public int b;
- public int xpgained = 0;
- public int startxp = 0;
- public int lvlsgained = 0;
- public int startlvl = 0;
- public int c;
- public int e = 0;
- public String item = "Boots";
- @Override
- protected void setup() {
- changenumbers();
- startxp = Skills.getExperience(Skills.SMITHING);
- startlvl = Skills.getExperience(Skills.SMITHING);
- final withdraw withdraw = new withdraw();
- final makeboots makeboots = new makeboots();
- final deposit deposit = new deposit();
- final Strategy Withdraw = new Strategy(withdraw, withdraw);
- final Strategy Makeboots = new Strategy(makeboots, makeboots);
- final Strategy Deposit = new Strategy(deposit, deposit);
- provide(Withdraw);
- provide(Makeboots);
- provide(Deposit);
- }
- public boolean contains(final int itemID) {
- return Inventory.getItem(itemID) != null;
- }
- public class withdraw extends Strategy implements Task, Condition
- {
- @Override
- public boolean validate() {
- if ((contains(ironingotID)) == false && (contains(bootID)) == false); {
- return true;
- }
- }
- public void run() {
- if(SceneEntities.getNearest(furnaceID).isOnScreen()){
- final SceneObject furnace = SceneEntities.getNearest(furnaceID);
- final Widget ppp = Widgets.get(1072);
- furnace.interact("Withdraw-ingots");
- Time.sleep(Random.nextInt(500, 600));
- Widgets.get(1072, 21).click(true);
- Time.sleep(Random.nextInt(1000, 1200));
- if (ppp != null)
- {
- Widgets.get(1072, 119).click(true);
- Time.sleep(Random.nextInt(350, 600));
- }
- }
- }
- }
- public void changenumbers() {
- a = Skills.getExperience(Skills.SMITHING);
- b = Skills.getLevel(Skills.SMITHING);
- xpgained = a - startxp;
- lvlsgained = b - startlvl;
- c = Skills.getExperienceToLevel(Skills.SMITHING, +1);
- e = b + 1;
- }
- public void onRepaint(Graphics g1) {
- Graphics2D g = (Graphics2D)g1;
- g.setColor(new Color(0, 255, 255, 42));
- g.fillRect(544,209,193,254);
- g.drawRect(544,209,193,254);
- g.setColor(new Color(0, 255, 204, 110));
- g.fillRect(9, 343, 485, 113);
- g.setColor(new Color(0, 0, 0));
- g.setStroke(new BasicStroke(1));
- g.drawRect(9, 343, 485, 113);
- g.setColor(new Color(255, 0, 0));
- g.fillRect(122, 351, 338, 18);
- g.setColor(new Color(0, 204, 0));
- g.fillRect(122, 351, xchange, 18);
- g.setColor(new Color(0, 0, 0));
- g.setFont(new Font("Arial", 0, 13));
- g.setFont(new Font("Arial", 1, 13));
- g.drawString("Lvls gained:" + lvlsgained, 552, 245);
- g.drawString("Exp gained:" + xpgained, 552, 300);
- g.drawString("Exp Remaining" + c, 552, 345);
- g.drawString("Current Lvl:" + b, 240, 386);
- g.drawString("Target Lvl:" + e, 240, 406);
- }
- public class makeboots extends Strategy implements Task, Condition
- {
- @Override
- public boolean validate() {
- if ((contains(ironingotID)==true));{
- return true; }
- }
- public void run() {
- {
- if(SceneEntities.getNearest(anvilID).isOnScreen()){
- final SceneObject anvil = SceneEntities.getNearest(anvilID);
- anvil.interact("Smith");
- Time.sleep(Random.nextInt(500, 600));
- if (Widgets.get(1073, 11).getText().contains("Helm")) {
- Widgets.get(905, 14).click(true);
- item = "Helm";
- }
- else if (Widgets.get(1073, 11).getText().contains("Chestplate")) {
- Widgets.get(905, 15).click(true);
- item = "Chestplate";
- }
- else if (Widgets.get(1073, 11).getText().contains("Boots")) {
- Widgets.get(905, 16).click(true);
- item = "Boots";
- }
- else if (Widgets.get(1073, 11).getText().contains("Gauntlets")) {
- Widgets.get(905, 17).click(true);
- item = "Gauntlets";
- }
- while ((Inventory.getCount(bootID) < 28) && (Widgets.get(1073, 11).getText().contains(item))) {
- Time.sleep(200, 300); }
- }
- }
- }
- }
- public class deposit extends Strategy implements Task, Condition
- {
- @Override
- public boolean validate() {
- if ((Inventory.getCount(bootID))==28 && Players.getLocal().getAnimation()==-1); {}
- return true;
- }
- public void run() {
- if(SceneEntities.getNearest(chuteID).isOnScreen()){
- final SceneObject chute = SceneEntities.getNearest(chuteID);
- chute.interact("Deposit-armour");
- Time.sleep(Random.nextInt(1200, 1500));
- }
- }
- }
- }