Skip to content

PlayerId

Bases: IntEnum

This enum class provides the integer values used to reference each player in the game. Use these over specifying player number directly to improve code readability

Source code in AoE2ScenarioParser/datasets/players.py
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
class PlayerId(IntEnum):
    """
    This enum class provides the integer values used to reference each player in the game. Use these over specifying
    player number directly to improve code readability
    """

    @staticmethod
    def all(exclude_gaia: bool = False) -> List[PlayerId]:
        """
        Return a list of all players

        Args:
            exclude_gaia: if the GAIA player should be excluded from the list or not

        Returns:
            The list of playerIds
        """
        return ([] if exclude_gaia else [PlayerId.GAIA]) + [
            PlayerId.ONE, PlayerId.TWO, PlayerId.THREE, PlayerId.FOUR,
            PlayerId.FIVE, PlayerId.SIX, PlayerId.SEVEN, PlayerId.EIGHT
        ]

    GAIA = 0
    ONE = 1
    TWO = 2
    THREE = 3
    FOUR = 4
    FIVE = 5
    SIX = 6
    SEVEN = 7
    EIGHT = 8

Attributes

GAIA = 0 class-attribute instance-attribute

Value: 0

ONE = 1 class-attribute instance-attribute

Value: 1

TWO = 2 class-attribute instance-attribute

Value: 2

THREE = 3 class-attribute instance-attribute

Value: 3

FOUR = 4 class-attribute instance-attribute

Value: 4

FIVE = 5 class-attribute instance-attribute

Value: 5

SIX = 6 class-attribute instance-attribute

Value: 6

SEVEN = 7 class-attribute instance-attribute

Value: 7

EIGHT = 8 class-attribute instance-attribute

Value: 8

Functions


def all(...) staticmethod

Return a list of all players

Parameters:

Name Type Description Default
exclude_gaia bool

if the GAIA player should be excluded from the list or not

False

Returns:

Type Description
List[PlayerId]

The list of playerIds

Source code in AoE2ScenarioParser/datasets/players.py
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
@staticmethod
def all(exclude_gaia: bool = False) -> List[PlayerId]:
    """
    Return a list of all players

    Args:
        exclude_gaia: if the GAIA player should be excluded from the list or not

    Returns:
        The list of playerIds
    """
    return ([] if exclude_gaia else [PlayerId.GAIA]) + [
        PlayerId.ONE, PlayerId.TWO, PlayerId.THREE, PlayerId.FOUR,
        PlayerId.FIVE, PlayerId.SIX, PlayerId.SEVEN, PlayerId.EIGHT
    ]