55
66def FullProcessor (replay ):
77 # Populate replay with details
8- replay .realm = replay .raw .init_data .realm
8+ replay .realm = replay .raw .initData .realm
99 replay .map = replay .raw .details .map
1010 replay .file_time = replay .raw .details .file_time
1111 replay .unix_timestamp = windows_to_unix (replay .file_time )
@@ -14,7 +14,7 @@ def FullProcessor(replay):
1414
1515 # Organize the attribute data to be useful
1616 attribute_data = defaultdict (dict )
17- for attr in replay .raw .attribute_events :
17+ for attr in replay .raw .attributes_events :
1818 attribute_data [attr .player ][attr .name ] = attr .value
1919
2020 # Populate replay with attributes
@@ -68,7 +68,7 @@ def FullProcessor(replay):
6868 player .chosen_race = attributes ['Race' ]
6969 player .difficulty = attributes ['Difficulty' ]
7070 player .type = attributes ['Player Type' ]
71- player .realm = replay .raw .init_data .realm
71+ player .realm = replay .raw .initData .realm
7272 player .uid = pdata .bnet .uid
7373 player .subregion = pdata .bnet .subregion
7474 player .handicap = pdata .handicap
@@ -88,7 +88,7 @@ def FullProcessor(replay):
8888 replay .person [pid ] = player
8989
9090 # Create observers out of the leftover names
91- all_players = replay .raw .init_data .player_names
91+ all_players = replay .raw .initData .player_names
9292 for i in range (observer_index ,len (all_players )):
9393 observer = Observer (i + 1 ,all_players [i ],replay )
9494 replay .observers .append (observer )
@@ -121,6 +121,38 @@ def FullProcessor(replay):
121121 for player in replay .players :
122122 replay .teams [player .team ].append (player )
123123
124+ # Copy the events over
125+ # TODO: the events need to be fixed both on the reader and processor side
126+ replay .events = replay .raw .game_events
127+ for event in replay .events :
128+ if event .is_local :
129+ # Set up the object cross references
130+ event .player = replay .person [event .pid ]
131+ event .player .events .append (event )
132+
133+ # event.apply() #Skip this for now
134+ l = replay .events_by_type [event .name ]
135+ l .append (event )
136+
137+ # Gather data for APM measurements
138+ for event in replay .events :
139+ if event .is_local and event .is_player_action :
140+ player = event .player
141+ if not player .is_observer :
142+ # Count up the APS, APM
143+ second , minute = event .second , event .second / 60
144+ player .aps [event .second ] += 1
145+ player .apm [minute ] += 1
146+ player .avg_apm += 1
147+
148+ # Average the APM for actual players
149+ for player in replay .players :
150+ if player .events :
151+ event_minutes = player .events [- 1 ].second / 60.0
152+ if event_minutes :
153+ player .avg_apm /= event_minutes
154+
155+ # TODO: only need to integrate results processing now!
124156 return replay
125157
126158
0 commit comments