use of net.runelite.rs.api.RSVarbit in project runelite by runelite.
the class VarbitMixin method getSetting.
@Inject
@Override
public int getSetting(Varbits varbit) {
int varbitId = varbit.getId();
RSVarbit v = varbitCache.getIfPresent(varbitId);
if (v == null) {
// load varbit into cache
client.getVarbit(varbitId);
RSNodeCache varbits = client.getVarbitCache();
// get from cache
v = (RSVarbit) varbits.get(varbitId);
varbitCache.put(varbitId, v);
}
int[] varps = getVarps();
int value = varps[v.getIndex()];
int lsb = v.getLeastSignificantBit();
int msb = v.getMostSignificantBit();
int mask = (1 << ((msb - lsb) + 1)) - 1;
return (value >> lsb) & mask;
}
Aggregations