def exchange_intellect_by_pharmacy(config, context, prefix): def before_action(_1, _2): if config.use_pharmacy_max > 0: if context.pharmacy_used >= config.use_pharmacy_max: cause = '已到达预设的可用药剂上限, 脚本将退出' logger.info(cause) program_exit_alert(cause) exit(0) else: cause = '理智不足,自动退出脚本' logger.info(cause) program_exit_alert(cause) exit(0) def after_action(_1, _2): context.pharmacy_used += 1 s = Scene('检测建议使用药剂补充理智页面', identify_image=load_resource( 'exchange_intellect_by_pharmacy.png', prefix), tap_image=load_resource("exchange_intellect_confirm.png", prefix)) s.before_action = before_action s.after_action = after_action return s
def battle_finished_lock_new_character(prefix): s = Scene('检测锁定新角色提示', identify_image=load_resource("lock_ship_detection.png", prefix), tap_image=load_resource("ship_lock_yes_button.png", prefix), tap_offset_y=-100) s.after_action = lambda _1, _2: logger.info(" new character locked!") return s
def battle_finished_team_exp(prefix): s = Scene("检测战斗完成经验结算界面", identify_image=load_resource("battle_post_confirm_detection.png", prefix), tap_image=load_resource("battle_post_confirm_button.png", prefix)) s.after_action = lambda _1, _2: time.sleep(5) return s
def wife_unhappy(prefix): def before_action(_1, _2): print() logger.info('队伍存在舰娘心情警告,指挥官休息一下吧') exit(0) s = Scene("检测舰娘心情值偏低", identify_image=load_resource("unhappy.png", prefix)) s.before_action = before_action return s
def level_finish_detection(context, prefix): def after_action(_1, _2): context.flag_start_printed = False s = Scene('检测指定关卡自律完成页面', identify_image=load_resource('level_finish_detection.png', prefix)) s.after_action = after_action return s
def shipyard_full(prefix): def before_action(_1, _2): print() logger.info('船坞满了,指挥官清理一下喵') exit(0) s = Scene("检测船坞已满提示", identify_image=load_resource("shipyard_full.png", prefix)) s.before_action = before_action return s
def battle_prepare(context, prefix): def before_action(_1, _2): context.round_count += 1 print('%s 次出击' % context.round_count, end=',', sep='', flush=True) s = Scene("检测出击队伍阵型调整", identify_image=load_resource("battle_prepare.png", prefix), tap_image=load_resource("battle_preview_start_button.png", prefix)) s.before_action = before_action return s
def wife_unhappy(prefix, context): def before_action(_1, _2): print() cause = "队伍存在舰娘心情警告,指挥官休息一下吧,已出击" + str(context.repeated_count) + "次" logger.info(cause) program_exit_alert(cause) exit(0) s = Scene("检测舰娘心情值偏低", identify_image=load_resource("unhappy.png", prefix)) s.before_action = before_action return s
def shipyard_full(prefix, context): def before_action(_1, _2): print() cause = "船坞满了,指挥官清理一下喵,已出击" + str(context.repeated_count) + "次" logger.info(cause) program_exit_alert(cause) exit(0) s = Scene("检测船坞已满提示", identify_image=load_resource("shipyard_full.png", prefix)) s.before_action = before_action return s
def battle_finished_team_exp(context, prefix): def after_action(_1, _2): context.round_count += 1 print('%s 次出击' % context.round_count, end=',', sep='', flush=True) time.sleep(5) s = Scene("检测战斗完成经验结算界面", identify_image=load_resource("battle_post_confirm_detection.png", prefix), tap_image=load_resource("battle_post_confirm_button.png", prefix)) s.after_action = after_action return s
def level_team_detection(config, context, prefix): def before_action(_1, _2): if 0 <= config.repeat_count_max <= context.repeated_count: logger.info('\n\n预设的复读次数已完成') exit(0) context.repeated_count += 1 logger.info('第 %03d 次副本' % context.repeated_count) s = Scene('检测指定关卡自律队伍阵容页面', identify_image=load_resource('level_team_detection.png', prefix)) s.before_action = before_action s.after_action = lambda _1, _2: time.sleep(2) return s
def next_friend_dormitory(prefix, config, context): image = load_resource('next_friend_dormitory_button.png', prefix) width, _ = image.shape[::-1] def before_action(_1, _2): if context.like_friend_dormitory_count >= config.max_like_dormitory: logger.info('点赞数达成') exit(0) context.like_friend_dormitory_count += 1 scene = Scene('前往下一位好友的宿舍', identify_image=image, tap_offset_x=width / 2 - 30) scene.before_action = before_action return scene
def battle_fighting(prefix): s = Scene( "检测战斗进行时", identify_image=load_resource("stop_auto_battle_detection.png", prefix), action_type='none', # 不需要点击 ) return s
def siren_light_blue(prefix): return Scene("检测蓝色塞壬轻巡", identify_image=load_resource("map_siren_light_blue.png", prefix), tap_offset_x=0, tap_offset_y=55, threshold=0.9) # 判断蓝色塞壬轻巡
def annihilation_detection(prefix): image = load_resource('annihilation_detection.png', prefix) width, _ = image.shape[::-1] return Scene('检测剿灭模式关卡信息介绍页面', identify_image=load_resource('annihilation_detection.png', prefix), tap_offset_x=250, tap_offset_y=30)
def load_target_ship_features(prefix): return [ Scene("检测旗舰", identify_image=load_resource("boss_icon_detection2.png", prefix), threshold=0.7), Scene("检测旗舰(带人物)", identify_image=load_resource("boss_small.png", prefix), threshold=0.7), Scene("检测侦查舰队", identify_image=load_resource("map_ship_type_1.png", prefix)), # 判断 Scene("检测航母舰队", identify_image=load_resource("map_ship_type_2.png", prefix)), # 判断航母舰队 Scene("检测主力舰队", identify_image=load_resource("map_ship_type_3.png", prefix)), # 判断主力舰队 Scene("检测运输舰队", identify_image=load_resource("map_ship_type_4.png", prefix)), # 判断侦查舰队 Scene("检测舰队等级", identify_image=load_resource("enemy_level.png", prefix), threshold=0.6, tap_offset_y=-55), difficult_small(prefix), # 小型舰队 difficult_medium(prefix), # 中型舰队 difficult_large(prefix), # 大型舰队 map_move_spec_question_mark(prefix) ]
def continue_next_auto_fight(prefix, config, context): def before_action(_1, _2): if 0 <= config.repeat_count_max <= context.repeated_count: cause = "预设的复读次数已完成" logger.info(cause) program_exit_alert(cause) exit(0) context.repeated_count += 1 context.round_count = 0 logger.info('第 %03d 次副本' % context.repeated_count) s = Scene("继续下次自律战斗", identify_image=load_resource("auto_fight_item_collections.png", prefix), tap_image=load_resource("continue_next_auto_fight_confirm.png", prefix)) s.before_action = before_action return s
def exchange_intellect_by_stone(config, context, prefix): def before_action(_1, _2): if config.use_stone_max > 0: if context.stone_used >= config.use_stone_max: logger.info('已到达预设的可用源石上限, 脚本将退出') exit(0) else: context.stone_used += 1 else: logger.info('理智不足,自动退出脚本') exit(0) s = Scene('检测建议使用石头补充理智页面', identify_image=load_resource('exchange_intellect_by_stone.png', prefix), tap_image=load_resource("exchange_intellect_confirm.png", prefix)) s.before_action = before_action return s
def battle_team_choose(config, context, prefix): def before_action(_1, _2): if 0 <= config.repeat_count_max <= context.repeated_count: print() logger.info('预设的复读次数已完成') exit(0) context.repeated_count += 1 context.round_count = 0 context.swipe_mode = config.default_swipe_direction print('') logger.info('第 %03d 次副本' % context.repeated_count) s = Scene("检测指定关卡出击队伍选择", identify_image=load_resource("team_choose.png", prefix), tap_image=load_resource("choose_level_go_now_button.png", prefix)) s.before_action = before_action s.after_action = lambda _1, _2: time.sleep(5) return s
def battle_team_choose(config, context, prefix): def before_action(_1, _2): if 0 <= config.repeat_count_max <= context.repeated_count: print() cause = "预设的复读次数已完成" logger.info(cause) program_exit_alert(cause) exit(0) context.repeated_count += 1 context.round_count = 0 context.swipe_hor_times = 0 context.swipe_ver_times = 0 context.team_switched = False print('') logger.info('第 %03d 次副本' % context.repeated_count) s = Scene("检测指定关卡出击队伍选择", identify_image=load_resource("team_choose.png", prefix), tap_image=load_resource("choose_level_go_now_button.png", prefix)) s.before_action = before_action s.after_action = lambda _1, _2: time.sleep(5) return s
def load_target_ship_features(prefix): return [ ship_202006_sp3_1(prefix), ship_202006_sp3_2(prefix), ship_202006_sp3_3(prefix), Scene("检测旗舰", identify_image=load_resource("boss_icon_detection2.png", prefix), threshold=0.7), Scene("检测旗舰(带人物)", identify_image=load_resource("boss_small.png", prefix), threshold=0.7), map_move_spec_question_mark(prefix), siren_DD_blue(prefix), siren_light_blue(prefix), siren_heavy_blue(prefix), #判断塞壬蓝色重巡 siren_heavy_purple(prefix), # 判断紫色塞壬重巡 Scene("检测运输舰队", identify_image=load_resource("map_ship_type_4.png", prefix)), # 判断运输舰队 Scene("检测侦查舰队", identify_image=load_resource("map_ship_type_1.png", prefix)), # 判断侦查 Scene("检测航母舰队", identify_image=load_resource("map_ship_type_2.png", prefix)), # 判断航母舰队 Scene("检测主力舰队", identify_image=load_resource("map_ship_type_3.png", prefix)), # 判断主力舰队 Scene("检测舰队等级", identify_image=load_resource("enemy_level.png", prefix), threshold=0.6, tap_offset_y=-55), difficult_small(prefix), # 小型舰队 difficult_medium(prefix), # 中型舰队 difficult_large(prefix) # 大型舰队 ]
def battle_special_info(prefix): return Scene("检测特别行动开启提示", identify_image=load_resource( "special_operation_enable_warn.png", prefix), tap_image=load_resource("confirm.png", prefix))
def battle_finished_super_rare_character_confirm(prefix): return Scene('检测获得稀有及以上级别角色', identify_image=load_resource( "battle_post_new_character_detection.png", prefix), tap_offset_y=-100)
def battle_finished_item_list_check(prefix): return Scene("检测战斗完成道具获得界面", identify_image=load_resource( "battle_post_view_get_items_detection.png", prefix))
def battle_finished_evaluation(prefix): return Scene("检测战斗完成评价(S/A/B/C)界面", identify_image=load_resource("battle_post_view_s_level.png", prefix))
def battle_prepare(prefix): return Scene("检测出击队伍阵型调整", identify_image=load_resource("battle_prepare.png", prefix), tap_image=load_resource("battle_preview_start_button.png", prefix))
def battle_highly_danger_lane_strike_confirm(prefix): return Scene( "检测指定关卡出击确认", # identify_image=load_resource("choose_level_go_now_button.png", prefix), identify_image=load_resource("highly_danger_lane.png", prefix), tap_image=load_resource("choose_level_go_now_button.png", prefix))
def use_special_ticket(prefix): return Scene("特别行动:战斗!皇家女仆队2", identify_image=load_resource("use_special_ticket.png", prefix), tap_image=load_resource("use.png", prefix))
def battle_entry(entry_name, prefix): return Scene("检测自律关卡入口", identify_image=load_resource("battle_" + entry_name + '.png', prefix))
def evade_ambush(prefix): return Scene("检测命中伏击舰队(bad luck)", identify_image=load_resource( "ambush_encountered_detection.png", prefix), tap_image=load_resource("map_move_evade_ambush.png", prefix))