PamGram/modules/wiki/models/avatar.py

69 lines
1.3 KiB
Python
Raw Permalink Normal View History

from typing import List, Optional
2023-04-26 08:48:05 +00:00
from pydantic import BaseModel
from .enums import Destiny, Element
2023-04-26 08:48:05 +00:00
class YattaAvatarPath(BaseModel):
id: str
name: str
2023-04-26 08:48:05 +00:00
class YattaAvatarTypes(BaseModel):
pathType: YattaAvatarPath
combatType: YattaAvatarPath
2023-04-26 08:48:05 +00:00
class YattaAvatarCV(BaseModel):
CV_CN: str
CV_JP: str
CV_KR: str
CV_EN: str
2023-04-26 08:48:05 +00:00
class YattaAvatarFetter(BaseModel):
2024-11-30 14:31:42 +00:00
faction: Optional[str] = None
description: Optional[str] = None
cv: Optional[YattaAvatarCV] = None
class YattaAvatarEidolon(BaseModel):
id: int
rank: int
2024-11-30 14:31:42 +00:00
name: Optional[str] = None
description: Optional[str] = None
icon: str
@property
def icon_url(self) -> str:
return f"https://api.yatta.top/hsr/assets/UI/skill/{self.icon}.png"
2023-04-26 08:48:05 +00:00
class YattaAvatar(BaseModel):
2023-04-26 08:48:05 +00:00
id: int
""" 角色ID """
2023-04-26 08:48:05 +00:00
name: str
""" 名称 """
rank: int
""" 星级 """
types: YattaAvatarTypes
""" 角色类型 """
2023-04-28 12:03:38 +00:00
icon: str
""" 图标 """
release: int
""" 上线时间 """
route: str
fetter: YattaAvatarFetter
eidolons: List[YattaAvatarEidolon]
@property
def destiny(self) -> Destiny:
"""命途"""
return Destiny(self.types.pathType.name)
@property
def element(self) -> Element:
"""属性"""
return Element(self.types.combatType.name)