Merge pull request #3427 from LmeSzinc/dev

Bug fix
This commit is contained in:
LmeSzinc 2024-01-12 18:51:02 +08:00 committed by GitHub
commit 6a78be535b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 59 additions and 42 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

@ -54,17 +54,18 @@ class Config:
# ===== End of generated config ===== # ===== End of generated config =====
INTERNAL_LINES_FIND_PEAKS_PARAMETERS = { INTERNAL_LINES_FIND_PEAKS_PARAMETERS = {
'height': (80, 255 - 40), 'height': (80, 255 - 17),
'width': (0.9, 10), 'width': (0.9, 10),
'prominence': 10, 'prominence': 10,
'distance': 35, 'distance': 35,
} }
EDGE_LINES_FIND_PEAKS_PARAMETERS = { EDGE_LINES_FIND_PEAKS_PARAMETERS = {
'height': (255 - 24, 255), 'height': (255 - 17, 255),
'prominence': 10, 'prominence': 10,
'distance': 50, 'distance': 50,
'wlen': 1000 'wlen': 1000
} }
HOMO_EDGE_COLOR_RANGE = (0, 17)
MAP_SWIPE_MULTIPLY = (1.141, 1.162) MAP_SWIPE_MULTIPLY = (1.141, 1.162)
MAP_SWIPE_MULTIPLY_MINITOUCH = (1.103, 1.123) MAP_SWIPE_MULTIPLY_MINITOUCH = (1.103, 1.123)
MAP_SWIPE_MULTIPLY_MAATOUCH = (1.071, 1.090) MAP_SWIPE_MULTIPLY_MAATOUCH = (1.071, 1.090)

View File

@ -63,18 +63,19 @@ class Config:
MOVABLE_NORMAL_ENEMY_TURN = (2,) MOVABLE_NORMAL_ENEMY_TURN = (2,)
MAP_SIREN_MOVE_WAIT = 1.0 MAP_SIREN_MOVE_WAIT = 1.0
INTERNAL_LINES_FIND_PEAKS_PARAMETERS = { INTERNAL_LINES_FIND_PEAKS_PARAMETERS = {
'height': (150, 255 - 24), 'height': (80, 255 - 17),
'width': (0.9, 10), 'width': (0.9, 10),
'prominence': 10, 'prominence': 10,
'distance': 35, 'distance': 35,
} }
EDGE_LINES_FIND_PEAKS_PARAMETERS = { EDGE_LINES_FIND_PEAKS_PARAMETERS = {
'height': (255 - 24, 255), 'height': (255 - 17, 255),
'prominence': 10, 'prominence': 10,
'distance': 50, 'distance': 50,
'wlen': 1000 'wlen': 1000
} }
HOMO_EDGE_COLOR_RANGE = (0, 17) HOMO_EDGE_COLOR_RANGE = (0, 17)
HOMO_EDGE_HOUGHLINES_THRESHOLD = 180
MAP_SWIPE_MULTIPLY = (1.033, 1.053) MAP_SWIPE_MULTIPLY = (1.033, 1.053)
MAP_SWIPE_MULTIPLY_MINITOUCH = (0.999, 1.018) MAP_SWIPE_MULTIPLY_MINITOUCH = (0.999, 1.018)
MAP_SWIPE_MULTIPLY_MAATOUCH = (0.970, 0.988) MAP_SWIPE_MULTIPLY_MAATOUCH = (0.970, 0.988)

View File

@ -54,13 +54,13 @@ class Config:
# ===== End of generated config ===== # ===== End of generated config =====
INTERNAL_LINES_FIND_PEAKS_PARAMETERS = { INTERNAL_LINES_FIND_PEAKS_PARAMETERS = {
'height': (150, 255 - 24), 'height': (150, 255 - 17),
'width': (0.9, 10), 'width': (0.9, 10),
'prominence': 10, 'prominence': 10,
'distance': 35, 'distance': 35,
} }
EDGE_LINES_FIND_PEAKS_PARAMETERS = { EDGE_LINES_FIND_PEAKS_PARAMETERS = {
'height': (255 - 24, 255), 'height': (255 - 17, 255),
'prominence': 10, 'prominence': 10,
'distance': 50, 'distance': 50,
'wlen': 1000 'wlen': 1000

View File

@ -54,13 +54,13 @@ class Config:
# ===== End of generated config ===== # ===== End of generated config =====
INTERNAL_LINES_FIND_PEAKS_PARAMETERS = { INTERNAL_LINES_FIND_PEAKS_PARAMETERS = {
'height': (150, 255 - 24), 'height': (150, 255 - 17),
'width': (0.9, 10), 'width': (0.9, 10),
'prominence': 10, 'prominence': 10,
'distance': 35, 'distance': 35,
} }
EDGE_LINES_FIND_PEAKS_PARAMETERS = { EDGE_LINES_FIND_PEAKS_PARAMETERS = {
'height': (255 - 24, 255), 'height': (255 - 17, 255),
'prominence': 10, 'prominence': 10,
'distance': 50, 'distance': 50,
'wlen': 1000 'wlen': 1000

View File

@ -63,13 +63,13 @@ class Config:
MOVABLE_NORMAL_ENEMY_TURN = (2,) MOVABLE_NORMAL_ENEMY_TURN = (2,)
MAP_SIREN_MOVE_WAIT = 1.0 MAP_SIREN_MOVE_WAIT = 1.0
INTERNAL_LINES_FIND_PEAKS_PARAMETERS = { INTERNAL_LINES_FIND_PEAKS_PARAMETERS = {
'height': (150, 255 - 24), 'height': (150, 255 - 17),
'width': (0.9, 10), 'width': (0.9, 10),
'prominence': 10, 'prominence': 10,
'distance': 35, 'distance': 35,
} }
EDGE_LINES_FIND_PEAKS_PARAMETERS = { EDGE_LINES_FIND_PEAKS_PARAMETERS = {
'height': (255 - 24, 255), 'height': (255 - 17, 255),
'prominence': 10, 'prominence': 10,
'distance': 50, 'distance': 50,
'wlen': 1000 'wlen': 1000

View File

@ -55,13 +55,13 @@ class Config:
# ===== End of generated config ===== # ===== End of generated config =====
INTERNAL_LINES_FIND_PEAKS_PARAMETERS = { INTERNAL_LINES_FIND_PEAKS_PARAMETERS = {
'height': (150, 255 - 24), 'height': (150, 255 - 17),
'width': (0.9, 10), 'width': (0.9, 10),
'prominence': 10, 'prominence': 10,
'distance': 35, 'distance': 35,
} }
EDGE_LINES_FIND_PEAKS_PARAMETERS = { EDGE_LINES_FIND_PEAKS_PARAMETERS = {
'height': (255 - 24, 255), 'height': (255 - 17, 255),
'prominence': 10, 'prominence': 10,
'distance': 50, 'distance': 50,
'wlen': 1000 'wlen': 1000

View File

@ -65,13 +65,13 @@ class Config:
# ===== End of generated config ===== # ===== End of generated config =====
INTERNAL_LINES_FIND_PEAKS_PARAMETERS = { INTERNAL_LINES_FIND_PEAKS_PARAMETERS = {
'height': (150, 255 - 24), 'height': (150, 255 - 17),
'width': (0.9, 10), 'width': (0.9, 10),
'prominence': 10, 'prominence': 10,
'distance': 35, 'distance': 35,
} }
EDGE_LINES_FIND_PEAKS_PARAMETERS = { EDGE_LINES_FIND_PEAKS_PARAMETERS = {
'height': (255 - 24, 255), 'height': (255 - 17, 255),
'prominence': 10, 'prominence': 10,
'distance': 50, 'distance': 50,
'wlen': 1000 'wlen': 1000

View File

@ -324,13 +324,14 @@ class RewardCommission(UI, InfoHandler):
self.daily_choose, self.urgent_choose = self._commission_choose(self.daily, self.urgent) self.daily_choose, self.urgent_choose = self._commission_choose(self.daily, self.urgent)
return daily, 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. Start a commission.
Args: Args:
comm (Commission): comm (Commission):
is_urgent (bool): is_urgent (bool):
skip_first_screenshot:
Returns: Returns:
bool: If success bool: If success
@ -345,14 +346,37 @@ class RewardCommission(UI, InfoHandler):
comm_timer = Timer(7) comm_timer = Timer(7)
count = 0 count = 0
while 1: while 1:
if comm_timer.reached(): if skip_first_screenshot:
self.device.click(comm.button) skip_first_screenshot = False
self.device.sleep(0.3) else:
comm_timer.reset() 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() 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): if self.appear(COMMISSION_ADVICE, offset=(5, 20), interval=7):
area = (0, 0, image_size(self.device.image)[0], COMMISSION_ADVICE.button[1]) area = (0, 0, image_size(self.device.image)[0], COMMISSION_ADVICE.button[1])
current = self.commission_detect(area=area) current = self.commission_detect(area=area)
@ -369,28 +393,15 @@ class RewardCommission(UI, InfoHandler):
logger.warning('No selected commission detected, assuming correct') logger.warning('No selected commission detected, assuming correct')
self.device.click(COMMISSION_ADVICE) self.device.click(COMMISSION_ADVICE)
count += 1 count += 1
self.interval_reset(COMMISSION_ADVICE)
self.interval_clear(COMMISSION_START)
comm_timer.reset() 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 continue
# Enter
# End if comm_timer.reached():
if self.info_bar_count(): self.device.click(comm.button)
break self.device.sleep(0.3)
if count >= 3: comm_timer.reset()
# 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()
return True return True

View File

@ -221,6 +221,10 @@ class MapOperation(MysteryHandler, FleetPreparation, Retirement, FastForwardHand
# End # End
if self.map_is_auto_search: if self.map_is_auto_search:
if self.is_auto_search_running(): 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 break
else: else:
if self.handle_in_map_with_enemy_searching(): if self.handle_in_map_with_enemy_searching():

View File

@ -4,7 +4,7 @@ from module.base.template import Template
# This file was automatically generated by dev_tools/button_extract.py. # This file was automatically generated by dev_tools/button_extract.py.
# Don't modify it manually. # 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_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'}) 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'}) 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'})