Jump to content

Wilderness API


liverare

Recommended Posts

Let's work to make Wilderness bots great again!

Example code:

import java.util.List;

import org.osbot.rs07.api.model.Player;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;

import com.liverare.api.WildernessAPI;

@ScriptManifest(author = "", info = "", logo = "", name = "Test", version = 0)
public class Test extends Script {

	WildernessAPI wilderness;
	
	@Override
	public void onStart() throws InterruptedException {
		wilderness = new WildernessAPI();
		wilderness.exchangeContext(bot);
	}

	@Override
	public int onLoop() throws InterruptedException {
		
		Player workerBot = players.closest("W0rk3r B0t 5001");
		
		handleRealThreats();
		handlePotentialThreats();
		saveWorkerBot(workerBot);
		
		return 100;
	}


	private void handleRealThreats() {
		
		List<Player> realThreats = wilderness.findRealThreats();
		
		if (realThreats != null && !realThreats.isEmpty()) {
			
			// oh shit they can attack us
			// better check what they're wearing and what they're doing
		}
	}

	private void handlePotentialThreats() {
		
		List<Player> potentialThreats = wilderness.findPotentialThreats();

		if (potentialThreats != null && !potentialThreats.isEmpty()) {

			// oh dear, we may be in trouble
			// we'd better not go deeper into the Wilderness, they may be
			// waiting for us to do exactly that!

		}
	}

	private void saveWorkerBot(Player workerBot) {
		
		List<Player> realThreatsToWorkerBot = wilderness.findRealThreats(workerBot);
		
		if (realThreatsToWorkerBot != null && !realThreatsToWorkerBot.isEmpty()) {

			// worker bot may be in trouble
			// perhaps we should attack baddie? lure them away? etc.

		}
	}
}

Methods:

public int getSafeWildernessLevel(Player player)
public int getSafeWildernessLevel(Player playerA, Player playerB)
public List<Player> findPotentialThreats()
public List<Player> findPotentialThreats(Player victim)
public List<Player> findRealThreats()
public List<Player> findRealThreats(Player victim)
public static boolean canPlayerAFighterPlayerB(Player playerA, Player playerB)
public static int calculateYCoordinate(Vector3D vector3d, boolean upperBound)
public static int calculateYCoordinate(int wildernessLevel, boolean upperBound)
public static int calculateWildernessLevel(Vector3D vector3d)
public static int calculateWildernessLevel(int yCoordinate)

Source:

  Reveal hidden contents

Let me know if there are any problems.

Have fun!

  • Like 7
Link to comment
Share on other sites

  On 9/23/2017 at 9:25 PM, liverare said:

Let's work to make Wilderness bots great again!

Example code:

import java.util.List;

import org.osbot.rs07.api.model.Player;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;

import com.liverare.api.WildernessAPI;

@ScriptManifest(author = "", info = "", logo = "", name = "Test", version = 0)
public class Test extends Script {

	WildernessAPI wilderness;
	
	@Override
	public void onStart() throws InterruptedException {
		wilderness = new WildernessAPI();
		wilderness.exchangeContext(bot);
	}

	@Override
	public int onLoop() throws InterruptedException {
		
		Player workerBot = players.closest("W0rk3r B0t 5001");
		
		handleRealThreats();
		handlePotentialThreats();
		saveWorkerBot(workerBot);
		
		return 100;
	}


	private void handleRealThreats() {
		
		List<Player> realThreats = wilderness.findRealThreats();
		
		if (realThreats != null && !realThreats.isEmpty()) {
			
			// oh shit they can attack us
			// better check what they're wearing and what they're doing
		}
	}

	private void handlePotentialThreats() {
		
		List<Player> potentialThreats = wilderness.findPotentialThreats();

		if (potentialThreats != null && !potentialThreats.isEmpty()) {

			// oh dear, we may be in trouble
			// we'd better not go deeper into the Wilderness, they may be
			// waiting for us to do exactly that!

		}
	}

	private void saveWorkerBot(Player workerBot) {
		
		List<Player> realThreatsToWorkerBot = wilderness.findRealThreats(workerBot);
		
		if (realThreatsToWorkerBot != null && !realThreatsToWorkerBot.isEmpty()) {

			// worker bot may be in trouble
			// perhaps we should attack baddie? lure them away? etc.

		}
	}
}

Methods:

public int getSafeWildernessLevel(Player player)
public int getSafeWildernessLevel(Player playerA, Player playerB)
public List<Player> findPotentialThreats()
public List<Player> findPotentialThreats(Player victim)
public List<Player> findRealThreats()
public List<Player> findRealThreats(Player victim)
public static boolean canPlayerAFighterPlayerB(Player playerA, Player playerB)
public static int calculateYCoordinate(Vector3D vector3d, boolean upperBound)
public static int calculateYCoordinate(int wildernessLevel, boolean upperBound)
public static int calculateWildernessLevel(Vector3D vector3d)
public static int calculateWildernessLevel(int yCoordinate)

Source:

 

  Reveal hidden contents

Let me know if there are any problems.

Have fun!

 

Expand  

Good job my sweet friend

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...
  • 1 year 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...