Jump to content

Boosted Thiever [Master Farmer Thiever]


Boosted

Recommended Posts

This is a script I made to get the 53 Thieving requirement for Desert Treasure. It was made for personal use so it's not very dynamic but it's stable so I thought others might find it helpful. I also included the source for people who want to learn or change anything.

- Supports lobsters.

- Eats at less than 4 HP.

Progress picture

xiY2ZPv.png

Download

http://www.filedropper.com/boostedthiever

Code

Spoiler

package scripts;

import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;

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

@ScriptManifest(author = "Boosted", info = "Master Farmer Thiever", logo = "", name = "Boosted Thiever", version = 1)
public class MasterFarmer extends Script {
	
	/*
	 * Fields
	 */
	private long startTime;
	
	public static final Area THIEVING_AREA = new Area(3087, 3245, 3074, 3257);
	
	public static final Area BANKING_AREA  = new Area(3097, 3240, 3092, 3245);
	
	/*
	 * Store starting time.
	 * Start tracking Thieving experience.
	 */
	@Override
	public void onStart() throws InterruptedException {
		startTime = System.currentTimeMillis();
		
		getExperienceTracker().start(Skill.THIEVING);
	}
	
	/*
	 * Main loop.
	 */
	@Override
	public int onLoop() throws InterruptedException {
		
			if (!getInventory().isFull() && getInventory().contains("Lobster")) {
				
				if (getSkills().getDynamic(Skill.HITPOINTS) > 3) {
					pickpocket();
				} else {
					eat();
				}
			} else {
				bank();
			}
		return random(350, 750);
	}

	/*
	 * Display runtime.
	 * Display experience gained.
	 */
	@Override
	public void onPaint(Graphics2D g) {
		long runTime = System.currentTimeMillis() - startTime;
		
		g.setColor(Color.WHITE);
		
		g.setFont(new Font("Arial", Font.BOLD, 18));
		
		g.drawString("Boosted Thiever", 15, 255);
		
		g.setFont(new Font("Arial", Font.BOLD, 16));
		
		g.drawString("Running: "  + displayTime(runTime), 15, 290);
		
		g.drawString("EXP Gained: "  + getExperienceTracker().getGainedXP(Skill.THIEVING), 15, 325);
	}
	
	/*
	 * Pickpocketing method.
	 */
	public void pickpocket() {
		NPC farmer = getNpcs().closest("Master Farmer");
		
		if (farmer != null) {
			farmer.interact("Pickpocket");
			
			try {
				sleep(random(125, 250));
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
			
			new ConditionalSleep(random(4500, 7500)) {
				
				@Override
				public boolean condition() throws InterruptedException {
					return myPlayer().getHeight() < 200;
				}
			}.sleep();
		} else {
			getWalking().webWalk(THIEVING_AREA.getRandomPosition());
		}
	}
	
	/*
	 * Banking method.
	 */
	public void bank() {
		RS2Object bank = getObjects().closest("Bank booth");
		
		if (bank != null && bank.hasAction("Bank")) {
			
			if (getBank().isOpen()) {
				
				if (getInventory().isFull()) {
					getBank().depositAll();
					
					try {
						sleep(random(350, 750));
					} catch (InterruptedException e) {
						e.printStackTrace();
					}
					
					new ConditionalSleep(random(3500, 6500)) {
						
						@Override
						public boolean condition() throws InterruptedException {
							return !getInventory().isFull();
						}
					}.sleep();
				} else {
					
					getBank().depositAll();
					
					try {
						sleep(random(350, 750));
					} catch (InterruptedException e) {
						e.printStackTrace();
					}
					
					new ConditionalSleep(random(3500, 6500)) {
						
						@Override
						public boolean condition() throws InterruptedException {
							return getInventory().isEmpty();
						}
					}.sleep();
					
					getBank().withdraw("Lobster", 6);
					
					try {
						sleep(random(350, 750));
					} catch (InterruptedException e) {
						e.printStackTrace();
					}
					
					new ConditionalSleep(random(3500, 6500)) {
						
						@Override
						public boolean condition() throws InterruptedException {
							return getInventory().contains("Lobster");
						}
					}.sleep();
				}
				
			} else {
				bank.interact("Bank");
				
				try {
					sleep(random(350, 750));
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
				
				new ConditionalSleep(random(3500, 6500)) {
					
					@Override
					public boolean condition() throws InterruptedException {
						return getBank().isOpen();
					}
				}.sleep();
			}
		} else {
			getWalking().webWalk(BANKING_AREA.getRandomPosition());
		}
	}
	
	/*
	 * Eating method.
	 */
	public void eat() {
		getInventory().getItem("Lobster").interact("Eat");
		
		try {
			sleep(random(550, 900));
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		
		new ConditionalSleep(random(3500, 6500)) {
			
			@Override
			public boolean condition() throws InterruptedException {
				return getSkills().getDynamic(Skill.HITPOINTS) > 3;
			}
		}.sleep();
	}
	
	/*
	 * Format runtime in hh:mm:ss format.
	 */
	public final String displayTime(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);
	}
}

 

 

 

 

 

Edited by Boosted
Link to comment
Share on other sites

  • 2 weeks later...
  • 3 weeks later...
  • 2 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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...