Skip to content

Commit 8644b1c

Browse files
authored
Merge pull request #103 from KSneijders/dev
v0.6.2
2 parents 7994072 + 250f7f7 commit 8644b1c

File tree

9 files changed

+78
-10
lines changed

9 files changed

+78
-10
lines changed

AoE2ScenarioParser/helper/bytes_parser.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from AoE2ScenarioParser.helper.bytes_conversions import bytes_to_int
77
from AoE2ScenarioParser.exceptions.asp_exceptions import EndOfFileError
88
from AoE2ScenarioParser.helper.incremental_generator import IncrementalGenerator
9-
from AoE2ScenarioParser.helper.string_manipulations import create_textual_hex
9+
from AoE2ScenarioParser.helper.string_manipulations import create_textual_hex, trunc_string
1010

1111
if TYPE_CHECKING:
1212
from AoE2ScenarioParser.sections.retrievers.retriever import Retriever
@@ -71,7 +71,11 @@ def retrieve_bytes(igenerator: IncrementalGenerator, retriever: 'Retriever') ->
7171
else:
7272
print(f"\n\nError while setting bytes on retriever: \n\t{retriever} [Iteration: {i + 1}/{retriever.datatype.repeat}]")
7373
print("Remaining bytes:")
74-
print(create_textual_hex(igenerator.get_remaining_bytes().hex(), enter_distance=96))
74+
bytes_ = igenerator.get_remaining_bytes()
75+
complete_hex = create_textual_hex(bytes_.hex(), enter_distance=96)
76+
hex_ = trunc_string(complete_hex, 2000, add_ellipsis=False)
77+
78+
print(hex_ + f"// (Truncated. {len(bytes_)} bytes remaining)")
7579

7680
raise e
7781

AoE2ScenarioParser/objects/data_objects/effect.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,10 @@ def _is_variable_based_aa_effect(effect_type: int | EffectId, object_attributes:
596596

597597

598598
def _is_float_quantity_effect(effect_type: int | EffectId, object_attributes: int | ObjectAttribute) -> bool:
599-
return "quantity_float" in effects.attributes[effect_type] and ObjectAttribute._storage_type(object_attributes) == 'float'
599+
try:
600+
return "quantity_float" in effects.attributes[effect_type] and ObjectAttribute._storage_type(object_attributes) == 'float'
601+
except KeyError:
602+
return False
600603

601604

602605
def _get_armour_attack_source(effect_type: int | EffectId, object_attributes: int | ObjectAttribute) -> str | None:

AoE2ScenarioParser/objects/managers/option_manager.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ class OptionManager(AoE2Object):
3030
RetrieverObjectLink("lock_coop_alliances", support=Support(since=1.42)),
3131
RetrieverObjectLink("secondary_game_modes", support=Support(since=1.42)),
3232
]),
33+
34+
RetrieverObjectLink("legacy_execution_order", "Triggers", "legacy_exec_order", support=Support(since=1.55)),
3335
]
3436

3537
def __init__(
@@ -45,6 +47,7 @@ def __init__(
4547
collide_and_correct: bool,
4648
villager_force_drop: bool,
4749
lock_coop_alliances: bool,
50+
legacy_execution_order: bool,
4851
**kwargs
4952
):
5053
super().__init__(**kwargs)
@@ -67,6 +70,8 @@ def __init__(
6770
self.villager_force_drop: bool = bool(villager_force_drop) if villager_force_drop is not None else None
6871
self.lock_coop_alliances: bool = bool(lock_coop_alliances) if lock_coop_alliances is not None else None
6972

73+
self.legacy_execution_order = bool(legacy_execution_order) if legacy_execution_order is not None else None
74+
7075
@property
7176
def victory_years(self) -> float:
7277
return self._victory_years_10ths / 10

AoE2ScenarioParser/scenarios/aoe2_de_scenario.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class AoE2DEScenario(AoE2Scenario):
1818
Used to represent a scenario with version >= 1.36 (DE). It is the main class that is exposed to the user of the API.
1919
"""
2020

21-
LATEST_VERSION: Tuple[int, int] = (1, 55)
21+
LATEST_VERSION: Tuple[int, int] = (1, 56)
2222

2323
@property
2424
def trigger_manager(self) -> TriggerManagerDE:

AoE2ScenarioParser/versions/DE/v1.54/structure.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1980,6 +1980,33 @@
19801980
"comment": "Present since Trigger Version 4.1",
19811981
"default": -1
19821982
},
1983+
"_filler_0": {
1984+
"is_list": false,
1985+
"type": "s32",
1986+
"comment": "In some scenarios? But not others with trigger version 4.1...",
1987+
"default": -1,
1988+
1989+
"dependencies": {
1990+
"on_construct": {
1991+
"action": "SET_REPEAT",
1992+
"target": "self:static_value_62",
1993+
"eval": "1 if static_value_62 >= 63 else 0"
1994+
}
1995+
}
1996+
},
1997+
"_filler_1": {
1998+
"is_list": false,
1999+
"type": "s32",
2000+
"comment": "In some scenarios? But not others with trigger version 4.1...",
2001+
"default": -1,
2002+
"dependencies": {
2003+
"on_construct": {
2004+
"action": "SET_REPEAT",
2005+
"target": "self:static_value_62",
2006+
"eval": "1 if static_value_62 >= 64 else 0"
2007+
}
2008+
}
2009+
},
19832010
"message": {
19842011
"type": "str32",
19852012
"default": ""
@@ -2150,6 +2177,20 @@
21502177
"comment": "Present since Trigger Version 4.1",
21512178
"default": -1
21522179
},
2180+
"_filler_0": {
2181+
"is_list": false,
2182+
"type": "s32",
2183+
"comment": "In some scenarios? But not others with trigger version 4.1...",
2184+
"default": -1,
2185+
2186+
"dependencies": {
2187+
"on_construct": {
2188+
"action": "SET_REPEAT",
2189+
"target": "self:static_value_30",
2190+
"eval": "1 if static_value_30 >= 31 else 0"
2191+
}
2192+
}
2193+
},
21532194
"xs_function": {
21542195
"type": "str32",
21552196
"default": ""

AoE2ScenarioParser/versions/DE/v1.55/structure.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1576,9 +1576,9 @@
15761576
"comment": "Present since Trigger Version 4.1"
15771577
},
15781578
"legacy_exec_order": {
1579-
"comment": "",
1580-
"type": "1",
1581-
"default": "00",
1579+
"is_list": false,
1580+
"type": "u8",
1581+
"default": "0",
15821582

15831583
"dependencies": {
15841584
"on_construct": {
637 Bytes
Binary file not shown.

AoE2ScenarioParser/versions/DE/v1.56/structure.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1584,9 +1584,9 @@
15841584
"comment": "Present since Trigger Version 4.1"
15851585
},
15861586
"legacy_exec_order": {
1587-
"comment": "",
1588-
"type": "1",
1589-
"default": "00",
1587+
"is_list": false,
1588+
"type": "u8",
1589+
"default": "0",
15901590

15911591
"dependencies": {
15921592
"on_construct": {

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
---
99

10+
## 0.6.2 - 2025-October-31
11+
12+
### Added
13+
14+
- `OptionsManager.legacy_execution_order` (When `False`: Run triggers and effects in display order)
15+
16+
### Fixes
17+
18+
- `LATEST_VERSION` not being set to `(1, 56)`
19+
- Missing default scenario for scenario version `1.56`
20+
- Inability to read some campaigns with inconsistent structures
21+
- Reading scenarios with effects that are hidden in the editor
22+
23+
---
24+
1025
## 0.6.1 - 2025-October-31
1126

1227
### Added

0 commit comments

Comments
 (0)