GraylinKim / sc2reader

A python library that extracts data from various Starcraft II resources to power tools and services for the SC2 community. Who doesn't want to hack on the games they play?
http://sc2reader.readthedocs.org
MIT License
413 stars 85 forks source link

Fix pid issues in hots branch #89

Closed dsjoerg closed 11 years ago

dsjoerg commented 11 years ago

There is a new test in test_all.py in ggtracker/sc2reader to demonstrate the bug.

def test_pids():
    replay = sc2reader.load_replay("test_replays/2.0.3.24764/Antiga Shipyard (3).SC2Replay")
    assert replay.players[0].pid == 0
    assert replay.player[0].pid == 0
    assert replay.players[1].pid == 6
    assert replay.player[6].pid == 6

    eventpids = set()
    for event in replay.events:
        eventpids.add(event.pid)

    assert eventpids == set([0, 6, 16])
GraylinKim commented 11 years ago

This is actually a symptom of the replay.initData format being completely different in new versions of HotS. It now includes player clan tags!! Possibly another 5-6 bytes of extra goodies I haven't figured out yet. I'll try to push a patch later tonight.

GraylinKim commented 11 years ago

Done!