Skip to content

icecap.domain.dto

Data transfer objects for the application.

This module contains data structures used to transfer data between different parts of the application.

Classes:

  • GameObjectFields

    Data class representing the fields of a game object.

  • Position

    Data class representing a 3D position with rotation.

  • UnitFields

    Data class representing the fields of a unit.

GameObjectFields dataclass

GameObjectFields(entry_id: int, display_id: int, owner_guid: int, state: int)

Data class representing the fields of a game object.

Important note: The DTO does not contain all fields of the game object. For ah exhaustive list of available data, please refer to the C structs definitions in the infrastructure layer.

Attributes:

display_id instance-attribute

display_id: int

The display ID of the game object.

It is used to determine the visual representation of the game object.

entry_id instance-attribute

entry_id: int

The entry ID of the game object.

It indicates the game which template to use when placing the object in the world.

owner_guid instance-attribute

owner_guid: int

The GUID of the owner of the game object.

state instance-attribute

state: int

The state of the game object.

For example, it can be used to check if a bobber is bobbing or not.

Position dataclass

Position(x: float, y: float, z: float, rotation: float)

Data class representing a 3D position with rotation.

Attributes:

  • rotation (float) –

    The rotation angle in radians (0-2pi).

  • x (float) –

    The x-coordinate of the position.

  • y (float) –

    The y-coordinate of the position.

  • z (float) –

    The z-coordinate of the position.

rotation instance-attribute

rotation: float

The rotation angle in radians (0-2pi).

x instance-attribute

x: float

The x-coordinate of the position.

y instance-attribute

y: float

The y-coordinate of the position.

z instance-attribute

z: float

The z-coordinate of the position.

get_distance_to

get_distance_to(other: Position) -> float

Calculates the distance to another position.

Source code in icecap/domain/dto/position.py
def get_distance_to(self, other: "Position") -> float:
    """Calculates the distance to another position."""
    return ((self.x - other.x) ** 2 + (self.y - other.y) ** 2 + (self.z - other.z) ** 2) ** 0.5

UnitFields dataclass

UnitFields(
    level: int,
    hit_points: int,
    max_hit_points: int,
    faction: Faction | None = None,
    player_class: PlayerClass | None = None,
    race: Race | None = None,
    gender: Gender | None = None,
)

Data class representing the fields of a unit.

This object is shared between players and units.

Attributes:

faction class-attribute instance-attribute

faction: Faction | None = None

The faction of the unit, if applicable.

gender class-attribute instance-attribute

gender: Gender | None = None

The gender of the unit, if applicable.

hit_points instance-attribute

hit_points: int

The current hit points of the unit.

level instance-attribute

level: int

The level of the unit.

max_hit_points instance-attribute

max_hit_points: int

The maximum hit points of the unit.

player_class class-attribute instance-attribute

player_class: PlayerClass | None = None

The class of the player, if applicable.

race class-attribute instance-attribute

race: Race | None = None

The race of the unit, if applicable.