happyleavesaoc / aoc-mgz

Age of Empires II recorded game parsing and summarization in Python 3.
MIT License
197 stars 41 forks source link

fixed parsing of scenario matches #100

Closed Skazu closed 1 year ago

Skazu commented 1 year ago

This PR enables the parsing of games with a selected user scenario, such as this one: https://www.aoe2insights.com/match/245096119/. Without the changes, an exception occurs when parsing the scenario data. I was not able to check a possible downward compatibility, perhaps the structure has changed here with a special DE version?

Skazu commented 1 year ago

I am confident that the current status is compatible now. I have added a new test and a rec containing a user scenario. Only the test that tries all available recs in the tests/recs folder with the full header parser fails now, but as far as I understood, the full header parser is no longer be maintained, so maybe this test should be removed or narrowed to not just test all recs?

happyleavesaoc commented 1 year ago

The full header parsing is still maintained and should continue to function (you're probably thinking of the full body parsing). Looks like this change should be easy to add to the full parser, though.

Here's the relevant section: https://github.com/happyleavesaoc/aoc-mgz/blob/master/mgz/header/scenario.py#L28

That block should be moved into messages.