diff --git a/AoE2ScenarioParser/datasets/object_support.py b/AoE2ScenarioParser/datasets/object_support.py index 0af80971..e4e9e894 100644 --- a/AoE2ScenarioParser/datasets/object_support.py +++ b/AoE2ScenarioParser/datasets/object_support.py @@ -76,5 +76,8 @@ class Civilization(_DataSetIntEnums): ROMANS = 43 ARMENIANS = 44 GEORGIANS = 45 + ACHAEMENIDS = 46 + ATHENIANS = 47 + SPARTANS = 48 RANDOM = 65537 FULL_RANDOM = 65539 diff --git a/AoE2ScenarioParser/datasets/techs.py b/AoE2ScenarioParser/datasets/techs.py index 8c3e325d..df846759 100644 --- a/AoE2ScenarioParser/datasets/techs.py +++ b/AoE2ScenarioParser/datasets/techs.py @@ -1002,3 +1002,23 @@ def civilization_techs() -> List[TechInfo]: TECHNOLOGY_PLACEHOLDER_08 = 975, 107 TECHNOLOGY_PLACEHOLDER_09 = 976, 107 TECHNOLOGY_PLACEHOLDER_10 = 977, 107 + BLANK_TECHNOLOGY_0 = 1180, -1 + BLANK_TECHNOLOGY_1 = 1181, -1 + BLANK_TECHNOLOGY_2 = 1182, -1 + BLANK_TECHNOLOGY_3 = 1183, -1 + BLANK_TECHNOLOGY_4 = 1184, -1 + BLANK_TECHNOLOGY_5 = 1185, -1 + BLANK_TECHNOLOGY_6 = 1186, -1 + BLANK_TECHNOLOGY_7 = 1187, -1 + BLANK_TECHNOLOGY_8 = 1188, -1 + BLANK_TECHNOLOGY_9 = 1189, -1 + BLANK_TECHNOLOGY_10 = 1240, -1 + BLANK_TECHNOLOGY_11 = 1241, -1 + BLANK_TECHNOLOGY_12 = 1242, -1 + BLANK_TECHNOLOGY_13 = 1243, -1 + BLANK_TECHNOLOGY_14 = 1244, -1 + BLANK_TECHNOLOGY_15 = 1245, -1 + BLANK_TECHNOLOGY_16 = 1246, -1 + BLANK_TECHNOLOGY_17 = 1247, -1 + BLANK_TECHNOLOGY_18 = 1248, -1 + BLANK_TECHNOLOGY_19 = 1249, -1 diff --git a/AoE2ScenarioParser/datasets/trigger_lists/action_type.py b/AoE2ScenarioParser/datasets/trigger_lists/action_type.py index a954a66c..6fcd30fd 100644 --- a/AoE2ScenarioParser/datasets/trigger_lists/action_type.py +++ b/AoE2ScenarioParser/datasets/trigger_lists/action_type.py @@ -31,3 +31,7 @@ class ActionType(_DataSetIntEnums): PACK = 15 UNPACK = 16 ATTACK_MOVE = 17 + LINE_FORMATION = 18 + BOX_FORMATION = 19 + STAGGERED_FORMATION = 20 + FLANK_FORMATION = 21 diff --git a/AoE2ScenarioParser/objects/managers/trigger_manager.py b/AoE2ScenarioParser/objects/managers/trigger_manager.py index dcf228c5..4531dfb8 100644 --- a/AoE2ScenarioParser/objects/managers/trigger_manager.py +++ b/AoE2ScenarioParser/objects/managers/trigger_manager.py @@ -41,7 +41,7 @@ def __init__( ): super().__init__(**kwargs) - self.triggers: List[Trigger] = triggers + self.triggers = triggers self.trigger_display_order: List[int] = trigger_display_order self._trigger_hash = hash_list(triggers) @@ -51,12 +51,12 @@ def triggers(self) -> UuidList[Trigger]: return self._triggers @triggers.setter - def triggers(self, value: List[Trigger]) -> None: - value = UuidList(self._uuid, value, on_update_execute_entry=self._update_triggers_uuid) + def triggers(self, triggers: List[Trigger]) -> None: + triggers = UuidList(self._uuid, triggers, on_update_execute_entry=self._update_triggers_uuid) - self._trigger_hash = hash_list(value) - self._triggers = value - self.trigger_display_order = list(range(len(value))) + self._trigger_hash = hash_list(triggers) + self._triggers: UuidList[Trigger] = triggers + self.trigger_display_order = list(range(len(triggers))) def _update_triggers_uuid(self, trigger): """Function to update inner UUIDs """ diff --git a/AoE2ScenarioParser/objects/support/uuid_list.py b/AoE2ScenarioParser/objects/support/uuid_list.py index 08b83efe..bda87425 100644 --- a/AoE2ScenarioParser/objects/support/uuid_list.py +++ b/AoE2ScenarioParser/objects/support/uuid_list.py @@ -1,7 +1,7 @@ from __future__ import annotations from copy import deepcopy -from typing import Iterable, Sequence, TypeVar, List, Generic, Iterator +from typing import Iterable, Sequence, TypeVar, List, Generic, Iterator, overload from uuid import UUID from typing_extensions import SupportsIndex @@ -100,6 +100,16 @@ def reverse(self) -> None: def sort(self: List, *, key: None = ..., reverse: bool = ...) -> None: super().sort(key=key, reverse=reverse) + @overload + def __getitem__(self, __i: SupportsIndex) -> _T: ... + + @overload + def __getitem__(self, __s: slice) -> list[_T]: ... + + def __getitem__(self, __i): + """Only overwritten because Python Generics are... 'Interesting'""" + return super().__getitem__(__i) + def __setitem__(self, i: SupportsIndex, o: _T | Iterable[_T]) -> None: """ Set self[key] to value or set self[i:j] to slice. diff --git a/CHANGELOG.md b/CHANGELOG.md index 06b87413..58e10a7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 --- +## 0.2.12 - 2024-November-16 + +### Added + +- Support for the new civilizations -- Credits: [mardaravicius](https://github.com/KSneijders/AoE2ScenarioParser/pull/52) + - `Civilization.ACHAEMENIDS = 46` + - `Civilization.ATHENIANS = 47` + - `Civilization.SPARTANS = 48` +- Support for the new blank technologies -- Credits: [mardaravicius](https://github.com/KSneijders/AoE2ScenarioParser/pull/52) + - `TechInfo.BLANK_TECHNOLOGY_0` to `TechInfo.BLANK_TECHNOLOGY_19` +- Support for the new action types -- Credits: [mardaravicius](https://github.com/KSneijders/AoE2ScenarioParser/pull/52) + - `ActionType.LINE_FORMATION` = 18 + - `ActionType.BOX_FORMATION` = 19 + - `ActionType.STAGGERED_FORMATION` = 20 + - `ActionType.FLANK_FORMATION` = 21 + +### Improved + +- Type hinting for triggers and some other object lists + +--- + ## 0.2.11 - 2024-November-02 ### Fixed