Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

POH Locations

Featured Replies

Returns POH location found in config 738. My cons is quite low so I've only tested this for rimmington/taverly/pollniveach, unless they do some weird shit it should work for other locations as well.

Note: positions for brimhaven/yanille are missing atm.

public class POH {

    private static final int POH_CONFIG = 738;

    public static POHLocation getLocation(MethodProvider api) {
        int c = api.configs.get(POH_CONFIG) & 0x7; // clear other bits
        return POHLocation.values()[c];
    }

    public enum POHLocation {
        None(0x0, new Position(0,0,0)),
        RIMMINGTON(0x1, new Position(2953,3224,0)),
        TAVERLY(0x2, new Position(2893,3465,0)),
        POLLNIVEACH(0x3, new Position(3340,3003,0)),
        RELLEKKA(0x4, new Position(2670,3631,0)),
        BRIMHAVEN(0x5, new Position(0,0,0)),
        YANILLE(0x6, new Position(0,0,0));


        public final int mask;
        public final Position position;

        POHLocation(int mask, Position position) {
            this.mask = mask;
            this.position = position;
        }

    }

}

Edited by Flamezzz

Sorry but I just had to clean this code up:

package com.liverare.better.utility.data;

import org.osbot.rs07.api.filter.Filter;
import org.osbot.rs07.api.map.Position;
import org.osbot.rs07.api.model.RS2Object;
import org.osbot.rs07.script.MethodProvider;

public enum HouseLocation implements Filter<RS2Object> {
	
	NONE("None", 0, 0),
	RIMMINGTON("Rimmington", 2953, 3224),
	TAVERLY("Taverly", 2893, 3465),
	POLLNIVEACH("Pollniveach", 3340, 3003),
	RELLEKKA("Rellekka", 2670, 3631),
	BRIMHAVEN("Brimhaven", 0, 0),  // TODO Data required
	YANILLE("Yanille", 0, 0), // TODO Data required
	;
	
	/*
	 * Static global variables
	 */
	
	public static final String PORTAL_NAME = "Portal";
	public static final Integer CONFIG_ID = 738;
	
	/*
	 * Local field variables
	 */
	
	private final String name;
	private final Position position;

	HouseLocation(String name, Integer x, Integer y) {
		this.name = name;
		this.position = new Position(x, y, 0);
	}
	
	/*
	 * Overriden methods
	 */
	
	@Override
	public String toString() {
		return name + " [" + position.toString() + "]";
	}
	
	@Override
	public boolean match(RS2Object object) {
		return object.getPosition().equals(position)
				&& object.getName().equals(PORTAL_NAME);
	}
	
	/*
	 * Getters/setters
	 */
	
	public Position getPosition() {
		return position;
	}
	
	/*
	 * Static methods
	 */
	
	public static HouseLocation getCurrent(MethodProvider methodProvider) {
		final Integer index = (methodProvider.configs.get(CONFIG_ID) & 0x7);
		return values()[index];
	}
}

Example of usage:

RS2Object housePortalEntrance = getObjects().closest(
				HouseLocation.getCurrent(this));

Edited by liverare

Sorry but I just had to clean this code up:

public enum HouseLocation {
	
	NONE(0, 0),
	RIMMINGTON(2953, 3224),
	TAVERLY(2893, 3465),
	POLLNIVEACH(3340, 3003),
	RELLEKKA(2670, 3631),
	BRIMHAVEN(0, 0),  // TODO Data required
	YANILLE(0, 0), // TODO Data required
	;
	
	private static final int CONFIG_ID = 738;
	
	public final Position position;

	HouseLocation(Integer x, Integer y) {
		this.position = new Position(x, y, 0);
	}
	
	public Position getLocation() {
		return position;
	}
	
	/*
	 * Static methods
	 */
	
	public static HouseLocation getCurrent(MethodProvider methodProvider) {
		final Integer index = (api.configs.get(CONFIG_ID) & 0x7);
		return values()[index];
	}
}

Nice find though. It may be very useful in some scripts, especially gilded altar (own house) scripts. If you wanted, you could implement an Filter<RS2Object> onto the enum, implement the required filter methods and then use the Enumerator record itself to filter for the house portal RS2Object. smile.png

 

The Filter interface? ew.

 

Edited by Botre

The Filter interface? ew.

For enum records, I use Filter. For records that need a tad more filtering, I use Lambda. :)

For enum records, I use Filter. For records that need a tad more filtering, I use Lambda. smile.png

 

You can use lambdas with the Filter class.

 Filter<RS2Object> lambda = o -> o != null && o.exists();

Filtering a Stream with a Predicate is more efficient than using a Filter on a List, hence the ew. Lambdas are just a matter of reducing verbosity :p

 

Also, why are you boxing the ints ? Oo

  • Author

Stupid question here, why do you use the bitwise AND in the script?

Is it so you can limit the values between 0 and 6?

Ye there were some other bits set in config 738, but as liverare posted the enum values should of course be indexed and not iterated as I did.

You can use lambdas with the Filter class.

 Filter<RS2Object> lambda = o -> o != null && o.exists();

Filtering a Stream with a Predicate is more efficient than using a Filter on a List, hence the ew. Lambdas are just a matter of reducing verbosity tongue.png

 

Also, why are you boxing the ints ? Oo

As for efficiency, we're not talking about a great deal of loss there. It's not like you're gonna need to constantly iterate for the RS2Object like 100 times a second. It's just each time you encounter the zone containing the portal. It's not much of a loss in my eyes.

 

I've (almost) made a full habit of switching from primitives to their Object counterparts, save for the booleans, in order to future proof the programme encase Java remove primitives altogether. There's a bit of controversy surrounding this with people making the case for primitives to be kept. :)

 

I've (almost) made a full habit of switching from primitives to their Object counterparts, save for the booleans, in order to future proof the programme encase Java remove primitives altogether. There's a bit of controversy surrounding this with people making the case for primitives to be kept. smile.png

 

Java won't ever remove primitives.

Objects waste space, primitives don't, easy as that x)

But at this level it probably doesn't matter.

As for efficiency, we're not talking about a great deal of loss there. It's not like you're gonna need to constantly iterate for the RS2Object like 100 times a second. It's just each time you encounter the zone containing the portal. It's not much of a loss in my eyes.

 

I've (almost) made a full habit of switching from primitives to their Object counterparts, save for the booleans, in order to future proof the programme encase Java remove primitives altogether. There's a bit of controversy surrounding this with people making the case for primitives to be kept. smile.png

Java would never remove primitives. Even with Java 9's value type, which lowers the footprint of object creation, they will not be removed. It would break too much code. 

Java won't ever remove primitives.

Objects waste space, primitives don't, easy as that x)

But at this level it probably doesn't matter.

Check this out wink.png

Edited by fixthissite

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.