LionelBergen / MundoScript

Node.js League/LoL/League Of Legends API wrapper, Focus is to be easy to use
33 stars 7 forks source link

Can I get the summoner icon for a given user? #5

Closed bgv2 closed 3 years ago

bgv2 commented 3 years ago

I know the image links are available in DDragon (in profileIcon.json) but I don't know how to get the ID that corresponds to one of those icons.

LionelBergen commented 3 years ago

There was a mistake in the project, the format of profileIcon from ddragon must have changed at some point. It's fixed with the latest version, You should see profileIconId, or profileIconObject if initialized, inside of LeagueAccountInfo.

Example:

LeagueAPI.initialize().then(function(){
  LeagueAPI.getSummonerByName('LeagueOfSausage').then(function(accountInfo) {
    console.log(accountInfo);
  })
});

Result:

LeagueAccountInfo {
  ...
  profileIconObject: {
    id: 3872,
    image: {
    full: '3872.png',
      sprite: 'profileicon0.png',
      group: 'profileicon',
      x: 432,
      y: 6528,
      w: 48,
      h: 48
    }
  }
}
bgv2 commented 3 years ago

Thanks, it works! Is there a way to get the current DDragon version that's included in this package programmatically?

LionelBergen commented 3 years ago

I added a method to get the current DDRagon included: LeagueApi.getDDragonLocalDataVersion

I'm also working on a program that will alert me when DDragon posts a new version - soon, this project will update within 12 hours of a new DDRagon update.

bgv2 commented 3 years ago

worked great, thanks!