Add refinement (AffixMap) value and Character max level

This commit is contained in:
M-307 2022-07-17 13:07:40 +07:00
parent 45f633a63f
commit 1bb158e00c
2 changed files with 12 additions and 2 deletions

View File

@ -44,6 +44,7 @@ class CharacterInfo(BaseModel):
Custom data
"""
name: str = "" # Get from name hash map
element: ElementType = ElementType.Unknown
image: CharacterIconAsset = CharacterIconAsset()
skills: List[CharacterSkill] = []
@ -54,6 +55,9 @@ class CharacterInfo(BaseModel):
ascension: int = 0 # AKA. propMap 4001
level: int = 0 # AKA. propMap 1002
# Other
max_level: int = 20
def __init__(__pydantic_self__, **data: Any) -> None:
super().__init__(**data)
@ -62,6 +66,9 @@ class CharacterInfo(BaseModel):
__pydantic_self__.ascension = int(data["propMap"]["1002"]["ival"]) if "1002" in data["propMap"] else 0
__pydantic_self__.level = int(data["propMap"]["4001"]["ival"]) if "4001" in data["propMap"] else 0
# Get max character level
__pydantic_self__.max_level = (__pydantic_self__.ascension * 10) + (10 if __pydantic_self__.ascension > 0 else 0) + 20
# Get character
LOGGER.debug(f"=== Character Data ===")
character = Assets.character(str(data["avatarId"]))
@ -74,7 +81,7 @@ class CharacterInfo(BaseModel):
__pydantic_self__.image = character.images
# Get element
__pydantic_self__.element = character.element
__pydantic_self__.element = ElementType(character.element).name
# Load constellation
LOGGER.debug(f"=== Constellation ===")

View File

@ -61,7 +61,7 @@ class EquipmentsDetail(BaseModel):
if data["itemType"] == "ITEM_RELIQUARY": # AKA. Artifact
LOGGER.debug(f"=== Artifact ===")
__pydantic_self__.icon = Assets.create_icon_path(data["icon"])
__pydantic_self__.artifactType = data["equipType"]
__pydantic_self__.artifactType = EquipType(data["equipType"]).name
# Sub Stats
for stats in data["reliquarySubstats"]:
__pydantic_self__.substats.append(EquipmentsStats.parse_obj(stats))
@ -98,6 +98,7 @@ class Equipments(BaseModel):
"""
level: int = 0 # Get form key "reliquary" and "weapon"
type: EquipmentsType = EquipmentsType.UNKNOWN # Type of equipments (Ex. Artifact, Weapon)
refinement: int = 0 # Refinement of equipments (Weapon only)
class Config:
use_enum_values = True
@ -112,3 +113,5 @@ class Equipments(BaseModel):
if data["flat"]["itemType"] == "ITEM_WEAPON": # AKA. Weapon
__pydantic_self__.type = EquipmentsType.WEAPON
__pydantic_self__.level = data["weapon"]["level"] - 1
if "affixMap" in data["weapon"]:
__pydantic_self__.refinement = data["weapon"]["affixMap"][list(data["weapon"]["affixMap"].keys())[0]] + 1