Skip to content
Merged
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
409 changes: 409 additions & 0 deletions sc2reader/data/LotV/80949_abilities.csv

Large diffs are not rendered by default.

1,058 changes: 1,058 additions & 0 deletions sc2reader/data/LotV/80949_units.csv

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions sc2reader/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,7 @@ def load_build(expansion, version):
"70154",
"76114",
"77379",
"80949",
):
lotv_builds[version] = load_build("LotV", version)

Expand Down
1 change: 1 addition & 0 deletions sc2reader/data/ability_lookup.csv
Original file line number Diff line number Diff line change
Expand Up @@ -865,3 +865,4 @@ BattlecruiserStop,Stop
BattlecruiserAttack,BattlecruiserAttack
BattlecruiserMove,Move,Patrol,HoldPos
AmorphousArmorcloud,AmorphousArmorcloud
BatteryOvercharge,BatteryOvercharge
20 changes: 20 additions & 0 deletions sc2reader/data/unit_lookup.csv
Original file line number Diff line number Diff line change
Expand Up @@ -1062,3 +1062,23 @@ ArtilleryMengskACGluescreenDummy,ArtilleryMengskACGluescreenDummy
AccelerationZoneSmall,AccelerationZoneSmall
AccelerationZoneMedium,AccelerationZoneMedium
AccelerationZoneLarge,AccelerationZoneLarge
LoadOutSpray@1,LoadOutSpray@1
LoadOutSpray@2,LoadOutSpray@2
LoadOutSpray@3,LoadOutSpray@3
LoadOutSpray@4,LoadOutSpray@4
LoadOutSpray@5,LoadOutSpray@5
LoadOutSpray@6,LoadOutSpray@6
LoadOutSpray@7,LoadOutSpray@7
LoadOutSpray@8,LoadOutSpray@8
LoadOutSpray@9,LoadOutSpray@9
LoadOutSpray@10,LoadOutSpray@10
LoadOutSpray@11,LoadOutSpray@11
LoadOutSpray@12,LoadOutSpray@12
LoadOutSpray@13,LoadOutSpray@13
LoadOutSpray@14,LoadOutSpray@14
AccelerationZoneFlyingSmall,AccelerationZoneFlyingSmall
AccelerationZoneFlyingMedium,AccelerationZoneFlyingMedium
AccelerationZoneFlyingLarge,AccelerationZoneFlyingLarge
InhibitorZoneFlyingSmall,InhibitorZoneFlyingSmall
InhibitorZoneFlyingMedium,InhibitorZoneFlyingMedium
InhibitorZoneFlyingLarge,InhibitorZoneFlyingLarge
66 changes: 65 additions & 1 deletion sc2reader/readers.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,9 @@ def __call__(self, data, replay):
ai_build=data.read_bits(8 if replay.base_build >= 38749 else 7)
if replay.base_build >= 23925
else None,
handicap=data.read_bits(7),
handicap=data.read_bits(
32 if replay.base_build >= 80669 else 7
),
observe=data.read_bits(2),
logo_index=data.read_uint32()
if replay.base_build >= 32283
Expand Down Expand Up @@ -270,6 +272,9 @@ def __call__(self, data, replay):
ac_enemy_wave_type=data.read_uint32()
if replay.base_build >= 77379
else None,
selected_commander_prestige=data.read_uint32()
if replay.base_build >= 80871
else None,
)
for i in range(data.read_bits(5))
],
Expand Down Expand Up @@ -2196,6 +2201,65 @@ def set_sync_playing(self, data):
return dict(sync_load=data.read_uint32())


class GameEventsReader_80669(GameEventsReader_65895):
# this is almost the same as `command_event` from previous build
# the only addition is introduction of extra command flag:
# > https://news.blizzard.com/en-us/starcraft2/23471116/starcraft-ii-4-13-0-ptr-patch-notes
# > New order command flag: Attack Once
# > When issuing an attack order, it is now allowed to issue an “attack once” order with order command flags.
# > const int c_cmdAttackOnce = 26;
# ideally this part of the code should be more generic so it doesn't have to copy-pasted as a whole
# every time there's a tiny change in one of the sub-structs
def command_event(self, data):
return dict(
flags=data.read_bits(27),
ability=dict(
ability_link=data.read_uint16(),
ability_command_index=data.read_bits(5),
ability_command_data=data.read_uint8() if data.read_bool() else None,
)
if data.read_bool()
else None,
data={ # Choice
0: lambda: ("None", None),
1: lambda: (
"TargetPoint",
dict(
point=dict(
x=data.read_bits(20),
y=data.read_bits(20),
z=data.read_uint32() - 2147483648,
)
),
),
2: lambda: (
"TargetUnit",
dict(
flags=data.read_uint16(),
timer=data.read_uint8(),
unit_tag=data.read_uint32(),
unit_link=data.read_uint16(),
control_player_id=data.read_bits(4)
if data.read_bool()
else None,
upkeep_player_id=data.read_bits(4)
if data.read_bool()
else None,
point=dict(
x=data.read_bits(20),
y=data.read_bits(20),
z=data.read_uint32() - 2147483648,
),
),
),
3: lambda: ("Data", dict(data=data.read_uint32())),
}[data.read_bits(2)](),
sequence=data.read_uint32() + 1,
other_unit_tag=data.read_uint32() if data.read_bool() else None,
unit_group=data.read_uint32() if data.read_bool() else None,
)


class TrackerEventsReader(object):
def __init__(self):
self.EVENT_DISPATCH = {
Expand Down
13 changes: 11 additions & 2 deletions sc2reader/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,12 @@ def register_default_readers(self):
self.register_reader(
"replay.game.events",
readers.GameEventsReader_65895(),
lambda r: 65895 <= r.base_build,
lambda r: 65895 <= r.base_build < 80669,
)
self.register_reader(
"replay.game.events",
readers.GameEventsReader_80669(),
lambda r: 80669 <= r.base_build,
)
self.register_reader(
"replay.game.events",
Expand Down Expand Up @@ -865,7 +870,11 @@ def register_default_datapacks(self):
)
self.register_datapack(
datapacks["LotV"]["77379"],
lambda r: r.expansion == "LotV" and 77379 <= r.build,
lambda r: r.expansion == "LotV" and 77379 <= r.build < 80949,
)
self.register_datapack(
datapacks["LotV"]["80949"],
lambda r: r.expansion == "LotV" and 80949 <= r.build,
)

# Internal Methods
Expand Down
Binary file not shown.
5 changes: 5 additions & 0 deletions test_replays/test_replays.py
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,11 @@ def test_77379(self):
self.assertEqual(replay.players[0].commander, "Mengsk")
self.assertEqual(replay.players[1].commander, "Stetmann")

def test_80949(self):
replay = sc2reader.load_replay(
"test_replays/5.0.0.80949/2020-07-28 - (T)Ocrucius VS (Z)Rairden.SC2Replay"
)

def test_anonymous_replay(self):
replayfilename = "test_replays/4.1.2.60604/1.SC2Replay"
factory = sc2reader.factories.SC2Factory()
Expand Down