Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Sign up now!

getExperience and getLevel should return -1 if not logged in

Engineer
Joined
Jul 28, 2013
Messages
2,776
On RS3 it'll return -1 if the skill object isn't loaded, ie logged out. On OSRS they just use int[]'s so I can't do the same style of check because they're always populated. Adding an isLoggedIn check to ever call in that is too expensive imo.
 
First Bot Author
Joined
Aug 7, 2013
Messages
262
On RS3 it'll return -1 if the skill object isn't loaded, ie logged out. On OSRS they just use int[]'s so I can't do the same style of check because they're always populated. Adding an isLoggedIn check to ever call in that is too expensive imo.
Nah, this is expensive:
Code:
public class RMSkills implements Skills.Tracker.Provider {

    @Override
    public int getCurrentLevel(com.skelware.bot.data.Skill skill) {
        if (!RuneScape.isLoggedIn()) {
            return -1;
        }

        return convert(skill).getCurrentLevel();
    }

    @Override
    public int getCurrentExperience(com.skelware.bot.data.Skill skill) {
        if (!RuneScape.isLoggedIn()) {
            return -1;
        }

        return convert(skill).getExperience();
    }

    private Skill convert(com.skelware.bot.data.Skill skill) {
        return Skill.values()[skill.getGameIndex()];
    }
}
 
Author of MaxiBots
Joined
Dec 3, 2013
Messages
7,032
Might be worth looking into stopping the xp gained event from firing when logging in.
 
Top