Module genshin.models.zzz.chronicle.challenge

Classes

class ShiyuDefense (**data: Any)

ZZZ Shiyu Defense 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.

Expand source code
class ShiyuDefense(APIModel):
    """ZZZ Shiyu Defense model."""

    schedule_id: int
    begin_time: typing.Optional[DateTimeField] = Aliased("hadal_begin_time")
    end_time: typing.Optional[DateTimeField] = Aliased("hadal_end_time")
    has_data: bool
    ratings: typing.Mapping[typing.Literal["S", "A", "B"], int] = Aliased("rating_list")
    floors: list[ShiyuDefenseFloor] = Aliased("all_floor_detail")
    fastest_clear_time: int = Aliased("fast_layer_time")
    """Fastest clear time this season in seconds."""
    max_floor: int = Aliased("max_layer")

    @pydantic.field_validator("begin_time", "end_time", mode="before")
    @classmethod
    def __parse_datetime(cls, value: typing.Mapping[str, typing.Any]) -> typing.Optional[DateTimeField]:
        if value:
            return datetime.datetime(**value)
        return None

    @pydantic.field_validator("ratings", mode="before")
    @classmethod
    def __convert_ratings(
        cls, v: list[dict[typing.Literal["times", "rating"], typing.Any]]
    ) -> typing.Mapping[typing.Literal["S", "A", "B"], int]:
        return {d["rating"]: d["times"] for d in v}

Ancestors

Class variables

var begin_time : Optional[datetime.datetime]
var end_time : Optional[datetime.datetime]
var fastest_clear_time : int

Fastest clear time this season in seconds.

var floors : list[ShiyuDefenseFloor]
var has_data : bool
var max_floor : int
var model_computed_fields
var model_config : pydantic.config.ConfigDict
var model_fields
var ratings : Mapping[Literal['S', 'A', 'B'], int]
var schedule_id : int
class ShiyuDefenseBangboo (**data: Any)

Shiyu Defense bangboo 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.

Expand source code
class ShiyuDefenseBangboo(APIModel):
    """Shiyu Defense bangboo model."""

    id: int
    rarity: typing.Literal["S", "A"]
    level: int

    @property
    def icon(self) -> str:
        return f"https://act-webstatic.hoyoverse.com/game_record/zzz/bangboo_square_avatar/bangboo_square_avatar_{self.id}.png"

Ancestors

Class variables

var id : int
var level : int
var model_computed_fields
var model_config : pydantic.config.ConfigDict
var model_fields
var rarity : Literal['S', 'A']

Instance variables

prop icon : str
Expand source code
@property
def icon(self) -> str:
    return f"https://act-webstatic.hoyoverse.com/game_record/zzz/bangboo_square_avatar/bangboo_square_avatar_{self.id}.png"
class ShiyuDefenseBuff (**data: Any)

Shiyu Defense buff 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.

Expand source code
class ShiyuDefenseBuff(APIModel):
    """Shiyu Defense buff model."""

    name: str = Aliased("title")
    description: str = Aliased("text")

Ancestors

Class variables

var description : str
var model_computed_fields
var model_config : pydantic.config.ConfigDict
var model_fields
var name : str
class ShiyuDefenseCharacter (**data: Any)

Shiyu Defense character 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.

Expand source code
class ShiyuDefenseCharacter(APIModel):
    """Shiyu Defense character model."""

    id: int
    level: int
    rarity: typing.Literal["S", "A"]
    element: ZZZElementType = Aliased("element_type")

    @property
    def icon(self) -> str:
        return (
            f"https://act-webstatic.hoyoverse.com/game_record/zzz/role_square_avatar/role_square_avatar_{self.id}.png"
        )

Ancestors

Class variables

var elementZZZElementType
var id : int
var level : int
var model_computed_fields
var model_config : pydantic.config.ConfigDict
var model_fields
var rarity : Literal['S', 'A']

Instance variables

prop icon : str
Expand source code
@property
def icon(self) -> str:
    return (
        f"https://act-webstatic.hoyoverse.com/game_record/zzz/role_square_avatar/role_square_avatar_{self.id}.png"
    )
class ShiyuDefenseFloor (**data: Any)

Shiyu Defense floor 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.

Expand source code
class ShiyuDefenseFloor(APIModel):
    """Shiyu Defense floor model."""

    index: int = Aliased("layer_index")
    rating: typing.Literal["S", "A", "B"]
    id: int = Aliased("layer_id")
    buffs: list[ShiyuDefenseBuff]
    node_1: ShiyuDefenseNode
    node_2: ShiyuDefenseNode
    challenge_time: DateTimeField = Aliased("floor_challenge_time")
    name: str = Aliased("zone_name")

    @pydantic.field_validator("challenge_time", mode="before")
    @classmethod
    def __parse_datetime(cls, value: typing.Mapping[str, typing.Any]) -> typing.Optional[DateTimeField]:
        if value:
            return datetime.datetime(**value)
        return None

Ancestors

Class variables

var buffs : list[ShiyuDefenseBuff]
var challenge_time : datetime.datetime
var id : int
var index : int
var model_computed_fields
var model_config : pydantic.config.ConfigDict
var model_fields
var name : str
var node_1ShiyuDefenseNode
var node_2ShiyuDefenseNode
var rating : Literal['B', 'A', 'S']
class ShiyuDefenseMonster (**data: Any)

Shiyu Defense monster 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.

Expand source code
class ShiyuDefenseMonster(APIModel):
    """Shiyu Defense monster model."""

    id: int
    name: str
    weakness: typing.Union[ZZZElementType, int] = Aliased("weak_element_type")
    level: int

    @pydantic.field_validator("weakness", mode="before")
    def __convert_weakness(cls, v: int) -> typing.Union[ZZZElementType, int]:
        try:
            return ZZZElementType(v)
        except ValueError:
            return v

Ancestors

Class variables

var id : int
var level : int
var model_computed_fields
var model_config : pydantic.config.ConfigDict
var model_fields
var name : str
var weakness : Union[ZZZElementType, int]
class ShiyuDefenseNode (**data: Any)

Shiyu Defense node 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.

Expand source code
class ShiyuDefenseNode(APIModel):
    """Shiyu Defense node model."""

    characters: list[ShiyuDefenseCharacter] = Aliased("avatars")
    bangboo: ShiyuDefenseBangboo = Aliased("buddy")
    recommended_elements: list[ZZZElementType] = Aliased("element_type_list")
    enemies: list[ShiyuDefenseMonster] = Aliased("monster_info")

    @pydantic.field_validator("enemies", mode="before")
    @classmethod
    def __convert_enemies(cls, value: dict[typing.Literal["level", "list"], typing.Any]) -> list[ShiyuDefenseMonster]:
        level = value["level"]
        result: list[ShiyuDefenseMonster] = []
        for monster in value["list"]:
            monster["level"] = level
            result.append(ShiyuDefenseMonster(**monster))
        return result

Ancestors

Class variables

var bangbooShiyuDefenseBangboo
var characters : list[ShiyuDefenseCharacter]
var enemies : list[ShiyuDefenseMonster]
var model_computed_fields
var model_config : pydantic.config.ConfigDict
var model_fields
var recommended_elements : list[ZZZElementType]