Nice plugins for sc2reader.
The plugins are designed to be simple, easy to understand and use, yet versatile enough to provide a wide range of functionalities. It is worth noting that these plugins are designed with decoupling in mind, allowing selectively loading and using only the ones required for your sc2 replay job.
Using pip:
pip install git+https://github.com/NumberPigeon/sc2reader-plugins.gitUsing rye:
rye add --git https://github.com/NumberPigeon/sc2reader-plugins.git sc2reader-pluginsA simple example that using APMTracker plugin to get the players' apm:
>>> import sc2reader
>>> from sc2reader_plugins import EventSecondCorrector, APMTracker
>>> sc2reader.engine.register_plugin(EventSecondCorrector()) #Recommended for lotv reps
>>> sc2reader.engine.register_plugin(APMTracker())
>>> replay = sc2reader.load_replay("tests/replays/1v1.SC2Replay")
>>> p1, p2 = replay.players
>>> p1.official_apm
305.0
>>> p1.avg_apm
276.69565217391306The official_apm, which is the apm value shown in the after game summary, and the avg_apm which is calculated based on a naive algorithm.
- APMTracker: track players' apm and official apm.
- EventSecondCorrector: align
event.secondtoreplay.game_lengthunder lotv. See issue. - PlayerStatsTracker: extract infos from
PlayersStatsEventand buildplayer.statsfor easier data extraction. - SQTracker: track players' sq.
- WorkerTracker: track players' worker stats.
More plugins, better documents...
Any suggestions and contributions are welcomed!