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:
    249
    Likes Received:
    63
    Currently they return 0, which is BAD.
     
  2. Arbiter

    Arbiter Mod Automation

    Joined:
    Jul 26, 2013
    Messages:
    2,508
    Likes Received:
    1,031
  3. Cloud

    Cloud The Developer

    Joined:
    Jul 28, 2013
    Messages:
    2,319
    Likes Received:
    744
    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:
    249
    Likes Received:
    63
    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 The Developer

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

    Aidden The better executive ;)

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

Share This Page

Loading...