Skip to content

AoE2DEScenario

Attributes

Classes

AoE2DEScenario

Bases: AoE2Scenario

Used to represent a scenario with version >= 1.36 (DE). It is the main class that is exposed to the user of the API.

Source code in AoE2ScenarioParser/scenarios/aoe2_de_scenario.py
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
class AoE2DEScenario(AoE2Scenario):
    """
    Used to represent a scenario with version >= 1.36 (DE). It is the main class that is exposed to the user of the API.
    """

    @property
    def trigger_manager(self) -> TriggerManagerDE:
        """The trigger manager of the scenario"""
        return self._object_manager.managers['Trigger']

    @property
    def unit_manager(self) -> UnitManagerDE:
        """The unit manager of the scenario"""
        return self._object_manager.managers['Unit']

    @property
    def map_manager(self) -> MapManagerDE:
        """The map manager of the scenario"""
        return self._object_manager.managers['Map']

    @property
    def xs_manager(self) -> XsManagerDE:
        """The XS manager of the scenario"""
        return self._object_manager.managers['Xs']

    @property
    def player_manager(self) -> PlayerManager:
        """The player manager of the scenario"""
        return self._object_manager.managers['Player']

    @property
    def message_manager(self) -> MessageManager:
        return self._object_manager.managers['Message']

    @property
    def option_manager(self) -> OptionManager:
        return self._object_manager.managers['Option']

    @classmethod
    def from_file(cls: Type[S], path: str, game_version: str = "DE", name: str = "") -> S:
        """
        Creates and returns an instance of the AoE2DEScenario class from the given scenario file

        Args:
            path: The path to the scenario file to create the object from
            game_version: The version of the game to create the object for
            name: The name given to this scenario (defaults to the filename without extension)

        Returns:
            An instance of the AoE2DEScenario class which is the object representation of the given scenario file
        """
        return super().from_file(path=path, game_version=game_version, name=name)

Attributes

map_manager: MapManagerDE property
Type: MapManagerDE

The map manager of the scenario

message_manager: MessageManager property
Type: MessageManager
option_manager: OptionManager property
Type: OptionManager
player_manager: PlayerManager property
Type: PlayerManager

The player manager of the scenario

trigger_manager: TriggerManagerDE property
Type: TriggerManagerDE

The trigger manager of the scenario

unit_manager: UnitManagerDE property
Type: UnitManagerDE

The unit manager of the scenario

xs_manager: XsManagerDE property
Type: XsManagerDE

The XS manager of the scenario

Functions


def from_file(...) classmethod

Creates and returns an instance of the AoE2DEScenario class from the given scenario file

Parameters:

Name Type Description Default
path str

The path to the scenario file to create the object from

required
game_version str

The version of the game to create the object for

'DE'
name str

The name given to this scenario (defaults to the filename without extension)

''

Returns:

Type Description
S

An instance of the AoE2DEScenario class which is the object representation of the given scenario file

Source code in AoE2ScenarioParser/scenarios/aoe2_de_scenario.py
53
54
55
56
57
58
59
60
61
62
63
64
65
66
@classmethod
def from_file(cls: Type[S], path: str, game_version: str = "DE", name: str = "") -> S:
    """
    Creates and returns an instance of the AoE2DEScenario class from the given scenario file

    Args:
        path: The path to the scenario file to create the object from
        game_version: The version of the game to create the object for
        name: The name given to this scenario (defaults to the filename without extension)

    Returns:
        An instance of the AoE2DEScenario class which is the object representation of the given scenario file
    """
    return super().from_file(path=path, game_version=game_version, name=name)