Jump to content

Bone bolt/pack buyer


Recommended Posts

Posted (edited)

Pretty straightforward, buys bone bolt packs at the Dorgesh-kaan mines, unpacks them and hops when shop runs out of stock.

 

Needed it for myself and thought might as well release it in case anyone else ever needs it.

 

Download jar: https://drive.google.com/open?id=0B5zfq4J918uyZHc1YTJMWEM3QUU

 

Source:

 

import org.osbot.rs07.api.model.NPC;
import org.osbot.rs07.api.ui.Message;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import org.osbot.rs07.utility.ConditionalSleep;

@ScriptManifest(author = "Temsei", info = "Bone Bolt Buyer", name = "Bone Pack Buyer", version = 0, logo = "")
public class Buyer extends Script {
 
    @[member='Override']
    public void onStart() {
    }
    
    private enum State {
		BUY, UNPACK, WAIT
	};
	
	
	private State getState() {
		if (!inventory.isFull())
			return State.BUY;
		if (inventory.isFull())
			return State.UNPACK;
		return State.WAIT;
	}
	
	public void buyBolts() throws InterruptedException {
		NPC npc = npcs.closest("Nardok");
		if (!inventory.isFull() && npc != null){
			npc.interact("Trade");
			new ConditionalSleep(3000) {
				@[member='Override']
				public boolean condition() {
					return store.isOpen();
				}
			}.sleep();
			if (store.isOpen()) {
				while (store.getAmount("Bone bolt pack") > 0 && !inventory.isFull()) {
					store.buy("Bone bolt pack", 10);
				}
				if (store.isOpen())
				store.close();
			}
		}
	}
	
	public void unpackBolts() throws InterruptedException {
			while (inventory.getAmount("Bone bolt pack") > 0) {
				inventory.getItem("Bone bolt pack").interact("Open");
		}
	}
	
	public void onMessage(Message message) throws java.lang.InterruptedException {	
		String txt = message.getMessage().toLowerCase();
		if (txt.contains("stock")) {
			worlds.hopToP2PWorld();
		}
	}
 
    @[member='Override']
    public int onLoop() throws InterruptedException {
    	switch (getState()) {
    	case BUY:    		
    	buyBolts();
    	break;
    	case UNPACK:   		
    	unpackBolts();
     	break; 		
	default:
	break;  
    	}
    	return random(200, 300);
    } 
} 

Edited by Temsei
  • Like 5
Posted

gl on release

 

Pretty straightforward, buys bone bolt packs at the Dorgesh-kaan mines, unpacks them and hops when shop runs out of stock.

 

Needed it for myself and thought might as well release it in case anyone else ever needs it.

 

Download jar: https://drive.google.com/open?id=0B5zfq4J918uyZHc1YTJMWEM3QUU

 

Source:

 

import org.osbot.rs07.api.model.NPC;
import org.osbot.rs07.api.ui.Message;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import org.osbot.rs07.utility.ConditionalSleep;

@ScriptManifest(author = "Temsei", info = "Bone Bolt Buyer", name = "Bone Pack Buyer", version = 0, logo = "")
public class Buyer extends Script {
 
    @[member='Override']
    public void onStart() {
    }
    
    private enum State {
		BUY, UNPACK, WAIT
	};
	
	
	private State getState() {
		if (!inventory.isFull())
			return State.BUY;
		if (inventory.isFull())
			return State.UNPACK;
		return State.WAIT;
	}
	
	public void buyBolts() throws InterruptedException {
		NPC npc = npcs.closest("Nardok");
		if (!inventory.isFull() && npc != null){
			npc.interact("Trade");
			new ConditionalSleep(3000) {
				@[member='Override']
				public boolean condition() {
					return store.isOpen();
				}
			}.sleep();
			if (store.isOpen()) {
				while (store.getAmount("Bone bolt pack") > 0 && !inventory.isFull()) {
					store.buy("Bone bolt pack", 10);
				}
				if (store.isOpen())
				store.close();
			}
		}
	}
	
	public void unpackBolts() throws InterruptedException {
			while (inventory.getAmount("Bone bolt pack") > 0) {
				inventory.getItem("Bone bolt pack").interact("Open");
		}
	}
	
	public void onMessage(Message message) throws java.lang.InterruptedException {	
		String txt = message.getMessage().toLowerCase();
		if (txt.contains("stock")) {
			worlds.hopToP2PWorld();
		}
	}
 
    @[member='Override']
    public int onLoop() throws InterruptedException {
    	switch (getState()) {
    	case BUY:    		
    	buyBolts();
    	break;
    	case UNPACK:   		
    	unpackBolts();
     	break; 		
	default:
	break;  
    	}
    	return random(200, 300);
    } 
} 

 

 

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