Skip to content

Commit

Permalink
Merge pull request #190 from NumberPigeon/mmr
Browse files Browse the repository at this point in the history
Feat: add mmr for Players and Observers
  • Loading branch information
StoicLoofah authored Sep 1, 2023
2 parents 0c79fc9 + 50a137e commit a68dc10
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions sc2reader/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,15 @@ def __init__(self, uid, init_data):
#: This is deprecated because it doesn't actually work.
self.recorder = None

#: The user's mmr at the time of the game
#: Currently, there are three cases observed for a user that does not have a current mmr:
#: 1. The user has no 'scaled_rating' key in their init_data,
#: 2. The user has a None value for their 'scaled_rating' key, or
#: 3. The user has a negative rating, often -36400.
#: For ease of use, this property will return None in both cases.
matchmaking_rating = int(init_data.get("scaled_rating") or 0)
self.mmr = matchmaking_rating if matchmaking_rating > 0 else None

@property
def url(self):
"""
Expand Down

0 comments on commit a68dc10

Please sign in to comment.