示例#1
0
def set_direction(handle, xy, direction):
    #direction left ,right up down
    if direction == "left":
        temp_xy = [xy[0] - config_ark.BUSHU_OFFSET, xy[1]]
        mouse_drag(handle, (xy, temp_xy), globalvar.get_drag_speed())
    elif direction == "right":
        temp_xy = [xy[0] + config_ark.BUSHU_OFFSET, xy[1]]
        mouse_drag(handle, (xy, temp_xy), globalvar.get_drag_speed())
    elif direction == "up":
        temp_xy = [xy[0], xy[1] - config_ark.BUSHU_OFFSET]
        mouse_drag(handle, (xy, temp_xy), globalvar.get_drag_speed())
    elif direction == "down":
        temp_xy = [xy[0], xy[1] - config_ark.BUSHU_OFFSET]
        mouse_drag(handle, (xy, temp_xy), globalvar.get_drag_speed())
示例#2
0
def staff_set(handle, name_or_xy, target_xy, direction):
    """
    部署干员,自动检查费用是否足够及部署目标位置是否正确
    :param handle: 窗口句柄
    :param name_or_xy: 部署干员名称或xy坐标
    :param target_xy: 部署位置xy坐标
    :return:  true部署正确,false未知错误
    """
    if isinstance(name_or_xy, str):
        #干员名称
        assert (name_or_xy in config_ark.staff_pic.keys())
        staff_pic = config_ark.staff_pic[name_or_xy]
        i = 0
        while (i < 30):
            i += 1
            position = pic_position(handle,
                                    staff_pic,
                                    globalvar.get_thresh_pic(),
                                    once=True)
            if position != None:
                mouse_drag(handle, (position["result"], target_xy),
                           globalvar.get_drag_speed())
                time.sleep(1)

                if pic_position(handle,
                                config_ark.pic_confirm["bushu_fangxiang"],
                                thresh=globalvar.get_thresh_pic() - 0.1,
                                once=True) != None:
                    set_direction(handle, target_xy, direction)
                    time.sleep(2)
                    return True
            else:
                print("No staff{} detected".format(name_or_xy))

        return False
示例#3
0
def enter_zhuxian(handle, where, daili_confirm=True):
    """
    :param handle:
    :param where: exp 'ZX|1|1-11' 'HD|1|xx-xx'
    :param daili_confirm:
    :return:
    """
    #从章节进入主线
    #开始拖拽至最最右侧
    #先判定是否有选择的关卡
    chapter = where.split('|')[0]
    if chapter == 'HD':
        tmp1 = config_ark.pic_huodong[where]
        tmp2 = config_ark.pic_huodong[where + '_confirm']
    else:
        tmp1 = config_ark.guanqia_pic[where]
        tmp2 = config_ark.guanqia_pic[where + '_confirm']
    position = pic_position(handle, tmp1, once=True)
    if position == None:
        position = pic_position(handle, tmp2, once=True)
    if position == None:
        print('当前界面未检测到选择关卡,划至最右侧寻找')
        for i in range(20):
            mouse_drag(handle, config_ark.points['drag_right'], 3)
        cnt = 0
        while (1):
            position = pic_position(handle, tmp1, once=1)
            if position != None:
                break
            mouse_drag(handle, config_ark.points['drag_left'],
                       globalvar.get_drag_speed())
            cnt += 1
            if cnt > 20:
                print("主线进入失败,重新进入战斗界面")
                return False
    mouse_click(handle, position["result"])
    time.sleep(1)
    print("选择关卡")
    #if confirm_where(handle, config_ark.guanqia_pic["{}_confirm".format(where)], confirm_once=2):
    if daili_confirm == True:
        position = pic_position(handle,
                                config_ark.pic_confirm["daili_do"],
                                once=True)
        if position != None:
            print("代理已使用")
            # i += 1
            pass
        else:
            mouse_click(handle, config_ark.points['daili'])
            time.sleep(1)
            print("使用代理")
    else:
        return False
    mouse_click(handle, config_ark.points["peizhi_enter"])
    print("进入队伍配置界面")
    #else:
    #return False
    time.sleep(3)
    return True
示例#4
0
def enter_chapter(handle, where):
    #从战斗进入主线,物资,活动关卡等
    #主线、物资、活动关卡需要进入两次才能选择关卡,而剿灭只需要一次
    #where为关卡完整信息,如 "ZX|1|1-11"
    tmp = where.split('|')
    sub_class = tmp[0] + "|" + tmp[1]
    chapter = tmp[0]
    if chapter in ['ZX', 'PR', 'WZ']:
        confirm_pic = config_ark.guanqia_pic[chapter]
        sub_class_pic = config_ark.guanqia_pic[sub_class]
    elif chapter == 'HD':
        confirm_pic = config_ark.pic_huodong[chapter]
        sub_class_pic = config_ark.pic_huodong[sub_class]
    elif chapter == 'JM':
        # 剿灭菜单相较于普通关卡少一级,不需要子类别
        confirm_pic = config_ark.guanqia_pic[chapter]
        sub_class_pic = None
    else:
        #实际上不可能出现
        temp_str = None
        raise Exception
    #进入一级章节
    position = pic_position(handle, confirm_pic, once=True)
    if position != None:
        mouse_click(handle, position["result"])
        time.sleep(1)
    else:
        return False
    cnt = 0
    #进入子章节
    if chapter == 'JM':
        pass
    else:
        while (1):
            position = pic_position(handle, sub_class_pic, once=1)
            if position != None:
                break
            mouse_drag(handle, config_ark.points['drag_left'],
                       globalvar.get_drag_speed())
            cnt += 1
            if cnt > 10:
                print("主线进入失败,重新进入战斗界面")
                return False

        mouse_click(handle, position["result"])
        print("进入{}".format(sub_class))
    return True