|
16 | 16 | from sc2reader import log_utils
|
17 | 17 | from sc2reader import readers
|
18 | 18 | from sc2reader.data import builds as datapacks
|
| 19 | +from sc2reader.events import AbilityEvent, CameraEvent, HotkeyEvent, SelectionEvent |
19 | 20 | from sc2reader.objects import Player, Observer, Team, PlayerSummary, Graph, DepotFile
|
20 | 21 | from sc2reader.constants import REGIONS, LOCALIZED_RACES, GAME_SPEED_FACTOR, LOBBY_PROPERTIES
|
21 | 22 |
|
@@ -473,12 +474,32 @@ def load_events(self):
|
473 | 474 | self.events += self.raw_data['replay.game.events']
|
474 | 475 |
|
475 | 476 | self.events = sorted(self.events, key=lambda e: e.frame)
|
476 |
| - |
| 477 | + self.camera_events = list() |
| 478 | + self.selection_events = list() |
| 479 | + self.ability_events = list() |
477 | 480 | for event in self.events:
|
| 481 | + is_camera = isinstance(event, CameraEvent) |
| 482 | + is_selection = isinstance(event, SelectionEvent) or isinstance(event,HotkeyEvent) |
| 483 | + is_ability = isinstance(event, AbilityEvent) |
| 484 | + |
| 485 | + if is_camera: |
| 486 | + self.camera_events.append(event) |
| 487 | + elif is_selection: |
| 488 | + self.selection_events.append(event) |
| 489 | + elif is_ability: |
| 490 | + self.ability_events.append(event) |
| 491 | + |
478 | 492 | event.load_context(self)
|
479 | 493 | # TODO: Should this be documented or removed? I don't like it.
|
480 | 494 | if event.pid != 16:
|
481 |
| - self.person[event.pid].events.append(event) |
| 495 | + player = self.person[event.pid] |
| 496 | + player.events.append(event) |
| 497 | + if is_camera: |
| 498 | + player.camera_events.append(event) |
| 499 | + elif is_selection: |
| 500 | + player.selection_events.append(event) |
| 501 | + elif is_ability: |
| 502 | + player.ability_events.append(event) |
482 | 503 |
|
483 | 504 | def register_reader(self, data_file, reader, filterfunc=lambda r: True):
|
484 | 505 | """
|
|
0 commit comments