Skip to content

enums

enums

CoinType

CoinType(description: str, exchange_rate: float)

Bases: Enum

value_in_gold staticmethod

value_in_gold(coin_amounts: dict) -> int

Calculate the combined value in gold pieces based on the coin amounts, rounded up to the nearest integer.

Parameters:

  • coin_amounts (dict) –

    A dictionary with CoinType as key and quantity of that type as value.

Returns:

  • int ( int ) –

    The total value in gold pieces, rounded up to the nearest integer.

Examples:

>>> CoinType.value_in_gold({CoinType.COPPER: 1000, CoinType.SILVER: 100})
20
>>> CoinType.value_in_gold({CoinType.GOLD: 100})
100
>>> coin_type_string = CoinType.GOLD.name
>>> coins = {CoinType[coin_type_string]: 100}
>>> CoinType.value_in_gold(coins)
100

TreasureType

Bases: Enum

Specifies the type of treasure in a treasure haul the party might be awarded.