Beispiel #1
0
def get_weapon_parts(img, main_positions):
    """
    获取武器 配件信息
    :param main_positions:
    :param img:
    :return:
    """
    # 主武器 位置信息
    parts_images = []
    # 绘制线条/保存图片
    for i in range(0, len(main_positions)):
        # 保存图片
        x1, x2, y1, y2 = main_positions[i]

        if img is None:
            im = image_util.capture((x1, y1, x2, y2))
        else:
            im = img.crop((x1, y1, x2, y2))

        if i % 6 == 0:
            put_weapon_name(im)
        else:
            put_weapon_parts(im)

        parts_images.append(im)

    return parts_images
def get_position_images(image, positions):
    res = []
    for position in positions:
        x1, x2, y1, y2 = position
        if image is None:
            weapon_img = image_util.capture((x1, y1, x2, y2))
        else:
            weapon_img = image.crop((x1, y1, x2, y2))

        res.append(weapon_img)
    return res
Beispiel #3
0
def handle_capture_image():
    """
    实施截图,用于图片分析 每次截图在

    0.03366827964782715
    0.03325605392456055
    0.03352046012878418
    0.033231496810913086
    0.033119916915893555
    0.034018754959106445
    :return:
    """
    global _capture_image
    while 1:
        _capture_image = image_util.capture(None)
        time.sleep(0.2)
Beispiel #4
0
def weapon_selection_images(image, positions):
    """
    武器选择
    :param image:
    :param positions:
    :return:
    """
    res = []
    for position in positions:
        x1, x2, y1, y2 = position
        if image is None:
            weapon_img = image_util.capture((x1, y1, x2, y2))
        else:
            weapon_img = image.crop((x1, y1, x2, y2))
        res.append(weapon_img)
    return res
Beispiel #5
0
def shoot_images(image, shoot_positions):
    """
    获取 开枪图片
    :param image:
    :param shoot_positions:
    :return:
    """
    res = []
    for position in shoot_positions:
        x1, x2, y1, y2 = position

        if image is None:
            res.append(image_util.capture((x1, y1, x2, y2)))
        else:
            res.append(image.crop((x1, y1, x2, y2)))

    return res
Beispiel #6
0
def package_positions_images(image, position_arr):
    """
    获取 背包 位置图片
    :param image:
    :param position_arr:
    :return:
    """
    res = []
    for position in position_arr:
        x1, x2, y1, y2 = position

        if image is None:
            res.append(image_util.capture((x1, y1, x2, y2)))
        else:
            res.append(image.crop((x1, y1, x2, y2)))

    return res
Beispiel #7
0
def stance_images(image, positions):
    """
       获取 检查开枪姿势
       :param positions:
       :param image:
       :return:
       """
    res = []
    for position in positions:
        x1, x2, y1, y2 = position

        if image is None:
            res.append(image_util.capture((x1, y1, x2, y2)))
        else:
            res.append(image.crop((x1, y1, x2, y2)))

    return res
Beispiel #8
0
def start(system_context):
    """
    开启 实时截屏
    :param system_context:
    :return:
    """
    while 1:
        try:
            # 获取截屏信息
            # now = time.time()
            # capture = image_util.capture((10, 10, 10, 10))
            capture = image_util.capture(None)
            system_context.capture = capture
            # 休眠
            # print(time.time() - now)
            time.sleep(0.03)
        except Exception as e:
            print(e)
Beispiel #9
0
        # 加载 box 驱动文件
        drive_path = resource.resource_path('box64.dll')
        if environment.env.usb_has_default == 2:
            lib, handle = box_drive64.inmmit(drive_path, None, None)
        else:
            lib, handle = box_drive64.init(drive_path, environment.env.usb_vid,
                                           environment.env.usb_pid)

        # 设置 box 驱动
        _systemContext.box_lib = lib
        _systemContext.box_handle = handle
        _systemContext.box_handle64 = handle

        # 初始化 截屏
        _systemContext.capture = image_util.capture(None)

        # 打印 banner
        print_banner()

        # 开启自动狙击
        _executor.submit(event_agent.mouse_left_agent, _systemContext)
        # 开启自动狙击
        _executor.submit(real_time_capture.start, _systemContext)
        # 开启自动狙击
        _executor.submit(automatic_sniper.start, _systemContext)
        # 开启自动步枪
        _executor.submit(automatic_rifle.start, _systemContext)

        # 监听事件
        hm = PyHook3.HookManager()