Module genshin.models.zzz.chronicle.challenge

Classes

class ChallengeBangboo (**data: Any)
Expand source code
class ChallengeBangboo(ShiyuDefenseBangboo):
    """Bangboo model for backward compatibility."""

Bangboo model for backward compatibility.

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 icon : str
var id : int
var level : int
var model_config : pydantic.config.ConfigDict
var rarity : Literal['S', 'A']
class DeadlyAssault (**data: Any)
Expand source code
class DeadlyAssault(APIModel):
    """ZZZ Deadly Assault model."""

    id: int = Aliased("zone_id")
    start_time: typing.Optional[DateTime]
    end_time: typing.Optional[DateTime]

    challenges: typing.Sequence[DeadlyAssaultChallenge] = Aliased("list")
    has_data: bool
    total_score: int
    total_star: int
    rank_percent: str

    nickname: str = Aliased("nick_name")
    player_avatar: str = Aliased("avatar_icon")

    @pydantic.field_validator("rank_percent", mode="before")
    def __parse_rank_percent(cls, value: int) -> str:
        return f"{value / 100}%"

ZZZ Deadly Assault 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 challenges : Sequence[DeadlyAssaultChallenge]
var end_time : datetime.datetime | None
var has_data : bool
var id : int
var model_config : pydantic.config.ConfigDict
var nickname : str
var player_avatar : str
var rank_percent : str
var start_time : datetime.datetime | None
var total_score : int
var total_star : int
class DeadlyAssaultAgent (**data: Any)
Expand source code
class DeadlyAssaultAgent(APIModel):
    """ZZZ Deadly Assault agent model."""

    id: int
    level: int
    element: ZZZElementType = Aliased("element_type")
    specialty: ZZZSpecialty = Aliased("avatar_profession")
    rarity: typing.Literal["S", "A"]
    mindscape: int = Aliased("rank")
    icon: str = Aliased("role_square_url")

ZZZ Deadly Assault agent 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 elementZZZElementType
var icon : str
var id : int
var level : int
var mindscape : int
var model_config : pydantic.config.ConfigDict
var rarity : Literal['S', 'A']
var specialtyZZZSpecialty
class DeadlyAssaultBoss (**data: Any)
Expand source code
class DeadlyAssaultBoss(APIModel):
    """ZZZ Deadly Assault boss."""

    icon: str
    name: str
    background: str = Aliased("bg_icon")
    badge_icon: str = Aliased("race_icon")

ZZZ Deadly Assault boss.

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 background : str
var badge_icon : str
var icon : str
var model_config : pydantic.config.ConfigDict
var name : str
class DeadlyAssaultBuff (**data: Any)
Expand source code
class DeadlyAssaultBuff(APIModel):
    """ZZZ Deadly Assault buff model."""

    name: str
    description: str = Aliased("desc")
    icon: str

ZZZ Deadly Assault 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.

Ancestors

Class variables

var description : str
var icon : str
var model_config : pydantic.config.ConfigDict
var name : str
class DeadlyAssaultChallenge (**data: Any)
Expand source code
class DeadlyAssaultChallenge(APIModel):
    """ZZZ Deadly Assault challenge model."""

    score: int
    star: int
    total_star: int
    challenge_time: datetime.datetime

    boss: DeadlyAssaultBoss
    buffs: typing.Sequence[DeadlyAssaultBuff] = Aliased("buffer")
    agents: typing.Sequence[DeadlyAssaultAgent] = Aliased("avatar_list")
    bangboo: typing.Optional[ShiyuDefenseBangboo] = Aliased("buddy", default=None)

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

    @pydantic.field_validator("boss", mode="before")
    def __parse_boss(cls, value: typing.List[typing.Mapping[str, typing.Any]]) -> DeadlyAssaultBoss:
        if not value:
            raise ValueError("No boss data provided.")
        return DeadlyAssaultBoss(**value[0])

ZZZ Deadly Assault challenge 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 agents : Sequence[DeadlyAssaultAgent]
var bangbooShiyuDefenseBangboo | None
var bossDeadlyAssaultBoss
var buffs : Sequence[DeadlyAssaultBuff]
var challenge_time : datetime.datetime
var model_config : pydantic.config.ConfigDict
var score : int
var star : int
var total_star : int
class ShiyuDefense (**data: Any)
Expand source code
class ShiyuDefense(APIModel):
    """ZZZ Shiyu Defense model."""

    schedule_id: int
    begin_time: typing.Optional[TZDateTime] = Aliased("hadal_begin_time")
    end_time: typing.Optional[TZDateTime] = 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[TZDateTime]:
        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}

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.

Ancestors

Class variables

var begin_time : datetime.datetime | None
var end_time : datetime.datetime | None
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_config : pydantic.config.ConfigDict
var ratings : Mapping[Literal['S', 'A', 'B'], int]
var schedule_id : int
class ShiyuDefenseBangboo (**data: Any)
Expand source code
class ShiyuDefenseBangboo(APIModel):
    """Shiyu Defense bangboo model."""

    id: int
    rarity: typing.Literal["S", "A"]
    level: int
    icon: str = Aliased("bangboo_rectangle_url")

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.

Ancestors

Subclasses

Class variables

var icon : str
var id : int
var level : int
var model_config : pydantic.config.ConfigDict
var rarity : Literal['S', 'A']
class ShiyuDefenseBuff (**data: Any)
Expand source code
class ShiyuDefenseBuff(APIModel):
    """Shiyu Defense buff model."""

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

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.

Ancestors

Class variables

var description : str
var model_config : pydantic.config.ConfigDict
var name : str
class ShiyuDefenseCharacter (**data: Any)
Expand source code
class ShiyuDefenseCharacter(APIModel):
    """Shiyu Defense character model."""

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

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.

Ancestors

Class variables

var elementZZZElementType
var icon : str
var id : int
var level : int
var mindscape : int
var model_config : pydantic.config.ConfigDict
var rarity : Literal['S', 'A']
class ShiyuDefenseFloor (**data: Any)
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: TZDateTime = 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[TZDateTime]:
        if value:
            return datetime.datetime(**value)
        return None

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.

Ancestors

Class variables

var buffs : list[ShiyuDefenseBuff]
var challenge_time : datetime.datetime
var id : int
var index : int
var model_config : pydantic.config.ConfigDict
var name : str
var node_1ShiyuDefenseNode
var node_2ShiyuDefenseNode
var rating : Literal['B', 'A', 'S']
class ShiyuDefenseMonster (**data: Any)
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

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.

Ancestors

Class variables

var id : int
var level : int
var model_config : pydantic.config.ConfigDict
var name : str
var weaknessZZZElementType | int
class ShiyuDefenseNode (**data: Any)
Expand source code
class ShiyuDefenseNode(APIModel):
    """Shiyu Defense node model."""

    characters: list[ShiyuDefenseCharacter] = Aliased("avatars")
    bangboo: typing.Optional[ShiyuDefenseBangboo] = Aliased("buddy", default=None)
    recommended_elements: list[ZZZElementType] = Aliased("element_type_list")
    enemies: list[ShiyuDefenseMonster] = Aliased("monster_info")
    battle_time: typing.Optional[datetime.timedelta] = None

    @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

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.

Ancestors

Class variables

var bangbooShiyuDefenseBangboo | None
var battle_time : datetime.timedelta | None
var characters : list[ShiyuDefenseCharacter]
var enemies : list[ShiyuDefenseMonster]
var model_config : pydantic.config.ConfigDict
var recommended_elements : list[ZZZElementType]