mirror of
https://github.com/baiqwerdvd/StarRailUID.git
synced 2025-05-05 11:13:45 +08:00
🐛 修复 msgspec 使用错误
This commit is contained in:
parent
270a15fe20
commit
b2efc5b194
@ -1,5 +1,6 @@
|
|||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
|
import msgspec
|
||||||
from msgspec import Struct, field
|
from msgspec import Struct, field
|
||||||
|
|
||||||
|
|
||||||
@ -48,7 +49,7 @@ class DamageInstanceWeapon(Struct):
|
|||||||
class AttributeBounsStatusAdd(Struct):
|
class AttributeBounsStatusAdd(Struct):
|
||||||
property: str
|
property: str
|
||||||
name: str
|
name: str
|
||||||
value: int
|
value: float
|
||||||
|
|
||||||
|
|
||||||
class DamageInstanceAvatarAttributeBouns(Struct):
|
class DamageInstanceAvatarAttributeBouns(Struct):
|
||||||
@ -80,8 +81,8 @@ class DamageInstance:
|
|||||||
rank=char.char_rank,
|
rank=char.char_rank,
|
||||||
element=char.char_element,
|
element=char.char_element,
|
||||||
promotion=char.char_promotion,
|
promotion=char.char_promotion,
|
||||||
attribute_bonus=char.attribute_bonus,
|
attribute_bonus=msgspec.from_builtins(char.attribute_bonus, List[DamageInstanceAvatarAttributeBouns] | None),
|
||||||
extra_ability=char.extra_ability,
|
extra_ability=msgspec.from_builtins(char.extra_ability, List | None),
|
||||||
)
|
)
|
||||||
self.weapon = DamageInstanceWeapon(
|
self.weapon = DamageInstanceWeapon(
|
||||||
id_=char.equipment['equipmentID'],
|
id_=char.equipment['equipmentID'],
|
||||||
@ -92,10 +93,10 @@ class DamageInstance:
|
|||||||
self.relic = []
|
self.relic = []
|
||||||
for relic in char.char_relic:
|
for relic in char.char_relic:
|
||||||
self.relic.append(
|
self.relic.append(
|
||||||
DamageInstanceRelic(**relic)
|
msgspec.from_builtins(relic, DamageInstanceRelic)
|
||||||
)
|
)
|
||||||
self.skill = []
|
self.skill = []
|
||||||
for skill in char.char_skill:
|
for skill in char.char_skill:
|
||||||
self.skill.append(
|
self.skill.append(
|
||||||
DamageInstanceSkill(**skill)
|
msgspec.from_builtins(skill, DamageInstanceSkill)
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user