Skip to content

Commit

Permalink
Fix: Handle auto search, disable it currently
Browse files Browse the repository at this point in the history
  • Loading branch information
LmeSzinc committed Jan 21, 2021
1 parent 191274c commit 453b38f
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 2 deletions.
Binary file added assets/cn/handler/AUTO_SEARCH_OFF.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/cn/handler/AUTO_SEARCH_ON.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/cn/handler/FAST_FORWARD_OFF.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/cn/handler/FAST_FORWARD_ON.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions module/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ def FLEET_1_STEP(self, value):

ENABLE_STOP_CONDITION = True
ENABLE_FAST_FORWARD = True
ENABLE_AUTO_SEARCH = False
STOP_IF_OIL_LOWER_THAN = 5000
STOP_IF_COUNT_GREATER_THAN = 0
STOP_IF_TIME_REACH = 0
Expand Down
6 changes: 4 additions & 2 deletions module/handler/assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
# This file was automatically generated by dev_tools.button_extract.
# Don't modify it manually.

FAST_FORWARD_OFF = Button(area={'cn': (984, 587, 1021, 606), 'en': (984, 587, 1021, 606), 'jp': (984, 587, 1021, 606), 'tw': (984, 587, 1021, 606)}, color={'cn': (252, 252, 252), 'en': (252, 252, 252), 'jp': (252, 252, 252), 'tw': (252, 252, 252)}, button={'cn': (984, 587, 1021, 606), 'en': (984, 587, 1021, 606), 'jp': (984, 587, 1021, 606), 'tw': (984, 587, 1021, 606)}, file={'cn': './assets/cn/handler/FAST_FORWARD_OFF.png', 'en': './assets/en/handler/FAST_FORWARD_OFF.png', 'jp': './assets/jp/handler/FAST_FORWARD_OFF.png', 'tw': './assets/tw/handler/FAST_FORWARD_OFF.png'})
FAST_FORWARD_ON = Button(area={'cn': (1025, 587, 1063, 606), 'en': (1025, 587, 1063, 606), 'jp': (1025, 587, 1063, 606), 'tw': (1025, 587, 1063, 606)}, color={'cn': (252, 252, 252), 'en': (252, 252, 252), 'jp': (252, 252, 252), 'tw': (252, 252, 252)}, button={'cn': (1025, 587, 1063, 606), 'en': (1025, 587, 1063, 606), 'jp': (1025, 587, 1063, 606), 'tw': (1025, 587, 1063, 606)}, file={'cn': './assets/cn/handler/FAST_FORWARD_ON.png', 'en': './assets/en/handler/FAST_FORWARD_ON.png', 'jp': './assets/jp/handler/FAST_FORWARD_ON.png', 'tw': './assets/tw/handler/FAST_FORWARD_ON.png'})
AUTO_SEARCH_OFF = Button(area={'cn': (869, 588, 885, 604), 'en': (869, 588, 885, 604), 'jp': (869, 588, 885, 604), 'tw': (869, 588, 885, 604)}, color={'cn': (96, 97, 102), 'en': (96, 97, 102), 'jp': (96, 97, 102), 'tw': (96, 97, 102)}, button={'cn': (869, 588, 885, 604), 'en': (869, 588, 885, 604), 'jp': (869, 588, 885, 604), 'tw': (869, 588, 885, 604)}, file={'cn': './assets/cn/handler/AUTO_SEARCH_OFF.png', 'en': './assets/cn/handler/AUTO_SEARCH_OFF.png', 'jp': './assets/cn/handler/AUTO_SEARCH_OFF.png', 'tw': './assets/cn/handler/AUTO_SEARCH_OFF.png'})
AUTO_SEARCH_ON = Button(area={'cn': (869, 588, 885, 604), 'en': (869, 588, 885, 604), 'jp': (869, 588, 885, 604), 'tw': (869, 588, 885, 604)}, color={'cn': (139, 167, 119), 'en': (139, 167, 119), 'jp': (139, 167, 119), 'tw': (139, 167, 119)}, button={'cn': (869, 588, 885, 604), 'en': (869, 588, 885, 604), 'jp': (869, 588, 885, 604), 'tw': (869, 588, 885, 604)}, file={'cn': './assets/cn/handler/AUTO_SEARCH_ON.png', 'en': './assets/cn/handler/AUTO_SEARCH_ON.png', 'jp': './assets/cn/handler/AUTO_SEARCH_ON.png', 'tw': './assets/cn/handler/AUTO_SEARCH_ON.png'})
FAST_FORWARD_OFF = Button(area={'cn': (982, 587, 1022, 605), 'en': (984, 587, 1021, 606), 'jp': (984, 587, 1021, 606), 'tw': (984, 587, 1021, 606)}, color={'cn': (251, 251, 251), 'en': (252, 252, 252), 'jp': (252, 252, 252), 'tw': (252, 252, 252)}, button={'cn': (982, 587, 1022, 605), 'en': (984, 587, 1021, 606), 'jp': (984, 587, 1021, 606), 'tw': (984, 587, 1021, 606)}, file={'cn': './assets/cn/handler/FAST_FORWARD_OFF.png', 'en': './assets/en/handler/FAST_FORWARD_OFF.png', 'jp': './assets/jp/handler/FAST_FORWARD_OFF.png', 'tw': './assets/tw/handler/FAST_FORWARD_OFF.png'})
FAST_FORWARD_ON = Button(area={'cn': (1024, 587, 1064, 605), 'en': (1025, 587, 1063, 606), 'jp': (1025, 587, 1063, 606), 'tw': (1025, 587, 1063, 606)}, color={'cn': (251, 251, 251), 'en': (252, 252, 252), 'jp': (252, 252, 252), 'tw': (252, 252, 252)}, button={'cn': (1024, 587, 1064, 605), 'en': (1025, 587, 1063, 606), 'jp': (1025, 587, 1063, 606), 'tw': (1025, 587, 1063, 606)}, file={'cn': './assets/cn/handler/FAST_FORWARD_ON.png', 'en': './assets/en/handler/FAST_FORWARD_ON.png', 'jp': './assets/jp/handler/FAST_FORWARD_ON.png', 'tw': './assets/tw/handler/FAST_FORWARD_ON.png'})
FLEET_LOCKED = Button(area={'cn': (1185, 501, 1192, 519), 'en': (1184, 502, 1191, 519), 'jp': (1172, 496, 1180, 531), 'tw': (1185, 501, 1192, 519)}, color={'cn': (59, 100, 110), 'en': (61, 102, 111), 'jp': (56, 87, 103), 'tw': (59, 100, 110)}, button={'cn': (1185, 501, 1192, 519), 'en': (1184, 502, 1191, 519), 'jp': (1172, 496, 1180, 531), 'tw': (1185, 501, 1192, 519)}, file={'cn': './assets/cn/handler/FLEET_LOCKED.png', 'en': './assets/en/handler/FLEET_LOCKED.png', 'jp': './assets/jp/handler/FLEET_LOCKED.png', 'tw': './assets/tw/handler/FLEET_LOCKED.png'})
FLEET_UNLOCKED = Button(area={'cn': (1185, 492, 1192, 525), 'en': (1184, 496, 1191, 522), 'jp': (1171, 492, 1181, 531), 'tw': (1185, 492, 1192, 525)}, color={'cn': (84, 74, 98), 'en': (95, 81, 101), 'jp': (80, 75, 103), 'tw': (84, 74, 98)}, button={'cn': (1185, 492, 1192, 525), 'en': (1184, 496, 1191, 522), 'jp': (1171, 492, 1181, 531), 'tw': (1185, 492, 1192, 525)}, file={'cn': './assets/cn/handler/FLEET_UNLOCKED.png', 'en': './assets/en/handler/FLEET_UNLOCKED.png', 'jp': './assets/jp/handler/FLEET_UNLOCKED.png', 'tw': './assets/tw/handler/FLEET_UNLOCKED.png'})
FORMATION_1 = Button(area={'cn': (1108, 415, 1170, 477), 'en': (1108, 415, 1170, 477), 'jp': (1108, 415, 1170, 477), 'tw': (1108, 415, 1170, 477)}, color={'cn': (80, 82, 93), 'en': (80, 82, 93), 'jp': (80, 82, 93), 'tw': (80, 82, 93)}, button={'cn': (1108, 415, 1170, 477), 'en': (1108, 415, 1170, 477), 'jp': (1108, 415, 1170, 477), 'tw': (1108, 415, 1170, 477)}, file={'cn': './assets/cn/handler/FORMATION_1.png', 'en': './assets/en/handler/FORMATION_1.png', 'jp': './assets/jp/handler/FORMATION_1.png', 'tw': './assets/tw/handler/FORMATION_1.png'})
Expand Down
26 changes: 26 additions & 0 deletions module/handler/fast_forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
fleet_lock = Switch('Fleet_Lock', offset=(5, 5))
fleet_lock.add_status('on', check_button=FLEET_LOCKED)
fleet_lock.add_status('off', check_button=FLEET_UNLOCKED)
auto_search = Switch('Auto_Search', offset=(20, 20))
auto_search.add_status('on', check_button=AUTO_SEARCH_ON)
auto_search.add_status('off', check_button=AUTO_SEARCH_OFF)


class FastForwardHandler(ModuleBase):
Expand Down Expand Up @@ -89,10 +92,33 @@ def handle_map_fleet_lock(self):

return changed

def handle_auto_search(self):
"""
Returns:
bool: If changed
Pages:
in: MAP_PREPARATION
"""
# if not self.map_is_clear_mode:
# return False

if not auto_search.appear(main=self):
logger.info('No auto search option.')
return False

status = 'on' if self.config.ENABLE_AUTO_SEARCH else 'off'
changed = auto_search.set(status=status, main=self)

return changed

def get_map_clear_percentage(self):
"""
Returns:
float: 0 to 1.
Pages:
in: MAP_PREPARATION
"""
return color_bar_percentage(self.device.image, area=MAP_CLEAR_PERCENTAGE.area, prev_color=(231, 170, 82))

Expand Down
1 change: 1 addition & 0 deletions module/map/map_operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def enter_map(self, button, mode='normal'):
if map_timer.reached() and self.handle_map_preparation():
self.map_get_info()
self.handle_fast_forward()
self.handle_auto_search()
if self.triggered_map_stop():
self.enter_map_cancel()
raise ScriptEnd(f'Reach condition: {self.config.STOP_IF_MAP_REACH}')
Expand Down

0 comments on commit 453b38f

Please sign in to comment.