Skip to content

icecap.domain.models

This module contains models that represent various game entities. All models are read-only and represent the state of the game at a specific point in time.

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

Classes:

  • Entity

    Minimal lightweight representation of an object in the game.

  • GameObject

    Representation of a game object.

  • Player

    Representation of a player in the game.

  • Unit

    Representation of a non-player unit in the game.

Entity dataclass

Entity(guid: int, object_address: int, entity_type: EntityType)

Minimal lightweight representation of an object in the game.

This class serves as the base for all entity types and can be used for more detailed querying of the game state.

Attributes:

entity_type instance-attribute

entity_type: EntityType

Entity type of the object.

This is used to differentiate between different types of entities in the game.

guid instance-attribute

guid: int

Global unique identifier of the entity.

For players, this changes each time the player enters the world.

object_address instance-attribute

object_address: int

Memory address of the object in the game.

GameObject dataclass

GameObject(
    guid: int,
    object_address: int,
    entity_type: EntityType,
    position: Position,
    name: str,
    game_object_fields: GameObjectFields,
)

Bases: Entity

Representation of a game object.

Game objects are entities in the world that can be interacted with, manipulated, or observed.

Attributes:

entity_type instance-attribute

entity_type: EntityType

Entity type of the object.

This is used to differentiate between different types of entities in the game.

game_object_fields instance-attribute

game_object_fields: GameObjectFields

Fields specific to the game object.

guid instance-attribute

guid: int

Global unique identifier of the entity.

For players, this changes each time the player enters the world.

name instance-attribute

name: str

Human-readable name of the game object.

object_address instance-attribute

object_address: int

Memory address of the object in the game.

position instance-attribute

position: Position

The position of the game object in the world.

Player dataclass

Player(
    guid: int,
    object_address: int,
    entity_type: EntityType,
    position: Position,
    name: str,
    unit_fields: UnitFields,
)

Bases: Entity

Representation of a player in the game.

Methods:

  • is_enemy

    Determines if the other player is an enemy.

Attributes:

entity_type instance-attribute

entity_type: EntityType

Entity type of the object.

This is used to differentiate between different types of entities in the game.

guid instance-attribute

guid: int

Global unique identifier of the entity.

For players, this changes each time the player enters the world.

name instance-attribute

name: str

The name of the player.

object_address instance-attribute

object_address: int

Memory address of the object in the game.

position instance-attribute

position: Position

The position of the player in the world.

unit_fields instance-attribute

unit_fields: UnitFields

Fields specific to the player.

is_enemy

is_enemy(other: Player) -> bool

Determines if the other player is an enemy.

Source code in icecap/domain/models/player.py
def is_enemy(self, other: "Player") -> bool:
    """Determines if the other player is an enemy."""
    return self.unit_fields.faction != other.unit_fields.faction

Unit dataclass

Unit(
    guid: int,
    object_address: int,
    entity_type: EntityType,
    position: Position,
    name: str,
    unit_fields: UnitFields,
)

Bases: Entity

Representation of a non-player unit in the game.

Attributes:

entity_type instance-attribute

entity_type: EntityType

Entity type of the object.

This is used to differentiate between different types of entities in the game.

guid instance-attribute

guid: int

Global unique identifier of the entity.

For players, this changes each time the player enters the world.

name instance-attribute

name: str

The name of the unit, typically a creature or NPC.

object_address instance-attribute

object_address: int

Memory address of the object in the game.

position instance-attribute

position: Position

The position of the unit in the world.

unit_fields instance-attribute

unit_fields: UnitFields

Fields specific to the unit.