Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Load mmr #89

Open
il8677 opened this issue Jul 13, 2019 · 3 comments
Open

Feature request: Load mmr #89

il8677 opened this issue Jul 13, 2019 · 3 comments

Comments

@il8677
Copy link

il8677 commented Jul 13, 2019

Replays include MMR info. It would be good to load it as a player attribute

@StoicLoofah
Copy link
Collaborator

So I have to admit that I"m not sure if the top of the header whether this is available in replays or not. Is this what scaled_rating is, or is that something else?

scaled_rating=data.read_uint32() - 2147483648

@il8677
Copy link
Author

il8677 commented Jul 19, 2019

It is available in the player information file, replay.gamemetadata.json within the mpq archive. The file looks like this:

"Duration": 1996, "Players": [ { "PlayerID": 1, "MMR": 2988, "APM": 58.000000, "Result": "Win", "SelectedRace": "Prot", "AssignedRace": "Prot" }

I was successfully able to extract this information using mpq archive:
archive = mpyq.MPQArchive(replay.filename)
jsondata = archive.read_file("replay.gamemetadata.json").decode("utf-8")
obj = json.loads(jsondata)
mmr = obj['Players'][0]['MMR']
`

@NumberPigeon
Copy link
Contributor

The scaled_rating is the player's mmr in most cases via some basic tests.

Besides, it seems currently the lib does not read "replay.gamemetadata.json" file. While most of the info in it is duplicated, the 'APM' of each player is not included. It may be better to include this file's info for potential uses.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants