Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
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
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
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
f012566
Fixes #165, properly parse mouse click events.
GraylinKim Dec 13, 2013
4b45b62
Fix initdata parsing for base_build 23260 replays.
GraylinKim Dec 13, 2013
53e5678
Add killer logic to ContextLoader, refine the API.
GraylinKim Dec 19, 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
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
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
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
2139abc
remove debugging print statement
dsjoerg Oct 7, 2015
d69feb4
add failing test for 3.0
dsjoerg Oct 7, 2015
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
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
Misc. documentation improvements.
  • Loading branch information
GraylinKim committed Sep 22, 2013
commit bb8f9d242b244b00d0b43150fddef24a4dc0f509
1 change: 0 additions & 1 deletion docs/source/events/game.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@ computer player.

.. automodule:: sc2reader.events.game
:members:
:undoc-members:
3 changes: 0 additions & 3 deletions docs/source/events/message.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,5 @@
Message Events
===================

Coming soon!

.. automodule:: sc2reader.events.message
:members:
:undoc-members:
1 change: 0 additions & 1 deletion docs/source/events/tracker.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@ are also periodically recorded to snapshot aspects of the current game state.

.. automodule:: sc2reader.events.tracker
:members:
:undoc-members:
49 changes: 38 additions & 11 deletions sc2reader/events/game.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ class GameEvent(Event):
def __init__(self, frame, pid):
#: The id of the player generating the event. This is 16 for global non-player events.
#: Prior to Heart of the Swarm this was the player id. Since HotS it is
#: now the user id (uid), we still call it pid for backwards compatibility.
#: now the user id (uid), we still call it pid for backwards compatibility. You shouldn't
#: ever need to use this; use :attr:`player` instead.
self.pid = pid

#: A reference to the :class:`~sc2reader.objects.Player` object representing
#: this player in the replay. Not available for global events (:attr:`pid` = 16)
#: this player in the replay. Not available for global events (:attr:`is_local` = False)
self.player = None

#: The frame of the game that this event was recorded at. 16 frames per game second.
Expand Down Expand Up @@ -51,6 +52,9 @@ class GameStartEvent(GameEvent):
def __init__(self, frame, pid, data):
super(GameStartEvent, self).__init__(frame, pid)

#: ???
self.data = data


class PlayerLeaveEvent(GameEvent):
"""
Expand All @@ -59,6 +63,9 @@ class PlayerLeaveEvent(GameEvent):
def __init__(self, frame, pid, data):
super(PlayerLeaveEvent, self).__init__(frame, pid)

#: ???
self.data = data


class UserOptionsEvent(GameEvent):
"""
Expand All @@ -80,7 +87,7 @@ def __init__(self, frame, pid, data):
self.sync_checksumming_enabled = data['sync_checksumming_enabled']

#:
is_map_to_map_transition = data['is_map_to_map_transition']
self.is_map_to_map_transition = data['is_map_to_map_transition']

#:
self.use_ai_beacons = data['use_ai_beacons']
Expand Down Expand Up @@ -127,11 +134,31 @@ def __init__(self, frame, pid, data):
#: Flags on the command???
self.flags = data['flags']

#: A dictionary of possible ability flags. Flag names are: alternate,
#: queued, preempt, smart_click, smart_rally, subgroup, set_autocast,
#: set_autocast_on, user, data_a, data_b, data_passenger, data_abil_queue_order_id,
#: ai, ai_ignore_on_finish, is_order, script, homogenous_interruption,
#: minimap, repeat, dispatch_to_other_unit, and target_self
#: A dictionary of possible ability flags. Flags are:
#:
#: * alternate
#: * queued
#: * preempt
#: * smart_click
#: * smart_rally
#: * subgroup
#: * set_autocast,
#: * set_autocast_on
#: * user
#: * data_a
#: * data_b
#: * data_passenger
#: * data_abil_queue_order_id,
#: * ai
#: * ai_ignore_on_finish
#: * is_order
#: * script
#: * homogenous_interruption,
#: * minimap
#: * repeat
#: * dispatch_to_other_unit
#: * target_self
#:
self.flag = dict(
alternate=0x1 & self.flags != 0,
queued=0x2 & self.flags != 0,
Expand Down Expand Up @@ -446,13 +473,13 @@ class CameraEvent(GameEvent):
def __init__(self, frame, pid, data):
super(CameraEvent, self).__init__(frame, pid)

#: The x coordinate of the center? of the camera
#: The x coordinate of the center of the camera
self.x = (data['target']['x'] if data['target'] is not None else 0)/256.0

#: The y coordinate of the center? of the camera
#: The y coordinate of the center of the camera
self.y = (data['target']['y'] if data['target'] is not None else 0)/256.0

#: The location of the center? of the camera
#: The location of the center of the camera
self.location = (self.x, self.y)

#: The distance to the camera target ??
Expand Down
14 changes: 14 additions & 0 deletions sc2reader/events/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@ class MessageEvent(Event):
Parent class for all message events.
"""
def __init__(self, frame, pid):
#: The user id (or player id for older replays) of the person that generated the event.
self.pid = pid

#: The frame of the game this event was applied
self.frame = frame

#: The second of the game (game time not real time) this event was applied
self.second = frame >> 4

#: Short cut string for event class name
Expand All @@ -34,10 +39,19 @@ class ChatEvent(MessageEvent):
"""
def __init__(self, frame, pid, target, text):
super(ChatEvent, self).__init__(frame, pid)
#: The numerical target type. 0 = to all; 2 = to allies; 4 = to observers.
self.target = target

#: The text of the message.
self.text = text

#: Flag marked true of message was to all.
self.to_all = (self.target == 0)

#: Flag marked true of message was to allies.
self.to_allies = (self.target == 2)

#: Flag marked true of message was to observers.
self.to_observers = (self.target == 4)


Expand Down
72 changes: 40 additions & 32 deletions sc2reader/events/tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,14 @@


class TrackerEvent(Event):
"""
Parent class for all tracker events.
"""
def __init__(self, frames):
#: The frame of the game this event was applied
self.frame = frames

#: The second of the game (game time not real time) this event was applied
self.second = frames >> 4

#: Short cut string for event class name
Expand All @@ -30,17 +35,15 @@ def __str__(self):

class PlayerStatsEvent(TrackerEvent):
"""
Player Stats events are generated for all players that were in the game
even if they've since left every 10 seconds. An additional set of stats
events are generated at the end of the game.
Player Stats events are generated for all players that were in the game even if they've since
left every 10 seconds. An additional set of stats events are generated at the end of the game.

When a player leaves the game, a single PlayerStatsEvent is generated
for that player and no one else. That player continues to generate
PlayerStatsEvents at 10 second intervals until the end of the game.
When a player leaves the game, a single PlayerStatsEvent is generated for that player and no
one else. That player continues to generate PlayerStatsEvents at 10 second intervals until the
end of the game.

In 1v1 games, the above behavior can cause the losing player to have 2
events generated at the end of the game. One for leaving and one for
the end of the game.
In 1v1 games, the above behavior can cause the losing player to have 2 events generated at the
end of the game. One for leaving and one for the end of the game.
"""
def __init__(self, frames, data, build):
super(PlayerStatsEvent, self).__init__(frames)
Expand Down Expand Up @@ -213,15 +216,14 @@ def __str__(self):

class UnitBornEvent(TrackerEvent):
"""
Generated when a unit is created in a finished state in the game. Examples
include the Marine, Zergling, and Zealot (when trained from a gateway).
Units that enter the game unfinished (all buildings, warped in units) generate
a :class:`UnitInitEvent` instead.

Unfortunately, units that are born do not have events marking their beginnings
like :class:`UnitInitEvent` and :class:`UnitDoneEvent` do. The closest thing to
it are the :class:`~sc2reader.event.game.AbilityEvent` game events where the ability
is a train unit command.
Generated when a unit is created in a finished state in the game. Examples include the Marine,
Zergling, and Zealot (when trained from a gateway). Units that enter the game unfinished (all
buildings, warped in units) generate a :class:`UnitInitEvent` instead.

Unfortunately, units that are born do not have events marking their beginnings like
:class:`UnitInitEvent` and :class:`UnitDoneEvent` do. The closest thing to it are the
:class:`~sc2reader.event.game.AbilityEvent` game events where the ability is a train unit
command.
"""
def __init__(self, frames, data, build):
super(UnitBornEvent, self).__init__(frames)
Expand Down Expand Up @@ -253,10 +255,12 @@ def __init__(self, frames, data, build):
#: The player object that controls this unit. 0 means neutral unit
self.unit_controller = None

#: The x coordinate of the location
#: The x coordinate of the location with 4 point resolution. E.g. 13.75 recorded as 12.
#: Location prior to rounding marks the center of the unit footprint.
self.x = data[5] * 4

#: The y coordinate of the location
#: The y coordinate of the location with 4 point resolution. E.g. 13.75 recorded as 12.
#: Location prior to rounding marks the center of the unit footprint.
self.y = data[6] * 4

#: The map location of the unit birth
Expand Down Expand Up @@ -292,10 +296,12 @@ def __init__(self, frames, data, build):
#: The player object of the that killed the unit. Not always available.
self.killer = None

#: The x coordinate of the location
#: The x coordinate of the location with 4 point resolution. E.g. 13.75 recorded as 12.
#: Location prior to rounding marks the center of the unit footprint.
self.x = data[3] * 4

#: The y coordinate of the location
#: The y coordinate of the location with 4 point resolution. E.g. 13.75 recorded as 12.
#: Location prior to rounding marks the center of the unit footprint.
self.y = data[4] * 4

#: The map location the unit was killed at.
Expand Down Expand Up @@ -394,10 +400,9 @@ def __str__(self):

class UnitInitEvent(TrackerEvent):
"""
The counter part to :class:`UnitDoneEvent`, generated by the game engine
when a unit is initiated. This applies only to units which are started
in game before they are finished. Primary examples being buildings and
warp-in units.
The counter part to :class:`UnitDoneEvent`, generated by the game engine when a unit is
initiated. This applies only to units which are started in game before they are finished.
Primary examples being buildings and warp-in units.
"""
def __init__(self, frames, data, build):
super(UnitInitEvent, self).__init__(frames)
Expand Down Expand Up @@ -429,10 +434,12 @@ def __init__(self, frames, data, build):
#: The player object that controls this unit. 0 means neutral unit
self.unit_controller = None

#: The x coordinate of the location
#: The x coordinate of the location with 4 point resolution. E.g. 13.75 recorded as 12.
#: Location prior to rounding marks the center of the unit footprint.
self.x = data[5] * 4

#: The y coordinate of the location
#: The y coordinate of the location with 4 point resolution. E.g. 13.75 recorded as 12.
#: Location prior to rounding marks the center of the unit footprint.
self.y = data[6] * 4

#: The map location the unit was started at
Expand All @@ -444,9 +451,8 @@ def __str__(self):

class UnitDoneEvent(TrackerEvent):
"""
The counter part to the :class:`UnitInitEvent`, generated by the game engine
when an initiated unit is completed. E.g. warp-in finished, building finished,
morph complete.
The counter part to the :class:`UnitInitEvent`, generated by the game engine when an initiated
unit is completed. E.g. warp-in finished, building finished, morph complete.
"""
def __init__(self, frames, data, build):
super(UnitDoneEvent, self).__init__(frames)
Expand Down Expand Up @@ -485,7 +491,9 @@ def __init__(self, frames, data, build):
#: A dict mapping of units that had their position updated to their positions
self.units = dict()

#: A list of (unit_index, (x,y)) derived from the first_unit_index and items
#: A list of (unit_index, (x,y)) derived from the first_unit_index and items. Like the other
#: tracker events, these coordinates have 4 point resolution. (15,25) recorded as (12,24).
#: Location prior to rounding marks the center of the unit footprint.
self.positions = list()

unit_index = self.first_unit_index
Expand Down