From c060242501528a8995833fc46128e310e53d5b19 Mon Sep 17 00:00:00 2001 From: Craig Dods Date: Sat, 15 Jul 2023 16:52:55 -0400 Subject: [PATCH] 2 of 2 changes to support bot replays in ggtracker#149 Fixes the issue when defaulting to LoTV for GAME_SPEED_FACTOR for bot replays --- sc2reader/resources.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sc2reader/resources.py b/sc2reader/resources.py index 428e9cc9..078d8d1e 100644 --- a/sc2reader/resources.py +++ b/sc2reader/resources.py @@ -429,9 +429,10 @@ def load_details(self): ) self.game_length = self.length + expansion = self.expansion if self.expansion else 'LotV' # Using @brean's logic to fix bot replays self.real_length = utils.Length( seconds=self.length.seconds - // GAME_SPEED_FACTOR[self.expansion].get(self.speed, 1.0) + // GAME_SPEED_FACTOR[expansion].get(self.speed, 1.0) ) self.start_time = datetime.utcfromtimestamp( self.unix_timestamp - self.real_length.seconds @@ -1096,9 +1097,10 @@ def __init__(self, summary_file, filename=None, lang="enUS", **options): self.end_time = datetime.utcfromtimestamp(self.parts[0][8]) self.game_speed = LOBBY_PROPERTIES[0xBB8][1][self.parts[0][0][1].decode("utf8")] self.game_length = utils.Length(seconds=self.parts[0][7]) + expansion = self.expansion if self.expansion else 'LotV' self.real_length = utils.Length( seconds=int( - self.parts[0][7] / GAME_SPEED_FACTOR[self.expansion][self.game_speed] + self.parts[0][7] / GAME_SPEED_FACTOR[expansion][self.game_speed] # Using @brean's logic to fix bot replays ) ) self.start_time = datetime.utcfromtimestamp(