Skip to content

Commit

Permalink
chore: 增加数据校验开关
Browse files Browse the repository at this point in the history
  • Loading branch information
weiduhuo authored and Night-stars-1 committed Oct 12, 2023
1 parent 220e51b commit ed704a3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions utils/relic.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@ def __init__(self, title=_("崩坏:星穹铁道")):
self.team_data = read_json_file(TEAM_FILE_NAME, schema=self.team_schema)
log.info(_("遗器数据载入完成"))

self.is_detail = True # 在打印遗器信息时,显示拓展信息
self.is_check = True # 是否对副词条数据进行校验 (关闭后,可临时使程序能够识别五星以下遗器,同时会将数据增强强制关闭)
self.is_detail = True # 在打印遗器信息时进行数据增强,显示拓展信息
self.is_detail = self.is_detail if self.is_check else False

def relic_entrance(self):
"""
Expand Down Expand Up @@ -530,7 +532,7 @@ def ocr_relic(self, equip_set_index:int = None) -> dict:
else:
total_level += check[0]
subs_stats_dict[tmp_name] = tmp_value
if total_level > level // 3 + 4:
if self.is_check and total_level > level // 3 + 4:
log.error(f"total_level: {total_level}")
raise RelicOCRException(_("遗器副词条某一数值OCR错误"))
# [7]生成结果数据包
Expand Down Expand Up @@ -588,6 +590,8 @@ def get_subs_stats_detail(self, data:tuple[str, float], index:int=None) -> tuple
:return score: 挡位总积分: 1挡记0分, 2挡记1分, 3挡记2分
:return result: 修正后数值 (提高了原数值精度)
"""
if not self.is_check:
return (0,0,0)
name, value = data
index = np.where(self.subs_stats_name[:, -1] == name)[0][0] if index is None else index
a, d = self.subs_stats_tier[index]
Expand Down

0 comments on commit ed704a3

Please sign in to comment.