Support Resume from Replay
Totally failing right now.
We can parse these replays now but the fact that new players took control part way through the game is completely ignored. We need a good way to make this information available.
The information is exposed in a very basic way now with the following added to the replay:
#: True of the game was resumed from a replay
resume_from_replay = False
#: A flag marking which method was used to resume from replay. Unknown interpretation.
resume_method = None
#: Lists info for each user that is resuming from replay.
resume_user_info = None
The user info can't really be applied at this point because it is incomplete. Specifically, the user's toon_id, region, and subregion are missing. Without this information we can't really tell who the new user really is. Putting on hold for now, hopefully Blizzard can add this information in the future.
This toon, region, and subregion information can be extracted from the toon_handle for each user:
Example 1-S2-1-390979:
- Region = 1
- Game = S2
- Subregion = 1
- Toon Id = 390979
This information could be extracted and packaged to create new Player/Observer objects for the game. How exactly to expose this isn't settled yet.
The resume_from_replay flag doesn't seem to work for me. It's always false. Is it meant to be working yet?
Please attach an example replay and state your sc2reader version when reporting issues. If the replay is private you can email it to me.
Sorry I figured out it was because I had load_level=3. I didn't realise that this information required the game events to be loaded :)
I found this issue with resumed replays. Haven't dug into it much but here is a stacktrace and its pretty obvious what file it blew up on:
(master * u=)$: python sc2analyzer.py '../WCS 2015 Season 1/SSL/Challenge/Roundof32_Classic_Cure_1Set(After Recover).SC2Replay'
Traceback (most recent call last):
File "sc2analyzer.py", line 48, in <module>
main()
File "sc2analyzer.py", line 32, in main
replay = sc2reader.load_replay(filename, debug=True)
File "/home/nibz/projects/sc2replay_proc/venv/local/lib/python2.7/site-packages/sc2reader/factories/sc2factory.py", line 85, in load_replay
return self.load(Replay, source, options, **new_options)
File "/home/nibz/projects/sc2replay_proc/venv/local/lib/python2.7/site-packages/sc2reader/factories/sc2factory.py", line 137, in load
return self._load(cls, resource, filename=filename, options=options)
File "/home/nibz/projects/sc2replay_proc/venv/local/lib/python2.7/site-packages/sc2reader/factories/sc2factory.py", line 146, in _load
obj = cls(resource, filename=filename, factory=self, **options)
File "/home/nibz/projects/sc2replay_proc/venv/local/lib/python2.7/site-packages/sc2reader/resources.py", line 309, in __init__
engine.run(self)
File "/home/nibz/projects/sc2replay_proc/venv/local/lib/python2.7/site-packages/sc2reader/engine/engine.py", line 174, in run
for new_event in (event_handler(event, replay) or []):
File "/home/nibz/projects/sc2replay_proc/venv/local/lib/python2.7/site-packages/sc2reader/engine/plugins/context.py", line 228, in handleUnitDoneEvent
self.logger.error("Unit {0} done at {1} [{2}] before it was started!".format(event.killer_pid, Length(seconds=event.second), event.frame))
AttributeError: 'UnitDoneEvent' object has no attribute 'killer_pid'