getExperience and getLevel should return -1 if not logged in

Discussion in 'Client & Site Suggestions' started by Salvation, Jun 19, 2015.

  1. Currently they return 0, which is BAD.
     
  2. 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.
     
  3. Nah, this is expensive:
    Code (Text):
    1. public class RMSkills implements Skills.Tracker.Provider {
    2.  
    3.     @Override
    4.     public int getCurrentLevel(com.skelware.bot.data.Skill skill) {
    5.         if (!RuneScape.isLoggedIn()) {
    6.             return -1;
    7.         }
    8.  
    9.         return convert(skill).getCurrentLevel();
    10.     }
    11.  
    12.     @Override
    13.     public int getCurrentExperience(com.skelware.bot.data.Skill skill) {
    14.         if (!RuneScape.isLoggedIn()) {
    15.             return -1;
    16.         }
    17.  
    18.         return convert(skill).getExperience();
    19.     }
    20.  
    21.     private Skill convert(com.skelware.bot.data.Skill skill) {
    22.         return Skill.values()[skill.getGameIndex()];
    23.     }
    24. }
     
  4. On osrs if they return 0 internally, moving forward it'll make it say -1
     
  5. Might be worth looking into stopping the xp gained event from firing when logging in.
     

Share This Page

Loading...