2022-07-16 19:36:14 +00:00
|
|
|
from pydantic import BaseModel, Field
|
2022-07-18 19:07:53 +00:00
|
|
|
from typing import List, Any
|
2022-07-16 19:36:14 +00:00
|
|
|
|
|
|
|
from ..enum import ElementType
|
2022-08-14 09:44:47 +00:00
|
|
|
from .utils import IconAsset
|
2022-07-29 04:31:21 +00:00
|
|
|
|
2022-07-16 19:36:14 +00:00
|
|
|
class NamecardAsset(BaseModel):
|
|
|
|
id: int = 0
|
|
|
|
hash_id: str = Field("", alias="nameTextMapHash")
|
2022-08-14 09:44:47 +00:00
|
|
|
icon: IconAsset
|
|
|
|
banner: IconAsset
|
|
|
|
navbar: IconAsset
|
2022-07-16 19:36:14 +00:00
|
|
|
|
2022-07-29 04:31:21 +00:00
|
|
|
|
2022-07-16 19:36:14 +00:00
|
|
|
class CharacterIconAsset(BaseModel):
|
2022-08-14 09:44:47 +00:00
|
|
|
icon: IconAsset
|
|
|
|
side: IconAsset
|
|
|
|
banner: IconAsset
|
|
|
|
card: IconAsset
|
2022-07-16 19:36:14 +00:00
|
|
|
|
2022-07-29 04:31:21 +00:00
|
|
|
|
2022-07-16 19:36:14 +00:00
|
|
|
class CharacterSkillAsset(BaseModel):
|
|
|
|
id: int = 0
|
|
|
|
hash_id: str = Field("", alias="nameTextMapHash")
|
2022-08-14 09:44:47 +00:00
|
|
|
icon: IconAsset = Field(None, alias="skillIcon")
|
2022-07-16 19:36:14 +00:00
|
|
|
|
2022-07-29 04:31:21 +00:00
|
|
|
|
2022-07-16 19:36:14 +00:00
|
|
|
class CharacterConstellationsAsset(BaseModel):
|
|
|
|
id: int = 0
|
|
|
|
hash_id: str = Field("", alias="nameTextMapHash")
|
2022-08-14 09:44:47 +00:00
|
|
|
icon: IconAsset = Field(None, alias="icon")
|
2022-07-16 19:36:14 +00:00
|
|
|
|
|
|
|
|
2022-08-03 07:50:15 +00:00
|
|
|
class CharacterCostume(BaseModel):
|
|
|
|
id: int = 0
|
|
|
|
images: CharacterIconAsset = None
|
|
|
|
|
|
|
|
|
2022-07-16 19:36:14 +00:00
|
|
|
class CharacterAsset(BaseModel):
|
|
|
|
id: int = 0
|
2022-08-03 07:50:15 +00:00
|
|
|
rarity: int = 0
|
2022-07-16 19:36:14 +00:00
|
|
|
hash_id: str = Field("", alias="nameTextMapHash")
|
2022-07-18 19:07:53 +00:00
|
|
|
element: ElementType = ElementType.Unknown
|
2022-07-16 19:36:14 +00:00
|
|
|
images: CharacterIconAsset = None
|
2022-08-03 07:50:15 +00:00
|
|
|
skill_id: int = 0
|
2022-07-16 19:36:14 +00:00
|
|
|
skills: List[int] = []
|
|
|
|
constellations: List[int] = Field([], alias="talents")
|
|
|
|
|
|
|
|
class Config:
|
2022-07-18 19:07:53 +00:00
|
|
|
use_enum_values = True
|
|
|
|
|
|
|
|
def __init__(__pydantic_self__, **data: Any) -> None:
|
|
|
|
super().__init__(**data)
|
|
|
|
|
2022-08-03 07:50:15 +00:00
|
|
|
__pydantic_self__.element = ElementType(data["costElemType"]) if data["costElemType"] != "" else ElementType.Unknown # noqa: E501
|
|
|
|
__pydantic_self__.rarity = 5 if data["qualityType"].endswith("_ORANGE") else 4 # noqa: E501
|