paquettg / leaguewrap

League of Legend API wrapper
MIT License
67 stars 28 forks source link

Can someone update LeagueWrap to support the new Masteries? #103

Closed Tastefull closed 9 years ago

Tastefull commented 9 years ago

Hi,

I had my hopes that someone would do this without creating an issue. I'm only a user of LeagueWrap and haven't had the time to get into details with everything.

The perfect solutions with be some kind of back compatibility with the old masteries, because a old match report could contain the old mastery setup.

So a way to call the new masteries would be nice :)

@paquettg & @danijoo i'll tag you because you two are awesome :)

dnlbauer commented 9 years ago

Are you talking about /api/lol/static-data/{region}/v1.2/mastery ?

dnlbauer commented 9 years ago

I updated the unit tests to 5.23 masteries and they are still all working. Since they also worked fine in the past, they should also be backward compatible to old versions.

If some part of the library is broken with the new masteries, it seems our tests arent catching this (yet). Please provide more information on what exactly is not working.

Tastefull commented 9 years ago

Okai to be more specific :)

MasteryTreeDto returned by the /api/lol/static-data/{region}/v1.2/mastery has new names (Cunning, Ferocity, Resolve) and the StaticData Dto in /src/LeagueWrap/Dto/StaticData/MasteryTree.php refers to the old (Offence, Defence, Utility)

I don't get errors, just don't get the data as it is now.

Tastefull commented 9 years ago

Also, i have created a thread about "old" masteries

https://developer.riotgames.com/discussion/community-discussion/show/r3wVp5AO

Tastefull commented 9 years ago

When i do

staticData()->getMasteries('tree')->tree->Defense

I don't get anything. I though the data was dynamic so i changed it to

staticData()->getMasteries('tree')->tree->Cunning

But that just game me an error

dnlbauer commented 9 years ago

The references to Defense/Offensive/Utility where indeed hardcoded in MasteryTree.php. I changed that to make the library recognize this names by the structure of the json response.

It should now return the correct response (an array of MasteryTreeLists) or null if the index is not found.

For example:

 // null for 5.23.1, array of MasteryTreeList for 5.21.1
staticData()->getMasteries('tree')->tree->Defense

 // array of MasteryTreeList for 5.23.1, not working on 5.21
staticData()->getMasteries('tree')->tree->Cunning