Skip to content

Commit 0bc6707

Browse files
fix object id parsing for some actions
1 parent 478dc02 commit 0bc6707

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

mgz/fast/actions.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,20 @@ def parse_action_71094(action_type, player_id, raw):
2626
elif command_id in [13, 14, 17, 18]:
2727
payload['number'] = unpack('<4xh', data)
2828
if action_type is Action.DE_QUEUE:
29-
selected, building_type, unit_id, amount, *object_ids = unpack('<h4xhhh', data)
29+
selected, building_type, unit_id, amount, *object_ids = unpack('<h4xhhh4x', data)
3030
object_ids = list(unpack(f'<{selected}I', data, shorten=False))
3131
payload = dict(object_ids=object_ids, amount=amount, unit_id=unit_id)
3232
if action_type is Action.MOVE:
3333
x, y, selected = unpack('<4x2fh', data)
3434
object_ids = []
35-
data.read(4)
35+
data.read(6)
3636
if selected > 0:
3737
object_ids = list(unpack(f'<{selected}I', data, shorten=False))
3838
payload = dict(object_ids=object_ids, x=x, y=y)
3939
if action_type is Action.ORDER:
4040
target_id, x, y, selected = unpack('<I2fh', data)
4141
object_ids = []
42-
data.read(4)
42+
data.read(6)
4343
if selected > 0:
4444
object_ids = list(unpack(f'<{selected}I', data, shorten=False))
4545
payload = dict(object_ids=object_ids, target_id=target_id, x=x, y=y)
@@ -48,7 +48,7 @@ def parse_action_71094(action_type, player_id, raw):
4848
object_ids = list(unpack(f'{selected}I', data, shorten=False))
4949
payload = dict(building_id=building_id, object_ids=object_ids, x=x, y=y)
5050
if action_type is Action.GATHER_POINT:
51-
selected, x, y, target_id, target_type = unpack('<h2xffii', data)
51+
selected, x, y, target_id, target_type = unpack('<h2xffiix', data)
5252
object_ids = list(unpack(f'{selected}I', data, shorten=False))
5353
payload = dict(target_id=target_id, target_type=target_type, x=x, y=y, object_ids=object_ids)
5454
if action_type is Action.DE_MULTI_GATHERPOINT:

mgz/model/compat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ def get_objects(self):
231231
objects.append((player.number, player.objects))
232232
for player_number, objs in objects:
233233
for obj in objs:
234-
if obj.class_id not in [10, 30, 70, 80]:
234+
if obj.class_id not in [10, 20, 30, 70, 80]:
235235
continue
236236
if obj.index == 1:
237237
continue

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.39',
6+
version='1.8.40',
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.27',
14+
'aocref>=2.0.28',
1515
'construct==2.8.16',
1616
'dataclasses==0.8; python_version < "3.7"',
1717
'tabulate>=0.9.0',

0 commit comments

Comments
 (0)