Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
255 commits
Select commit Hold shift + click to select a range
148f322
added no tracker events handling
jonomon Aug 1, 2013
f3ef915
Update creeptracker.py
jonomon Aug 1, 2013
7906de6
README/documentation updates.
GraylinKim Aug 12, 2013
5e4e94f
Update the change log and move links around.
GraylinKim Aug 13, 2013
b34be94
Small readme revisions.
GraylinKim Aug 13, 2013
768792d
Small additional changes for release.
GraylinKim Aug 13, 2013
fbda9eb
New v0.6.0 release.
GraylinKim Aug 13, 2013
0f5e949
Fix changelog formatting.
GraylinKim Aug 13, 2013
3f020da
seems to work OK
dsjoerg Aug 13, 2013
1c8e7e3
APMTracker needs to track APM for observers as well as players.
GraylinKim Aug 13, 2013
2b9c477
Make sure to process game events last.
GraylinKim Aug 13, 2013
3423130
Add regression test for event order.
GraylinKim Aug 13, 2013
e0feb86
Bump version to v0.6.1 [skip ci]
GraylinKim Aug 13, 2013
1c42c9a
Update changelog for v0.6.1 [skip ci]
GraylinKim Aug 13, 2013
bfef5be
fix more bugs eeccchhh
dsjoerg Aug 14, 2013
6de72a0
Remove dated download URL [skip ci].
GraylinKim Aug 16, 2013
82ad817
Better fix for hours/minutes on game length.
GraylinKim Aug 16, 2013
cc34ecf
Coverage reporting fix refs #145.
GraylinKim Aug 24, 2013
4e638e8
Fix FileCaching for python3.
GraylinKim Aug 24, 2013
380ab28
Attempt to fix coverage take 2.
GraylinKim Aug 24, 2013
7f448d8
Coverage fix take 3, use develop and not install.
GraylinKim Aug 24, 2013
9692db7
Small clarification on the unit.finished_at time.
GraylinKim Sep 1, 2013
79fe810
Substantial performance improvements.
GraylinKim Sep 1, 2013
e244c35
Fix the tutorial, thanks sil5555.
GraylinKim Sep 1, 2013
c89e58d
Fix up a lot of small issues in the tutorial.
GraylinKim Sep 1, 2013
8c8c908
When we have tracker events, don't change type with game events.
GraylinKim Sep 5, 2013
2622463
Register plugin exceptions as PluginExit events.
GraylinKim Sep 6, 2013
cba9d63
Bump to 0.6.2
GraylinKim Sep 6, 2013
f65122a
Properly handle hallucinated units. Fixes #153.
GraylinKim Sep 15, 2013
37b3924
Bump to 0.6.3.
GraylinKim Sep 15, 2013
78404df
Updates to the plugin documentation.
GraylinKim Sep 16, 2013
3416b04
Adjust tank supply cost. fixes #156.
GraylinKim Sep 18, 2013
1fb58be
Small unicode related fix.
GraylinKim Sep 21, 2013
6c0adc2
Consolidate and improve readers layer.
GraylinKim Sep 21, 2013
2d4bd6b
Bump version to 0.6.4.
GraylinKim Sep 22, 2013
dda41fb
Fix up event names and hierarchy.
GraylinKim Sep 22, 2013
24c0acf
Flesh out the ping class.
GraylinKim Sep 22, 2013
bb8f9d2
Misc. documentation improvements.
GraylinKim Sep 22, 2013
1d03283
First pass at replay resume support. refs #91
GraylinKim Sep 22, 2013
be7883c
dont assume player name is ascii
dsjoerg Nov 16, 2013
e672168
Remove unused player_names. closes #158.
GraylinKim Nov 17, 2013
a3153db
Remove map specific attributes from the listing.
GraylinKim Dec 2, 2013
6fb12e8
Raise an informative error on corrupt tracker file
GraylinKim Dec 2, 2013
caeb6ca
Fix python3 bug in plugin error handling routine.
GraylinKim Dec 2, 2013
2b35c07
Fixes #160 with non back compatible changes.
GraylinKim Dec 2, 2013
72da6ae
Remove some old % style string formatting.
GraylinKim Dec 2, 2013
6d13524
And this is why you run tests before pushing.
GraylinKim Dec 2, 2013
665cc12
Make note of the additional changes in the log.
GraylinKim Dec 2, 2013
1d9c141
adding a missing change from the list
StoicLoofah Dec 6, 2013
52e5be9
Merge pull request #163 from StoicLoofah/update-0.7-changelog
GraylinKim Dec 7, 2013
fe86668
Remove a couple more defunct replay attributes.
GraylinKim Dec 11, 2013
9283c33
Use generic UnitType and Ability classes for data.
GraylinKim Dec 11, 2013
4d068bf
datapacks is a better word than builds here.
GraylinKim Dec 11, 2013
0e6286f
Replace all references to gateway with region.
GraylinKim Dec 11, 2013
d9df519
Fix typo.
GraylinKim Dec 11, 2013
bd2a8cf
Use a regular dict for raw data results.
GraylinKim Dec 11, 2013
f58daf7
Remove stray reference.
GraylinKim Dec 11, 2013
b968b57
Misc import and documentation improvements.
GraylinKim Dec 11, 2013
81809e5
Don't forget the tests.
GraylinKim Dec 11, 2013
03bbdae
Our readers and lambdas can't be pickled.
GraylinKim Dec 11, 2013
b421a7c
Initial pass at PTR 2.1 support.
GraylinKim Dec 11, 2013
9c06d28
Initial pass at PTR 2.1 support.
GraylinKim Dec 11, 2013
50aa557
Fix small bugs in PTR support.
GraylinKim Dec 12, 2013
38dfa77
Fix small bugs in PTR support.
GraylinKim Dec 12, 2013
ba404a5
Clarify the highest leauge user attribute.
GraylinKim Dec 12, 2013
94263a5
The clan logo is a DepotFile location, not a string.
GraylinKim Dec 13, 2013
b6e6f82
The clan logo is a DepotFile location, not a string.
GraylinKim Dec 13, 2013
f012566
Fixes #165, properly parse mouse click events.
GraylinKim Dec 13, 2013
554b94d
Flesh out the ping class.
GraylinKim Sep 22, 2013
d3834e7
Misc. documentation improvements.
GraylinKim Sep 22, 2013
1c83190
Remove unused player_names. closes #158.
GraylinKim Nov 17, 2013
53498df
Remove map specific attributes from the listing.
GraylinKim Dec 2, 2013
760858a
Raise an informative error on corrupt tracker file
GraylinKim Dec 2, 2013
1094012
Fix python3 bug in plugin error handling routine.
GraylinKim Dec 2, 2013
f4fe8bb
Remove some old % style string formatting.
GraylinKim Dec 2, 2013
d21c50a
Remove a couple more defunct replay attributes.
GraylinKim Dec 11, 2013
e373ac4
Use generic UnitType and Ability classes for data.
GraylinKim Dec 11, 2013
23b36f5
datapacks is a better word than builds here.
GraylinKim Dec 11, 2013
e836c6a
Fix typo.
GraylinKim Dec 11, 2013
fc79bbb
Use a regular dict for raw data results.
GraylinKim Dec 11, 2013
a7c7e21
Misc import and documentation improvements.
GraylinKim Dec 11, 2013
3b0a9d5
Clarify the highest leauge user attribute.
GraylinKim Dec 12, 2013
b829379
Fixes #165, properly parse mouse click events.
GraylinKim Dec 13, 2013
e4fd231
Bring the changelog for 0.6.5 up to speed.
GraylinKim Dec 13, 2013
1a70911
Fix initdata parsing for base_build 23260 replays.
GraylinKim Dec 13, 2013
14c99b3
fix creepTracker so it runs as part of the test suite. and fix it to …
dsjoerg Dec 13, 2013
2f419eb
Updates to the project documentation.
GraylinKim Jul 31, 2013
aff260d
Small event documentation improvements.
GraylinKim Aug 1, 2013
ace3708
Better team string formatting.
GraylinKim Aug 5, 2013
78f4fe6
Improvements to documentation.
GraylinKim Aug 5, 2013
ea02352
Plugins can now yield PluginExit events.
GraylinKim Aug 6, 2013
94ec71b
More documentation changes.
GraylinKim Aug 6, 2013
3cc1cd0
Move get_real_type to utils.
GraylinKim Aug 7, 2013
1d497d8
Improve conflicting results message.
GraylinKim Aug 7, 2013
0bc00ce
GameHeart Plugin
StoicLoofah Aug 5, 2013
99bd6c1
GameHeart plugin as a GameEngine plugin.
GraylinKim Aug 7, 2013
23e82ab
GameHeart on by default.
GraylinKim Aug 7, 2013
9f6b076
Oops. Forgot the events file.
GraylinKim Aug 7, 2013
bcd0859
Fix broken function reference.
GraylinKim Aug 7, 2013
07617d1
Add a short guide to getting started.
GraylinKim Aug 7, 2013
b6adea4
Record the replay load_level for later.
GraylinKim Aug 12, 2013
20fe0cb
README/documentation updates.
GraylinKim Aug 12, 2013
27f40af
Update the change log and move links around.
GraylinKim Aug 13, 2013
aaab03f
Small readme revisions.
GraylinKim Aug 13, 2013
01b6164
Small additional changes for release.
GraylinKim Aug 13, 2013
170b484
New v0.6.0 release.
GraylinKim Aug 13, 2013
04988db
Fix changelog formatting.
GraylinKim Aug 13, 2013
1254505
APMTracker needs to track APM for observers as well as players.
GraylinKim Aug 13, 2013
c1f5d33
Make sure to process game events last.
GraylinKim Aug 13, 2013
1777d84
Add regression test for event order.
GraylinKim Aug 13, 2013
0c7f0b2
Bump version to v0.6.1 [skip ci]
GraylinKim Aug 13, 2013
041d2fc
Update changelog for v0.6.1 [skip ci]
GraylinKim Aug 13, 2013
68678bc
Remove dated download URL [skip ci].
GraylinKim Aug 16, 2013
daf9cd7
Better fix for hours/minutes on game length.
GraylinKim Aug 16, 2013
44a6106
Coverage reporting fix refs #145.
GraylinKim Aug 24, 2013
e3020d0
Fix FileCaching for python3.
GraylinKim Aug 24, 2013
b634e05
Attempt to fix coverage take 2.
GraylinKim Aug 24, 2013
6e19fe4
Coverage fix take 3, use develop and not install.
GraylinKim Aug 24, 2013
2f433cf
Small clarification on the unit.finished_at time.
GraylinKim Sep 1, 2013
33769ab
Substantial performance improvements.
GraylinKim Sep 1, 2013
ff28da2
Fix the tutorial, thanks sil5555.
GraylinKim Sep 1, 2013
1799249
Fix up a lot of small issues in the tutorial.
GraylinKim Sep 1, 2013
aaa2b89
When we have tracker events, don't change type with game events.
GraylinKim Sep 5, 2013
46ee535
Register plugin exceptions as PluginExit events.
GraylinKim Sep 6, 2013
50e3adc
Bump to 0.6.2
GraylinKim Sep 6, 2013
07c3eca
Properly handle hallucinated units. Fixes #153.
GraylinKim Sep 15, 2013
f2a7286
Bump to 0.6.3.
GraylinKim Sep 15, 2013
f3b0191
Updates to the plugin documentation.
GraylinKim Sep 16, 2013
088e2eb
Adjust tank supply cost. fixes #156.
GraylinKim Sep 18, 2013
3020b60
Consolidate and improve readers layer.
GraylinKim Sep 21, 2013
ec238c9
Bump version to 0.6.4.
GraylinKim Sep 22, 2013
b2aac81
Initial pass at PTR 2.1 support.
GraylinKim Dec 11, 2013
9ab207d
Fix small bugs in PTR support.
GraylinKim Dec 12, 2013
dcb3e8e
The clan logo is a DepotFile location, not a string.
GraylinKim Dec 13, 2013
af974eb
Flesh out the ping class.
GraylinKim Sep 22, 2013
3579d06
Misc. documentation improvements.
GraylinKim Sep 22, 2013
d443e7e
Remove unused player_names. closes #158.
GraylinKim Nov 17, 2013
28506b0
Remove map specific attributes from the listing.
GraylinKim Dec 2, 2013
49158d1
Raise an informative error on corrupt tracker file
GraylinKim Dec 2, 2013
e1f3d4e
Fix python3 bug in plugin error handling routine.
GraylinKim Dec 2, 2013
6e929cc
Remove some old % style string formatting.
GraylinKim Dec 2, 2013
f9cbeaa
Remove a couple more defunct replay attributes.
GraylinKim Dec 11, 2013
e3ff027
Use generic UnitType and Ability classes for data.
GraylinKim Dec 11, 2013
c4eea74
datapacks is a better word than builds here.
GraylinKim Dec 11, 2013
8a62df6
Fix typo.
GraylinKim Dec 11, 2013
74606f8
Use a regular dict for raw data results.
GraylinKim Dec 11, 2013
9564387
Misc import and documentation improvements.
GraylinKim Dec 11, 2013
8075ac4
Clarify the highest leauge user attribute.
GraylinKim Dec 12, 2013
b246755
Fixes #165, properly parse mouse click events.
GraylinKim Dec 13, 2013
79ddc88
Bring the changelog for 0.6.5 up to speed.
GraylinKim Dec 13, 2013
8179ff6
Fix initdata parsing for base_build 23260 replays.
GraylinKim Dec 13, 2013
5eea845
Add name to the CreepTracker plugin.
GraylinKim Dec 13, 2013
f5b1975
Fix a small rebase error, my bad.
GraylinKim Dec 13, 2013
4b45b62
Fix initdata parsing for base_build 23260 replays.
GraylinKim Dec 13, 2013
9949c9b
Add killer logic to ContextLoader, refine the API.
GraylinKim Dec 19, 2013
53e5678
Add killer logic to ContextLoader, refine the API.
GraylinKim Dec 19, 2013
3d34e4c
Update the changelog.
GraylinKim Dec 19, 2013
b8982c2
Merge branch 'v0.6.5' of http://github.com/GraylinKim/sc2reader into …
GraylinKim Dec 21, 2013
e5001a3
added a replay thats failing for GGTracker, but surprisingly it turns…
dsjoerg Jan 5, 2014
00411e3
Bump mpyq version.
GraylinKim Jan 8, 2014
04f06a1
workaround for objects that appear in selections but not in tracker e…
dsjoerg Jan 19, 2014
18ca54c
fix name of 'ControlGroupEvent' in comments
eqy Jan 30, 2014
a303fd7
Merge pull request #167 from eqy/patch-1
GraylinKim Jan 30, 2014
9277ec4
No more lints.
Apr 13, 2014
d275182
Merge pull request #168 from MakozFriends/master
GraylinKim Apr 15, 2014
214cd7c
Fixes SelectionTracker plugin with new handler names.
Apr 23, 2014
1a6220b
Merge pull request #169 from MakozFriends/hotfix/selectiontracker
GraylinKim May 5, 2014
846bfaf
fixes so that we can parse loaded games
dsjoerg Jun 23, 2014
b35d88c
new failing test for replays that started by loading a saved game
dsjoerg Jun 30, 2014
c860d8e
fix for replays that started with a load from a saved game
dsjoerg Jun 30, 2014
0988a58
2.1.4 now works hooray
dsjoerg Sep 23, 2014
762a8ab
test replay for 2.1.4
dsjoerg Sep 23, 2014
89f4eee
amended author info
dsjoerg Sep 26, 2014
6f30900
fix for 2.1.4
dsjoerg Sep 26, 2014
6580ebb
Fix various issues related to issue #180.
GraylinKim Dec 29, 2014
0dbe561
Fix gameheart plugin handling of teams and observers. Closes #174.
GraylinKim Dec 29, 2014
83d3809
Add option to print observers to sc2printer.
GraylinKim Dec 29, 2014
26c569e
Harden up the code for processing s2ma files.
GraylinKim Dec 29, 2014
6c48e8a
This is a polish translation.
GraylinKim Dec 29, 2014
a194b67
Remove PersonDict and AttributeDict implementations.
GraylinKim Dec 31, 2014
3e1cea3
Remove dead code.
GraylinKim Jan 5, 2015
722ae4f
Bump version to a pre-release (for clarity).
GraylinKim Jan 5, 2015
c5d22d6
decoding this so that it reads as a string not bytes in python 3
StoicLoofah Feb 11, 2015
4b3bd9b
Merge pull request #183 from StoicLoofah/decode_upgrade_type_name
GraylinKim Mar 3, 2015
20156ec
Fix ancient typo in struct decoder. refs #184
GraylinKim Mar 15, 2015
1ccc57c
beginning of LotV support. ported over from mainline.
dsjoerg Sep 15, 2015
69976fc
pil is required
dsjoerg Sep 15, 2015
109fbfc
for LotV, stop parsing the map info we can't read.
dsjoerg Sep 21, 2015
e48f306
LotV data from @StoicLoofah's branch
dsjoerg Sep 21, 2015
2139abc
remove debugging print statement
dsjoerg Oct 7, 2015
d69feb4
add failing test for 3.0
dsjoerg Oct 7, 2015
c6fdb74
handle 3.0 replays, work in progress.
dsjoerg Oct 7, 2015
ac8c220
further support for 3.0.
dsjoerg Oct 7, 2015
f6b54d4
add third replay for fun
dsjoerg Oct 7, 2015
0c9b272
read even less of the map data, because we can't read part of some ma…
dsjoerg Oct 7, 2015
ea6a7a1
hack to make HotS 3.0 / 38215 use the LotV datapack
dsjoerg Oct 8, 2015
7d12c2a
introduce failing test for 38749
dsjoerg Oct 28, 2015
64217c7
handle 38749. test passes now.
dsjoerg Oct 28, 2015
650a9cb
add a failing replay
dsjoerg Oct 30, 2015
b6d63e5
make diagnostic script not die when players don't have names
dsjoerg Oct 30, 2015
27948bf
correctly handle 38749. test passes now
dsjoerg Oct 30, 2015
ab8d826
make diagnostic script work
dsjoerg Oct 30, 2015
6a828a9
handle weird update_types in create_control_group_event. failing rep…
dsjoerg Nov 13, 2015
77d405f
handle 38996
dsjoerg Nov 13, 2015
a421ca0
handle 3.1.0. add test replays to prove it.
dsjoerg Dec 16, 2015
f2787f6
add instructions on running just one test
dsjoerg Dec 21, 2015
15c06f9
add test for the Central Protocol map which had a new kind of mineral…
dsjoerg Dec 21, 2015
e4240d9
add failing replay. no idea whats wrong
dsjoerg Jan 10, 2016
20b4544
new attributes. thx graylin for writing sc2attributes.py
dsjoerg Jan 10, 2016
333d027
add failing creepspread test
dsjoerg Feb 23, 2016
4eb4593
new failing test for 3.2
dsjoerg Apr 6, 2016
4d42147
fix for 3.2 (while breaking for older versions)
dsjoerg Apr 6, 2016
5e6e235
Use Pillow since pil is not available on Ubuntu 14.04.
nickelsen Apr 13, 2016
4be87ef
Fix LotV time by fps modifier (for length) and new game_speed_factors…
nickelsen Apr 14, 2016
504fff2
Merge pull request #9 from nickelsen/vagrant
dsjoerg Apr 15, 2016
b36791c
Merge pull request #10 from nickelsen/lotv-length-fix
dsjoerg Apr 17, 2016
73d11a9
Fix MapInfo parsing for version 0x26
gravelweb Apr 18, 2016
80ea580
Merge pull request #11 from gravelweb/mini-map
dsjoerg Apr 19, 2016
3bc825c
handle 3.3.0
dsjoerg May 18, 2016
189dcea
Fix some non-python 3 things
DasFranck May 21, 2016
5dbe62b
Adding StringIO import for Python3
DasFranck May 21, 2016
641e494
Run tests on circleci.
nickelsen Jun 9, 2016
32721d3
Merge pull request #15 from nickelsen/circleci
dsjoerg Jun 9, 2016
d5f5203
mark as expected a failure related to the APM from a HotS replay. it…
dsjoerg Jun 9, 2016
4b73007
tell CircleCI to ignore the branches that we know are old and busted
dsjoerg Jun 9, 2016
504fd5c
Merge branch 'upstream' into upstream
DasFranck Jun 9, 2016
bdf3bc2
Merge pull request #13 from DasFranck/upstream
dsjoerg Jun 10, 2016
90bc219
Add handler for command_update_target_unit_event
gravelweb Jun 9, 2016
9520a57
UpdateTargetAbilityEvent: Safer implementation, per player ability tr…
gravelweb Jun 11, 2016
9fd95ac
UpdateTargetAbilityEvent: Unit tests
gravelweb Jun 11, 2016
6fdaf29
Merge pull request #14 from gravelweb/update-target
dsjoerg Jun 11, 2016
32dec12
@mischanix wrote this back in Sept 2015 but I neglected to commit unt…
dsjoerg Jul 13, 2016
7df5941
fix usage message to have the right script name
dsjoerg Jul 13, 2016
cf67e1d
add new abilities and units for 3.4.0 (44401)
dsjoerg Jul 13, 2016
82fff8c
add test for 3.4.0. it passed before we did anything for it, and it s…
dsjoerg Jul 13, 2016
82887d9
register datapack so that the new ability info is actually used
dsjoerg Jul 13, 2016
2d36f82
44401 units, take 2
dsjoerg Jul 13, 2016
2f7bfcf
more units for unit lookup yay
dsjoerg Jul 13, 2016
a131d50
howto on how to do the abilities and units nonsense
dsjoerg Jul 13, 2016
ae41bda
handle 3.7
dsjoerg Oct 18, 2016
131ac4e
add another replay to the 3.7 test, works fine
dsjoerg Oct 18, 2016
dbffc7f
add new abilities and units for 47185
dsjoerg Oct 26, 2016
d5eb61a
Merge remote-tracking branch 'upstream/master' into ggtracker/upstream
StoicLoofah Nov 18, 2016
e6ca55b
fixing tests from graylinkim/ggtracker merge
StoicLoofah Nov 18, 2016
c86eb5a
fixing more references from the CHANGELOG
StoicLoofah Nov 28, 2016
f5fa1c5
Merge pull request #16 from StoicLoofah/reconcile_graylinkim_ggtracker
dsjoerg Dec 4, 2016
af4d492
bump to 0.8.0, update some URLs and contributor info
dsjoerg Dec 6, 2016
8cdc7d2
added support for protocol 48258
frugs Dec 11, 2016
afe0232
Merge pull request #17 from frugs/master
dsjoerg Dec 11, 2016
3730034
Remove unnecessary print statement
nibalizer Jan 19, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add killer logic to ContextLoader, refine the API.
  • Loading branch information
GraylinKim committed Dec 19, 2013
commit 53e56784508932c7aa967bf400cdb366ed9ccce4
16 changes: 15 additions & 1 deletion sc2reader/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,24 @@ def __init__(self, unit_id):
#: Specifically, it is the frame that the :class:`~sc2reader.events.tracker.UnitDiedEvent` is received.
self.died_at = None

#: Deprecated, see :attr:`self.killing_player`
self.killed_by = None

#: A reference to the player that killed this unit. Only available for 2.0.8+ replays.
#: This value is not set if the killer is unknown or not relevant (morphed into a
#: different unit or used to create a building, etc)
self.killed_by = None
self.killing_player = None

#: A reference to the unit that killed this unit. Only available for 2.1+ replays.
#: This value is not set if the killer is unknown or not relevant (morphed into a
#: different unit or used to create a building, etc). If the killing unit dies before
#: the killed unit dies, a bug may cause the killing unit to be None. This can occur
#: due because of projectile speeds.
self.killing_unit = None

#: A list of units that this unit has killed. Only available for 2.1+ replays.
#: The unit only gets credit for the kills that it gets the final blow on.
self.killed_units = list()

#: The unique in-game id for this unit. The id can sometimes be zero because
#: TargetUnitCommandEvents will create a new unit with id zero when a unit
Expand Down
20 changes: 14 additions & 6 deletions sc2reader/engine/plugins/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,21 @@ def handleUnitDiedEvent(self, event, replay):
else:
self.logger.error("Unit {0} died at {1} [{2}] before it was born!".format(event.unit_id, Length(seconds=event.second), event.frame))

if event.killer_pid in replay.player:
event.killer = replay.player[event.killer_pid]
if event.killing_player_id in replay.player:
event.killing_player = event.killer = replay.player[event.killing_player_id]
if event.unit:
event.unit.killed_by = event.killer
event.killer.killed_units.append(event.unit)
elif event.killer_pid:
self.logger.error("Unknown killer pid {0} at {1} [{2}]".format(event.killer_pid, Length(seconds=event.second), event.frame))
event.unit.killing_player = event.unit.killed_by = event.killing_player
event.killing_player.killed_units.append(event.unit)
elif event.killing_player_id:
self.logger.error("Unknown killing player id {0} at {1} [{2}]".format(event.killing_player_id, Length(seconds=event.second), event.frame))

if event.killing_unit_id in replay.objects:
event.killing_unit = replay.objects[event.killing_unit_id]
if event.unit:
event.unit.killing_unit = event.killing_unit
event.killing_unit.killed_units.append(event.unit)
elif event.killing_unit_id:
self.logger.error("Unknown killing unit id {0} at {1} [{2}]".format(event.killing_unit_id, Length(seconds=event.second), event.frame))

def handleUnitOwnerChangeEvent(self, event, replay):
self.load_tracker_controller(event, replay)
Expand Down
27 changes: 18 additions & 9 deletions sc2reader/events/tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,12 +313,18 @@ def __init__(self, frames, data, build):
#: The unit object that died
self.unit = None

#: The id of the player that killed this unit. None when not available.
#: Deprecated, see :attr:`killing_player_id`
self.killer_pid = data[2]

#: The player object of the that killed the unit. Not always available.
#: Deprecated, see :attr:`killing_player`
self.killer = None

#: The id of the player that killed this unit. None when not available.
self.killing_player_id = data[2]

#: The player object of the that killed the unit. Not always available.
self.killing_player = None

#: The x coordinate of the center of the dying unit's footprint. Only 4 point resolution
#: prior to Starcraft Patch 2.1.
self.x = data[3]
Expand All @@ -331,24 +337,27 @@ def __init__(self, frames, data, build):
self.location = (self.x, self.y)

#: The index portion of the killing unit's id. Available for build 27950+
self.killer_unit_index = None
self.killing_unit_index = None

#: The recycle portion of the killing unit's id. Available for build 27950+
self.killer_unit_recycle = None
self.killing_unit_recycle = None

#: The unique id of the unit doing the killing. Available for build 27950+
self.killer_unit_id = None
self.killing_unit_id = None

#: A reference to the :class:`Unit` that killed this :class:`Unit`
self.killing_unit = None

if build < 27950:
self.x = self.x * 4
self.y = self.y * 4
self.location = (self.x, self.y)
else:
# Starcraft patch 2.1 introduced killer unit indexes
self.killer_unit_index = data[5]
self.killer_unit_recycle = data[6]
if self.killer_unit_index:
self.killer_unit_id = self.killer_unit_index << 18 | self.killer_unit_recycle
self.killing_unit_index = data[5]
self.killing_unit_recycle = data[6]
if self.killing_unit_index:
self.killing_unit_id = self.killing_unit_index << 18 | self.killing_unit_recycle

def __str__(self):
return self._str_prefix() + "{0: >15} - Unit died {1}.".format(self.unit.owner, self.unit)
Expand Down