diff --git a/hakushin/models/zzz/character.py b/hakushin/models/zzz/character.py index 9dbf8f5..529fbc7 100644 --- a/hakushin/models/zzz/character.py +++ b/hakushin/models/zzz/character.py @@ -34,10 +34,46 @@ class Character(APIModel): specialty: ZZZSpecialty = Field(alias="type") element: ZZZElement | None attack_type: ZZZAttackType | None = Field(alias="hit") - icon: str + image: str en_description: str = Field(alias="desc") names: dict[Literal["EN", "KO", "CHS", "JA"], str] + @computed_field + @property + def phase_3_cinema_art(self) -> str: + """Agent phase 3 mindscape cinema art. + + Example: https://api.hakush.in/zzz/UI/Mindscape_1041_3.webp + """ + return f"https://api.hakush.in/zzz/UI/Mindscape_{self.id}_3.webp" + + @computed_field + @property + def phase_2_cinema_art(self) -> str: + """Agent phase 2 mindscape cinema art. + + Example: https://api.hakush.in/zzz/UI/Mindscape_1041_2.webp + """ + return f"https://api.hakush.in/zzz/UI/Mindscape_{self.id}_2.webp" + + @computed_field + @property + def phase_1_cinema_art(self) -> str: + """Agent phase 1 mindscape cinema art. + + Example: https://api.hakush.in/zzz/UI/Mindscape_1041_1.webp + """ + return f"https://api.hakush.in/zzz/UI/Mindscape_{self.id}_1.webp" + + @computed_field + @property + def icon(self) -> str: + """Agent icon. + + Example: https://api.hakush.in/zzz/UI/IconRoleSelect01.webp + """ + return self.image.replace("Role", "RoleSelect") + @field_validator("rarity", mode="before") @classmethod def __convert_rarity(cls, value: int | None) -> Literal["S", "A"] | None: @@ -51,9 +87,9 @@ def __convert_attack_type(cls, value: int) -> ZZZAttackType | None: except ValueError: return None - @field_validator("icon") + @field_validator("image") @classmethod - def __convert_icon(cls, value: str) -> str: + def __convert_image(cls, value: str) -> str: return f"https://api.hakush.in/zzz/UI/{value}.webp" @model_validator(mode="before") @@ -238,6 +274,33 @@ class CharacterDetail(APIModel): skills: dict[ZZZSkillType, CharacterSkill] = Field(alias="Skill") passive: CharacterCoreSkill = Field(alias="Passive") + @computed_field + @property + def phase_3_cinema_art(self) -> str: + """Agent phase 3 mindscape cinema art. + + Example: https://api.hakush.in/zzz/UI/Mindscape_1041_3.webp + """ + return f"https://api.hakush.in/zzz/UI/Mindscape_{self.id}_3.webp" + + @computed_field + @property + def phase_2_cinema_art(self) -> str: + """Agent phase 2 mindscape cinema art. + + Example: https://api.hakush.in/zzz/UI/Mindscape_1041_2.webp + """ + return f"https://api.hakush.in/zzz/UI/Mindscape_{self.id}_2.webp" + + @computed_field + @property + def phase_1_cinema_art(self) -> str: + """Agent phase 1 mindscape cinema art. + + Example: https://api.hakush.in/zzz/UI/Mindscape_1041_1.webp + """ + return f"https://api.hakush.in/zzz/UI/Mindscape_{self.id}_1.webp" + @computed_field @property def icon(self) -> str: