Skip to content

Commit

Permalink
feat(zzz): Add cinema arts
Browse files Browse the repository at this point in the history
  • Loading branch information
seriaati committed Aug 9, 2024
1 parent 2e3d1c0 commit 5486d5e
Showing 1 changed file with 66 additions and 3 deletions.
69 changes: 66 additions & 3 deletions hakushin/models/zzz/character.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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")
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 5486d5e

Please sign in to comment.