From af603eadf8a4faf876a4630d8611c8dec5cb3b75 Mon Sep 17 00:00:00 2001 From: LmeSzinc <37934724+LmeSzinc@users.noreply.github.com> Date: Mon, 13 May 2024 19:24:17 +0800 Subject: [PATCH] Fix: Lower OcrCharacterName.merge_thres_y so DanHeng's long name won't mix with others --- tasks/battle_pass/battle_pass.py | 16 ++++++++++++---- tasks/character/switch.py | 2 +- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/tasks/battle_pass/battle_pass.py b/tasks/battle_pass/battle_pass.py index a7e172b41..4386dd136 100644 --- a/tasks/battle_pass/battle_pass.py +++ b/tasks/battle_pass/battle_pass.py @@ -96,6 +96,10 @@ class BattlePassUI(UI): MAX_LEVEL = 70 def _battle_pass_wait_rewards_loaded(self, skip_first_screenshot=True): + """ + Returns: + bool: If load success + """ timeout = Timer(2, count=4).start() while 1: if skip_first_screenshot: @@ -105,12 +109,16 @@ class BattlePassUI(UI): if timeout.reached(): logger.warning('Wait rewards tab loaded timeout') - break + return False if self.appear(REWARDS_LOADED): logger.info('Rewards tab loaded') - break + return True def _battle_pass_wait_missions_loaded(self, skip_first_screenshot=True): + """ + Returns: + bool: If load success + """ timeout = Timer(2, count=4).start() while 1: if skip_first_screenshot: @@ -120,14 +128,14 @@ class BattlePassUI(UI): if timeout.reached(): logger.warning('Wait missions tab loaded timeout') - break + return False # Has scroll and last mission loaded if self.appear(MISSION_PAGE_SCROLL): color = get_color(self.device.image, MISSIONS_LOADED.area) if np.mean(color) > 128: logger.info('Missions tab loaded') - break + return True def battle_pass_goto(self, state: KEYWORDS_BATTLE_PASS_TAB): """ diff --git a/tasks/character/switch.py b/tasks/character/switch.py index 7b36b6806..a30e25796 100644 --- a/tasks/character/switch.py +++ b/tasks/character/switch.py @@ -16,7 +16,7 @@ from tasks.character.keywords import CharacterList, DICT_SORTED_RANGES, KEYWORDS class OcrCharacterName(OcrWhiteLetterOnComplexBackground): merge_thres_x = 20 - merge_thres_y = 20 + merge_thres_y = 10 def after_process(self, result): result = result.replace('蛆', '妲')