EnkaNetwork.py/enkanetwork/model/assets.py

48 lines
1.2 KiB
Python
Raw Normal View History

from pydantic import BaseModel, Field
from typing import List, Any
from ..enum import ElementType
2022-07-29 04:31:21 +00:00
class NamecardAsset(BaseModel):
id: int = 0
hash_id: str = Field("", alias="nameTextMapHash")
icon: str = Field("", alias="icon")
banner: str = ""
navbar: str = ""
2022-07-29 04:31:21 +00:00
class CharacterIconAsset(BaseModel):
icon: str = ""
side: str = ""
banner: str = ""
2022-07-29 04:31:21 +00:00
class CharacterSkillAsset(BaseModel):
id: int = 0
hash_id: str = Field("", alias="nameTextMapHash")
icon: str = Field(None, alias="skillIcon")
2022-07-29 04:31:21 +00:00
class CharacterConstellationsAsset(BaseModel):
id: int = 0
hash_id: str = Field("", alias="nameTextMapHash")
icon: str = Field(None, alias="icon")
class CharacterAsset(BaseModel):
id: int = 0
hash_id: str = Field("", alias="nameTextMapHash")
element: ElementType = ElementType.Unknown
images: CharacterIconAsset = None
skills: List[int] = []
constellations: List[int] = Field([], alias="talents")
class Config:
use_enum_values = True
def __init__(__pydantic_self__, **data: Any) -> None:
super().__init__(**data)
2022-07-29 04:31:21 +00:00
__pydantic_self__.element = ElementType(data["costElemType"]) if data["costElemType"] != "" else ElementType.Unknown.name # noqa: E501