1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

getExperience and getLevel should return -1 if not logged in

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

  1. Salvation

    Salvation First Bot Author

    Joined:
    Aug 7, 2013
    Messages:
    262
    Likes Received:
    68
    Currently they return 0, which is BAD.
     
  2. Arbiter

    Arbiter Mod Automation

    Joined:
    Jul 26, 2013
    Messages:
    2,938
    Likes Received:
    1,266
  3. Cloud

    Cloud Engineer

    Joined:
    Jul 28, 2013
    Messages:
    2,777
    Likes Received:
    1,124
    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.
     
  4. Salvation

    Salvation First Bot Author

    Joined:
    Aug 7, 2013
    Messages:
    262
    Likes Received:
    68
    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. }
     
  5. Cloud

    Cloud Engineer

    Joined:
    Jul 28, 2013
    Messages:
    2,777
    Likes Received:
    1,124
    On osrs if they return 0 internally, moving forward it'll make it say -1
     
  6. Aidden

    Aidden Author of MaxiBots

    Joined:
    Dec 3, 2013
    Messages:
    6,600
    Likes Received:
    990
    Might be worth looking into stopping the xp gained event from firing when logging in.
     

Share This Page

Loading...