icecap.infrastructure.repository
This module provides repository classes for accessing different types of game entities.
The repositories abstract the data access layer and provide a clean interface for retrieving and manipulating game entities.
Classes:
-
GameObjectRepository
–Repository for game object entities.
-
PlayerRepository
–Repository for player entities.
-
UnitRepository
–Repository for unit entities.
GameObjectRepository
GameObjectRepository(driver: GameDriver)
Repository for game object entities.
This class provides methods to access game object entities in the game.
Source code in icecap/infrastructure/repository/game_object_repository.py
get_game_object_from_entity
get_game_object_from_entity(
entity: Entity,
object_manager: ObjectManager | None = None,
name_resolver: NameResolver | None = None,
) -> GameObject
Extends an Entity object to a GameObject instance.
This method takes an Entity object, extracts all the necessary information and creates a GameObject object from it.
You can bring your own name resolver and object manager.
Source code in icecap/infrastructure/repository/game_object_repository.py
refresh_game_object
refresh_game_object(game_object: GameObject) -> GameObject
Refresh the game object data with the latest information from the game.
This method retrieves the latest data for a game object from the game and returns a new GameObject instance with the updated data. The original GameObject instance is not modified.
Source code in icecap/infrastructure/repository/game_object_repository.py
yield_game_objects
yield_game_objects() -> Generator[GameObject, None, None]
Yield all game object entities around the local player.
This method iterates through all objects around the player and yields only those that are of type GAME_OBJECT. Each entity is extended to a GameObject object before being yielded.
Source code in icecap/infrastructure/repository/game_object_repository.py
PlayerRepository
PlayerRepository(driver: GameDriver)
Repository for player entities.
This class provides methods to access player entities in the game.
Source code in icecap/infrastructure/repository/player_repository.py
get_local_player
get_local_player() -> Player
Retrieve the local player entity (the user's character).
It uses the object manager to get the local player's GUID and then searches for the corresponding entity.
Source code in icecap/infrastructure/repository/player_repository.py
get_player_from_entity
get_player_from_entity(
entity: Entity,
object_manager: ObjectManager | None = None,
name_resolver: NameResolver | None = None,
) -> Player
Extend an Entity object to a Player object.
This method takes an Entity object and extracts all the necessary information to create a Player object.
Source code in icecap/infrastructure/repository/player_repository.py
refresh_player
Refresh the player data with the latest information from the game.
This method retrieves the latest data for a player from the game and returns a new Player instance with the updated data. The original Player instance is not modified.
Source code in icecap/infrastructure/repository/player_repository.py
yield_players
Yield all player entities around the local player.
This method iterates through all objects around the local player and yields only those that are of type PLAYER. Each entity is extended to a Player object before being yielded.
Source code in icecap/infrastructure/repository/player_repository.py
UnitRepository
UnitRepository(driver: GameDriver)
Repository for unit entities.
This class provides methods to access unit entities in the game.
Source code in icecap/infrastructure/repository/unit_repository.py
get_unit_from_entity
get_unit_from_entity(
entity: Entity,
object_manager: ObjectManager | None = None,
name_resolver: NameResolver | None = None,
) -> Unit
Extend an Entity object to a Unit object.
This method takes an Entity object and extracts all the necessary information and creates a Unit object from it.
Source code in icecap/infrastructure/repository/unit_repository.py
refresh_unit
Refresh the unit data with the latest information from the game.
This method retrieves the latest data for a unit from the game and returns a new Unit instance with the updated data. The original Unit instance is not modified.
Source code in icecap/infrastructure/repository/unit_repository.py
yield_units
Yield all unit entities around the player.
This method iterates through all objects around the player and yields only those that are of type UNIT. Each entity is extended to a Unit object before being yielded.