def _add_to_workers(self, event, replay): self._workers_created[event.unit.owner.pid] += event.unit.supply supp = SupplyCount(util.convert_to_realtime_r(replay, event.second), self._workers_created[event.unit.owner.pid], event.unit.supply, event.unit.is_worker) replay.player[event.unit.owner.pid].metrics.workers_created.append( supp)
def handleCameraEvent(self, event, replay): loc_diff = abs(event.location[0] - self._location[event.player.pid][0] ) + abs(event.location[1] - self._location[event.player.pid][1]) self._location[event.player.pid] = event.location if loc_diff > 15: self._sps[event.player.pid][convert_to_realtime_r( replay, event.second)] += 1
def generateResourcesTracked(self, player_name): res = [] for plyr in self._replay.players: if plyr.name == player_name: plyr_stats_events = list( filter(lambda evts: evts.name == 'PlayerStatsEvent', plyr.events)) for evt in plyr_stats_events: res.append( ResourceCount( convert_to_realtime_r(self._replay, evt.second), (evt.minerals_collection_rate + evt.vespene_collection_rate), (evt.minerals_current + evt.vespene_current))) break return res
def handlePlayerStatsEvent(self,event,replay): replay.player[event.pid].metrics.resources.append( ResourceCount(convert_to_realtime_r(replay,event.second), (event.minerals_collection_rate + event.vespene_collection_rate), (event.minerals_current + event.vespene_current)))
def handlePlayerLeaveEvent(self, event, replay): self._seconds_played[event.player.pid] = convert_to_realtime_r( replay, event.second ) - self.initial_apm_seconds_skipped #convert_to_realtime_r(replay, self.initial_apm_seconds_skipped)
def handlePlayerLeaveEvent(self, event, replay): self._seconds_played[event.player.pid] = convert_to_realtime_r( replay, event.second)
def handleUnitDoneEvent(self,event,replay): if event.unit.is_building and (event.unit.name in self._base_names): replay.player[event.unit.owner.pid].metrics.bases_created.append( BaseCount(convert_to_realtime_r(replay, event.second)))