Exemplo n.º 1
0
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
Exemplo n.º 2
0
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)
Exemplo n.º 3
0
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)  # 判断蓝色塞壬轻巡
Exemplo n.º 4
0
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)
    ]
Exemplo n.º 5
0
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
Exemplo n.º 6
0
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
Exemplo n.º 7
0
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
Exemplo n.º 8
0
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
Exemplo n.º 9
0
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)  # 大型舰队
    ]
Exemplo n.º 10
0
def prts_running_scene(prefix):
    s = Scene('检测自律战斗进行中',
              action_type='none',
              identify_image=load_resource('level_fighting_detection.png',
                                           prefix))
    return s
Exemplo n.º 11
0
def annihilation_finish_detection(prefix):
    return Scene('检测剿灭模式自律完成页面',
                 identify_image=load_resource(
                     'annihilation_finish_detection.png', prefix))
Exemplo n.º 12
0
def collect_friends_batteries(prefix):
    return Scene('获取好友电池',
                 identify_image=load_resource('collect_friend_batteries.png',
                                              prefix),
                 threshold=0.6)
Exemplo n.º 13
0
def level_info_detection(prefix):
    image = load_resource('level_info_detection.png', prefix)
    width, _ = image.shape[::-1]
    return Scene('检测指定关卡信息介绍页面', identify_image=image, tap_offset_x=width)
Exemplo n.º 14
0
def prts_disable_detection(prefix):
    return Scene('检测自律未打开',
                 identify_image=load_resource('prts_disable_detection.png',
                                              prefix))
Exemplo n.º 15
0
def ship_202005_light(prefix):
    return Scene("检测圣穹轻巡",
                 identify_image=load_resource("map_ship_202005_light.png",
                                              prefix))  #判断圣穹轻巡
Exemplo n.º 16
0
def prts_disable_detection_3rd(prefix):
    return Scene('检测自律未打开(3周年活动)',
                 identify_image=load_resource(
                     'prts_disable_detection-3rd-anniversary.png', prefix))
Exemplo n.º 17
0
def account_upgrade_detection(prefix):
    return Scene('检测账号升级',
                 identify_image=load_resource('account_upgrade_detection.png',
                                              prefix))
Exemplo n.º 18
0
def map_move_spec_question_mark(prefix):
    return Scene('检测问号探索点',
                 identify_image=load_resource("explore_map_question_mark.png",
                                              prefix),
                 tap_offset_y=50)
Exemplo n.º 19
0
def siren_heavy_blue(prefix):
    return Scene("检测蓝色塞壬重巡",
                 identify_image=load_resource("map_siren_heavy_blue.png",
                                              prefix))  #判断塞壬蓝色重巡
Exemplo n.º 20
0
def ship_202006_sp3_3(prefix):
    return Scene("检测峡湾反击驱逐",
                 identify_image=load_resource("map_ship_202006_dd_3.png",
                                              prefix))  #判断峡湾反击驱逐
Exemplo n.º 21
0
def ship_202005_heavy_1(prefix):
    return Scene("检测圣穹重巡",
                 identify_image=load_resource("map_ship_202005_heavy_1.png",
                                              prefix))  #判断圣穹轻巡
Exemplo n.º 22
0
def level_info_detection_3rd(prefix):
    image = load_resource('level_info_detection-3rd-anniversary.png', prefix)
    width, _ = image.shape[::-1]
    return Scene('检测指定关卡信息介绍页面(3周年活动)',
                 identify_image=image,
                 tap_offset_x=width)
Exemplo n.º 23
0
def siren_heavy_purple(prefix):
    return Scene("检测紫色塞壬重巡",
                 identify_image=load_resource("map_siren_heavy_purple.png",
                                              prefix))  # 判断紫色塞壬重巡
Exemplo n.º 24
0
def difficult_small(prefix):
    return Scene('检测中型舰队标志',
                 identify_image=load_resource("difficult_medium.png", prefix),
                 tap_offset_x=40,
                 tap_offset_y=30,
                 threshold=0.7)
Exemplo n.º 25
0
def like_friend_dormitory(prefix):
    scene = Scene('给好友宿舍点赞',
                  identify_image=load_resource(
                      'like_friend_dormitory_button.png', prefix))
    return scene