1
0
mirror of https://gitee.com/sui-feng-cb/AzurLaneAutoScript1 synced 2026-03-18 01:01:29 +08:00

Merge pull request #132 from LmeSzinc/master

Add: Option map_green_without_3_star to setting if_map_reach
This commit is contained in:
Kyo
2020-08-10 21:04:02 -03:00
committed by GitHub
19 changed files with 217 additions and 105 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 8.3 KiB

View File

@@ -65,7 +65,7 @@ class Config:
MAP_HAS_DYNAMIC_RED_BORDER = False MAP_HAS_DYNAMIC_RED_BORDER = False
# MAP_HAS_MAP_STORY = True # MAP_HAS_MAP_STORY = True
MAP_SIREN_COUNT = 3 MAP_SIREN_COUNT = 3
MAP_STAR_CLEAR_ALL = 0 # SP map don't need to clear all enemies. STAR_REQUIRE_3 = 0 # SP map don't need to clear all enemies.
HOMO_EDGE_HOUGHLINES_THRESHOLD = 280 HOMO_EDGE_HOUGHLINES_THRESHOLD = 280
MAP_SIREN_TEMPLATE = ['Deutschland', 'Tirpitz', 'Gneisenau', 'Scharnhorst', 'Spee'] MAP_SIREN_TEMPLATE = ['Deutschland', 'Tirpitz', 'Gneisenau', 'Scharnhorst', 'Spee']

View File

@@ -8,6 +8,7 @@ enable_fast_forward = yes
if_count_greater_than = 0 if_count_greater_than = 0
if_time_reach = 0 if_time_reach = 0
if_oil_lower_than = 0 if_oil_lower_than = 0
if_map_reach = no
if_trigger_emotion_control = no if_trigger_emotion_control = no
if_dock_full = no if_dock_full = no
enable_fleet_control = yes enable_fleet_control = yes
@@ -55,9 +56,6 @@ retire_sr = no
retire_ssr = no retire_ssr = no
enable_drop_screenshot = no enable_drop_screenshot = no
drop_screenshot_folder = drop_screenshot_folder =
enable_map_clear_mode = yes
clear_mode_stop_condition = map_green
map_star_clear_all = index_3
command = setting command = setting
[Reward] [Reward]
@@ -92,6 +90,7 @@ urgent_ship = 155
tactical_book_tier_max = 3 tactical_book_tier_max = 3
tactical_book_tier_min = 2 tactical_book_tier_min = 2
tactical_exp_first = yes tactical_exp_first = yes
tactical_if_no_book_satisfied = cancel_tactical
enable_research_reward = no enable_research_reward = no
research_use_cube = no research_use_cube = no
research_use_coin = yes research_use_coin = yes

View File

@@ -103,6 +103,7 @@ def main(ini_name=''):
stop.add_argument('--如果出击次数大于', default=default('--如果出击次数大于'), help='会沿用先前设置, 完成出击将扣除次数, 直至清零') stop.add_argument('--如果出击次数大于', default=default('--如果出击次数大于'), help='会沿用先前设置, 完成出击将扣除次数, 直至清零')
stop.add_argument('--如果时间超过', default=default('--如果时间超过'), help='使用未来24小时内的时间, 会沿用先前设置, 触发后清零. 建议提前10分钟左右, 以完成当前出击. 格式 14:59') stop.add_argument('--如果时间超过', default=default('--如果时间超过'), help='使用未来24小时内的时间, 会沿用先前设置, 触发后清零. 建议提前10分钟左右, 以完成当前出击. 格式 14:59')
stop.add_argument('--如果石油低于', default=default('--如果石油低于')) stop.add_argument('--如果石油低于', default=default('--如果石油低于'))
stop.add_argument('--如果地图开荒', default=default('--如果地图开荒'), choices=['', '地图通关', '地图三星', '地图绿海不打三星', '地图绿海'], help='如果已经满足, 无视此设置')
stop.add_argument('--如果触发心情控制', default=default('--如果触发心情控制'), choices=['', ''], help='若是, 等待回复, 完成本次, 停止\n若否, 等待回复, 完成本次, 继续') stop.add_argument('--如果触发心情控制', default=default('--如果触发心情控制'), choices=['', ''], help='若是, 等待回复, 完成本次, 停止\n若否, 等待回复, 完成本次, 继续')
# stop.add_argument('--如果船舱已满', default=default('--如果船舱已满'), choices=['是', '否']) # stop.add_argument('--如果船舱已满', default=default('--如果船舱已满'), choices=['是', '否'])
@@ -173,7 +174,7 @@ def main(ini_name=''):
retire.add_argument('--退役方案', default=default('--退役方案'), choices=['强化角色', '一键退役', '传统退役']) retire.add_argument('--退役方案', default=default('--退役方案'), choices=['强化角色', '一键退役', '传统退役'])
retire.add_argument('--退役数量', default=default('--退役数量'), choices=['退役全部', '退役10个']) retire.add_argument('--退役数量', default=default('--退役数量'), choices=['退役全部', '退役10个'])
retire.add_argument('--强化常用角色', default=default('--强化常用角色'), choices=['', '']) retire.add_argument('--强化常用角色', default=default('--强化常用角色'), choices=['', ''])
retire.add_argument('--enhance_order_string', default=default('--enhance_order_string'), help='Use example format "cv > bb > ..." may omit a ship type category altogether to skip otherwise leave blank to use default enhance method') retire.add_argument('--强化过滤字符串', default=default('--强化过滤字符串'), help='格式: "cv > bb > ...", 留空则使用默认强化方式')
rarity = retire.add_argument_group('退役稀有度', '暂不支持舰种选择, 使用一键退役时忽略以下选项') rarity = retire.add_argument_group('退役稀有度', '暂不支持舰种选择, 使用一键退役时忽略以下选项')
rarity.add_argument('--退役白皮', default=default('--退役白皮'), choices=['', ''], help='N') rarity.add_argument('--退役白皮', default=default('--退役白皮'), choices=['', ''], help='N')
@@ -186,10 +187,10 @@ def main(ini_name=''):
drop.add_argument('--启用掉落记录', default=default('--启用掉落记录'), choices=['', '']) drop.add_argument('--启用掉落记录', default=default('--启用掉落记录'), choices=['', ''])
drop.add_argument('--掉落保存目录', default=default('--掉落保存目录')) drop.add_argument('--掉落保存目录', default=default('--掉落保存目录'))
clear = setting_parser.add_argument_group('开荒模式', '未开荒地图会在完成后停止, 已开荒的地图会忽略选项, 无脑开就完事了') # clear = setting_parser.add_argument_group('开荒模式', '未开荒地图会在完成后停止, 已开荒的地图会忽略选项, 无脑开就完事了')
clear.add_argument('--启用开荒', default=default('--启用开荒'), choices=['', '']) # clear.add_argument('--启用开荒', default=default('--启用开荒'), choices=['是', '否'])
clear.add_argument('--开荒停止条件', default=default('--开荒停止条件'), choices=['地图通关', '地图三星', '地图绿海']) # clear.add_argument('--开荒停止条件', default=default('--开荒停止条件'), choices=['地图通关', '地图三星', '地图绿海'])
clear.add_argument('--地图全清星星', default=default('--地图全清星星'), choices=['第一个', '第二个', '第三个', '不使用'], help='第几颗星星是击破所有敌舰') # clear.add_argument('--地图全清星星', default=default('--地图全清星星'), choices=['第一个', '第二个', '第三个', '不使用'], help='第几颗星星是击破所有敌舰')
# ==========收菜设置========== # ==========收菜设置==========
reward_parser = subs.add_parser('收菜设置') reward_parser = subs.add_parser('收菜设置')
@@ -243,6 +244,7 @@ def main(ini_name=''):
reward_tactical.add_argument('--技能书最小稀有度', default=default('--技能书最小稀有度'), choices=['3', '2', '1'], help='最低使用T几的技能书\n') reward_tactical.add_argument('--技能书最小稀有度', default=default('--技能书最小稀有度'), choices=['3', '2', '1'], help='最低使用T几的技能书\n')
# reward_tactical.add_argument('--技能书夜间稀有度', default=default('--技能书夜间稀有度'), choices=['3', '2', '1']) # reward_tactical.add_argument('--技能书夜间稀有度', default=default('--技能书夜间稀有度'), choices=['3', '2', '1'])
# reward_tactical.add_argument('--技能书夜间优先使用同类型', default=default('--技能书夜间优先使用同类型'), choices=['是', '否']) # reward_tactical.add_argument('--技能书夜间优先使用同类型', default=default('--技能书夜间优先使用同类型'), choices=['是', '否'])
reward_tactical.add_argument('--如果无技能书可用', default=default('--如果无技能书可用'), choices=['停止学习', '使用第一本'])
reward_research = reward_parser.add_argument_group('科研项目', '科研预设选择为自定义时, 须先阅读 doc/filter_string_en_cn.md') reward_research = reward_parser.add_argument_group('科研项目', '科研预设选择为自定义时, 须先阅读 doc/filter_string_en_cn.md')
reward_research.add_argument('--启用科研项目收获', default=default('--启用科研项目收获'), choices=['', '']) reward_research.add_argument('--启用科研项目收获', default=default('--启用科研项目收获'), choices=['', ''])
@@ -252,7 +254,7 @@ def main(ini_name=''):
research_input.add_argument('--科研项目使用部件', default=default('--科研项目使用部件'), choices=['', '']) research_input.add_argument('--科研项目使用部件', default=default('--科研项目使用部件'), choices=['', ''])
research_output = reward_research.add_argument_group('科研产出', '') research_output = reward_research.add_argument_group('科研产出', '')
research_output.add_argument('--科研项目选择预设', default=default('--科研项目选择预设'), choices=research_preset) research_output.add_argument('--科研项目选择预设', default=default('--科研项目选择预设'), choices=research_preset)
research_output.add_argument('--research_filter_string', default=default('--research_filter_string'), help='Only if you are using custom preset.') research_output.add_argument('--科研过滤字符串', default=default('--科研过滤字符串'), help='仅在科研预设选择为自定义时启用')
# ==========设备设置========== # ==========设备设置==========
emulator_parser = subs.add_parser('设备设置') emulator_parser = subs.add_parser('设备设置')

View File

@@ -103,6 +103,7 @@ def main(ini_name=''):
stop.add_argument('--if_count_greater_than', default=default('--if_count_greater_than'), help='How many map completions\n until ALAS enter in Reward loop.') stop.add_argument('--if_count_greater_than', default=default('--if_count_greater_than'), help='How many map completions\n until ALAS enter in Reward loop.')
stop.add_argument('--if_time_reach', default=default('--if_time_reach'), help='How many time in minutes run ALAS until stop\n. It is recommended about\n 10 minutes to complete the current attack. Format 14:59') stop.add_argument('--if_time_reach', default=default('--if_time_reach'), help='How many time in minutes run ALAS until stop\n. It is recommended about\n 10 minutes to complete the current attack. Format 14:59')
stop.add_argument('--if_oil_lower_than', default=default('--if_oil_lower_than'), help='Will enter in reward loop when\ntriggered Oil limit') stop.add_argument('--if_oil_lower_than', default=default('--if_oil_lower_than'), help='Will enter in reward loop when\ntriggered Oil limit')
stop.add_argument('--if_map_reach', default=default('--if_map_reach'), choices=['no', 'map_100', 'map_3_star', 'map_green_without_3_star', 'map_green'], help='If already reached, ignore this setting')
stop.add_argument('--if_trigger_emotion_control', default=default('--if_trigger_emotion_control'), choices=['yes', 'no'], help='Will enter in reward loop when\ntriggered Mood limit') stop.add_argument('--if_trigger_emotion_control', default=default('--if_trigger_emotion_control'), choices=['yes', 'no'], help='Will enter in reward loop when\ntriggered Mood limit')
# stop.add_argument('--if_dock_full', default=default('--if_dock_full'), choices=['yes', 'no']) # stop.add_argument('--if_dock_full', default=default('--if_dock_full'), choices=['yes', 'no'])
@@ -186,10 +187,10 @@ def main(ini_name=''):
drop.add_argument('--enable_drop_screenshot', default=default('--enable_drop_screenshot'), choices=['yes', 'no']) drop.add_argument('--enable_drop_screenshot', default=default('--enable_drop_screenshot'), choices=['yes', 'no'])
drop.add_argument('--drop_screenshot_folder', default=default('--drop_screenshot_folder')) drop.add_argument('--drop_screenshot_folder', default=default('--drop_screenshot_folder'))
clear = setting_parser.add_argument_group('Wasteland mode', 'Unopened maps will stop after completion. Opened maps will ignore options, and its done if you do not open up') # clear = setting_parser.add_argument_group('Wasteland mode', 'Unopened maps will stop after completion. Opened maps will ignore options, and its done if you do not open up')
clear.add_argument('--enable_map_clear_mode', default=default('--enable_map_clear_mode'), choices=['yes', 'no']) # clear.add_argument('--enable_map_clear_mode', default=default('--enable_map_clear_mode'), choices=['yes', 'no'])
clear.add_argument('--clear_mode_stop_condition', default=default('--clear_mode_stop_condition'), choices=['map_100', 'map_3_star', 'map_green']) # clear.add_argument('--clear_mode_stop_condition', default=default('--clear_mode_stop_condition'), choices=['map_100', 'map_3_star', 'map_green'])
clear.add_argument('--map_star_clear_all', default=default('--map_star_clear_all'), choices=['index_1', 'index_2', 'index_3', 'do_not_use'], help='The first few stars are to destroy all enemy ships') # clear.add_argument('--map_star_clear_all', default=default('--map_star_clear_all'), choices=['index_1', 'index_2', 'index_3', 'do_not_use'], help='The first few stars are to destroy all enemy ships')
# ==========reward========== # ==========reward==========
@@ -244,6 +245,7 @@ def main(ini_name=''):
reward_tactical.add_argument('--tactical_book_tier_min', default=default('--tactical_book_tier_min'), choices=['3', '2', '1'], help='Minimal tier to choose.') reward_tactical.add_argument('--tactical_book_tier_min', default=default('--tactical_book_tier_min'), choices=['3', '2', '1'], help='Minimal tier to choose.')
# reward_tactical.add_argument('--tactical_book_tier_night', default=default('--tactical_book_tier_night'), choices=['3', '2', '1']) # reward_tactical.add_argument('--tactical_book_tier_night', default=default('--tactical_book_tier_night'), choices=['3', '2', '1'])
# reward_tactical.add_argument('--tactical_exp_first_night', default=default('--tactical_exp_first_night'), choices=['yes', 'no']) # reward_tactical.add_argument('--tactical_exp_first_night', default=default('--tactical_exp_first_night'), choices=['yes', 'no'])
reward_tactical.add_argument('--tactical_if_no_book_satisfied', default=default('--tactical_if_no_book_satisfied'), choices=['cancel_tactical', 'use_the_first_book'])
reward_research = reward_parser.add_argument_group('Research', 'If set research_filter_preset=customized, read doc/filter_string_en_cn.md first') reward_research = reward_parser.add_argument_group('Research', 'If set research_filter_preset=customized, read doc/filter_string_en_cn.md first')
reward_research.add_argument('--enable_research_reward', default=default('--enable_research_reward'), choices=['yes', 'no']) reward_research.add_argument('--enable_research_reward', default=default('--enable_research_reward'), choices=['yes', 'no'])

View File

@@ -103,6 +103,7 @@ def main(ini_name=''):
stop.add_argument('--if_count_greater_than', default=default('--if_count_greater_than'), help='The previous setting will be used, and the number\n of deductions will be deducted after completion of the attack until it is cleared.') stop.add_argument('--if_count_greater_than', default=default('--if_count_greater_than'), help='The previous setting will be used, and the number\n of deductions will be deducted after completion of the attack until it is cleared.')
stop.add_argument('--if_time_reach', default=default('--if_time_reach'), help='Use the time within the next 24 hours, the previous setting will be used, and it will be cleared\n after the trigger. It is recommended to advance about\n 10 minutes to complete the current attack. Format 14:59') stop.add_argument('--if_time_reach', default=default('--if_time_reach'), help='Use the time within the next 24 hours, the previous setting will be used, and it will be cleared\n after the trigger. It is recommended to advance about\n 10 minutes to complete the current attack. Format 14:59')
stop.add_argument('--if_oil_lower_than', default=default('--if_oil_lower_than')) stop.add_argument('--if_oil_lower_than', default=default('--if_oil_lower_than'))
stop.add_argument('--if_map_reach', default=default('--if_map_reach'), choices=['no', 'map_100', 'map_3_star', 'map_green_without_3_star', 'map_green'], help='If already reached, ignore this setting')
stop.add_argument('--if_trigger_emotion_control', default=default('--if_trigger_emotion_control'), choices=['yes', 'no'], help='If yes, wait for reply, complete this time, stop \nIf no, wait for reply, complete this time, continue') stop.add_argument('--if_trigger_emotion_control', default=default('--if_trigger_emotion_control'), choices=['yes', 'no'], help='If yes, wait for reply, complete this time, stop \nIf no, wait for reply, complete this time, continue')
# stop.add_argument('--if_dock_full', default=default('--if_dock_full'), choices=['yes', 'no']) # stop.add_argument('--if_dock_full', default=default('--if_dock_full'), choices=['yes', 'no'])
@@ -186,10 +187,10 @@ def main(ini_name=''):
drop.add_argument('--enable_drop_screenshot', default=default('--enable_drop_screenshot'), choices=['yes', 'no']) drop.add_argument('--enable_drop_screenshot', default=default('--enable_drop_screenshot'), choices=['yes', 'no'])
drop.add_argument('--drop_screenshot_folder', default=default('--drop_screenshot_folder')) drop.add_argument('--drop_screenshot_folder', default=default('--drop_screenshot_folder'))
clear = setting_parser.add_argument_group('Wasteland mode', 'Unopened maps will stop after completion. Opened maps will ignore options, and its done if you do not open up') # clear = setting_parser.add_argument_group('Wasteland mode', 'Unopened maps will stop after completion. Opened maps will ignore options, and its done if you do not open up')
clear.add_argument('--enable_map_clear_mode', default=default('--enable_map_clear_mode'), choices=['yes', 'no']) # clear.add_argument('--enable_map_clear_mode', default=default('--enable_map_clear_mode'), choices=['yes', 'no'])
clear.add_argument('--clear_mode_stop_condition', default=default('--clear_mode_stop_condition'), choices=['map_100', 'map_3_star', 'map_green']) # clear.add_argument('--clear_mode_stop_condition', default=default('--clear_mode_stop_condition'), choices=['map_100', 'map_3_star', 'map_green'])
clear.add_argument('--map_star_clear_all', default=default('--map_star_clear_all'), choices=['index_1', 'index_2', 'index_3', 'do_not_use'], help='The first few stars are to destroy all enemy ships') # clear.add_argument('--map_star_clear_all', default=default('--map_star_clear_all'), choices=['index_1', 'index_2', 'index_3', 'do_not_use'], help='The first few stars are to destroy all enemy ships')
# ==========reward========== # ==========reward==========
@@ -243,6 +244,7 @@ def main(ini_name=''):
reward_tactical.add_argument('--tactical_book_tier_min', default=default('--tactical_book_tier_min'), choices=['3', '2', '1'], help='Minimal tier to choose.') reward_tactical.add_argument('--tactical_book_tier_min', default=default('--tactical_book_tier_min'), choices=['3', '2', '1'], help='Minimal tier to choose.')
# reward_tactical.add_argument('--tactical_book_tier_night', default=default('--tactical_book_tier_night'), choices=['3', '2', '1']) # reward_tactical.add_argument('--tactical_book_tier_night', default=default('--tactical_book_tier_night'), choices=['3', '2', '1'])
# reward_tactical.add_argument('--tactical_exp_first_night', default=default('--tactical_exp_first_night'), choices=['yes', 'no']) # reward_tactical.add_argument('--tactical_exp_first_night', default=default('--tactical_exp_first_night'), choices=['yes', 'no'])
reward_tactical.add_argument('--tactical_if_no_book_satisfied', default=default('--tactical_if_no_book_satisfied'), choices=['cancel_tactical', 'use_the_first_book'])
reward_research = reward_parser.add_argument_group('Research', 'If set research_filter_preset=customized, read doc/filter_string_en_cn.md first') reward_research = reward_parser.add_argument_group('Research', 'If set research_filter_preset=customized, read doc/filter_string_en_cn.md first')
reward_research.add_argument('--enable_research_reward', default=default('--enable_research_reward'), choices=['yes', 'no']) reward_research.add_argument('--enable_research_reward', default=default('--enable_research_reward'), choices=['yes', 'no'])

View File

@@ -130,11 +130,13 @@ class AzurLaneConfig:
STOP_IF_TIME_REACH = 0 STOP_IF_TIME_REACH = 0
STOP_IF_TRIGGER_EMOTION_LIMIT = False STOP_IF_TRIGGER_EMOTION_LIMIT = False
STOP_IF_DOCK_FULL = False STOP_IF_DOCK_FULL = False
STOP_IF_MAP_REACH = 'no' # no, map_100, map_3_star, map_green_without_3_star, map_green
ENABLE_MAP_CLEAR_MODE = False
CLEAR_MODE_STOP_CONDITION = 'map_green' # map_green, map_3_star, map_100
MAP_STAR_CLEAR_ALL = 3
MAP_CLEAR_ALL_THIS_TIME = False MAP_CLEAR_ALL_THIS_TIME = False
# From chapter_template.lua
STAR_REQUIRE_1 = 1
STAR_REQUIRE_2 = 2
STAR_REQUIRE_3 = 3
""" """
module.event module.event
@@ -385,6 +387,7 @@ class AzurLaneConfig:
TACTICAL_BOOK_TIER_MAX = 3 TACTICAL_BOOK_TIER_MAX = 3
TACTICAL_BOOK_TIER_MIN = 2 TACTICAL_BOOK_TIER_MIN = 2
TACTICAL_EXP_FIRST = True TACTICAL_EXP_FIRST = True
TACTICAL_IF_NO_BOOK_SATISFIED = 'cancel_tactical' # cancel_tactical, use_the_first_book
# TACTICAL_BOOK_TIER_NIGHT = 3 # TACTICAL_BOOK_TIER_NIGHT = 3
# TACTICAL_EXP_FIRST_NIGHT = False # TACTICAL_EXP_FIRST_NIGHT = False
# TACTICAL_NIGHT_RANGE = future_time_range('23:30-06:30') # (Night start, night end), datetime.datetime instance. # TACTICAL_NIGHT_RANGE = future_time_range('23:30-06:30') # (Night start, night end), datetime.datetime instance.
@@ -500,6 +503,7 @@ class AzurLaneConfig:
self.STOP_IF_OIL_LOWER_THAN = int(option['if_oil_lower_than']) self.STOP_IF_OIL_LOWER_THAN = int(option['if_oil_lower_than'])
self.STOP_IF_TRIGGER_EMOTION_LIMIT = to_bool(option['if_trigger_emotion_control']) self.STOP_IF_TRIGGER_EMOTION_LIMIT = to_bool(option['if_trigger_emotion_control'])
self.STOP_IF_DOCK_FULL = to_bool(option['if_dock_full']) self.STOP_IF_DOCK_FULL = to_bool(option['if_dock_full'])
self.STOP_IF_MAP_REACH = option['if_map_reach']
# Fleet # Fleet
self.ENABLE_FLEET_CONTROL = to_bool(option['enable_fleet_control']) self.ENABLE_FLEET_CONTROL = to_bool(option['enable_fleet_control'])
self.ENABLE_MAP_FLEET_LOCK = to_bool(option['enable_map_fleet_lock']) self.ENABLE_MAP_FLEET_LOCK = to_bool(option['enable_map_fleet_lock'])
@@ -537,11 +541,6 @@ class AzurLaneConfig:
self.ENHANCE_ORDER_STRING = option['enhance_order_string'] self.ENHANCE_ORDER_STRING = option['enhance_order_string']
for r in ['n', 'r', 'sr', 'ssr']: for r in ['n', 'r', 'sr', 'ssr']:
self.__setattr__(f'RETIRE_{r.upper()}', to_bool(option[f'retire_{r}'])) self.__setattr__(f'RETIRE_{r.upper()}', to_bool(option[f'retire_{r}']))
# Clear mode
self.ENABLE_MAP_CLEAR_MODE = to_bool(option['enable_map_clear_mode'])
self.CLEAR_MODE_STOP_CONDITION = option['clear_mode_stop_condition']
star = option['map_star_clear_all']
self.MAP_STAR_CLEAR_ALL = int(star.split('_')[1]) if star.startswith('index_') else 0
# Reward # Reward
option = config['Reward'] option = config['Reward']
@@ -559,6 +558,7 @@ class AzurLaneConfig:
self.TACTICAL_BOOK_TIER_MAX = int(option['tactical_book_tier_max']) self.TACTICAL_BOOK_TIER_MAX = int(option['tactical_book_tier_max'])
self.TACTICAL_BOOK_TIER_MIN = int(option['tactical_book_tier_min']) self.TACTICAL_BOOK_TIER_MIN = int(option['tactical_book_tier_min'])
self.TACTICAL_EXP_FIRST = to_bool(option['tactical_exp_first']) self.TACTICAL_EXP_FIRST = to_bool(option['tactical_exp_first'])
self.TACTICAL_IF_NO_BOOK_SATISFIED = option['tactical_if_no_book_satisfied']
# self.TACTICAL_NIGHT_RANGE = future_time_range(option['tactical_night_range']) # self.TACTICAL_NIGHT_RANGE = future_time_range(option['tactical_night_range'])
# self.TACTICAL_BOOK_TIER_NIGHT = int(option['tactical_book_tier_night']) # self.TACTICAL_BOOK_TIER_NIGHT = int(option['tactical_book_tier_night'])
# self.TACTICAL_EXP_FIRST_NIGHT = to_bool(option['tactical_exp_first_night']) # self.TACTICAL_EXP_FIRST_NIGHT = to_bool(option['tactical_exp_first_night'])

View File

@@ -52,6 +52,7 @@ dic_true_eng_to_eng = {
'if_oil_lower_than': 'if_oil_lower_than', 'if_oil_lower_than': 'if_oil_lower_than',
'if_trigger_emotion_control': 'if_trigger_emotion_control', 'if_trigger_emotion_control': 'if_trigger_emotion_control',
'if_dock_full': 'if_dock_full', 'if_dock_full': 'if_dock_full',
'if_map_reach': 'if_map_reach',
'enable_fleet_control': 'enable_fleet_control', 'enable_fleet_control': 'enable_fleet_control',
'enable_map_fleet_lock': 'enable_map_fleet_lock', 'enable_map_fleet_lock': 'enable_map_fleet_lock',
'fleet_index_1': 'fleet_index_1', 'fleet_index_1': 'fleet_index_1',
@@ -90,15 +91,16 @@ dic_true_eng_to_eng = {
'retire_method': 'retire_method', 'retire_method': 'retire_method',
'retire_amount': 'retire_amount', 'retire_amount': 'retire_amount',
'enhance_favourite': 'enhance_favourite', 'enhance_favourite': 'enhance_favourite',
'enhance_order_string': 'enhance_order_string',
'retire_n': 'retire_n', 'retire_n': 'retire_n',
'retire_r': 'retire_r', 'retire_r': 'retire_r',
'retire_sr': 'retire_sr', 'retire_sr': 'retire_sr',
'retire_ssr': 'retire_ssr', 'retire_ssr': 'retire_ssr',
'enable_drop_screenshot': 'enable_drop_screenshot', 'enable_drop_screenshot': 'enable_drop_screenshot',
'drop_screenshot_folder': 'drop_screenshot_folder', 'drop_screenshot_folder': 'drop_screenshot_folder',
'enable_map_clear_mode': 'enable_map_clear_mode', # 'enable_map_clear_mode': 'enable_map_clear_mode',
'clear_mode_stop_condition': 'clear_mode_stop_condition', # 'clear_mode_stop_condition': 'clear_mode_stop_condition',
'map_star_clear_all': 'map_star_clear_all', # 'map_star_clear_all': 'map_star_clear_all',
'enable_reward': 'enable_reward', 'enable_reward': 'enable_reward',
'reward_interval': 'reward_interval', 'reward_interval': 'reward_interval',
'enable_daily_reward': 'enable_daily_reward', 'enable_daily_reward': 'enable_daily_reward',
@@ -130,6 +132,7 @@ dic_true_eng_to_eng = {
'tactical_book_tier_max': 'tactical_book_tier_max', 'tactical_book_tier_max': 'tactical_book_tier_max',
'tactical_book_tier_min': 'tactical_book_tier_min', 'tactical_book_tier_min': 'tactical_book_tier_min',
'tactical_exp_first': 'tactical_exp_first', 'tactical_exp_first': 'tactical_exp_first',
'tactical_if_no_book_satisfied': 'tactical_if_no_book_satisfied',
# 'tactical_book_tier_night': 'tactical_book_tier_night', # 'tactical_book_tier_night': 'tactical_book_tier_night',
# 'tactical_exp_first_night': 'tactical_exp_first_night', # 'tactical_exp_first_night': 'tactical_exp_first_night',
'enable_research_reward': 'enable_research_reward', 'enable_research_reward': 'enable_research_reward',
@@ -137,6 +140,7 @@ dic_true_eng_to_eng = {
'research_use_cube': 'research_use_cube', 'research_use_cube': 'research_use_cube',
'research_use_coin': 'research_use_coin', 'research_use_coin': 'research_use_coin',
'research_use_part': 'research_use_part', 'research_use_part': 'research_use_part',
'research_filter_string': 'research_filter_string',
'serial': 'serial', 'serial': 'serial',
'package_name': 'package_name', 'package_name': 'package_name',
'enable_error_log_and_screenshot_save': 'enable_error_log_and_screenshot_save', 'enable_error_log_and_screenshot_save': 'enable_error_log_and_screenshot_save',
@@ -241,6 +245,7 @@ dic_true_eng_to_eng = {
'retire_10': 'retire_10', 'retire_10': 'retire_10',
'map_100': 'map_100', 'map_100': 'map_100',
'map_3_star': 'map_3_star', 'map_3_star': 'map_3_star',
'map_green_without_3_star': 'map_green_without_3_star',
'map_green': 'map_green', 'map_green': 'map_green',
'aScreenCap': 'aScreenCap', 'aScreenCap': 'aScreenCap',
'uiautomator2': 'uiautomator2', 'uiautomator2': 'uiautomator2',
@@ -251,6 +256,8 @@ dic_true_eng_to_eng = {
'index_1': 'index_1', 'index_1': 'index_1',
'index_2': 'index_2', 'index_2': 'index_2',
'index_3': 'index_3', 'index_3': 'index_3',
'cancel_tactical': 'cancel_tactical',
'use_the_first_book': 'use_the_first_book',
'max_exp': 'max_exp', 'max_exp': 'max_exp',
'max_ranking': 'max_ranking', 'max_ranking': 'max_ranking',
'good_opponent': 'good_opponent', 'good_opponent': 'good_opponent',
@@ -295,6 +302,7 @@ dic_chi_to_eng = {
'如果石油低于': 'if_oil_lower_than', '如果石油低于': 'if_oil_lower_than',
'如果触发心情控制': 'if_trigger_emotion_control', '如果触发心情控制': 'if_trigger_emotion_control',
'如果船舱已满': 'if_dock_full', '如果船舱已满': 'if_dock_full',
'如果地图开荒': 'if_map_reach',
'启用舰队控制': 'enable_fleet_control', '启用舰队控制': 'enable_fleet_control',
'启用阵容锁定': 'enable_map_fleet_lock', '启用阵容锁定': 'enable_map_fleet_lock',
'舰队编号1': 'fleet_index_1', '舰队编号1': 'fleet_index_1',
@@ -333,15 +341,16 @@ dic_chi_to_eng = {
'退役方案': 'retire_method', '退役方案': 'retire_method',
'退役数量': 'retire_amount', '退役数量': 'retire_amount',
'强化常用角色': 'enhance_favourite', '强化常用角色': 'enhance_favourite',
'强化过滤字符串': 'enhance_order_string',
'退役白皮': 'retire_n', '退役白皮': 'retire_n',
'退役蓝皮': 'retire_r', '退役蓝皮': 'retire_r',
'退役紫皮': 'retire_sr', '退役紫皮': 'retire_sr',
'退役金皮': 'retire_ssr', '退役金皮': 'retire_ssr',
'启用掉落记录': 'enable_drop_screenshot', '启用掉落记录': 'enable_drop_screenshot',
'掉落保存目录': 'drop_screenshot_folder', '掉落保存目录': 'drop_screenshot_folder',
'启用开荒': 'enable_map_clear_mode', # '启用开荒': 'enable_map_clear_mode',
'开荒停止条件': 'clear_mode_stop_condition', # '开荒停止条件': 'clear_mode_stop_condition',
'地图全清星星': 'map_star_clear_all', # '地图全清星星': 'map_star_clear_all',
'启用收获': 'enable_reward', '启用收获': 'enable_reward',
'收菜间隔': 'reward_interval', '收菜间隔': 'reward_interval',
'启用每日收获': 'enable_daily_reward', '启用每日收获': 'enable_daily_reward',
@@ -373,6 +382,7 @@ dic_chi_to_eng = {
'技能书最大稀有度': 'tactical_book_tier_max', '技能书最大稀有度': 'tactical_book_tier_max',
'技能书最小稀有度': 'tactical_book_tier_min', '技能书最小稀有度': 'tactical_book_tier_min',
'技能书优先使用同类型': 'tactical_exp_first', '技能书优先使用同类型': 'tactical_exp_first',
'如果无技能书可用': 'tactical_if_no_book_satisfied',
# '技能书夜间稀有度': 'tactical_book_tier_night', # '技能书夜间稀有度': 'tactical_book_tier_night',
# '技能书夜间优先使用同类型': 'tactical_exp_first_night', # '技能书夜间优先使用同类型': 'tactical_exp_first_night',
'启用科研项目收获': 'enable_research_reward', '启用科研项目收获': 'enable_research_reward',
@@ -380,6 +390,7 @@ dic_chi_to_eng = {
'科研项目使用魔方': 'research_use_cube', '科研项目使用魔方': 'research_use_cube',
'科研项目使用金币': 'research_use_coin', '科研项目使用金币': 'research_use_coin',
'科研项目使用部件': 'research_use_part', '科研项目使用部件': 'research_use_part',
'科研过滤字符串': 'research_filter_string',
'设备': 'serial', '设备': 'serial',
'包名': 'package_name', '包名': 'package_name',
'出错时保存log和截图': 'enable_error_log_and_screenshot_save', '出错时保存log和截图': 'enable_error_log_and_screenshot_save',
@@ -484,6 +495,7 @@ dic_chi_to_eng = {
'退役10个': 'retire_10', '退役10个': 'retire_10',
'地图通关': 'map_100', '地图通关': 'map_100',
'地图三星': 'map_3_star', '地图三星': 'map_3_star',
'地图绿海不打三星': 'map_green_without_3_star',
'地图绿海': 'map_green', '地图绿海': 'map_green',
'aScreenCap': 'aScreenCap', 'aScreenCap': 'aScreenCap',
'uiautomator2': 'uiautomator2', 'uiautomator2': 'uiautomator2',
@@ -494,6 +506,8 @@ dic_chi_to_eng = {
'第一个': 'index_1', '第一个': 'index_1',
'第二个': 'index_2', '第二个': 'index_2',
'第三个': 'index_3', '第三个': 'index_3',
'停止学习': 'cancel_tactical',
'使用第一本': 'use_the_first_book',
'经验最多': 'max_exp', '经验最多': 'max_exp',
'排名最前': 'max_ranking', '排名最前': 'max_ranking',
'福利队': 'good_opponent', '福利队': 'good_opponent',

View File

@@ -6,8 +6,8 @@ from module.base.template import Template
FAST_FORWARD_OFF = Button(area={'cn': (984, 587, 1021, 606), 'en': (984, 587, 1021, 606), 'jp': (984, 587, 1021, 606)}, color={'cn': (252, 252, 252), 'en': (252, 252, 252), 'jp': (252, 252, 252)}, button={'cn': (984, 587, 1021, 606), 'en': (984, 587, 1021, 606), 'jp': (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'}) FAST_FORWARD_OFF = Button(area={'cn': (984, 587, 1021, 606), 'en': (984, 587, 1021, 606), 'jp': (984, 587, 1021, 606)}, color={'cn': (252, 252, 252), 'en': (252, 252, 252), 'jp': (252, 252, 252)}, button={'cn': (984, 587, 1021, 606), 'en': (984, 587, 1021, 606), 'jp': (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'})
FAST_FORWARD_ON = Button(area={'cn': (1025, 587, 1063, 606), 'en': (1025, 587, 1063, 606), 'jp': (1025, 587, 1063, 606)}, color={'cn': (252, 252, 252), 'en': (252, 252, 252), 'jp': (252, 252, 252)}, button={'cn': (1025, 587, 1063, 606), 'en': (1025, 587, 1063, 606), 'jp': (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'}) FAST_FORWARD_ON = Button(area={'cn': (1025, 587, 1063, 606), 'en': (1025, 587, 1063, 606), 'jp': (1025, 587, 1063, 606)}, color={'cn': (252, 252, 252), 'en': (252, 252, 252), 'jp': (252, 252, 252)}, button={'cn': (1025, 587, 1063, 606), 'en': (1025, 587, 1063, 606), 'jp': (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'})
FLEET_LOCKED = Button(area={'cn': (1197, 502, 1274, 519), 'en': (1181, 490, 1280, 531), 'jp': (1173, 502, 1277, 517)}, color={'cn': (146, 186, 179), 'en': (61, 82, 97), 'jp': (128, 165, 162)}, button={'cn': (1197, 502, 1274, 519), 'en': (1181, 490, 1280, 531), 'jp': (1173, 502, 1277, 517)}, file={'cn': './assets/cn/handler/FLEET_LOCKED.png', 'en': './assets/en/handler/FLEET_LOCKED.png', 'jp': './assets/jp/handler/FLEET_LOCKED.png'}) FLEET_LOCKED = Button(area={'cn': (1185, 501, 1192, 519), 'en': (1184, 502, 1191, 519), 'jp': (1173, 502, 1277, 517)}, color={'cn': (59, 100, 110), 'en': (61, 102, 111), 'jp': (128, 165, 162)}, button={'cn': (1185, 501, 1192, 519), 'en': (1184, 502, 1191, 519), 'jp': (1173, 502, 1277, 517)}, file={'cn': './assets/cn/handler/FLEET_LOCKED.png', 'en': './assets/en/handler/FLEET_LOCKED.png', 'jp': './assets/jp/handler/FLEET_LOCKED.png'})
FLEET_UNLOCKED = Button(area={'cn': (1197, 502, 1274, 519), 'en': (1181, 490, 1280, 531), 'jp': (1173, 502, 1277, 517)}, color={'cn': (195, 168, 168), 'en': (82, 76, 93), 'jp': (176, 154, 158)}, button={'cn': (1197, 502, 1274, 519), 'en': (1181, 490, 1280, 531), 'jp': (1173, 502, 1277, 517)}, file={'cn': './assets/cn/handler/FLEET_UNLOCKED.png', 'en': './assets/en/handler/FLEET_UNLOCKED.png', 'jp': './assets/jp/handler/FLEET_UNLOCKED.png'}) FLEET_UNLOCKED = Button(area={'cn': (1185, 492, 1192, 525), 'en': (1184, 496, 1191, 522), 'jp': (1173, 502, 1277, 517)}, color={'cn': (84, 74, 98), 'en': (95, 81, 101), 'jp': (176, 154, 158)}, button={'cn': (1185, 492, 1192, 525), 'en': (1184, 496, 1191, 522), 'jp': (1173, 502, 1277, 517)}, file={'cn': './assets/cn/handler/FLEET_UNLOCKED.png', 'en': './assets/en/handler/FLEET_UNLOCKED.png', 'jp': './assets/jp/handler/FLEET_UNLOCKED.png'})
FORMATION_1 = Button(area={'cn': (1108, 415, 1170, 477), 'en': (1108, 415, 1170, 477), 'jp': (1108, 415, 1170, 477)}, color={'cn': (80, 82, 93), 'en': (80, 82, 93), 'jp': (80, 82, 93)}, button={'cn': (1108, 415, 1170, 477), 'en': (1108, 415, 1170, 477), 'jp': (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'}) FORMATION_1 = Button(area={'cn': (1108, 415, 1170, 477), 'en': (1108, 415, 1170, 477), 'jp': (1108, 415, 1170, 477)}, color={'cn': (80, 82, 93), 'en': (80, 82, 93), 'jp': (80, 82, 93)}, button={'cn': (1108, 415, 1170, 477), 'en': (1108, 415, 1170, 477), 'jp': (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'})
FORMATION_2 = Button(area={'cn': (1108, 415, 1170, 477), 'en': (1108, 415, 1170, 477), 'jp': (1108, 415, 1170, 477)}, color={'cn': (80, 82, 92), 'en': (80, 82, 92), 'jp': (80, 82, 92)}, button={'cn': (1108, 415, 1170, 477), 'en': (1108, 415, 1170, 477), 'jp': (1108, 415, 1170, 477)}, file={'cn': './assets/cn/handler/FORMATION_2.png', 'en': './assets/en/handler/FORMATION_2.png', 'jp': './assets/jp/handler/FORMATION_2.png'}) FORMATION_2 = Button(area={'cn': (1108, 415, 1170, 477), 'en': (1108, 415, 1170, 477), 'jp': (1108, 415, 1170, 477)}, color={'cn': (80, 82, 92), 'en': (80, 82, 92), 'jp': (80, 82, 92)}, button={'cn': (1108, 415, 1170, 477), 'en': (1108, 415, 1170, 477), 'jp': (1108, 415, 1170, 477)}, file={'cn': './assets/cn/handler/FORMATION_2.png', 'en': './assets/en/handler/FORMATION_2.png', 'jp': './assets/jp/handler/FORMATION_2.png'})
FORMATION_3 = Button(area={'cn': (1108, 415, 1170, 477), 'en': (1108, 415, 1170, 477), 'jp': (1108, 415, 1170, 477)}, color={'cn': (79, 82, 92), 'en': (79, 82, 92), 'jp': (79, 82, 92)}, button={'cn': (1108, 415, 1170, 477), 'en': (1108, 415, 1170, 477), 'jp': (1108, 415, 1170, 477)}, file={'cn': './assets/cn/handler/FORMATION_3.png', 'en': './assets/en/handler/FORMATION_3.png', 'jp': './assets/jp/handler/FORMATION_3.png'}) FORMATION_3 = Button(area={'cn': (1108, 415, 1170, 477), 'en': (1108, 415, 1170, 477), 'jp': (1108, 415, 1170, 477)}, color={'cn': (79, 82, 92), 'en': (79, 82, 92), 'jp': (79, 82, 92)}, button={'cn': (1108, 415, 1170, 477), 'en': (1108, 415, 1170, 477), 'jp': (1108, 415, 1170, 477)}, file={'cn': './assets/cn/handler/FORMATION_3.png', 'en': './assets/en/handler/FORMATION_3.png', 'jp': './assets/jp/handler/FORMATION_3.png'})

View File

@@ -12,7 +12,8 @@ class EnemySearchingHandler(InfoHandler):
MAP_ENEMY_SEARCHING_TIMEOUT_SECOND = 5 MAP_ENEMY_SEARCHING_TIMEOUT_SECOND = 5
in_stage_timer = Timer(1.5, count=5) in_stage_timer = Timer(1.5, count=5)
stage_entrance = None stage_entrance = None
is_map_green = False
map_is_clear = False # Will be override in fast_forward.py
def enemy_searching_color_initial(self): def enemy_searching_color_initial(self):
MAP_ENEMY_SEARCHING.load_color(self.device.image) MAP_ENEMY_SEARCHING.load_color(self.device.image)
@@ -42,7 +43,7 @@ class EnemySearchingHandler(InfoHandler):
if self.appear(MAP_PREPARATION) or self.appear(FLEET_PREPARATION): if self.appear(MAP_PREPARATION) or self.appear(FLEET_PREPARATION):
self.device.click(MAP_PREPARATION_CANCEL) self.device.click(MAP_PREPARATION_CANCEL)
return False return False
if self.is_map_green \ if self.map_is_clear \
and self.stage_entrance is not None \ and self.stage_entrance is not None \
and self.stage_entrance.area \ and self.stage_entrance.area \
and not self.appear(self.stage_entrance, threshold=30): and not self.appear(self.stage_entrance, threshold=30):

View File

@@ -13,79 +13,114 @@ fleet_lock.add_status('off', check_button=FLEET_UNLOCKED, offset=(5, 5))
class FastForwardHandler(ModuleBase): class FastForwardHandler(ModuleBase):
map_clear_percentage = 0.
map_achieved_star_1 = False
map_achieved_star_2 = False
map_achieved_star_3 = False
map_is_clear = False
map_is_3_star = False
map_is_green = False
map_has_fast_forward = False
map_clear_record = None map_clear_record = None
is_map_green = False
def map_get_info(self):
"""
Logs:
| INFO | [Map_info] 98%, star_1, star_2, star_3, clear, 3_star, green, fast_forward
"""
self.map_clear_percentage = color_bar_percentage(
self.device.image, area=MAP_CLEAR_PERCENTAGE.area, prev_color=(231, 170, 82))
self.map_achieved_star_1 = self.appear(MAP_STAR_1)
self.map_achieved_star_2 = self.appear(MAP_STAR_2)
self.map_achieved_star_3 = self.appear(MAP_STAR_3)
self.map_is_clear = self.map_clear_percentage > 0.95
self.map_is_3_star = self.map_achieved_star_1 and self.map_achieved_star_2 and self.map_achieved_star_3
self.map_is_green = self.appear(MAP_GREEN)
self.map_has_fast_forward = self.map_is_3_star and self.map_is_green and fast_forward.appear(main=self)
# Override config
if self.map_achieved_star_1:
# Story before boss spawn, Attribute "story_refresh_boss" in chapter_template.lua
self.config.MAP_HAS_MAP_STORY = False
self.config.MAP_CLEAR_ALL_THIS_TIME = self.config.STAR_REQUIRE_3 \
and not self.__getattribute__(f'map_achieved_star_{self.config.STAR_REQUIRE_3}') \
and self.config.STOP_IF_MAP_REACH != 'map_green_without_3_star'
logger.attr('MAP_CLEAR_ALL_THIS_TIME', self.config.MAP_CLEAR_ALL_THIS_TIME)
# Log
names = ['map_achieved_star_1', 'map_achieved_star_2', 'map_achieved_star_3', 'map_is_clear', 'map_is_3_star',
'map_is_green', 'map_has_fast_forward']
strip = ['map', 'achieved', 'is', 'has']
log_names = ['_'.join([x for x in name.split('_') if x not in strip]) for name in names]
text = ', '.join([l for l, n in zip(log_names, names) if self.__getattribute__(n)])
text = f'{int(self.map_clear_percentage * 100)}%, ' + text
logger.attr('Map_info', text)
def handle_fast_forward(self): def handle_fast_forward(self):
if self.config.MAP_HAS_MAP_STORY: if not self.map_has_fast_forward:
if self.appear(MAP_STAR_1):
self.config.MAP_HAS_MAP_STORY = False
if not self.appear(MAP_STAR_1) or not self.appear(MAP_STAR_2) or not self.appear(MAP_STAR_3):
self.config.ENABLE_FAST_FORWARD = False
logger.info('Campaign is not 3-star cleared.')
return False
if not self.appear(MAP_GREEN):
self.config.ENABLE_FAST_FORWARD = False
logger.info('Campaign is not green sea.')
return False return False
self.is_map_green = True if self.config.ENABLE_FAST_FORWARD:
self.config.MAP_HAS_AMBUSH = False
self.config.MAP_HAS_FLEET_STEP = False
self.config.MAP_HAS_MOVABLE_ENEMY = False
else:
# When disable fast forward, MAP_HAS_AMBUSH depends on map settings.
# self.config.MAP_HAS_AMBUSH = True
pass
if not fast_forward.appear(main=self):
self.config.ENABLE_FAST_FORWARD = False
logger.info('No fast forward mode.')
return False
logger.info('Set fast forward.')
status = 'on' if self.config.ENABLE_FAST_FORWARD else 'off' status = 'on' if self.config.ENABLE_FAST_FORWARD else 'off'
changed = fast_forward.set(status=status, main=self) changed = fast_forward.set(status=status, main=self)
return changed return changed
def handle_map_fleet_lock(self): def handle_map_fleet_lock(self):
# Fleet lock depends on if it appear on map, not depends on map status.
# Because if already in map, there's no map status,
if not fleet_lock.appear(main=self): if not fleet_lock.appear(main=self):
logger.info('No fleet lock option.') logger.info('No fleet lock option.')
return False return False
logger.info('fleet_lock')
self.is_map_green = True
self.config.MAP_HAS_AMBUSH = False
status = 'on' if self.config.ENABLE_MAP_FLEET_LOCK else 'off' status = 'on' if self.config.ENABLE_MAP_FLEET_LOCK else 'off'
changed = fleet_lock.set(status=status, main=self) changed = fleet_lock.set(status=status, main=self)
return changed return changed
def get_map_clear_percentage(self): def get_map_clear_percentage(self):
"""
Returns:
float: 0 to 1.
"""
return color_bar_percentage(self.device.image, area=MAP_CLEAR_PERCENTAGE.area, prev_color=(231, 170, 82)) return color_bar_percentage(self.device.image, area=MAP_CLEAR_PERCENTAGE.area, prev_color=(231, 170, 82))
def triggered_map_clear_mode_stop(self): def triggered_map_stop(self):
if not self.config.ENABLE_MAP_CLEAR_MODE: """
return False Returns:
bool:
percent = self.get_map_clear_percentage() """
logger.attr('Map_clear', f'{int(percent * 100)}%') if self.config.STOP_IF_MAP_REACH == 'map_100':
if self.config.CLEAR_MODE_STOP_CONDITION == 'map_100': if self.map_is_clear:
if percent > 0.95:
return True return True
if self.config.CLEAR_MODE_STOP_CONDITION == 'map_3_star': if self.config.STOP_IF_MAP_REACH == 'map_3_star':
if self.appear(MAP_STAR_1) and self.appear(MAP_STAR_2) and self.appear(MAP_STAR_3) and percent > 0.95: if self.map_is_clear and self.map_is_3_star:
return True return True
if self.config.CLEAR_MODE_STOP_CONDITION in ['map_3_star', 'map_green'] and self.config.MAP_STAR_CLEAR_ALL: if self.config.STOP_IF_MAP_REACH == 'map_green_without_3_star':
button = [MAP_STAR_1, MAP_STAR_2, MAP_STAR_3][self.config.MAP_STAR_CLEAR_ALL - 1] if self.map_is_clear and self.map_is_green:
self.config.MAP_CLEAR_ALL_THIS_TIME = not self.appear(button) return True
logger.attr('MAP_CLEAR_ALL_THIS_TIME', self.config.MAP_CLEAR_ALL_THIS_TIME)
if self.config.CLEAR_MODE_STOP_CONDITION == 'map_green': if self.config.STOP_IF_MAP_REACH == 'map_green':
if self.appear(MAP_GREEN): if self.map_is_clear and self.map_is_3_star and self.map_is_green:
return True return True
return False return False
def handle_map_clear_mode_stop(self): def handle_map_stop(self):
if self.map_clear_record is True: if self.map_clear_record is True:
return False return False
flag = self.triggered_map_clear_mode_stop() flag = self.triggered_map_stop()
if self.map_clear_record is None: if self.map_clear_record is None:
self.map_clear_record = flag self.map_clear_record = flag
elif self.map_clear_record is False and flag: elif self.map_clear_record is False and flag:

View File

@@ -92,8 +92,8 @@ class InfoHandler(ModuleBase):
""" """
Story Story
""" """
story_popup_timout = Timer(10, count=20) story_popup_timout = Timer(10, count=20)
map_has_fast_forward = False # Will be override in fast_forward.py
def story_skip(self): def story_skip(self):
if self.story_popup_timout.started() and not self.story_popup_timout.reached(): if self.story_popup_timout.started() and not self.story_popup_timout.reached():
@@ -118,9 +118,7 @@ class InfoHandler(ModuleBase):
return False return False
def handle_story_skip(self): def handle_story_skip(self):
if not self.config.ENABLE_MAP_CLEAR_MODE: if self.map_has_fast_forward:
return False
if self.config.ENABLE_FAST_FORWARD:
return False return False
return self.story_skip() return self.story_skip()

View File

@@ -1,6 +1,7 @@
import numpy as np import numpy as np
from module.base.switch import Switch from module.base.switch import Switch
from module.base.timer import Timer
from module.handler.assets import * from module.handler.assets import *
from module.handler.info_handler import InfoHandler from module.handler.info_handler import InfoHandler
from module.logger import logger from module.logger import logger
@@ -11,15 +12,70 @@ formation.add_status('1', check_button=FORMATION_1, offset=120)
formation.add_status('2', check_button=FORMATION_2, offset=120) formation.add_status('2', check_button=FORMATION_2, offset=120)
formation.add_status('3', check_button=FORMATION_3, offset=120) formation.add_status('3', check_button=FORMATION_3, offset=120)
submarine_view = Switch('Submarine_view')
submarine_view.add_status('on', check_button=SUBMARINE_VIEW_ON, offset=120)
submarine_view.add_status('off', check_button=SUBMARINE_VIEW_OFF, offset=120)
submarine_hunt = Switch('Submarine_hunt') submarine_hunt = Switch('Submarine_hunt')
submarine_hunt.add_status('on', check_button=SUBMARINE_HUNT_ON, offset=120) submarine_hunt.add_status('on', check_button=SUBMARINE_HUNT_ON, offset=120)
submarine_hunt.add_status('off', check_button=SUBMARINE_HUNT_OFF, offset=120) submarine_hunt.add_status('off', check_button=SUBMARINE_HUNT_OFF, offset=120)
class SwitchWithHandler(Switch):
@staticmethod
def handle_submarine_zone_icon_bug(main):
"""
When switching the submarine zone, the icon in the strategy don't change.
If click submarine hunt, submarine zone will show the correct icon.
So the key to deal with submarine zone icon bug, is to double click submarine_hunt.
Args:
main (ModuleBase):
"""
current = submarine_hunt.get(main=main)
opposite = 'off' if current == 'on' else 'on'
submarine_hunt.set(opposite, main=main)
submarine_hunt.set(current, main=main)
def set(self, status, main, skip_first_screenshot=True):
"""
Args:
status (str):
main (ModuleBase):
skip_first_screenshot (bool):
Returns:
bool:
"""
changed = False
warning_show_timer = Timer(5, count=10).start()
while 1:
if skip_first_screenshot:
skip_first_screenshot = False
else:
main.device.screenshot()
print('scr')
current = self.get(main=main)
logger.attr(self.name, current)
if current == status:
return changed
if current == 'unknown':
if warning_show_timer.reached():
logger.warning(f'Unknown {self.name} switch')
warning_show_timer.reset()
continue
for data in self.status_list:
if data['status'] == current:
main.device.click(data['click_button'])
main.device.sleep(data['sleep'])
self.handle_submarine_zone_icon_bug(main=main) # Different from Switch.
changed = True
submarine_view = SwitchWithHandler('Submarine_view')
submarine_view.add_status('on', check_button=SUBMARINE_VIEW_ON, offset=120)
submarine_view.add_status('off', check_button=SUBMARINE_VIEW_OFF, offset=120)
class StrategyHandler(InfoHandler): class StrategyHandler(InfoHandler):
fleet_1_formation_fixed = False fleet_1_formation_fixed = False
fleet_2_formation_fixed = False fleet_2_formation_fixed = False
@@ -53,8 +109,9 @@ class StrategyHandler(InfoHandler):
formation.set(str(formation_index), main=self) formation.set(str(formation_index), main=self)
# Disable this until the icon bug of submarine zone is fixed # Disable this until the icon bug of submarine zone is fixed
# And don't enable MAP_HAS_DYNAMIC_RED_BORDER when using submarine # And don't enable MAP_HAS_DYNAMIC_RED_BORDER when using submarine
# if submarine_view.appear(main=self): # Submarine view check is back again, see SwitchWithHandler.
# submarine_view.set('on' if sub_view else 'off', main=self) if submarine_view.appear(main=self):
submarine_view.set('on' if sub_view else 'off', main=self)
if submarine_hunt.appear(main=self): if submarine_hunt.appear(main=self):
submarine_hunt.set('on' if sub_hunt else 'off', main=self) submarine_hunt.set('on' if sub_hunt else 'off', main=self)

View File

@@ -527,19 +527,9 @@ class Fleet(Camera, MapOperation, AmbushHandler):
self.round_battle() self.round_battle()
def handle_map_green_config_cover(self): def handle_map_green_config_cover(self):
if not self.is_map_green: if not self.map_is_green:
return False return False
logger.info('Map is green sea.')
if self.config.ENABLE_FAST_FORWARD:
self.config.MAP_HAS_AMBUSH = False
self.config.MAP_HAS_FLEET_STEP = False
self.config.MAP_HAS_MOVABLE_ENEMY = False
else:
# When disable fast forward, MAP_HAS_AMBUSH depends on map settings.
# self.config.MAP_HAS_AMBUSH = True
pass
if self.config.POOR_MAP_DATA and self.map.is_map_data_poor: if self.config.POOR_MAP_DATA and self.map.is_map_data_poor:
self.config.POOR_MAP_DATA = False self.config.POOR_MAP_DATA = False

View File

@@ -55,10 +55,11 @@ class MapOperation(MysteryHandler, FleetPreparation, Retirement, FastForwardHand
# Map preparation # Map preparation
if map_timer.reached() and self.handle_map_preparation(): if map_timer.reached() and self.handle_map_preparation():
if self.handle_map_clear_mode_stop(): self.map_get_info()
self.enter_map_cancel()
raise ScriptEnd(f'Reach condition: {self.config.CLEAR_MODE_STOP_CONDITION}')
self.handle_fast_forward() self.handle_fast_forward()
if self.handle_map_stop():
self.enter_map_cancel()
raise ScriptEnd(f'Reach condition: {self.config.STOP_IF_MAP_REACH}')
self.device.click(MAP_PREPARATION) self.device.click(MAP_PREPARATION)
map_timer.reset() map_timer.reset()
campaign_timer.reset() campaign_timer.reset()

View File

@@ -141,8 +141,8 @@ class BookGroup:
logger.attr('Book_choose', books[0]) logger.attr('Book_choose', books[0])
return books[0] return books[0]
logger.warning('No book choose, return first book.') logger.info('No book choose')
return self[0] return None
class RewardTacticalClass(UI): class RewardTacticalClass(UI):
@@ -191,8 +191,20 @@ class RewardTacticalClass(UI):
tier_min=self.config.TACTICAL_BOOK_TIER_MIN, tier_min=self.config.TACTICAL_BOOK_TIER_MIN,
exp=self.config.TACTICAL_EXP_FIRST) exp=self.config.TACTICAL_EXP_FIRST)
self.device.click(book.button) if book is not None:
self.device.sleep((0.3, 0.5)) self.device.click(book.button)
self.device.sleep((0.3, 0.5))
self.device.click(TACTICAL_CLASS_START)
else:
# cancel_tactical, use_the_first_book
if self.config.TACTICAL_IF_NO_BOOK_SATISFIED == 'use_the_first_book':
logger.info('Choose first book')
self.device.click(books[0].button)
self.device.sleep((0.3, 0.5))
self.device.click(TACTICAL_CLASS_START)
else:
logger.info('Cancel tactical')
self.device.click(TACTICAL_CLASS_CANCEL)
def _tactical_class_receive(self, skip_first_screenshot=True): def _tactical_class_receive(self, skip_first_screenshot=True):
"""Remember to make sure current page is page_reward before calls. """Remember to make sure current page is page_reward before calls.
@@ -232,7 +244,6 @@ class RewardTacticalClass(UI):
self.device.screenshot() self.device.screenshot()
self.handle_info_bar() # info_bar appears when get ship in Launch Ceremony commissions self.handle_info_bar() # info_bar appears when get ship in Launch Ceremony commissions
self._tactical_books_choose() self._tactical_books_choose()
self.device.click(TACTICAL_CLASS_START)
self.interval_reset(TACTICAL_CLASS_CANCEL) self.interval_reset(TACTICAL_CLASS_CANCEL)
tactical_class_timout.reset() tactical_class_timout.reset()
continue continue