Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions sc2reader/engine/plugins/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@
from sc2reader.engine.plugins.supply import SupplyTracker
from sc2reader.engine.plugins.creeptracker import CreepTracker
from sc2reader.engine.plugins.gameheart import GameHeartNormalizer

from sc2reader.engine.plugins.lotv import EventSecondCorrector
1 change: 1 addition & 0 deletions sc2reader/engine/plugins/lotv/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from sc2reader.engine.plugins.lotv.event_second import EventSecondCorrector
20 changes: 20 additions & 0 deletions sc2reader/engine/plugins/lotv/event_second.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from sc2reader.events import Event
from sc2reader.resources import Replay


class EventSecondCorrector:
"""
In Lotv, the game fps is 22.4, which means that the game time is not
accurate to the second. But the event.seconds is hardcoded as the fps
is 16. Since currently the replay build is not passed into the event,
the safest way to correct the event.seconds is use plugin.
"""

name = "EventSecondCorrector"

def handleEvent(self, e: "Event", replay: "Replay"):
if 34784 <= replay.build: # lotv replay, adjust time
e.second = int(e.second * 16 / 22.4)
3 changes: 3 additions & 0 deletions sc2reader/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ def __init__(self, sid, slot_data):
toon_handle = self.toon_handle or "0-S2-0-0"
parts = toon_handle.split("-")

#: The Battle.net region id the entity is registered to
self.region_id = int(parts[0])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change looks unrelated. Is this just something that was missing?


#: The Battle.net region the entity is registered to
self.region = GATEWAY_LOOKUP[int(parts[0])]

Expand Down