Developer Interface

class api.Game(*args, **kwargs)
register_game_begin_listener(game_begin_listener)

Register a listener to be notified when the game begins.

The registered listener will be called when the game begins, such as when a saved game is loaded or when the game editor starts, etc.

Parameters:

game_begin_listener (callable) – A callable object, such as a function or method, to be notified when the game begins.

Example:

game = Game()

def game_begin_listener():

game.show_message(“hello,”, “world”)

game.register_game_begin_listener(game_begin_listener)

show_message(message)

Display a message in the chat.

This method allows the game to show a message in the chat

Parameters:

message (str) – The content of the message.

Example:

game.show_message(“hello, world”)

class api.Lord(lord_id)

Represents a lord with a unique identifier.

Parameters:

lord_id (int) – The identifier for the lord.

Raises:

LordDoesNotExistException – If the lord with the given ID does not exist.

count_ales()

Count the amount of ales owned by the lord.

Returns:

The count of ales.

Return type:

int

count_apples()

Count the amount of apples owned by the lord.

Returns:

The count of apples.

Return type:

int

count_bows()

Count the amount of bows owned by the lord.

Returns:

The count of bows.

Return type:

int

count_breads()

Count the amount of breads owned by the lord.

Returns:

The count of breads.

Return type:

int

count_cheeses()

Count the amount of cheeses owned by the lord.

Returns:

The count of cheeses.

Return type:

int

count_crossbows()

Count the amount of crossbows owned by the lord.

Returns:

The count of crossbows.

Return type:

int

count_flours()

Count the amount of flours owned by the lord.

Returns:

The count of flours.

Return type:

int

count_golds()

Count the amount of golds owned by the lord.

Returns:

The count of golds.

Return type:

int

count_good(good_type: GoodType) int

Get the amount of a specific type of good owned by the lord. :param good_type: The type of the good. :type good_type: GoodType :return: The amount of the specified good. :rtype int

count_hops()

Count the amount of hops owned by the lord.

Returns:

The count of hops.

Return type:

int

count_irons()

Count the amount of irons owned by the lord.

Returns:

The count of irons.

Return type:

int

count_leather_armor()

Count the amount of leather armor owned by the lord.

Returns:

The count of leather_armor.

Return type:

int

count_maces()

Count the amount of maces owned by the lord.

Returns:

The count of maces.

Return type:

int

count_meats()

Count the amount of meats owned by the lord.

Returns:

The count of meats.

Return type:

int

count_metal_armor()

Count the amount of metal armor owned by the lord.

Returns:

The count of metal armor.

Return type:

int

count_pikes()

Count the amount of pikes owned by the lord.

Returns:

The count of pikes.

Return type:

int

count_pitches()

Count the amount of pitches owned by the lord.

Returns:

The count of pitches.

Return type:

int

count_spears()

Count the amount of spears owned by the lord.

Returns:

The count of spears.

Return type:

int

count_stones()

Count the amount of stones owned by the lord.

Returns:

The count of stones.

Return type:

int

count_wheats()

Count the amount of wheats owned by the lord.

Returns:

The count of wheats.

Return type:

int

count_woods()

Count the amount of woods owned by the lord.

Returns:

The count of woods.

Return type:

int

get_id()

Get the identifier of the lord.

Returns:

The identifier of the lord.

Return type:

int

class api.Building(building_id, index=None)
class api.Unit(unit_id, index)