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

Adds MVP info #226

Closed
wants to merge 0 commits into from
Closed

Adds MVP info #226

wants to merge 0 commits into from

Conversation

agsalguero
Copy link

Fix #221

Copy link
Collaborator

@JanEricNitschke JanEricNitschke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This already looks pretty great.

I just have a couple fairly small comments.

It would also be good if you could add test coverage to the parts you added on the python side.

Like checking the MVP scores in the stats module (download the reference demo and double check what you get with what is shown in the game and on hltv and then add that as a test).

You should also add a small test that the stats function works correctly if the MVPName and/or steamid are None or a bot is the mvp.

I think there should already be some examples that you can have a look at in that regard in the stats test file https://github.com/pnxenopoulos/awpy/blob/main/tests/test_stats.py but if you have any questions just ask.

@@ -383,6 +384,7 @@ def player_stats(
for player, n_kills in round_kills.items():
if n_kills in range(6): # 0, 1, 2, 3, 4, 5
player_statistics[player][f"kills{n_kills}"] += 1 # type: ignore[literal-required]
player_statistics[str(r["MVPSteamID"])]["mvp"] += 1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good if you could use the same logic here that we use to check for the steamids in the other places here.

Like

 thrower_key = (
                g["throwerName"]
                if g["throwerSteamID"] == 0
                else str(g["throwerSteamID"])
            )

here:

for g in r["grenades"] or []:

This is to handle bots.

awpy/types.py Outdated
@@ -482,6 +482,8 @@ class GameRound(TypedDict):
weaponFires: Optional[list[WeaponFireAction]]
flashes: Optional[list[FlashAction]]
frames: Optional[list[GameFrame]]
mvp: Players
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont think the gameRounds dict contains a Players dict for the key mvp from your implementation.

I think it should have an MVPSteamID: Optional[int] and the same for MVPName as optional string.

@@ -129,6 +129,9 @@ type GameRound struct {
WinningTeam *string `json:"winningTeam"`
LosingTeam *string `json:"losingTeam"`
Reason string `json:"roundEndReason"`
MVPName string `json:"MVPName"`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think according to the demoinfocs-golang documentation the player can be nil and so we should handle this like we do the other cases where that can happen.

https://pkg.go.dev/github.com/markus-wa/demoinfocs-golang/v3@v3.3.0/pkg/demoinfocs/events#RoundMVPAnnouncement

https://github.com/pnxenopoulos/awpy/blob/main/awpy/parser/parse_demo.go#L205

@ricardoruwer
Copy link

@agsalguero @JanEricNitschke let's go forward with this PR? 😄

@JanEricNitschke
Copy link
Collaborator

@ricardoruwer There are still the open points i have mentioned + the PR has to be rebased to the current main. Sadly i dont have the time to do so at the moment.

But feel free to fork their repo and finish the PR from that.

@agsalguero
Copy link
Author

I'll have some time in a week or two. I'll take a look to it.

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

Successfully merging this pull request may close these issues.

Get round MVP
3 participants