Module genshin.models.starrail.chronicle.challenge

Starrail chronicle challenge.

Classes

class APCShadowBoss (**data: Any)

Boss in an apocalyptic shadow challenge.

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 APCShadowBoss(APIModel):
    """Boss in an apocalyptic shadow challenge."""

    id: int
    name_mi18n: str
    icon: str

Ancestors

Class variables

var icon : str
var id : int
var model_computed_fields
var model_config : pydantic.config.ConfigDict
var model_fields
var name_mi18n : str
class APCShadowFloor (**data: Any)

Floor in an apocalyptic shadow challenge.

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 APCShadowFloor(StarRailChallengeFloor):
    """Floor in an apocalyptic shadow challenge."""

    node_1: APCShadowFloorNode
    node_2: APCShadowFloorNode
    last_update_time: PartialTime
    is_quick_clear: bool = Aliased("is_fast")

    @property
    def score(self) -> int:
        """Total score of the floor."""
        return self.node_1.score + self.node_2.score

Ancestors

  • genshin.models.starrail.chronicle.challenge.StarRailChallengeFloor
  • APIModel
  • pydantic.main.BaseModel

Class variables

var is_quick_clear : bool
var last_update_timePartialTime
var model_computed_fields
var model_config : pydantic.config.ConfigDict
var model_fields
var node_1APCShadowFloorNode
var node_2APCShadowFloorNode

Instance variables

prop score : int

Total score of the floor.

Expand source code
@property
def score(self) -> int:
    """Total score of the floor."""
    return self.node_1.score + self.node_2.score
class APCShadowFloorNode (**data: Any)

Node for a apocalyptic shadow floor.

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 APCShadowFloorNode(FloorNode):
    """Node for a apocalyptic shadow floor."""

    challenge_time: Optional[PartialTime]  # type: ignore[assignment]
    buff: Optional[ChallengeBuff]
    score: int
    boss_defeated: bool

    @property
    def has_data(self) -> bool:
        """Check if the node has data."""
        return bool(self.avatars)

Ancestors

Class variables

var boss_defeated : bool
var buff : Optional[ChallengeBuff]
var challenge_time : Optional[PartialTime]
var model_computed_fields
var model_config : pydantic.config.ConfigDict
var model_fields
var score : int

Instance variables

prop has_data : bool

Check if the node has data.

Expand source code
@property
def has_data(self) -> bool:
    """Check if the node has data."""
    return bool(self.avatars)
class APCShadowSeason (**data: Any)

Season of an apocalyptic shadow challenge.

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 APCShadowSeason(StarRailChallengeSeason):
    """Season of an apocalyptic shadow challenge."""

    upper_boss: APCShadowBoss
    lower_boss: APCShadowBoss

Ancestors

Class variables

var lower_bossAPCShadowBoss
var model_computed_fields
var model_config : pydantic.config.ConfigDict
var model_fields
var upper_bossAPCShadowBoss
class ChallengeBuff (**data: Any)

Buff used in a pure fiction or apocalyptic shadow node.

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 ChallengeBuff(APIModel):
    """Buff used in a pure fiction or apocalyptic shadow node."""

    id: int
    name: str = Aliased("name_mi18n")
    description: str = Aliased("desc_mi18n")
    icon: str

Ancestors

Class variables

var description : str
var icon : str
var id : int
var model_computed_fields
var model_config : pydantic.config.ConfigDict
var model_fields
var name : str
class FictionFloor (**data: Any)

Floor in a Pure Fiction challenge.

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 FictionFloor(StarRailChallengeFloor):
    """Floor in a Pure Fiction challenge."""

    round_num: int
    node_1: FictionFloorNode
    node_2: FictionFloorNode

    @property
    def score(self) -> int:
        """Total score of the floor."""
        return self.node_1.score + self.node_2.score

Ancestors

  • genshin.models.starrail.chronicle.challenge.StarRailChallengeFloor
  • APIModel
  • pydantic.main.BaseModel

Class variables

var model_computed_fields
var model_config : pydantic.config.ConfigDict
var model_fields
var node_1FictionFloorNode
var node_2FictionFloorNode
var round_num : int

Instance variables

prop score : int

Total score of the floor.

Expand source code
@property
def score(self) -> int:
    """Total score of the floor."""
    return self.node_1.score + self.node_2.score
class FictionFloorNode (**data: Any)

Node for a Pure Fiction floor.

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 FictionFloorNode(FloorNode):
    """Node for a Pure Fiction floor."""

    buff: Optional[ChallengeBuff]
    score: int

Ancestors

Class variables

var buff : Optional[ChallengeBuff]
var model_computed_fields
var model_config : pydantic.config.ConfigDict
var model_fields
var score : int
class FloorNode (**data: Any)

Node for a memory of chaos floor.

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 FloorNode(APIModel):
    """Node for a memory of chaos floor."""

    challenge_time: PartialTime
    avatars: list[FloorCharacter]

Ancestors

Subclasses

Class variables

var avatars : list[FloorCharacter]
var challenge_timePartialTime
var model_computed_fields
var model_config : pydantic.config.ConfigDict
var model_fields
class StarRailAPCShadow (**data: Any)

Apocalyptic shadow challenge in a season.

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 StarRailAPCShadow(APIModel):
    """Apocalyptic shadow challenge in a season."""

    total_stars: int = Aliased("star_num")
    max_floor: str
    total_battles: int = Aliased("battle_num")
    has_data: bool

    floors: list[APCShadowFloor] = Aliased("all_floor_detail")
    seasons: list[APCShadowSeason] = Aliased("groups")
    max_floor_id: int

Ancestors

Class variables

var floors : list[APCShadowFloor]
var has_data : bool
var max_floor : str
var max_floor_id : int
var model_computed_fields
var model_config : pydantic.config.ConfigDict
var model_fields
var seasons : list[APCShadowSeason]
var total_battles : int
var total_stars : int
class StarRailChallenge (**data: Any)

Memory of chaos challenge in a season.

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 StarRailChallenge(APIModel):
    """Memory of chaos challenge in a season."""

    name: str
    season: int = Aliased("schedule_id")
    begin_time: PartialTime
    end_time: PartialTime

    total_stars: int = Aliased("star_num")
    max_floor: str
    total_battles: int = Aliased("battle_num")
    has_data: bool

    floors: list[StarRailFloor] = Aliased("all_floor_detail")
    seasons: list[StarRailChallengeSeason] = Aliased("groups")

    @pydantic.model_validator(mode="before")
    def __extract_name(cls, values: dict[str, Any]) -> dict[str, Any]:
        if "groups" in values and isinstance(values["groups"], list):
            seasons: list[dict[str, Any]] = values["groups"]
            if len(seasons) > 0:
                values["name"] = seasons[0]["name_mi18n"]

        return values

Ancestors

Class variables

var begin_timePartialTime
var end_timePartialTime
var floors : list[StarRailFloor]
var has_data : bool
var max_floor : str
var model_computed_fields
var model_config : pydantic.config.ConfigDict
var model_fields
var name : str
var season : int
var seasons : list[StarRailChallengeSeason]
var total_battles : int
var total_stars : int
class StarRailChallengeSeason (**data: Any)

A season of a challenge.

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 StarRailChallengeSeason(APIModel):
    """A season of a challenge."""

    id: int = Aliased("schedule_id")
    name: str = Aliased("name_mi18n")
    status: str
    begin_time: PartialTime
    end_time: PartialTime

Ancestors

Subclasses

Class variables

var begin_timePartialTime
var end_timePartialTime
var id : int
var model_computed_fields
var model_config : pydantic.config.ConfigDict
var model_fields
var name : str
var status : str
class StarRailFloor (**data: Any)

Floor in a memory of chaos challenge.

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 StarRailFloor(StarRailChallengeFloor):
    """Floor in a memory of chaos challenge."""

    round_num: int
    is_chaos: bool
    node_1: FloorNode
    node_2: FloorNode

Ancestors

  • genshin.models.starrail.chronicle.challenge.StarRailChallengeFloor
  • APIModel
  • pydantic.main.BaseModel

Class variables

var is_chaos : bool
var model_computed_fields
var model_config : pydantic.config.ConfigDict
var model_fields
var node_1FloorNode
var node_2FloorNode
var round_num : int
class StarRailPureFiction (**data: Any)

Pure Fiction challenge in a season.

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 StarRailPureFiction(APIModel):
    """Pure Fiction challenge in a season."""

    name: str = pydantic.Field(deprecated="Use `season_id` together with `seasons instead`.")
    season_id: int = pydantic.Field(deprecated="Use `season_id` together with `seasons instead`.")
    begin_time: PartialTime = pydantic.Field(deprecated="Use `season_id` together with `seasons instead`.")
    end_time: PartialTime = pydantic.Field(deprecated="Use `season_id` together with `seasons instead`.")

    total_stars: int = Aliased("star_num")
    max_floor: str
    total_battles: int = Aliased("battle_num")
    has_data: bool

    floors: list[FictionFloor] = Aliased("all_floor_detail")
    seasons: list[StarRailChallengeSeason] = Aliased("groups")
    max_floor_id: int

    @pydantic.model_validator(mode="before")
    def __unnest_groups(cls, values: dict[str, Any]) -> dict[str, Any]:
        if "groups" in values and isinstance(values["groups"], list):
            seasons: list[dict[str, Any]] = values["groups"]
            if len(seasons) > 0:
                values["name"] = seasons[0]["name_mi18n"]
                values["season_id"] = seasons[0]["schedule_id"]
                values["begin_time"] = seasons[0]["begin_time"]
                values["end_time"] = seasons[0]["end_time"]

        return values

Ancestors

Class variables

var floors : list[FictionFloor]
var has_data : bool
var max_floor : str
var max_floor_id : int
var model_computed_fields
var model_config : pydantic.config.ConfigDict
var model_fields
var seasons : list[StarRailChallengeSeason]
var total_battles : int
var total_stars : int

Instance variables

var begin_timePartialTime

Data descriptor used to emit a runtime deprecation warning before accessing a deprecated field.

Attributes

msg
The deprecation message to be emitted.
wrapped_property
The property instance if the deprecated field is a computed field, or None.
field_name
The name of the field being deprecated.
Expand source code
def __get__(self, obj: BaseModel | None, obj_type: type[BaseModel] | None = None) -> Any:
    if obj is None:
        raise AttributeError(self.field_name)

    warnings.warn(self.msg, builtins.DeprecationWarning, stacklevel=2)

    if self.wrapped_property is not None:
        return self.wrapped_property.__get__(obj, obj_type)
    return obj.__dict__[self.field_name]
var end_timePartialTime

Data descriptor used to emit a runtime deprecation warning before accessing a deprecated field.

Attributes

msg
The deprecation message to be emitted.
wrapped_property
The property instance if the deprecated field is a computed field, or None.
field_name
The name of the field being deprecated.
Expand source code
def __get__(self, obj: BaseModel | None, obj_type: type[BaseModel] | None = None) -> Any:
    if obj is None:
        raise AttributeError(self.field_name)

    warnings.warn(self.msg, builtins.DeprecationWarning, stacklevel=2)

    if self.wrapped_property is not None:
        return self.wrapped_property.__get__(obj, obj_type)
    return obj.__dict__[self.field_name]
var name : str

Data descriptor used to emit a runtime deprecation warning before accessing a deprecated field.

Attributes

msg
The deprecation message to be emitted.
wrapped_property
The property instance if the deprecated field is a computed field, or None.
field_name
The name of the field being deprecated.
Expand source code
def __get__(self, obj: BaseModel | None, obj_type: type[BaseModel] | None = None) -> Any:
    if obj is None:
        raise AttributeError(self.field_name)

    warnings.warn(self.msg, builtins.DeprecationWarning, stacklevel=2)

    if self.wrapped_property is not None:
        return self.wrapped_property.__get__(obj, obj_type)
    return obj.__dict__[self.field_name]
var season_id : int

Data descriptor used to emit a runtime deprecation warning before accessing a deprecated field.

Attributes

msg
The deprecation message to be emitted.
wrapped_property
The property instance if the deprecated field is a computed field, or None.
field_name
The name of the field being deprecated.
Expand source code
def __get__(self, obj: BaseModel | None, obj_type: type[BaseModel] | None = None) -> Any:
    if obj is None:
        raise AttributeError(self.field_name)

    warnings.warn(self.msg, builtins.DeprecationWarning, stacklevel=2)

    if self.wrapped_property is not None:
        return self.wrapped_property.__get__(obj, obj_type)
    return obj.__dict__[self.field_name]