Add: handle_map_walk_speedup()

This commit is contained in:
LmeSzinc 2023-08-03 22:59:37 +08:00
parent dae4b26147
commit d389f75c5f
9 changed files with 31 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

View File

@ -51,6 +51,7 @@ class Config:
MAP_HAS_MYSTERY = False
# ===== End of generated config =====
MAP_HAS_WALK_SPEEDUP = True
MAP_HAS_MOVABLE_NORMAL_ENEMY = True
MOVABLE_NORMAL_ENEMY_TURN = (2,)
MAP_SIREN_MOVE_WAIT = 0.5

View File

@ -110,6 +110,7 @@ class ManualConfig:
module.map.fleet
"""
MAP_HAS_CLEAR_PERCENTAGE = True
MAP_HAS_WALK_SPEEDUP = False
MAP_HAS_AMBUSH = True
MAP_HAS_FLEET_STEP = False
MAP_HAS_MOVABLE_ENEMY = False

View File

@ -63,6 +63,7 @@ MAP_STAR_1 = Button(area={'cn': (245, 377, 254, 384), 'en': (232, 381, 240, 389)
MAP_STAR_2 = Button(area={'cn': (532, 377, 540, 384), 'en': (518, 382, 526, 389), 'jp': (532, 377, 540, 384), 'tw': (532, 377, 540, 384)}, color={'cn': (251, 233, 144), 'en': (252, 234, 144), 'jp': (251, 233, 144), 'tw': (251, 233, 144)}, button={'cn': (532, 377, 540, 384), 'en': (518, 382, 526, 389), 'jp': (532, 377, 540, 384), 'tw': (532, 377, 540, 384)}, file={'cn': './assets/cn/handler/MAP_STAR_2.png', 'en': './assets/en/handler/MAP_STAR_2.png', 'jp': './assets/jp/handler/MAP_STAR_2.png', 'tw': './assets/tw/handler/MAP_STAR_2.png'})
MAP_STAR_3 = Button(area={'cn': (818, 377, 827, 384), 'en': (804, 382, 812, 389), 'jp': (818, 377, 827, 384), 'tw': (818, 377, 827, 384)}, color={'cn': (251, 233, 143), 'en': (252, 234, 144), 'jp': (251, 233, 143), 'tw': (251, 233, 143)}, button={'cn': (818, 377, 827, 384), 'en': (804, 382, 812, 389), 'jp': (818, 377, 827, 384), 'tw': (818, 377, 827, 384)}, file={'cn': './assets/cn/handler/MAP_STAR_3.png', 'en': './assets/en/handler/MAP_STAR_3.png', 'jp': './assets/jp/handler/MAP_STAR_3.png', 'tw': './assets/tw/handler/MAP_STAR_3.png'})
MAP_WALK_OUT_OF_STEP = Button(area={'cn': (654, 312, 704, 335), 'en': (454, 314, 698, 338), 'jp': (736, 312, 783, 336), 'tw': (653, 309, 705, 334)}, color={'cn': (109, 113, 120), 'en': (108, 109, 116), 'jp': (137, 135, 143), 'tw': (118, 124, 132)}, button={'cn': (654, 312, 704, 335), 'en': (454, 314, 698, 338), 'jp': (736, 312, 783, 336), 'tw': (653, 309, 705, 334)}, file={'cn': './assets/cn/handler/MAP_WALK_OUT_OF_STEP.png', 'en': './assets/en/handler/MAP_WALK_OUT_OF_STEP.png', 'jp': './assets/jp/handler/MAP_WALK_OUT_OF_STEP.png', 'tw': './assets/tw/handler/MAP_WALK_OUT_OF_STEP.png'})
MAP_WALK_SPEEDUP = Button(area={'cn': (1025, 406, 1055, 436), 'en': (1025, 406, 1055, 436), 'jp': (1025, 406, 1055, 436), 'tw': (1025, 406, 1055, 436)}, color={'cn': (62, 97, 72), 'en': (62, 97, 72), 'jp': (62, 97, 72), 'tw': (62, 97, 72)}, button={'cn': (1025, 406, 1055, 436), 'en': (1025, 406, 1055, 436), 'jp': (1025, 406, 1055, 436), 'tw': (1025, 406, 1055, 436)}, file={'cn': './assets/cn/handler/MAP_WALK_SPEEDUP.png', 'en': './assets/en/handler/MAP_WALK_SPEEDUP.png', 'jp': './assets/jp/handler/MAP_WALK_SPEEDUP.png', 'tw': './assets/tw/handler/MAP_WALK_SPEEDUP.png'})
MISSION_POPUP_ACK = Button(area={'cn': (413, 489, 566, 532), 'en': (413, 489, 566, 532), 'jp': (410, 482, 574, 539), 'tw': (413, 489, 566, 532)}, color={'cn': (169, 170, 172), 'en': (169, 170, 172), 'jp': (162, 164, 167), 'tw': (169, 170, 172)}, button={'cn': (413, 489, 566, 532), 'en': (413, 489, 566, 532), 'jp': (410, 482, 574, 539), 'tw': (413, 489, 566, 532)}, file={'cn': './assets/cn/handler/MISSION_POPUP_ACK.png', 'en': './assets/en/handler/MISSION_POPUP_ACK.png', 'jp': './assets/jp/handler/MISSION_POPUP_ACK.png', 'tw': './assets/tw/handler/MISSION_POPUP_ACK.png'})
MISSION_POPUP_GO = Button(area={'cn': (716, 488, 869, 533), 'en': (716, 488, 869, 533), 'jp': (711, 482, 874, 539), 'tw': (716, 488, 869, 533)}, color={'cn': (89, 138, 201), 'en': (89, 138, 201), 'jp': (93, 142, 204), 'tw': (89, 138, 201)}, button={'cn': (716, 488, 869, 533), 'en': (716, 488, 869, 533), 'jp': (711, 482, 874, 539), 'tw': (716, 488, 869, 533)}, file={'cn': './assets/cn/handler/MISSION_POPUP_GO.png', 'en': './assets/en/handler/MISSION_POPUP_GO.png', 'jp': './assets/jp/handler/MISSION_POPUP_GO.png', 'tw': './assets/tw/handler/MISSION_POPUP_GO.png'})
MONTHLY_PASS_NOTICE = Button(area={'cn': (554, 505, 726, 561), 'en': (716, 488, 869, 533), 'jp': (554, 505, 726, 561), 'tw': (554, 505, 726, 561)}, color={'cn': (109, 153, 208), 'en': (89, 138, 201), 'jp': (109, 153, 208), 'tw': (109, 153, 208)}, button={'cn': (872, 152, 939, 196), 'en': (863, 173, 929, 217), 'jp': (872, 152, 939, 196), 'tw': (872, 152, 939, 196)}, file={'cn': './assets/cn/handler/MONTHLY_PASS_NOTICE.png', 'en': './assets/en/handler/MONTHLY_PASS_NOTICE.png', 'jp': './assets/cn/handler/MONTHLY_PASS_NOTICE.png', 'tw': './assets/cn/handler/MONTHLY_PASS_NOTICE.png'})

View File

@ -475,3 +475,30 @@ class FastForwardHandler(AutoSearchHandler):
return True
return False
def handle_map_walk_speedup(self, skip_first_screenshot=True):
"""
Turn on walk speedup, no reason to turn it off
"""
if not self.config.MAP_HAS_WALK_SPEEDUP:
return False
timeout = Timer(2, count=4).start()
interval = Timer(1, count=2)
while 1:
if skip_first_screenshot:
skip_first_screenshot = False
else:
self.device.screenshot()
if self.image_color_count(MAP_WALK_SPEEDUP, color=(132, 255, 148), threshold=180, count=50):
logger.attr('Walk_Speedup', 'on')
return True
if timeout.reached():
logger.warning(f'Wait time has expired; Cannot set map walk speedup')
return False
if interval.reached():
self.device.click(MAP_WALK_SPEEDUP)
interval.reset()
continue

View File

@ -148,6 +148,7 @@ class MapOperation(MysteryHandler, FleetPreparation, Retirement, FastForwardHand
# Map preparation
if map_timer.reached() and self.handle_map_preparation():
self.map_get_info()
self.handle_map_walk_speedup()
self.handle_fast_forward()
self.handle_auto_search()
if self.triggered_map_stop():