loldevs / leaguespec

community crafted knowledge base around Riot Games observer system
Other
149 stars 18 forks source link

Mastery padding specification needs an explanation #28

Open Zero3 opened 10 years ago

Zero3 commented 10 years ago

The section at https://github.com/loldevs/leaguespec/wiki/Keyframe-Player-Segment#padding lacks an explanation. How do we know the amount of padding?

My initial guess would be that there always are 30 mastery slots in the data, even though not all of them are used (for example when several points are allocated towards the same mastery). The mastery IDs for the remaining slots are set to 0 as with runes (see #26). Does anyone know if this is true?

Zero3 commented 10 years ago

On a related note, the 03 00 part of the mastery entry appears to be 00 00 for empty slots. I will make a careful guess that the '3' is a mastery "season number". I don't know if we had a new set of masteries every season, but if so, this would make sense.

Zero3 commented 10 years ago

Besides what can reasonably be attributed to mastery points per above, there is exactly 250 additional "padding bytes" (all zero) before the item header starts. At least that is how the keyframe I'm currently working on looks.

avborhanian commented 10 years ago

It's 20 masteries in the offense tree, 19 in the defense tree, and 18 in the utility tree. Dedicating 5 bytes to each [ (20 + 19 + 18) * 5 ] results in 285 bytes total. Add 8 for the header, and we're at 293, which is still a fair bit short of the 404 bytes dedicated to the section in total.

avborhanian commented 10 years ago

Actually, now thanks to the bitflags work, we know exactly how the padding is done.

Satan6 already posted this in the wiki, but the header for the runes, summoner spells, and masteries is 83 00 12 02 00 00 // [contentlength] 2A // [blocktype] 19 00 00 40 // Entity ID [blockparam]

And 212 is 530 bytes. 120 for the runes, 8 for the summoner spells, and as much as is needed for masteries. Rest is padding until the last byte, which specifies summoner level.