mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-16 06:25:24 +00:00
Fix: Don't relay on validator when creating StoredPlannerProxy objects
This commit is contained in:
parent
e46c7bb174
commit
a94d0144ea
@ -118,23 +118,30 @@ class StoredPlannerProxy(BaseModelWithFallback):
|
|||||||
def val_value(self):
|
def val_value(self):
|
||||||
if self.item.has_group_base:
|
if self.item.has_group_base:
|
||||||
if not isinstance(self.value, MultiValue):
|
if not isinstance(self.value, MultiValue):
|
||||||
logger.warning(f'Planner item {self.item} has_group_base but given `value` is not a MultiValue')
|
logger.warning(f'Planner item {self.item} has_group_base '
|
||||||
|
f'but given value={self.value} is not a MultiValue')
|
||||||
self.value = MultiValue()
|
self.value = MultiValue()
|
||||||
if not isinstance(self.total, MultiValue):
|
if not isinstance(self.total, MultiValue):
|
||||||
logger.warning(f'Planner item {self.item} has_group_base but given `total` is not a MultiValue')
|
logger.warning(f'Planner item {self.item} has_group_base '
|
||||||
|
f'but given total={self.total} is not a MultiValue')
|
||||||
self.total = MultiValue()
|
self.total = MultiValue()
|
||||||
|
raise Exception
|
||||||
if not isinstance(self.synthesize, MultiValue):
|
if not isinstance(self.synthesize, MultiValue):
|
||||||
logger.warning(f'Planner item {self.item} has_group_base but given `synthesize` is not a MultiValue')
|
logger.warning(f'Planner item {self.item} has_group_base '
|
||||||
|
f'but given synthesize={self.synthesize} is not a MultiValue')
|
||||||
self.synthesize = MultiValue()
|
self.synthesize = MultiValue()
|
||||||
else:
|
else:
|
||||||
if not isinstance(self.value, int):
|
if not isinstance(self.value, int):
|
||||||
logger.warning(f'Planner item {self.item} has no group base but given `value` is not an int')
|
logger.warning(f'Planner item {self.item} has no group base '
|
||||||
|
f'but given value={self.value} is not an int')
|
||||||
self.value = 0
|
self.value = 0
|
||||||
if not isinstance(self.total, int):
|
if not isinstance(self.total, int):
|
||||||
logger.warning(f'Planner item {self.item} has no group base but given `total` is not an int')
|
logger.warning(f'Planner item {self.item} has no group base '
|
||||||
|
f'but given total={self.total} is not an int')
|
||||||
self.total = 0
|
self.total = 0
|
||||||
if not isinstance(self.synthesize, int):
|
if not isinstance(self.synthesize, int):
|
||||||
logger.warning(f'Planner item {self.item} has no group base but given `synthesize` is not an int')
|
logger.warning(f'Planner item {self.item} has no group base '
|
||||||
|
f'but given synthesize={self.synthesize} is not an int')
|
||||||
self.synthesize = 0
|
self.synthesize = 0
|
||||||
return self
|
return self
|
||||||
|
|
||||||
@ -424,7 +431,11 @@ class PlannerProgressParser:
|
|||||||
base = row.item.group_base
|
base = row.item.group_base
|
||||||
if base.name not in self.rows:
|
if base.name not in self.rows:
|
||||||
try:
|
try:
|
||||||
obj = StoredPlannerProxy(item=base)
|
if row.item.has_group_base:
|
||||||
|
obj = StoredPlannerProxy(
|
||||||
|
item=base, value=MultiValue(), total=MultiValue(), synthesize=MultiValue())
|
||||||
|
else:
|
||||||
|
obj = StoredPlannerProxy(item=base, value=0, total=0, synthesize=0)
|
||||||
except ScriptError as e:
|
except ScriptError as e:
|
||||||
logger.error(e)
|
logger.error(e)
|
||||||
continue
|
continue
|
||||||
|
Loading…
Reference in New Issue
Block a user