Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.*;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.script.*;
- import org.rsbot.script.wrappers.*;
- @ScriptManifest(authors = {"Striker"}, keywords = {""}, name = "YellowDyes",
- description = "Gets Dyes", version = 0.1)
- public class YellowDyes extends Script implements PaintListener {
- int onionID = 1957;
- int dyeID = 1765;
- int coins = 995;
- int aggieID = 922;
- int dyesGot, profit, profith, dyesAtm, dyePrice, onionPrice;
- public long runtime, starttime, millis, seconds, minutes, hours;
- private boolean atAggie() {
- RSNPC aggie = npcs.getNearest(aggieID);
- if (aggie != null) {
- if (aggie.isOnScreen()) {
- return true;
- }
- }
- return false;
- }
- private boolean atBank() {
- RSArea area = new RSArea(new RSTile(3092, 3242), new RSTile(3095, 3250));
- return area.contains(getMyPlayer().getLocation());
- }
- public void getDye() {
- RSNPC aggie = npcs.getNearest(aggieID);
- if (aggie != null) {
- if (aggie.isOnScreen()) {
- if (!interfaces.canContinue()) {
- if (!interfaces.get(230).isValid()) {
- aggie.doAction("dyes");
- sleep(500, 1000);
- }
- } else {
- if (!interfaces.get(519).isValid()) {
- interfaces.clickContinue();
- sleep(400, 500);
- }
- }
- if (interfaces.get(230).isValid()) {
- interfaces.getComponent(230, 4).doClick();
- sleep(500, 700);
- }
- if (interfaces.get(519).isValid()) {
- if (inventory.contains(onionID)) {
- aggie.doAction("dyes");
- sleep(500, 1000);
- }
- }
- }
- }
- }
- public void walkBank() {
- if (!getMyPlayer().isMoving()) {
- walking.walkTileMM(new RSTile(3093, 3245).randomize(2, 2));
- sleep(1000, 1500);
- }
- }
- public void walkAggie() {
- if (!getMyPlayer().isMoving()) {
- walking.walkTileMM(new RSTile(3085, 3260).randomize(2, 2));
- sleep(1000, 1500);
- }
- }
- public void bank() {
- bank.open();
- sleep(500, 1000);
- if (bank.isOpen()) {
- bank.depositAllExcept(coins);
- sleep(500, 700);
- if (inventory.getCount(onionID) <= 2 && bank.getItem(onionID) != null) {
- bank.withdraw(onionID, 26);
- sleep(200, 500);
- } else {
- log ("Out of onions");
- bank.close();
- sleep(200, 500);
- stopScript();
- }
- }
- }
- @Override
- public boolean onStart() {
- dyesAtm = inventory.getCount(dyeID);
- dyePrice = grandExchange.lookup(dyeID).getGuidePrice();
- onionPrice = grandExchange.lookup(onionID).getGuidePrice();
- starttime = System.currentTimeMillis();
- log("Onion price: " + onionPrice + " " + "Dye price: " + dyePrice);
- log("Profit per dye: " + (dyePrice - (2 * onionPrice) - 5));
- return true;
- }
- @Override
- public int loop() {
- if (!inventory.contains(coins)) {
- log("No coins in inventory, stopping.");
- stopScript();
- }
- if (!walking.isRunEnabled() && walking.getEnergy() > random(30, 40)) {
- walking.setRun(true);
- sleep(300, 1000);
- }
- RSObject door = objects.getTopAt(new RSTile(3088, 3259));
- if (door != null) {
- door.doClick();
- sleep(300, 500);
- }
- if (inventory.getCount(onionID) >= 2 ) {
- if (atAggie()) {
- getDye();
- } else {
- walkAggie();
- }
- } else {
- if (atBank()) {
- bank();
- } else {
- walkBank();
- }
- }
- return random(200, 400);
- }
- //START: Code generated using Enfilade's Easel
- private final Color color2 = new Color(0, 0, 0, 180);
- private final BasicStroke stroke1 = new BasicStroke(1);
- private final Font font1 = new Font("Arial", 0, 11);
- public void onRepaint(Graphics g1) {
- 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;
- runtime = System.currentTimeMillis() - starttime;
- profit = dyesGot * (dyePrice - (2 * onionPrice) - 5);
- profith = + (int) (profit * 3600000D / runtime);
- Graphics2D g = (Graphics2D)g1;
- g.setColor(new Color(0, 0, 0, 180));
- g.fillRoundRect(29, 32, 137, 109, 16, 16);
- g.setColor(color2);
- g.setStroke(stroke1);
- g.drawRoundRect(29, 32, 137, 109, 16, 16);
- g.setFont(new Font("Tahoma", Font.BOLD, 11));
- g.setColor(Color.RED);
- g.drawString("YellowDyes By Striker", 36, 46);
- g.setColor(Color.WHITE);
- g.setFont(font1);
- g.drawString("Time: " + hours + ":" + minutes + ":" + seconds, 36, 66);
- g.drawString("Dyes got: " + dyesGot , 36, 88);
- g.drawString("Profit: " + profit, 37, 110);
- g.drawString("Profit/h: " + profith, 37, 134);
- if (dyesAtm > inventory.getCount(dyeID)) {
- dyesAtm = inventory.getCount(dyeID);
- } else if (dyesAtm < inventory.getCount(dyeID)) {
- dyesGot++;
- dyesAtm = inventory.getCount(dyeID);
- }
- }
- //END: Code generated using Enfilade's Easel
- }
Add Comment
Please, Sign In to add comment