Module genshin.models.starrail.chronicle.characters

Starrail chronicle character.

Classes

class CharacterProperty (**data: Any)
Expand source code
class CharacterProperty(APIModel):
    """Base character property."""

    property_type: int
    base: str
    add: str
    final: str
    preferred: bool
    recommended: bool
    info: PropertyInfo

Base character property.

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 add : str
var base : str
var final : str
var infoPropertyInfo
var model_config : pydantic.config.ConfigDict
var preferred : bool
var property_type : int
var recommended : bool
class MemoSprite (**data: Any)
Expand source code
class MemoSprite(APIModel):
    """Memosprite data."""

    id: int = Aliased("servant_id")
    name: str = Aliased("servant_name")
    icon: str = Aliased("servant_icon")
    properties: Sequence[MemoSpriteProperty] = Aliased("servant_properties")
    skills: Sequence[Skill] = Aliased("servant_skills")

Memosprite data.

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 model_config : pydantic.config.ConfigDict
var name : str
var properties : Sequence[MemoSpriteProperty]
var skills : Sequence[Skill]
class MemoSpriteProperty (**data: Any)
Expand source code
class MemoSpriteProperty(APIModel):
    """Memosprite property."""

    property_type: int
    base: str
    add: str
    final: str
    info: PropertyInfo

Memosprite property.

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 add : str
var base : str
var final : str
var infoPropertyInfo
var model_config : pydantic.config.ConfigDict
var property_type : int
class ModifyRelicProperty (**data: Any)
Expand source code
class ModifyRelicProperty(APIModel):
    """Modify relic property."""

    property_type: int
    modify_property_type: int

Modify relic property.

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 modify_property_type : int
var property_type : int
class PropertyInfo (**data: Any)
Expand source code
class PropertyInfo(APIModel):
    """Relic property info."""

    property_type: int
    name: str
    icon: str
    property_name_relic: str
    property_name_filter: str

Relic property info.

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 model_config : pydantic.config.ConfigDict
var name : str
var property_name_filter : str
var property_name_relic : str
var property_type : int
class Rank (**data: Any)
Expand source code
class Rank(APIModel):
    """Character rank."""

    id: int
    pos: int
    name: str
    icon: str
    desc: str
    is_unlocked: bool

Character rank.

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 desc : str
var icon : str
var id : int
var is_unlocked : bool
var model_config : pydantic.config.ConfigDict
var name : str
var pos : int
class RecommendProperty (**data: Any)
Expand source code
class RecommendProperty(APIModel):
    """Character recommended and preferred properties."""

    recommend_relic_properties: Sequence[int]
    custom_relic_properties: Sequence[int]
    is_custom_property_valid: bool

Character recommended and preferred properties.

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 custom_relic_properties : Sequence[int]
var is_custom_property_valid : bool
var model_config : pydantic.config.ConfigDict
var recommend_relic_properties : Sequence[int]
class Relic (**data: Any)
Expand source code
class Relic(APIModel):
    """Character relic."""

    id: int
    level: int
    pos: int
    name: str
    desc: str
    icon: str
    rarity: int
    wiki: str
    main_property: RelicProperty
    properties: Sequence[RelicProperty]

Character relic.

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 desc : str
var icon : str
var id : int
var level : int
var main_propertyRelicProperty
var model_config : pydantic.config.ConfigDict
var name : str
var pos : int
var properties : Sequence[RelicProperty]
var rarity : int
var wiki : str
class RelicProperty (**data: Any)
Expand source code
class RelicProperty(APIModel):
    """Relic property."""

    property_type: int
    value: str
    times: int
    preferred: bool
    recommended: bool
    info: PropertyInfo

Relic property.

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 infoPropertyInfo
var model_config : pydantic.config.ConfigDict
var preferred : bool
var property_type : int
var recommended : bool
var times : int
var value : str
class Skill (**data: Any)
Expand source code
class Skill(APIModel):
    """Character/Memosprite skill."""

    point_id: str
    point_type: int
    item_url: str
    level: int
    is_activated: bool
    is_rank_work: bool
    pre_point: str
    anchor: str
    remake: str
    skill_stages: Sequence[SkillStage]

Character/Memosprite skill.

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 anchor : str
var is_activated : bool
var is_rank_work : bool
var item_url : str
var level : int
var model_config : pydantic.config.ConfigDict
var point_id : str
var point_type : int
var pre_point : str
var remake : str
var skill_stages : Sequence[SkillStage]
class SkillStage (**data: Any)
Expand source code
class SkillStage(APIModel):
    """Character skill stage."""

    name: str
    desc: str
    level: int
    remake: str
    item_url: str
    is_activated: bool
    is_rank_work: bool

Character skill stage.

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 desc : str
var is_activated : bool
var is_rank_work : bool
var item_url : str
var level : int
var model_config : pydantic.config.ConfigDict
var name : str
var remake : str
class StarRailDetailCharacter (**data: Any)
Expand source code
class StarRailDetailCharacter(character.StarRailPartialCharacter):
    """StarRail character with equipment and relics."""

    image: str
    equip: Optional[StarRailEquipment]
    relics: Sequence[Relic]
    ornaments: Sequence[Relic]
    ranks: Sequence[Rank]
    properties: Sequence[CharacterProperty]
    path: StarRailPath = Aliased("base_type")
    figure_path: str
    skills: Sequence[Skill]
    memosprite: Optional[MemoSprite] = Aliased("servant_detail")

    @property
    def is_wearing_outfit(self) -> bool:
        """Whether the character is wearing an outfit."""
        return "avatar_skin_image" in self.image

    @pydantic.field_validator("memosprite", mode="before")
    @classmethod
    def __return_none(cls, value: Optional[dict[str, Any]]) -> Optional[dict[str, Any]]:
        """Return None if memosprite ID is 0."""
        if value is None:
            return None
        if value.get("servant_id", "0") == "0":
            return None
        return value

StarRail character with equipment and relics.

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 equipStarRailEquipment | None
var figure_path : str
var image : str
var memospriteMemoSprite | None
var model_config : pydantic.config.ConfigDict
var ornaments : Sequence[Relic]
var pathStarRailPath
var properties : Sequence[CharacterProperty]
var ranks : Sequence[Rank]
var relics : Sequence[Relic]
var skills : Sequence[Skill]

Instance variables

prop is_wearing_outfit : bool
Expand source code
@property
def is_wearing_outfit(self) -> bool:
    """Whether the character is wearing an outfit."""
    return "avatar_skin_image" in self.image

Whether the character is wearing an outfit.

class StarRailDetailCharacters (**data: Any)
Expand source code
class StarRailDetailCharacters(APIModel):
    """StarRail characters."""

    avatar_list: Sequence[StarRailDetailCharacter]
    equip_wiki: Mapping[str, str]
    relic_wiki: Mapping[str, str]
    property_info: Mapping[str, PropertyInfo]
    recommend_property: Mapping[str, RecommendProperty]
    relic_properties: Sequence[ModifyRelicProperty]

    @pydantic.model_validator(mode="before")
    def __fill_additional_fields(cls, values: Mapping[str, Any]) -> Mapping[str, Any]:
        """Fill additional fields for convenience."""
        characters = values.get("avatar_list", [])
        props_info = values.get("property_info", {})
        rec_props = values.get("recommend_property", {})
        equip_wiki = values.get("equip_wiki", {})
        relic_wiki = values.get("relic_wiki", {})

        for char in characters:
            char_id = str(char["id"])
            char_rec_props = rec_props[char_id]["recommend_relic_properties"]
            char_custom_props = rec_props[char_id]["custom_relic_properties"]

            servant = char.get("servant_detail", {})
            if servant:
                for prop in servant["servant_properties"]:
                    prop_type = prop["property_type"]
                    prop["info"] = props_info[str(prop_type)]

            for relic in char["relics"] + char["ornaments"]:
                prop_type = relic["main_property"]["property_type"]
                relic["main_property"]["info"] = props_info[str(prop_type)]
                relic["main_property"]["recommended"] = prop_type in char_rec_props
                relic["main_property"]["preferred"] = prop_type in char_custom_props

                for prop in relic["properties"]:
                    prop_type = prop["property_type"]
                    prop["recommended"] = prop_type in char_rec_props
                    prop["preferred"] = prop_type in char_custom_props
                    prop["info"] = props_info[str(prop_type)]

                relic["wiki"] = relic_wiki.get(str(relic["id"]), "")

            for prop in char["properties"]:
                prop_type = prop["property_type"]
                prop["recommended"] = prop_type in char_rec_props
                prop["preferred"] = prop_type in char_custom_props
                prop["info"] = props_info[str(prop_type)]

            if char["equip"]:
                char["equip"]["wiki"] = equip_wiki.get(str(char["equip"]["id"]), "")

        return values

StarRail characters.

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 avatar_list : Sequence[StarRailDetailCharacter]
var equip_wiki : Mapping[str, str]
var model_config : pydantic.config.ConfigDict
var property_info : Mapping[str, PropertyInfo]
var recommend_property : Mapping[str, RecommendProperty]
var relic_properties : Sequence[ModifyRelicProperty]
var relic_wiki : Mapping[str, str]
class StarRailEquipment (**data: Any)
Expand source code
class StarRailEquipment(APIModel):
    """Character equipment."""

    id: int
    level: int
    rank: int
    name: str
    desc: str
    icon: str
    rarity: int
    wiki: str

Character equipment.

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 desc : str
var icon : str
var id : int
var level : int
var model_config : pydantic.config.ConfigDict
var name : str
var rank : int
var rarity : int
var wiki : str
class StarRailPath (value, names=None, *, module=None, qualname=None, type=None, start=1)
Expand source code
class StarRailPath(enum.IntEnum):
    """StarRail character path."""

    DESTRUCTION = 1
    THE_HUNT = 2
    ERUDITION = 3
    HARMONY = 4
    NIHILITY = 5
    PRESERVATION = 6
    ABUNDANCE = 7
    REMEMBRANCE = 8

StarRail character path.

Ancestors

  • enum.IntEnum
  • builtins.int
  • enum.Enum

Class variables

var ABUNDANCE
var DESTRUCTION
var ERUDITION
var HARMONY
var NIHILITY
var PRESERVATION
var REMEMBRANCE
var THE_HUNT