From 4ab292c9cb9a111925259fabbecad318446399f1 Mon Sep 17 00:00:00 2001 From: LmeSzinc <37934724+LmeSzinc@users.noreply.github.com> Date: Wed, 11 Sep 2024 00:49:49 +0800 Subject: [PATCH 1/3] Fix: Sort out the nearest pair_buttons --- module/ocr/utils.py | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/module/ocr/utils.py b/module/ocr/utils.py index d7a1584d5..ed6701e80 100644 --- a/module/ocr/utils.py +++ b/module/ocr/utils.py @@ -2,7 +2,23 @@ import itertools from pponnxcr.predict_system import BoxedResult -from module.base.utils import area_in_area, area_offset +from module.base.utils import area_center, area_in_area, area_offset + + +def area_distance(area1, area2): + """ + Get the distance of 2 area center + + Args: + area1: (upper_left_x, upper_left_y, bottom_right_x, bottom_right_y) + area2: (upper_left_x, upper_left_y, bottom_right_x, bottom_right_y) + + Returns: + float: + """ + x1, y1 = area_center(area1) + x2, y2 = area_center(area2) + return ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5 def area_cross_area(area1, area2, thres_x=20, thres_y=20): @@ -83,9 +99,10 @@ def pair_buttons(group1, group2, relative_area): """ for button1 in group1: area = area_offset(relative_area, offset=button1.area[:2]) - for button2 in group2: - if area_in_area(button2.area, area, threshold=0): - yield button1, button2 + combine = [(area_distance(area, b.area), b) for b in group2 if area_in_area(b.area, area, threshold=0)] + combine = sorted(combine, key=lambda x: x[0]) + for _, button2 in combine[:1]: + yield button1, button2 def split_and_pair_buttons(buttons, split_func, relative_area): From c700eb57d792f5adedd8a1f133a8440c1fcf0e93 Mon Sep 17 00:00:00 2001 From: LmeSzinc <37934724+LmeSzinc@users.noreply.github.com> Date: Wed, 11 Sep 2024 00:52:57 +0800 Subject: [PATCH 2/3] Fix: Remove TM from Penacony_SoulGladScorchsandAuditionVenue --- tasks/base/main_page.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tasks/base/main_page.py b/tasks/base/main_page.py index 2638165d9..a13c407a3 100644 --- a/tasks/base/main_page.py +++ b/tasks/base/main_page.py @@ -21,6 +21,8 @@ class OcrPlaneName(OcrWhiteLetterOnComplexBackground): result = re.sub(r'Y/?$', '', result) # Stargazer Navatia -> Stargazer Navalia result = result.replace('avatia', 'avalia') + # 苏乐达™热砂海选会场 + result = re.sub(r'(苏乐达|蘇樂達|SoulGlad|スラーダ|FelizAlma)[rtT]*M*', r'\1', result) # DomainiRespite result = result.replace('omaini', 'omain') # Domain=Combat From 44bd59251bc7fdef5379be8ae2b490ae28324f4d Mon Sep 17 00:00:00 2001 From: LmeSzinc <37934724+LmeSzinc@users.noreply.github.com> Date: Wed, 11 Sep 2024 00:54:11 +0800 Subject: [PATCH 3/3] Fix: Importing DungeonTabSwitch in assignment --- tasks/assignment/ui.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/assignment/ui.py b/tasks/assignment/ui.py index f6eb29fe6..3d1c0f228 100644 --- a/tasks/assignment/ui.py +++ b/tasks/assignment/ui.py @@ -15,7 +15,7 @@ from tasks.assignment.assets.assets_assignment_ui import * from tasks.assignment.keywords import * from tasks.base.assets.assets_base_page import ASSIGNMENT_CHECK from tasks.base.ui import UI -from tasks.dungeon.ui import DungeonTabSwitch +from tasks.dungeon.ui.nav import DungeonTabSwitch class AssignmentStatus(Enum):