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.

[Snippet] Warrior's Guild API

Featured Replies

Example

		WarriorsGuild wg = new WarriorsGuild(this);
		//...
		
		Defender next = wg.getNextDefender();
		if(next != null) {
			if(next == Defender.NONE) {
				//Go talk to Kamfreena
			}
			else if(next == Defender.RUNITE) {
				// If inventory contains rune defender -> go unlock Lorelai's door
				// Else -> continue killing regular cyclopses
			}
			else if(next == Defender.DRAGON) {
				// Kill high-level cyclopses
			}
			else {
				// Kill regular cyclopses
			}
		} 

Code

package org.botre.warriorsguild;

import java.awt.Point;

import org.osbot.rs07.script.MethodProvider;

public class WarriorsGuild {

	public static final int CONFIG = 788;
	
	public enum CatapultProjectile {
		
		SPIKED(679, CatapultDefenceStyle.STAB),
		ANVIL(680, CatapultDefenceStyle.BLUNT),
		KNIVES(681, CatapultDefenceStyle.SLASH),
		MAGICAL(682, CatapultDefenceStyle.MAGIC);
		
		private int id;
		private CatapultDefenceStyle defenceStyle;
		
		private CatapultProjectile(int id, CatapultDefenceStyle defenceStyle) {
			this.id = id;
			this.defenceStyle = defenceStyle;
		}
		
		public static CatapultProjectile forId(int id) {
			for (CatapultProjectile value : values()) {
				if(value.id == id) return value;
			}
			return null;
		}
		
		public int getId() {
			return id;
		}
		
		public CatapultDefenceStyle getDefenceStyle() {
			return defenceStyle;
		}
		
	}
	
	public enum CatapultDefenceStyle {
		
		STAB(1, new Point(564, 232)), 
		BLUNT(2, new Point(564, 288)), 
		SLASH(3, new Point(563, 344)),
		MAGIC(0, new Point(563, 401)); 
		
		private int maskedValue;
		private Point widgetPosition;
		
		private CatapultDefenceStyle(int maskedValue, Point widgetPosition) {
			this.maskedValue = maskedValue;
			this.widgetPosition = widgetPosition;
		}
		
		public int getMaskedValue() {
			return maskedValue;
		}
		
		public Point getWidgetPosition() {
			return widgetPosition;
		}
		
		public static CatapultDefenceStyle forConfigValue(int configValue) {
			for (CatapultDefenceStyle value : values()) {
				if(value.getMaskedValue() == (configValue & 0b00000011)) return value;
			}
			return null;
		}
		
	}
	
	public enum Defender {
		NONE(0),
		BRONZE(1),
		IRON(2),
		STEEL(3),
		BLACK(4),
		MITHRIL(5),
		ADAMANTITE(6),
		RUNITE(7),
		DRAGON(-1);
		
		private int maskedValue;
		
		private Defender(int maskedValue) {
			this.maskedValue = maskedValue;
		}
		
		public int getMaskedValue() {
			return maskedValue;
		}
		
		public static Defender forConfigValue(int configValue) {
			if(isLorelaisDoorUnlocked(configValue)) return Defender.DRAGON;
			for (Defender value : values()) {
				if(value.getMaskedValue() == ((configValue >> 3) & 0b000001111)) return value;
			}
			return null;
		}
		
	}
	
	private MethodProvider ctx;
	
	public WarriorsGuild(MethodProvider ctx) {
		this.ctx = ctx;
	}
	
	public CatapultDefenceStyle getCatapultDefenceStyle() {
		return CatapultDefenceStyle.forConfigValue(ctx.getConfigs().get(CONFIG));
	}
	
	public boolean isDefendingFromCatapultProjectile(CatapultProjectile projectile) {
		return getCatapultDefenceStyle() == projectile.getDefenceStyle();
	}
	
	public Defender getNextDefender() {
		return Defender.forConfigValue(ctx.getConfigs().get(CONFIG));
	}
	
	private static boolean isLorelaisDoorUnlocked(int configValue) {
		return ((configValue >> 12) & 0b00000001) == 1;
	}
	
	public boolean isLorelaisDoorUnlocked() {
		return isLorelaisDoorUnlocked(ctx.getConfigs().get(CONFIG));
	}
	
}

can u maybe make a enum guide for like Craftables (include like 5 examples of crafting stuff etc or fishing) that would be great thanks

 

ot: botre comin in hot with the snippets

can u maybe make a enum guide for like Craftables (include like 5 examples of crafting stuff etc or fishing) that would be great thanks

 

ot: botre comin in hot with the snippets

public enum TestEnum {
SAPPHIRE("Sapphire", "blue", 1222, false); //here we add the name, color, price and if it's a member item.

private String name;
private String color;
private int price;
private boolean isMember;

/**
*
* @param name
* @param color
* @param price
* @param isMember
*/
TestEnum(String name, String color, int price, boolean isMember){
this.name = name;
this.color = color;
this.price = price;
this.isMember = isMember;
}

/**
*
* @return name
*/
public String getName(){
return name;
}

/**
*
* @return color
*/
public String getColor(){
return color;
}

/**
*
* @return price
*/
public int getPrice(){
return price;
}

/**
*
* @return ismember
*/
public boolean isMember(){
return isMember;
}
}

inventory.getItem(TestEnum.SAPPHIRE.getName());
2min work.

Google how enums work for a better understanding.

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.