Skip to content

Commit

Permalink
Fix Qingyi icon URL
Browse files Browse the repository at this point in the history
  • Loading branch information
seriaati committed Oct 17, 2024
1 parent f166987 commit a7f796c
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions genshin/models/zzz/character.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ class ZZZSpecialty(enum.IntEnum):
DEFENSE = 5


SPECIAL_KIDS = {
1251, # Qingyi
}


class ZZZBaseAgent(APIModel, Unique):
"""ZZZ base agent model."""

Expand All @@ -56,22 +61,26 @@ class ZZZBaseAgent(APIModel, Unique):
faction_icon: str = Aliased("group_icon_path")
flat_icon: str = Aliased("hollow_icon_path")

@property
def base_icon_url(self) -> str:
if self.id in SPECIAL_KIDS:
return "https://act-webstatic.hoyoverse.com/game_record/nap"
return "https://act-webstatic.hoyoverse.com/game_record/zzz"

@property
def square_icon(self) -> str:
"""Example: https://act-webstatic.hoyoverse.com/game_record/zzz/role_square_avatar/role_square_avatar_1131.png"""
return (
f"https://act-webstatic.hoyoverse.com/game_record/zzz/role_square_avatar/role_square_avatar_{self.id}.png"
)
return f"{self.base_icon_url}/role_square_avatar/role_square_avatar_{self.id}.png"

@property
def rectangle_icon(self) -> str:
"""Example: https://act-webstatic.hoyoverse.com/game_record/zzz/role_rectangle_avatar/role_rectangle_avatar_1131.png"""
return f"https://act-webstatic.hoyoverse.com/game_record/zzz/role_rectangle_avatar/role_rectangle_avatar_{self.id}.png"
return f"{self.base_icon_url}/role_rectangle_avatar/role_rectangle_avatar_{self.id}.png"

@property
def banner_icon(self) -> str:
"""Example: https://act-webstatic.hoyoverse.com/game_record/zzz/role_vertical_painting/role_vertical_painting_1131.png"""
return f"https://act-webstatic.hoyoverse.com/game_record/zzz/role_vertical_painting/role_vertical_painting_{self.id}.png"
return f"{self.base_icon_url}/role_vertical_painting/role_vertical_painting_{self.id}.png"


class ZZZPartialAgent(ZZZBaseAgent):
Expand Down

0 comments on commit a7f796c

Please sign in to comment.