Jump to content

WC Guild Plank Maker [Money Making][300k+ p/h][Open Source]


Recommended Posts

Posted (edited)

Features

  • Makes any type of plank at the Woodcutting Guild

How to use

  • Download or compile the .jar file and add it to your C:\Users\*YOURUSERNAME*\OSBot\Scripts.

IMPORTANT NOTICE

  • Make sure you make the planks manually at least once. This enables the script to use the space bar to create the planks in the future.

Source Code

package core;

import org.osbot.rs07.api.map.Area;
import org.osbot.rs07.api.model.NPC;
import org.osbot.rs07.api.ui.RS2Widget;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import org.osbot.rs07.utility.ConditionalSleep;

import utils.MouseTrail;
import utils.ZoomControl;

import java.awt.*;

import javax.swing.JOptionPane;

@ScriptManifest(name = "WC Guild Plank Maker", version = 1.1, author = "Marcus", logo = "", info = "Makes planks in the WC Guild")

public class Main extends Script {

	private final Area bankPos = new Area(1593, 3476, 1591, 3478);
	private final Area operatorPos = new Area(1626, 3498, 1624, 3501);

	private MouseTrail trail = new MouseTrail(0, 255, 255, 2000, this);

	private long startTime = System.currentTimeMillis();
	
	String userOptions[] = { "Logs", "Oak logs", "Teak logs", "Mahogany logs" };
	String userChoice = "" + (String) JOptionPane.showInputDialog(null, "Choose a log type", "Log Selection Menu",
			JOptionPane.PLAIN_MESSAGE, null, userOptions, userOptions[1]);

	@Override
	public void onStart() throws InterruptedException {

		if (!ZoomControl.isInRange(getCamera().getScaleZ(), 500)) {
			ZoomControl.setZoom(getBot(), 350);
		}
	}

	@Override
	public int onLoop() throws InterruptedException {
		if (isReady()) {
			walkOperator();
			if (hasOperator()) {
				tradeOperator();
				if (chatExists()) {
					selectOption();
				}
			}
		} else {
			if (!inventory.contains(userChoice)) {
				bank();
			}
		}
		return 700;
	}

	public boolean isReady() {
		return (inventory.contains(userChoice) && (inventory.contains(userChoice) && inventory.isFull()));
	}

	public boolean hasOperator() {
		NPC operator = getNpcs().closest("Sawmill operator");
		return (operator != null && operator.isVisible());
	}

	public boolean chatExists() {
		RS2Widget chat = getWidgets().get(270, 17);
		return (chat != null && chat.isVisible());
	}

	private void bank() throws InterruptedException {
		if (!bankPos.contains(myPosition())) {
			getWalking().webWalk(bankPos);
		} else if (bankPos.contains(myPosition()) && (!getBank().isOpen())) {
			getBank().open();
		} else if (!getInventory().isEmptyExcept("Coins", userChoice)) {
			getBank().depositAllExcept("Coins", userChoice);
		} else if (getBank().contains("Coins", userChoice)) {
			getBank().withdrawAll("Coins");
			sleep(random(2, 5));
			getBank().withdrawAll(userChoice);
			sleep(random(2, 5));
			getBank().close();
			sleep(random(2, 5));
			new ConditionalSleep(2000, 600) {
				@Override
				public boolean condition() {
					return (inventory.contains("Coins") && (inventory.contains(userChoice) && inventory.isFull()));
				}
			}.sleep();
		} else {
			stop(false);
		}
	}

	public void selectOption() throws InterruptedException {

		RS2Widget chat = getWidgets().get(270, 17);

		if (chat != null && chat.isVisible()) {
			sleep(random(200, 700));
			keyboard.typeString(" ");
			new ConditionalSleep(2000, 20) {
				@Override
				public boolean condition() {
					return (!inventory.contains(userChoice));
				}
			}.sleep();
		}
	}

	public void tradeOperator() throws InterruptedException {

		NPC operator = npcs.closest("Sawmill operator");

		if (operator != null && operator.isVisible()) {
			operator.interact("Buy-plank");
			new ConditionalSleep(2500, 20) {

				@Override
				public boolean condition() {
					return (chatExists());
				}
			}.sleep();
		}
	}

	private void walkOperator() throws InterruptedException {
		if (!operatorPos.contains(myPosition())) {
			getWalking().walk(operatorPos);
			sleep(random(50, 50));
		}
		new ConditionalSleep(3000, 50) {
			@Override
			public boolean condition() {
				return (operatorPos.contains(myPosition()));
			}
		}.sleep();
	}

	@Override
	public void onPaint(Graphics2D g) {

		g.setColor(new Color(0, 0, 0, 155));
		g.fillRect(5, 238, 238, 99);

		g.setColor(new Color(255, 255, 255));
		g.drawRect(5, 238, 238, 99);

		g.setFont(g.getFont().deriveFont(14.0f));

		trail.paint(g);
		Point mP = getMouse().getPosition();
		g.drawLine(mP.x, 501, mP.x, 0);
		g.drawLine(0, mP.y, 764, mP.y);

		super.onPaint(g);
		g.drawString("WC Guild Plank Maker", 65, 255);
		g.drawString("Run time: " + String.valueOf(formatTime(System.currentTimeMillis() - startTime)), 15, 275);
	}

	private String formatTime(final long ms) {
		long s = ms / 1000, m = s / 60, h = m / 60;
		s %= 60;
		m %= 60;
		h %= 24;
		return String.format("%02d:%02d:%02d", h, m, s);
	}
}

 

PlankMaker.jar

Edited by Lol_marcus
  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...