Skip to content

Commit

Permalink
fix: 修复散件'贝洛伯格的铁卫防线'错误识别为铁卫套,将预选词按内外圈划分
Browse files Browse the repository at this point in the history
  • Loading branch information
weiduhuo committed Nov 2, 2023
1 parent c22362b commit d8ac10d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
5 changes: 4 additions & 1 deletion utils/relic.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ def save_loadout_for_team(self):
loadout_name_list[i] = team_name
self.loadout_data[char_name][team_name] = relics_hash
rewrite_json_file(LOADOUT_FILE_NAME, self.loadout_data)
group_data[team_name]["team_members"] = {key: value for key, value in zip(char_name_list, loadout_name_list)}
group_data[team_name] = {"team_members": {key: value for key, value in zip(char_name_list, loadout_name_list)}}
rewrite_json_file(TEAM_FILE_NAME, self.team_data)
log.info(_("编队录入成功"))

Expand Down Expand Up @@ -729,9 +729,12 @@ def ocr_relic(self, equip_set_index: Optional[int]=None) -> Dict[str, Any]:
equip_set_name = EQUIP_SET_NAME[equip_set_index]
# [2]套装识别
name_list = RELIC_SET_NAME[:, 0].tolist()
name_list = name_list[:RELIC_INNER_SET_INDEX] if equip_set_index < 4 else name_list[RELIC_INNER_SET_INDEX:] # 取外圈/内圈的切片
relic_set_index = self.calculated.ocr_pos_for_single_line(name_list, points=(77,15,92,19) if IS_PC else (71,17,88,21), img_pk=img_pc)
if relic_set_index < 0:
raise RelicOCRException(_("遗器部位OCR错误"))
if equip_set_index in [4, 5]:
relic_set_index += RELIC_INNER_SET_INDEX # 还原内圈遗器的真实索引
relic_set_name = RELIC_SET_NAME[relic_set_index, -1]
# [3]稀有度识别
hue, __, __ = self.calculated.get_relative_pix_hsv((43,55) if IS_PC else (41,55)) # 识别指定位点色相
Expand Down
9 changes: 7 additions & 2 deletions utils/relic_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

# 注:因为数据有时要行取有时要列取,故采用数组存储
RELIC_SET_NAME = np.array([
# 外圈
[_("过客"), _("过客"), _("治疗"), _("云无留迹的过客")],
[_("枪手"), _("枪手"), _("快枪手"), _("野穗伴行的快枪手")],
[_("圣骑"), _("圣骑"), _("圣骑"), _("净庭教宗的圣骑士")],
Expand All @@ -27,18 +28,22 @@
[_("废"), _("废"), _("虚数"), _("盗匪荒漠的废土客")],
[_("者"), _("长存"), _("莳者"), _("宝命长存的莳者")],
[_("信使"), _("信使"), _("信使"), _("骇域漫游的信使")],
# 内圈
[_("黑塔"), _("太空"), _("空间站"), _("太空封印站")],
[_("仙"), _("仙"), _("仙舟"), _("不老者的仙舟")],
[_("公司"), _("公司"), _("命中"), _("泛银河商业公司")],
[_("贝洛"), _("贝洛"), _("防御"), _("筑城者的贝洛伯格")],
[_("贝洛"), _("贝洛"), _("防御"), _("筑城者的贝洛伯格")], # 注:有散件名为'贝洛伯格的铁卫防线'
[_("螺丝"), _("差分"), _("差分"), _("星体差分机")],
[_("萨尔"), _("停转"), _("停转"), _("停转的萨尔索图")],
[_("利亚"), _("盗贼"), _("击破"), _("盗贼公国塔利亚")],
[_("瓦克"), _("瓦克"), _("翁瓦克"), _("生命的翁瓦克")],
[_("泰科"), _("繁星"), _("繁星"), _("繁星竞技场")],
[_("伊须"), _("龙骨"), _("龙骨"), _("折断的龙骨")]
], dtype=np.str_)
"""遗器套装名称:0-套装散件名的共有词(ocr-必须),1-套装名的特异词(ocr-可选,为了增强鲁棒性),2-玩家惯用简称(print),3-套装全称(json),已按[1.4游戏]遗器筛选界面排序"""
"""遗器套装名称:0-套装散件名的共有词(ocr-必须),1-套装名的特异词(ocr-可选,为了增强鲁棒性),2-玩家惯用简称(print),3-套装全称(json),已按[1.4游戏]遗器筛选界面排序 (且前段为外圈,后段为内圈)"""

RELIC_INNER_SET_INDEX = 14
"""RELIC_SET_NAME参数的遗器内圈的起始点索引"""

STATS_NAME = np.array([
[_("命值"), _("生"), _("生命值")],
Expand Down

0 comments on commit d8ac10d

Please sign in to comment.