Fix stats show DigitType wrong

This commit is contained in:
M-307 2022-08-22 16:29:18 +07:00
parent 8236b9a6ba
commit 887d0e458d

View File

@ -21,13 +21,11 @@ class EquipmentsStats(BaseModel):
prop_id: str = ""
type: DigitType = DigitType.NUMBER
name: str = ""
value: int = 0
value: Union[int, float] = Field(0, alias="statValue")
def __init__(self, **data: Any) -> None:
super().__init__(**data)
self.value = data["statValue"]
LOGGER.debug("=== Fight prop ===")
if "mainPropId" in data:
@ -39,7 +37,8 @@ class EquipmentsStats(BaseModel):
prod_id = ["HURT", "CRITICAL", "EFFICIENCY", "PERCENT", "ADD"]
if isinstance(self.value, float) or self.prop_id.split("_")[-1] in prod_id:
if self.prop_id.split("_")[-1] in prod_id:
self.value = float(data["statValue"])
self.type = DigitType.PERCENT
if not fight_prop: