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

How do I get live match player stats? #458

Open
HarlockOfficial opened this issue Aug 21, 2024 · 0 comments
Open

How do I get live match player stats? #458

HarlockOfficial opened this issue Aug 21, 2024 · 0 comments

Comments

@HarlockOfficial
Copy link

As part of a class, I have the following code:

cass.set_riot_api_key(RiotEnv.API_KEY)
self.account = cass.get_account(name=account_name, tagline=account_tagline, region=region.value)
self.summoner = self.account.summoner
self.match = self.summoner.current_match
participants = self.match.participants
self.player = [p for p in participants if p.summoner == self.summoner][0]
self.stats = cass.core.match.ParticipantStats(match=self.match, participant=self.player)

Reading the library code and the online documentation, I understood that it is possible to use the instance of ParticipantStats to obtain the live values for the kda, champion level, etc.

The first time I call self.stats.kills I get the following error:

Traceback (most recent call last):
  File "[redacted_1]\cassiopeia\core\match.py", line 56, in wrapper
    return method(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "[redacted_1]\cassiopeia\core\match.py", line 1217, in kills
    return self._data[ParticipantStatsData].kills
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'ParticipantStatsData' object has no attribute 'kills'

During handling of the above exception, another exception occurred:

...

File "[redacted_2]", line 22, in [redacted_3]
  reward = self.stats.kills * 100
           ^^^^^^^^^^^^^^^^
File "[redacted_1]\cassiopeia\core\match.py", line 59, in wrapper
  match = getattr(self, "_{}__match".format(self.__class__.__name__))
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'ParticipantStats' object has no attribute '_ParticipantStats__match'

I think I am missing some data in the ParicipantStats constructor or that I should obtain that value using other objects as I did for the match participants.
Following the documentation I can't find a path from the account to the live game participant stats.

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

No branches or pull requests

1 participant