Java Code Examples for net.runelite.api.Client#getVar()

The following examples show how to use net.runelite.api.Client#getVar() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HitPointsRenderer.java    From plugins with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void update(Client client, StatusBarsOverlay overlay)
{
	maximumValue = client.getRealSkillLevel(Skill.HITPOINTS);
	currentValue = client.getBoostedSkillLevel(Skill.HITPOINTS);
	restore = overlay.getRestoreValue(Skill.HITPOINTS.getName());

	final int poisonState = client.getVar(VarPlayer.IS_POISONED);

	if (poisonState > 0 && poisonState < 50)
	{
		standardColor = COLOR_POISON;
	}
	else if (poisonState >= 1000000)
	{
		standardColor = COLOR_VENOM;
	}
	else
	{
		standardColor = COLOR_STANDARD;
	}
}
 
Example 2
Source File: AgilitySession.java    From plugins with GNU General Public License v3.0 6 votes vote down vote up
void incrementLapCount(Client client)
{
	calculateLapsPerHour();
	++totalLaps;

	int currentExp = client.getSkillExperience(Skill.AGILITY);
	int nextLevel = client.getRealSkillLevel(Skill.AGILITY) + 1;
	double courseTotalExp = course.getTotalXp();
	if (course == Courses.PYRAMID)
	{
		// agility pyramid has a bonus exp drop on the last obstacle that scales with player level and caps at 1000
		// the bonus is not already accounted for in the total exp number in the courses enum
		courseTotalExp += Math.min(300 + 8 * client.getRealSkillLevel(Skill.AGILITY), 1000);
	}

	int remainingXp;
	do
	{
		remainingXp = nextLevel <= Experience.MAX_VIRT_LEVEL ? Experience.getXpForLevel(nextLevel) - currentExp : 0;
		nextLevel++;
	} while (remainingXp < 0);

	lapsTillLevel = remainingXp > 0 ? (int) Math.ceil(remainingXp / courseTotalExp) : 0;
	int goalRemainingXp = client.getVar(VarPlayer.AGILITY_GOAL_END) - currentExp;
	lapsTillGoal = goalRemainingXp > 0 ? (int) Math.ceil(goalRemainingXp / courseTotalExp) : 0;
}
 
Example 3
Source File: MusicPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
private int getValue(final MusicConfig config, final Client client)
{
	int value = getter.applyAsInt(config) - 1;
	if (value <= -1)
	{
		// Use the vanilla value
		value = ((4 - client.getVar(var)) * max) / 4;
	}

	return value;
}
 
Example 4
Source File: SpellBookRequirement.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean meetsRequirements(Client client)
{
	int autoCastSpellId = client.getVar(Varbits.AUTO_CAST_SPELL);
	if (autoCastSpellId == 0)
	{
		return false;
	}

	SpellBaseDamageConfig autoCastSpell = SpellBaseDamageConfig.findSpellById(autoCastSpellId);
	return autoCastSpell.getSpellBook() == this.spellBook;
}
 
Example 5
Source File: SpellRequirement.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean meetsRequirements(Client client)
{
	int autoCastSpellId = client.getVar(Varbits.AUTO_CAST_SPELL);
	if (autoCastSpellId == 0)
	{
		return false;
	}

	return autoCastSpellId == this.spellBaseDamageConfig.getSpellID();
}
 
Example 6
Source File: SpecialAttackRenderer.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void update(Client client, StatusBarsOverlay overlay)
{
	icon = spriteManager.getSprite(SpriteID.MINIMAP_ORB_SPECIAL_ICON, 0);
	currentValue = client.getVar(VarPlayer.SPECIAL_ATTACK_PERCENT) / 10;
	restore = 0;
}
 
Example 7
Source File: PrayerRenderer.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void update(Client client, StatusBarsOverlay overlay)
{
	maximumValue = client.getRealSkillLevel(Skill.PRAYER);
	currentValue = client.getBoostedSkillLevel(Skill.PRAYER);
	standardColor = client.getVar(Varbits.QUICK_PRAYER) == 1 ? COLOR_ACTIVE : COLOR_STANDARD;
	restore = overlay.getRestoreValue(Skill.PRAYER.getName());
}
 
Example 8
Source File: MusicPlugin.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private int getValue(final MusicConfig config, final Client client)
{
	int value = getter.applyAsInt(config) - 1;
	if (value <= -1)
	{
		// Use the vanilla value
		value = ((4 - client.getVar(var)) * max) / 4;
	}

	return value;
}
 
Example 9
Source File: AutocastSpellRequirement.java    From plugins with GNU General Public License v3.0 3 votes vote down vote up
@Override
public boolean meetsRequirements(Client client)
{
	int autoCastSpellId = client.getVar(Varbits.AUTO_CAST_SPELL);

	if (autoCastSpellId == 0)
	{

		return false;

	}

	return this.autocastSpells.stream().anyMatch(spell -> spell.getSpellID() == autoCastSpellId);

}