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

Fake observers created that take actions, perhaps related to clan tags #99

Closed dsjoerg closed 11 years ago

dsjoerg commented 11 years ago

Added a failing py.test to ggtracker/sc2reader

It's a 2v2 with no observers, where two of the players have clan tags.

and yet replay.people is length 6.

replay.people == [Player 1 - Ваня (Zerg), Player 2 - никита (Protoss), Player 3 - Arqen (Zerg), Player 4 - Skull (Terran), Player 5 - Arqen, Player 6 - Skull]

note that Player 3 and Player 5 have similar names except the clantag. Player 5 is listed as an observer, but the inject actions are attached to Player 5.

dsjoerg commented 11 years ago

Aha it seems like you may have already dealt with this in InitDataReader_24764

GraylinKim commented 11 years ago

Indeed. I think the registration callback needs to be modified from:

self.register_reader('replay.initData', readers.InitDataReader_Base(), lambda r: r.expansion=='WoL' or r.build < 24764)
self.register_reader('replay.initData', readers.InitDataReader_24764(), lambda r: r.expansion=='HotS' and r.build >= 24764)

to

self.register_reader('replay.initData', readers.InitDataReader_Base(), lambda r: r.build < 24764)
self.register_reader('replay.initData', readers.InitDataReader_24764(), lambda r: r.build >= 24764)

My only reservation is I am not 100% sure that all 1.x.x WoL builds were less than 24764. If that turns out to be true then this change should fix things.

dsjoerg commented 11 years ago

I am a few steps ahead of you. I verified that all 1.x.x WoL build are less than 24764. To my surprise, the change did not fix things.

The new problem is that the player names in the Details data structure contain clan nonsense now.

I'm pushing a patch that strips the clan name out. Tests all pass, I'll appreciate your review too.

GraylinKim commented 11 years ago

The clan name should be stripped out already here during the player creation step. It'd rather do it here instead of in the reader so that we retain the raw values for later if we need them. From your example I see that the clean-up needs to be updated now though because player names now look like [OTZ]<sp/>Skull and the <sp/> needs to be stripped out as well.

dsjoerg commented 11 years ago

OK, done in https://github.com/ggtracker/sc2reader/commit/5c78b727e5d7f34cad40b020c4d316a25292beab

GraylinKim commented 11 years ago

Okay great, closing the issue. Re-open if similar issues continue to crop up.