Jump to content

Bone bolt/pack buyer


Temsei

Recommended Posts

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
Link to comment
Share on other sites

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);
    } 
} 

 

 

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