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.

OSBot 2 getPercentageToLevel?

Featured Replies

Is there a method for getting the percentage to the next level, I'm shit at math too so yeah, appreciate helperino :D

private static final int[] XP = { 0, 83, 174, 276, 388, 512, 650, 801, 969,
			1154, 1358, 1584, 1833, 2107, 2411, 2746, 3115, 3523, 3973, 4470,
			5018, 5624, 6291, 7028, 7842, 8740, 9730, 10824, 12031, 13363,
			14833, 16456, 18247, 20224, 22406, 24815, 27473, 30408, 33648,
			37224, 41171, 45529, 50339, 55649, 61512, 67983, 75127, 83014,
			91721, 101333, 111945, 123660, 136594, 150872, 166636, 184040,
			203254, 224466, 247886, 273742, 302288, 333804, 368599, 407015,
			449428, 496254, 547953, 605032, 668051, 737627, 814445, 899257,
			992895, 1096278, 1210421, 1336443, 1475581, 1629200, 1798808,
			1986068, 2192818, 2421087, 2673114, 2951373, 3258594, 3597792,
			3972294, 4385776, 4842295, 5346332, 5902831, 6517253, 7195629,
			7944614, 8771558, 9684577, 10692629, 11805606, 13034431 };

XP List ^

	public int getPercentUntilLevel(Skill skill) {
		int getStatic = this.getSkills().getExperience(skill)
				- XP[this.getSkills().getStatic(skill) - 1];
		int getDynamic = XP[this.getSkills().getStatic(skill)]
				- XP[this.getSkills().getStatic(skill) - 1];
		int percentage = getStatic * 100 / getDynamic;
		return percentage > 0 ? percentage : 0;
	}

Calculation method ^

g.drawString("%tillstr " + getPercentUntilLevel(Skill.STRENGTH), 10, 20);

Implementation ^

 

Enjoy :)

Edited by Apaec

  • Author
private static final int[] XP = { 0, 83, 174, 276, 388, 512, 650, 801, 969,
			1154, 1358, 1584, 1833, 2107, 2411, 2746, 3115, 3523, 3973, 4470,
			5018, 5624, 6291, 7028, 7842, 8740, 9730, 10824, 12031, 13363,
			14833, 16456, 18247, 20224, 22406, 24815, 27473, 30408, 33648,
			37224, 41171, 45529, 50339, 55649, 61512, 67983, 75127, 83014,
			91721, 101333, 111945, 123660, 136594, 150872, 166636, 184040,
			203254, 224466, 247886, 273742, 302288, 333804, 368599, 407015,
			449428, 496254, 547953, 605032, 668051, 737627, 814445, 899257,
			992895, 1096278, 1210421, 1336443, 1475581, 1629200, 1798808,
			1986068, 2192818, 2421087, 2673114, 2951373, 3258594, 3597792,
			3972294, 4385776, 4842295, 5346332, 5902831, 6517253, 7195629,
			7944614, 8771558, 9684577, 10692629, 11805606, 13034431 };

XP List ^

	public int getPercentUntilLevel(Skill skill) {
		int getStatic = this.getSkills().getExperience(skill)
				- XP[this.getSkills().getStatic(skill) - 1];
		int getDynamic = XP[this.getSkills().getStatic(skill)]
				- XP[this.getSkills().getStatic(skill) - 1];
		int percentage = getStatic * 100 / getDynamic;
		return percentage > 0 ? percentage : 0;
	}

Calculation method ^

g.drawString("%tillstr " + getPercentUntilLevel(Skill.STRENGTH), 10, 20);

Implementation ^

 

Enjoy smile.png

 

 

 

public class XpDistance {

	private final Script script;
	@SuppressWarnings("unused")
	private final Bot b;

	public XpDistance(final Script script, final Bot b) {
		this.script = script;
		this.b = b;
	}
	
	private final int[] XP = {0, 83, 174, 276, 388, 512, 650, 801, 969, 
		1154, 1358, 1584, 1833, 2107, 2411, 2746, 3115, 3523, 3973, 4470, 5018,
		5624, 6291, 7028, 7842, 8740, 9730, 10824, 12031, 13363, 14833, 16456, 
		18247, 20224, 22406, 24815, 27473, 30408, 33648, 37224, 41171, 45529, 
		50339, 55649, 61512, 67983, 75127, 83014, 91721, 101333, 111945, 123660, 
		136594, 150872, 166636, 184040, 203254, 224466, 247886, 273742, 302288, 
		333804, 368599, 407015, 449428, 496254, 547953, 605032, 668051, 737627,
		814445, 899257, 992895, 1096278, 1210421, 1336443, 1475581, 1629200, 
		1798808, 1986068, 2192818, 2421087, 2673114, 2951373, 3258594, 3597792, 
		3972294, 4385776, 4842295, 5346332, 5902831, 6517253, 7195629, 7944614, 
		8771558, 9684577, 10692629, 11805606, 13034431};
	
	public int getXpUntilLevel(Skill skill, int level) {
		int currentXp = this.script.skills.getExperience(skill);
		int xpUntilLevel = this.XP[level-1] - currentXp;
		return xpUntilLevel > 0 ? xpUntilLevel : 0;
	}
	
	public int getXpUntilNextLevel(Skill skill) {
		int currentXp = this.script.skills.getExperience(skill);
		int currentLevel = this.script.skills.getStatic(skill);
		return this.XP[currentLevel] - currentXp;
	}
	
	public int getXpPastCurrentLevel(Skill skill) {
		int currentXp = this.script.skills.getExperience(skill);
		int currentLevel = this.script.skills.getStatic(skill);
		return currentXp - this.XP[currentLevel-1];
	}
	
}

Edit: just noted "percentage"

 

Depends,

 

Percentage until next level from 0 xp?

 

or

 

Percentage  until level from your current level's min XP?

 

 

Thanks guys, Appreciate the help.

public class XpDistance {

	private final Script script;
	@SuppressWarnings("unused")
	private final Bot b;

	public XpDistance(final Script script, final Bot b) {
		this.script = script;
		this.b = b;
	}

	private final int[] XP = { 0, 83, 174, 276, 388, 512, 650, 801, 969, 1154,
			1358, 1584, 1833, 2107, 2411, 2746, 3115, 3523, 3973, 4470, 5018,
			5624, 6291, 7028, 7842, 8740, 9730, 10824, 12031, 13363, 14833,
			16456, 18247, 20224, 22406, 24815, 27473, 30408, 33648, 37224,
			41171, 45529, 50339, 55649, 61512, 67983, 75127, 83014, 91721,
			101333, 111945, 123660, 136594, 150872, 166636, 184040, 203254,
			224466, 247886, 273742, 302288, 333804, 368599, 407015, 449428,
			496254, 547953, 605032, 668051, 737627, 814445, 899257, 992895,
			1096278, 1210421, 1336443, 1475581, 1629200, 1798808, 1986068,
			2192818, 2421087, 2673114, 2951373, 3258594, 3597792, 3972294,
			4385776, 4842295, 5346332, 5902831, 6517253, 7195629, 7944614,
			8771558, 9684577, 10692629, 11805606, 13034431 };

	public int getXpUntilLevel(Skill skill, int level) {
		int x = this.XP[level - 1] - this.script.skills.getExperience(skill);
		return x > 0 ? x : 0;
	}

	public int getXpUntilNextLevel(Skill skill) {
		int x = this.XP[this.script.skills.getStatic(skill)]
				- this.script.skills.getExperience(skill);
		return x > 0 ? x : 0;
	}

	public int getXpPastCurrentLevel(Skill skill) {
		int x = this.script.skills.getExperience(skill)
				- this.XP[this.script.skills.getStatic(skill) - 1];
		return x > 0 ? x : 0;
	}

	public int getPercentageUntilNextLevelFromZero(Skill skill) {
		int p = this.script.skills.getExperience(skill) * 100
				/ this.XP[this.script.skills.getStatic(skill)];
		return p > 0 ? p : 0;
	}

	public int getPercentageUntilNextLevelFromCurrentLevel(Skill skill) {
		int p = this.getXpUntilNextLevel(skill)
				* 100
				/ (this.XP[this.script.skills.getStatic(skill)] - this.XP[this.script.skills
						.getStatic(skill) - 1]);
		return p > 0 ? p : 0;
	}

}

Sorry my previous answer didn't really answer your question, this should do it^

 

Update 2: added some ternary operators in the returns.

Edited by Botrepreneur

Guest
This topic is now closed to further replies.

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.