Module genshin.models.zzz.chronicle.gacha

ZZZ chronicle gacha info models.

Classes

class ZZZGachaBannerInfo (**data: Any)
Expand source code
class ZZZGachaBannerInfo(APIModel):
    """ZZZ gacha banner info model."""

    type: ZZZGachaEventType = Aliased("gacha_type")
    pity: int = Aliased("more_s_need_cnt")
    """Number of pulls needed until guaranteed S."""

ZZZ gacha banner info model.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Ancestors

Class variables

var model_config : pydantic.config.ConfigDict
var pity : int

Number of pulls needed until guaranteed S.

var type : ZZZGachaEventType
class ZZZGachaCurrencies (**data: Any)
Expand source code
class ZZZGachaCurrencies(APIModel):
    """ZZZ gacha currency counts."""

    monochrome: int
    polychrome: int
    encrypted_master_tape: int
    master_tape: int
    boopon: int

ZZZ gacha currency counts.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Ancestors

Class variables

var boopon : int
var encrypted_master_tape : int
var master_tape : int
var model_config : pydantic.config.ConfigDict
var monochrome : int
var polychrome : int
class ZZZGachaInfo (**data: Any)
Expand source code
class ZZZGachaInfo(APIModel):
    """ZZZ gacha info model."""

    currencies: ZZZGachaCurrencies
    banners: list[ZZZGachaBannerInfo] = Aliased("gacha_info_list")

    @pydantic.model_validator(mode="before")
    @classmethod
    def __convert_currencies(cls, data: dict[str, typing.Any]) -> dict[str, typing.Any]:
        currency_mapping = {
            "GACHA_TICKET_TYPE_RECHARGE_MONOCHROME": "monochrome",
            "GACHA_TICKET_TYPE_POLYCHROME": "polychrome",
            "GACHA_TICKET_TYPE_ENCRYPTED_MASTER_TAPE": "encrypted_master_tape",
            "GACHA_TICKET_TYPE_MASTER_TAPE": "master_tape",
            "GACHA_TICKET_TYPE_BOOPON": "boopon",
        }

        tickets = data.get("tickets", [])
        converted_currencies = {
            currency_mapping[ticket["ticket_type"]]: ticket["ticket_cnt"]
            for ticket in tickets
            if ticket["ticket_type"] in currency_mapping
        }
        data["currencies"] = converted_currencies
        return data

ZZZ gacha info model.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Ancestors

Class variables

var banners : list[ZZZGachaBannerInfo]
var currencies : ZZZGachaCurrencies
var model_config : pydantic.config.ConfigDict