Skip to content

Commit f63acd0

Browse files
support ror
1 parent c51af6d commit f63acd0

7 files changed

Lines changed: 28 additions & 7 deletions

File tree

mgz/fast/header.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -294,8 +294,9 @@ def parse_de(data, version, save, skip=False):
294294
if save >= 26.16 and not skip:
295295
timestamp = unpack('<I', data) # missing on console (?)
296296
data.read(12)
297-
dlc_count = unpack('<I', data)
298-
data.read(dlc_count * 4)
297+
dlc_ids = []
298+
for i in range(0, unpack('<I', data)):
299+
dlc_ids.append(unpack('<I', data))
299300
data.read(4)
300301
difficulty_id = unpack('<I', data)
301302
data.read(4)
@@ -428,7 +429,8 @@ def parse_de(data, version, save, skip=False):
428429
visibility_id=visibility,
429430
rms_mod_id=rms_mod_id,
430431
rms_map_id=rms_map_id,
431-
rms_filename=rms_filename
432+
rms_filename=rms_filename,
433+
dlc_ids=dlc_ids
432434
)
433435

434436

@@ -566,7 +568,7 @@ def parse(data):
566568
map=map_,
567569
de=de,
568570
hd=hd,
569-
mod=mod,
571+
mod=de.get('dlc_ids') if de else mod,
570572
metadata=metadata,
571573
scenario=scenario,
572574
lobby=lobby

mgz/model/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@ def parse_match(handle):
348348
timedelta(milliseconds=timestamp + data['map']['restore_time']),
349349
diplomacy_type,
350350
bool(resigned),
351+
dataset_id,
351352
data['version'],
352353
data['game_version'],
353354
data['save_version'],

mgz/model/compat.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,12 @@ def get_postgame(self):
162162
return None
163163

164164
def get_dataset(self):
165+
if self.match.dataset_id == 101:
166+
return dict(
167+
id=101,
168+
name='Return of Rome',
169+
version=None
170+
)
165171
return dict(
166172
id=100,
167173
name='Definitive Edition',

mgz/model/definitions.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ class Match:
176176
duration: timedelta
177177
diplomacy_type: str
178178
completed: bool
179+
dataset_id: int
179180
version: Version
180181
game_version: str
181182
save_version: float

mgz/reference.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@
1111
def get_dataset(version, mod):
1212
"""Fetch dataset reference data."""
1313
if version is Version.DE:
14-
dataset_id = 100
14+
if 11 in mod:
15+
dataset_id = 101
16+
else:
17+
dataset_id = 100
1518
elif version is Version.HD:
1619
dataset_id = 300
1720
elif mod:

mgz/summary/dataset.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,18 @@ def get_dataset_data(header):
2525
"""Get dataset."""
2626
sample = header.initial.players[0].attributes.player_stats
2727
mod = None
28+
if header.de:
29+
mod = header.de.dlc_ids
2830
if 'mod' in sample:
2931
mod = (sample.mod.get('id'), sample.mod.get('version'))
3032
_, ref = get_dataset(header.version, mod)
3133
if header.version == Version.DE:
34+
if 11 in header.de.dlc_ids:
35+
return {
36+
'id': 101,
37+
'name': 'Return of Rome',
38+
'version': None
39+
}, ref
3240
return {
3341
'id': 100,
3442
'name': 'Definitive Edition',

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33

44
setup(
55
name='mgz',
6-
version='1.8.14',
6+
version='1.8.16',
77
description='Parse Age of Empires 2 recorded games.',
88
url='https://github.com/happyleavesaoc/aoc-mgz/',
99
license='MIT',
1010
author='happyleaves',
1111
author_email='happyleaves.tfr@gmail.com',
1212
packages=find_packages(),
1313
install_requires=[
14-
'aocref>=2.0.8',
14+
'aocref>=2.0.10',
1515
'construct==2.8.16',
1616
'dataclasses==0.8; python_version < "3.7"',
1717
'tabulate>=0.9.0',

0 commit comments

Comments
 (0)