From e1ae0c17b57b0c9cde5f8af88d8d463b35b26e6a Mon Sep 17 00:00:00 2001 From: LmeSzinc <37934724+LmeSzinc@users.noreply.github.com> Date: Sat, 17 Feb 2024 21:27:27 +0800 Subject: [PATCH 1/3] Fix: Remove random prefix in ocr result --- tasks/dungeon/ui.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tasks/dungeon/ui.py b/tasks/dungeon/ui.py index d290fadc9..457e739fa 100644 --- a/tasks/dungeon/ui.py +++ b/tasks/dungeon/ui.py @@ -94,8 +94,8 @@ class OcrDungeonList(Ocr): result = re.sub(r'蛀星的旧.*?历战', '蛀星的旧靥•历战', result) # 9支援仓段 - result = result.removeprefix('9') - result = result.removeprefix('Q') + for word in 'Q9α': + result = result.removeprefix(word) return result From 4fb1c85d98592de1cc5b5ca1ba97f61513ef829d Mon Sep 17 00:00:00 2001 From: LmeSzinc <37934724+LmeSzinc@users.noreply.github.com> Date: Sat, 17 Feb 2024 21:28:54 +0800 Subject: [PATCH 2/3] Fix: Wait echo of war list loaded --- tasks/dungeon/weekly.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tasks/dungeon/weekly.py b/tasks/dungeon/weekly.py index a5d549065..359b9ba59 100644 --- a/tasks/dungeon/weekly.py +++ b/tasks/dungeon/weekly.py @@ -54,6 +54,7 @@ class WeeklyDungeon(Dungeon): # Equivalent to self.dungeon_goto(dungeon), but check limit remains DUNGEON_LIST.search_button = OCR_DUNGEON_LIST self._dungeon_nav_goto(KEYWORDS_DUNGEON_NAV.Echo_of_War) + self._dungeon_wait_until_dungeon_list_loaded() # Check limit remain = self.get_weekly_remain() From 617be88a714ffe81f0a0a7bae303d57202622715 Mon Sep 17 00:00:00 2001 From: Yinhr <110515845+Yinhaoran1128@users.noreply.github.com> Date: Sun, 18 Feb 2024 00:10:49 +0800 Subject: [PATCH 3/3] Fix: Check indexes before using min() (#330) --- tasks/dungeon/ui.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tasks/dungeon/ui.py b/tasks/dungeon/ui.py index 457e739fa..6d42aeb42 100644 --- a/tasks/dungeon/ui.py +++ b/tasks/dungeon/ui.py @@ -165,6 +165,11 @@ class DraggableDungeonList(DraggableList): indexes = [self.keyword2index(row.matched_keyword) for row in self.cur_buttons] indexes = [index for index in indexes if index] + + if not indexes: + logger.warning(f'No valid rows loaded into {self}') + return + self.cur_min = min(indexes) self.cur_max = max(indexes) logger.attr(self.name, f'{self.cur_min} - {self.cur_max}')