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
14
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
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']

    @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

Attribute Type
map_manager property
MapManagerDE

The map manager of the scenario

Source code in AoE2ScenarioParser/scenarios/aoe2_de_scenario.py
30
31
32
def map_manager(self) -> MapManagerDE:
    """The map manager of the scenario"""
    return self._object_manager.managers['Map']
message_manager property
MessageManager
Source code in AoE2ScenarioParser/scenarios/aoe2_de_scenario.py
45
46
def message_manager(self) -> MessageManager:
    return self._object_manager.managers['Message']
player_manager property
PlayerManager

The player manager of the scenario

Source code in AoE2ScenarioParser/scenarios/aoe2_de_scenario.py
40
41
42
def player_manager(self) -> PlayerManager:
    """The player manager of the scenario"""
    return self._object_manager.managers['Player']
trigger_manager property
TriggerManagerDE

The trigger manager of the scenario

Source code in AoE2ScenarioParser/scenarios/aoe2_de_scenario.py
20
21
22
def trigger_manager(self) -> TriggerManagerDE:
    """The trigger manager of the scenario"""
    return self._object_manager.managers['Trigger']
unit_manager property
UnitManagerDE

The unit manager of the scenario

Source code in AoE2ScenarioParser/scenarios/aoe2_de_scenario.py
25
26
27
def unit_manager(self) -> UnitManagerDE:
    """The unit manager of the scenario"""
    return self._object_manager.managers['Unit']
xs_manager property
XsManagerDE

The XS manager of the scenario

Source code in AoE2ScenarioParser/scenarios/aoe2_de_scenario.py
35
36
37
def xs_manager(self) -> XsManagerDE:
    """The XS manager of the scenario"""
    return self._object_manager.managers['Xs']

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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
@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)