Jump to content
Booleans YAY

Sheep Sheering

Recommended Posts

Easy enough as it is, I made a script for fresh f2p accounts to instantly make money (semi bad gp I guess idk the active gp rates on regular wool and balls of wool).

  • Instant location walking/interaction (from anywhere obviously)
  • Bank supported
  • Instant start (no GUI crap)
  • Probably something else i'm missing, oh well.
package main.script.Wool_Runner;

import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.RenderingHints;

import org.osbot.rs07.api.map.Area;
import org.osbot.rs07.api.map.constants.Banks;
import org.osbot.rs07.api.model.NPC;
import org.osbot.rs07.api.model.RS2Object;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import org.osbot.rs07.utility.ConditionalSleep;

@ScriptManifest(author = "Booleans Yay", info = "Wool Running made ez pz", name = "Wool Runner", version = 1, logo = "")
public class WoolRunner extends Script {

	@Override
	public void onStart() throws InterruptedException {
		if (!myPlayer().getPosition().equals(woolArea)) {
			getWalking().webWalk(woolArea);
		}
	}

	private enum BotState {
		BANKING, SHEERING
	};

	private BotState getState() {
		return getInventory().isFull() ? BotState.BANKING : BotState.SHEERING;
	}

	@Override
	public int onLoop() throws InterruptedException {
		switch (getState()) {
		case BANKING:
			getWalking().webWalk(Banks.LUMBRIDGE_UPPER);
			bank();
			getWalking().webWalk(woolArea);
			break;
		case SHEERING:
			NPC sheepMob = getNpcs().closest("Sheep");
			if (sheepMob.hasAction("Shear") && getMap().canReach(sheepMob)) {
				getCamera().toEntity(sheepMob);
				sheepMob.interact("Shear");
				if (myPlayer().isAnimating()) {
					new ConditionalSleep(1_000) {
						@Override
						public boolean condition() {
							return myPlayer().isAnimating();
						}
					}.sleep();
				}
			}
			break;
		}
		return random(200, 400);
	}

	@Override
	public void onPaint(Graphics2D graphics) {
		drawMouse(graphics);
		Font font = new Font("TimesRoman", Font.PLAIN, 14);
		graphics.setFont(font);
		graphics.setColor(Color.WHITE);
		graphics.drawString("Wool Runner script created by: Booleans Yay", 5, 40);
		long runTime = System.currentTimeMillis() - scriptTimer;
		graphics.drawString("Script Runtime: " + formatTime(runTime), 5, 55);
	}

	public void drawMouse(Graphics graphic) {
		((Graphics2D) graphic).setRenderingHints(
				new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON));
		Point pointer = mouse.getPosition();
		Graphics2D spinG = (Graphics2D) graphic.create();
		Graphics2D spinGRev = (Graphics2D) graphic.create();
		spinG.setColor(new Color(255, 255, 255));
		spinGRev.setColor(Color.cyan);
		spinG.rotate(System.currentTimeMillis() % 2000d / 2000d * (360d) * 2 * Math.PI / 180.0, pointer.x, pointer.y);
		spinGRev.rotate(System.currentTimeMillis() % 2000d / 2000d * (-360d) * 2 * Math.PI / 180.0, pointer.x,
				pointer.y);

		final int outerSize = 20;
		final int innerSize = 12;

		spinG.setStroke(new BasicStroke(1.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
		spinGRev.setStroke(new BasicStroke(1.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
		spinG.drawArc(pointer.x - (outerSize / 2), pointer.y - (outerSize / 2), outerSize, outerSize, 100, 75);
		spinG.drawArc(pointer.x - (outerSize / 2), pointer.y - (outerSize / 2), outerSize, outerSize, -100, 75);
		spinGRev.drawArc(pointer.x - (innerSize / 2), pointer.y - (innerSize / 2), innerSize, innerSize, 100, 75);
		spinGRev.drawArc(pointer.x - (innerSize / 2), pointer.y - (innerSize / 2), innerSize, innerSize, -100, 75);
	}

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

	public void bank() throws InterruptedException {
		openBank();
		depositBank();
		closeBank();
	}

	public void openBank() throws InterruptedException {
		RS2Object bankObject = getObjects().closest(18491);
		if (!getBank().isOpen()) {
			bankObject.interact("Bank");
			sleep(random(1600, 5000));
		}
	}

	public void depositBank() throws InterruptedException {
		if (getBank().isOpen()) {
			getBank().depositAllExcept("Shears");
			sleep(random(400, 750));
		}
	}

	public void closeBank() throws InterruptedException {
		if (getBank().isOpen()) {
			getBank().close();
		}
	}

	private long scriptTimer = System.currentTimeMillis();
	private final Area woolArea = new Area(3211, 3259, 3195, 3274).setPlane(0);
}

 

  • Like 2
Link to comment
Share on other sites

6 minutes ago, Stimpack said:

????

 

edit: fookin emoji doesn't look normal 

edit2: null check the sheeeeeeeeeeeeeeep ???

Cant believe I forgot that lol. ??

3 minutes ago, KarpaloJuoma said:

Hi there,

 

Could you please compile this into a jar? I myself, don't know how to do it. Sorry, I'm a newbie. I'd love to give it a try. I will of course send progress pictures.

Thanks in advance!

 

Kind regards,

KarpaloJuoma :)

Use Eclipse's Export function, search it up on youtube.

Regardless, here's a Jar version. http://uppit.com/hvwkhfsgd2h2

  • Like 1
Link to comment
Share on other sites

Noticed a few things I would have done differently. Your bank method doesn't check if the previous step is complete.

Meaning when it fails it'll walk back to the sheep then realise the inventory is still full and walk back.

Another thing with the banking method there's a method to open all banks in the API already.

When grabbing the next NPC you can use a filter to check if the name is equal and has the action.

 

Here's my version: https://gist.github.com/anonymous/26be13656547372bfd4296cf424032ef

  • Like 2
Link to comment
Share on other sites

On 3/28/2017 at 4:56 PM, Septron said:

Noticed a few things I would have done differently. Your bank method doesn't check if the previous step is complete.

Meaning when it fails it'll walk back to the sheep then realise the inventory is still full and walk back.

Another thing with the banking method there's a method to open all banks in the API already.

When grabbing the next NPC you can use a filter to check if the name is equal and has the action.

 

Here's my version: https://gist.github.com/anonymous/26be13656547372bfd4296cf424032ef

 

I can't create this into a .jar since Im having issues installing Eclipse, could you make this into a .jar and send me the link? I'd like to try this out.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Recently Browsing   0 members

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