diff --git a/assets/en/ui/ACADEMY_CHECK.png b/assets/en/ui/ACADEMY_CHECK.png index 7e00c6d3b..9ecfd530a 100644 Binary files a/assets/en/ui/ACADEMY_CHECK.png and b/assets/en/ui/ACADEMY_CHECK.png differ diff --git a/campaign/event_20211229_cn/a1.py b/campaign/event_20211229_cn/a1.py index c0e51cf14..7273d10d8 100644 --- a/campaign/event_20211229_cn/a1.py +++ b/campaign/event_20211229_cn/a1.py @@ -54,17 +54,18 @@ class Config: # ===== End of generated config ===== INTERNAL_LINES_FIND_PEAKS_PARAMETERS = { - 'height': (80, 255 - 40), + 'height': (80, 255 - 17), 'width': (0.9, 10), 'prominence': 10, 'distance': 35, } EDGE_LINES_FIND_PEAKS_PARAMETERS = { - 'height': (255 - 24, 255), + 'height': (255 - 17, 255), 'prominence': 10, 'distance': 50, 'wlen': 1000 } + HOMO_EDGE_COLOR_RANGE = (0, 17) MAP_SWIPE_MULTIPLY = (1.141, 1.162) MAP_SWIPE_MULTIPLY_MINITOUCH = (1.103, 1.123) MAP_SWIPE_MULTIPLY_MAATOUCH = (1.071, 1.090) diff --git a/campaign/event_20211229_cn/b1.py b/campaign/event_20211229_cn/b1.py index f00413606..e99cc0b57 100644 --- a/campaign/event_20211229_cn/b1.py +++ b/campaign/event_20211229_cn/b1.py @@ -63,18 +63,19 @@ class Config: MOVABLE_NORMAL_ENEMY_TURN = (2,) MAP_SIREN_MOVE_WAIT = 1.0 INTERNAL_LINES_FIND_PEAKS_PARAMETERS = { - 'height': (150, 255 - 24), + 'height': (80, 255 - 17), 'width': (0.9, 10), 'prominence': 10, 'distance': 35, } EDGE_LINES_FIND_PEAKS_PARAMETERS = { - 'height': (255 - 24, 255), + 'height': (255 - 17, 255), 'prominence': 10, 'distance': 50, 'wlen': 1000 } HOMO_EDGE_COLOR_RANGE = (0, 17) + HOMO_EDGE_HOUGHLINES_THRESHOLD = 180 MAP_SWIPE_MULTIPLY = (1.033, 1.053) MAP_SWIPE_MULTIPLY_MINITOUCH = (0.999, 1.018) MAP_SWIPE_MULTIPLY_MAATOUCH = (0.970, 0.988) diff --git a/campaign/event_20211229_cn/bs1.py b/campaign/event_20211229_cn/bs1.py index be4632caf..02b3fd4c5 100644 --- a/campaign/event_20211229_cn/bs1.py +++ b/campaign/event_20211229_cn/bs1.py @@ -54,13 +54,13 @@ class Config: # ===== End of generated config ===== INTERNAL_LINES_FIND_PEAKS_PARAMETERS = { - 'height': (150, 255 - 24), + 'height': (150, 255 - 17), 'width': (0.9, 10), 'prominence': 10, 'distance': 35, } EDGE_LINES_FIND_PEAKS_PARAMETERS = { - 'height': (255 - 24, 255), + 'height': (255 - 17, 255), 'prominence': 10, 'distance': 50, 'wlen': 1000 diff --git a/campaign/event_20211229_cn/c1.py b/campaign/event_20211229_cn/c1.py index c1dc008de..6b37ac2d8 100644 --- a/campaign/event_20211229_cn/c1.py +++ b/campaign/event_20211229_cn/c1.py @@ -54,13 +54,13 @@ class Config: # ===== End of generated config ===== INTERNAL_LINES_FIND_PEAKS_PARAMETERS = { - 'height': (150, 255 - 24), + 'height': (150, 255 - 17), 'width': (0.9, 10), 'prominence': 10, 'distance': 35, } EDGE_LINES_FIND_PEAKS_PARAMETERS = { - 'height': (255 - 24, 255), + 'height': (255 - 17, 255), 'prominence': 10, 'distance': 50, 'wlen': 1000 diff --git a/campaign/event_20211229_cn/d1.py b/campaign/event_20211229_cn/d1.py index f9e7f1cf4..aa9277389 100644 --- a/campaign/event_20211229_cn/d1.py +++ b/campaign/event_20211229_cn/d1.py @@ -63,13 +63,13 @@ class Config: MOVABLE_NORMAL_ENEMY_TURN = (2,) MAP_SIREN_MOVE_WAIT = 1.0 INTERNAL_LINES_FIND_PEAKS_PARAMETERS = { - 'height': (150, 255 - 24), + 'height': (150, 255 - 17), 'width': (0.9, 10), 'prominence': 10, 'distance': 35, } EDGE_LINES_FIND_PEAKS_PARAMETERS = { - 'height': (255 - 24, 255), + 'height': (255 - 17, 255), 'prominence': 10, 'distance': 50, 'wlen': 1000 diff --git a/campaign/event_20211229_cn/ds1.py b/campaign/event_20211229_cn/ds1.py index bb2815cf6..059d6b4ac 100644 --- a/campaign/event_20211229_cn/ds1.py +++ b/campaign/event_20211229_cn/ds1.py @@ -55,13 +55,13 @@ class Config: # ===== End of generated config ===== INTERNAL_LINES_FIND_PEAKS_PARAMETERS = { - 'height': (150, 255 - 24), + 'height': (150, 255 - 17), 'width': (0.9, 10), 'prominence': 10, 'distance': 35, } EDGE_LINES_FIND_PEAKS_PARAMETERS = { - 'height': (255 - 24, 255), + 'height': (255 - 17, 255), 'prominence': 10, 'distance': 50, 'wlen': 1000 diff --git a/campaign/event_20211229_cn/sp.py b/campaign/event_20211229_cn/sp.py index 9aa0384d3..9b5770f4e 100644 --- a/campaign/event_20211229_cn/sp.py +++ b/campaign/event_20211229_cn/sp.py @@ -65,13 +65,13 @@ class Config: # ===== End of generated config ===== INTERNAL_LINES_FIND_PEAKS_PARAMETERS = { - 'height': (150, 255 - 24), + 'height': (150, 255 - 17), 'width': (0.9, 10), 'prominence': 10, 'distance': 35, } EDGE_LINES_FIND_PEAKS_PARAMETERS = { - 'height': (255 - 24, 255), + 'height': (255 - 17, 255), 'prominence': 10, 'distance': 50, 'wlen': 1000 diff --git a/module/commission/commission.py b/module/commission/commission.py index 9518dfbe2..23c898275 100644 --- a/module/commission/commission.py +++ b/module/commission/commission.py @@ -324,13 +324,14 @@ class RewardCommission(UI, InfoHandler): self.daily_choose, self.urgent_choose = self._commission_choose(self.daily, self.urgent) return daily, urgent - def _commission_start_click(self, comm, is_urgent=False): + def _commission_start_click(self, comm, is_urgent=False, skip_first_screenshot=True): """ Start a commission. Args: comm (Commission): is_urgent (bool): + skip_first_screenshot: Returns: bool: If success @@ -345,14 +346,37 @@ class RewardCommission(UI, InfoHandler): comm_timer = Timer(7) count = 0 while 1: - if comm_timer.reached(): - self.device.click(comm.button) - self.device.sleep(0.3) - comm_timer.reset() + if skip_first_screenshot: + skip_first_screenshot = False + else: + self.device.screenshot() - if self.handle_popup_confirm('COMMISSION_START'): + # End + if self.info_bar_count(): + break + if count >= 3: + # Restart game and handle commission recommend bug. + # After you click "Recommend", your ships appear and then suddenly disappear. + # At the same time, the icon of commission is flashing. + logger.warning('Triggered commission list flashing bug') + raise GameStuckError('Triggered commission list flashing bug') + + # Click + if self.appear_then_click(COMMISSION_START, offset=(5, 20), interval=7): + self.interval_reset(COMMISSION_ADVICE) comm_timer.reset() - pass + continue + if self.handle_popup_confirm('COMMISSION_START'): + self.interval_reset(COMMISSION_ADVICE) + comm_timer.reset() + continue + # Accidentally entered dock + if self.appear(DOCK_CHECK, offset=(20, 20), interval=3): + logger.info(f'equip_enter {DOCK_CHECK} -> {BACK_ARROW}') + self.device.click(BACK_ARROW) + comm_timer.reset() + continue + # Check if is the right commission if self.appear(COMMISSION_ADVICE, offset=(5, 20), interval=7): area = (0, 0, image_size(self.device.image)[0], COMMISSION_ADVICE.button[1]) current = self.commission_detect(area=area) @@ -369,28 +393,15 @@ class RewardCommission(UI, InfoHandler): logger.warning('No selected commission detected, assuming correct') self.device.click(COMMISSION_ADVICE) count += 1 + self.interval_reset(COMMISSION_ADVICE) + self.interval_clear(COMMISSION_START) comm_timer.reset() - pass - if self.appear_then_click(COMMISSION_START, offset=(5, 20), interval=7): - comm_timer.reset() - pass - # Accidentally entered dock - if self.appear(DOCK_CHECK, offset=(20, 20), interval=3): - logger.info(f'equip_enter {DOCK_CHECK} -> {BACK_ARROW}') - self.device.click(BACK_ARROW) continue - - # End - if self.info_bar_count(): - break - if count >= 3: - # Restart game and handle commission recommend bug. - # After you click "Recommend", your ships appear and then suddenly disappear. - # At the same time, the icon of commission is flashing. - logger.warning('Triggered commission list flashing bug') - raise GameStuckError('Triggered commission list flashing bug') - - self.device.screenshot() + # Enter + if comm_timer.reached(): + self.device.click(comm.button) + self.device.sleep(0.3) + comm_timer.reset() return True diff --git a/module/map/map_operation.py b/module/map/map_operation.py index 98e1b873b..82cf85301 100644 --- a/module/map/map_operation.py +++ b/module/map/map_operation.py @@ -221,6 +221,10 @@ class MapOperation(MysteryHandler, FleetPreparation, Retirement, FastForwardHand # End if self.map_is_auto_search: if self.is_auto_search_running(): + logger.info('is_auto_search_running appeared') + break + if hasattr(self, 'is_combat_loading') and self.is_combat_loading(): + logger.warning('Entered map with is_combat_loading appeared') break else: if self.handle_in_map_with_enemy_searching(): diff --git a/module/ui/assets.py b/module/ui/assets.py index 1c1d8562b..5a49855cd 100644 --- a/module/ui/assets.py +++ b/module/ui/assets.py @@ -4,7 +4,7 @@ from module.base.template import Template # This file was automatically generated by dev_tools/button_extract.py. # Don't modify it manually. -ACADEMY_CHECK = Button(area={'cn': (121, 14, 175, 39), 'en': (120, 22, 234, 36), 'jp': (121, 14, 174, 40), 'tw': (119, 12, 178, 44)}, color={'cn': (147, 163, 200), 'en': (130, 147, 189), 'jp': (159, 174, 208), 'tw': (125, 139, 176)}, button={'cn': (121, 14, 175, 39), 'en': (120, 22, 234, 36), 'jp': (121, 14, 174, 40), 'tw': (119, 12, 178, 44)}, file={'cn': './assets/cn/ui/ACADEMY_CHECK.png', 'en': './assets/en/ui/ACADEMY_CHECK.png', 'jp': './assets/jp/ui/ACADEMY_CHECK.png', 'tw': './assets/tw/ui/ACADEMY_CHECK.png'}) +ACADEMY_CHECK = Button(area={'cn': (121, 14, 175, 39), 'en': (122, 19, 258, 35), 'jp': (121, 14, 174, 40), 'tw': (119, 12, 178, 44)}, color={'cn': (147, 163, 200), 'en': (132, 149, 191), 'jp': (159, 174, 208), 'tw': (125, 139, 176)}, button={'cn': (121, 14, 175, 39), 'en': (122, 19, 258, 35), 'jp': (121, 14, 174, 40), 'tw': (119, 12, 178, 44)}, file={'cn': './assets/cn/ui/ACADEMY_CHECK.png', 'en': './assets/en/ui/ACADEMY_CHECK.png', 'jp': './assets/jp/ui/ACADEMY_CHECK.png', 'tw': './assets/tw/ui/ACADEMY_CHECK.png'}) ACADEMY_GOTO_GAME_ROOM = Button(area={'cn': (1074, 340, 1103, 374), 'en': (1074, 340, 1103, 374), 'jp': (1074, 340, 1103, 374), 'tw': (1074, 340, 1103, 374)}, color={'cn': (208, 185, 150), 'en': (208, 185, 150), 'jp': (208, 185, 150), 'tw': (208, 185, 150)}, button={'cn': (1074, 340, 1103, 374), 'en': (1074, 340, 1103, 374), 'jp': (1074, 340, 1103, 374), 'tw': (1074, 340, 1103, 374)}, file={'cn': './assets/cn/ui/ACADEMY_GOTO_GAME_ROOM.png', 'en': './assets/en/ui/ACADEMY_GOTO_GAME_ROOM.png', 'jp': './assets/jp/ui/ACADEMY_GOTO_GAME_ROOM.png', 'tw': './assets/tw/ui/ACADEMY_GOTO_GAME_ROOM.png'}) ACADEMY_GOTO_MUNITIONS = Button(area={'cn': (1046, 188, 1137, 210), 'en': (1039, 185, 1145, 209), 'jp': (1057, 188, 1126, 210), 'tw': (1044, 184, 1139, 213)}, color={'cn': (133, 135, 165), 'en': (115, 120, 153), 'jp': (129, 133, 162), 'tw': (113, 119, 149)}, button={'cn': (1046, 188, 1137, 210), 'en': (1039, 185, 1145, 209), 'jp': (1057, 188, 1126, 210), 'tw': (1044, 184, 1139, 213)}, file={'cn': './assets/cn/ui/ACADEMY_GOTO_MUNITIONS.png', 'en': './assets/en/ui/ACADEMY_GOTO_MUNITIONS.png', 'jp': './assets/jp/ui/ACADEMY_GOTO_MUNITIONS.png', 'tw': './assets/tw/ui/ACADEMY_GOTO_MUNITIONS.png'}) BACK_ARROW = Button(area={'cn': (33, 44, 47, 64), 'en': (33, 44, 47, 64), 'jp': (33, 44, 47, 64), 'tw': (33, 44, 47, 64)}, color={'cn': (112, 118, 152), 'en': (112, 118, 152), 'jp': (112, 118, 152), 'tw': (112, 118, 152)}, button={'cn': (33, 31, 81, 78), 'en': (33, 31, 81, 78), 'jp': (33, 31, 81, 78), 'tw': (33, 31, 81, 78)}, file={'cn': './assets/cn/ui/BACK_ARROW.png', 'en': './assets/en/ui/BACK_ARROW.png', 'jp': './assets/jp/ui/BACK_ARROW.png', 'tw': './assets/tw/ui/BACK_ARROW.png'})