Skip to content

Commit

Permalink
2 of 2 changes to support bot replays in ggtracker#149
Browse files Browse the repository at this point in the history
Fixes the issue when defaulting to LoTV for GAME_SPEED_FACTOR for bot replays
  • Loading branch information
craigdods authored Jul 15, 2023
1 parent 12634e1 commit c060242
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions sc2reader/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit c060242

Please sign in to comment.