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

Introduce ext.dota2 - Dota 2 Game Coordinator extension #460

Draft
wants to merge 54 commits into
base: main
Choose a base branch
from

Conversation

Aluerie
Copy link
Contributor

@Aluerie Aluerie commented Jan 23, 2024

🐸 Summary

This PR introduces ext.dota2 extension.

🖍️ TODO

🐍 Migrate ValvePython/dota2 implemented methods.

  • 👨‍💼Player
    • request_profile
    • request_gc_profile (disabled by valve)
    • request_profile_card
    • request_player_stats
    • request_player_info (disabled by valve?)
    • request_conduct_scorecard (behavior score system was revamped though)
    • request_hero_standings
  • Match
    • request_matchmaking_stats
    • request_match_details
    • request_matches
    • request_matches_minimal
    • request_top_source_tv_games
    • request_player_match_history
  • 🥳Party
    Sorry, I'm not interested in implementing this atm.
  • 🦞 Lobby
    Same^
  • 🗣️Chat
    Same^
  • 🤝Shared Objects
    • Maybe?
  • 🛠️Utils
    • replay_url
    • replay_url_from_match
    • metadata_url
    • metadata_url_from_match

🔚 Checklist

  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes. (a bit?)
  • This PR fixes an issue.
  • This PR adds something new (e.g. new method or parameters).
  • This PR is a breaking change (e.g. methods or parameters removed/renamed)
  • This PR is not a code change (e.g. documentation, README, ...)

Aluerie and others added 4 commits January 24, 2024 00:01
Done with `protoc -I . --python_betterproto_out=protos dota_gcmessages_client_watch.proto` using 1.2.5 betterproto and manual edits
only introduces one method `fetch_top_source_tv_games`
@Gobot1234 Gobot1234 self-assigned this Jan 23, 2024
@Aluerie Aluerie changed the title Introduce ext.dota2 - Game 2 Game Coordinator extension Introduce ext.dota2 - Dota 2 Game Coordinator extension Jan 23, 2024
@Aluerie Aluerie marked this pull request as ready for review January 23, 2024 22:25
Copy link
Owner

@Gobot1234 Gobot1234 left a comment

Choose a reason for hiding this comment

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

Thank you so much for this!

image
These don't need to be included, they are for steam non-sense.

Also if you wouldn't mind please could you clean up the enum names to remove underscores and normalise them to be PascalCase.

Finally could you add a very barebones test to the tests directory just to ensure that the client is importable

docs/ext/dota2/index.md Outdated Show resolved Hide resolved
steam/ext/dota2/client.py Outdated Show resolved Hide resolved
steam/ext/dota2/client.py Outdated Show resolved Hide resolved
steam/ext/dota2/client.py Outdated Show resolved Hide resolved
steam/ext/dota2/client.py Outdated Show resolved Hide resolved
steam/ext/dota2/client.py Outdated Show resolved Hide resolved
@Aluerie
Copy link
Contributor Author

Aluerie commented Jan 24, 2024

Thanks for the feedback!

Last time I had similar conversation (with Riot Games API wrapper developers) they actually had the opposite opinion - that it's better for both library devs and end-user to just follow "bad naming/practices/models" from the original devs instead of rethinking/over-cooking. The proto-models are here and kinda working - why not just give easy access to them, they aren't so bad, honestly.

Maybe affected by those, I just thought

  • to compile all protos
  • to list all known emsg-response pairs
  • to have easy kwargs->proto interface and let the user do whatever with returned responses.
  • only then implement helper methods which would modelize the responses.

But I definitely see your points/philosophy. Sorry that I was too linear. Let's modelize this stuff right away then. So... I've done a total overhaul of the PR (maybe I should resubmit it for cleaner commit history?). This is what I changed:

  • In practice, this top source proto message has very little keyword combinations that work and make sense. Thus, I reimplemented this into 3 separate methods.
  • I also implemented some models to wrap responses and its fields.
  • deleted all unused enums and proto messages -> naming and steam nonsense problems are gone.
  • intial test file.
  • moved EMsg to enums.py in root of the extension (kinda like yours).
  • renamed some files to feel more pythonic and less valve-gibbersih prefixes (kinda like yours).

@Aluerie Aluerie requested a review from Gobot1234 January 24, 2024 22:45
steam/ext/dota2/models.py Outdated Show resolved Hide resolved
Copy link
Owner

@Gobot1234 Gobot1234 left a comment

Choose a reason for hiding this comment

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

Overall looks very good, nearly there.

Last time I had similar conversation (with Riot Games API wrapper developers) they actually had the opposite opinion - that it's better for both library devs and end-user to just follow "bad naming/practices/models" from the original devs instead of rethinking/over-cooking

I wouldn't disagree if the names were consistent at the very least but with steam they aren't

steam/ext/dota2/protobufs/shared_enums.py Show resolved Hide resolved
steam/ext/dota2/protobufs/lobby.py Outdated Show resolved Hide resolved
steam/ext/dota2/protobufs/shared_enums.py Outdated Show resolved Hide resolved
steam/ext/dota2/state.py Outdated Show resolved Hide resolved
steam/ext/dota2/models.py Outdated Show resolved Hide resolved
steam/ext/dota2/models.py Outdated Show resolved Hide resolved
steam/ext/dota2/protobufs/common.py Outdated Show resolved Hide resolved
steam/ext/dota2/protobufs/sdk.py Outdated Show resolved Hide resolved
steam/ext/dota2/protobufs/lobby.py Outdated Show resolved Hide resolved
steam/ext/dota2/protobufs/shared_enums.py Outdated Show resolved Hide resolved
@Aluerie Aluerie requested a review from Gobot1234 January 25, 2024 02:20
Aluerie and others added 4 commits January 25, 2024 05:27
Black didn't automate it cause fmt: off 😒custom rule-set when
@Aluerie Aluerie marked this pull request as draft January 25, 2024 21:23
steam/ext/dota2/client.py Outdated Show resolved Hide resolved
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.

2 participants