Example #1
0
def loop(hwnd):
    baseImg = "../images/blackground.jpg"  # 储存的文件名  # 储存的文件名
    rect = win32gui.GetWindowRect(hwnd)
    WindowCapture.window_capture(baseImg, hwnd)  # 对整个屏幕截图,并保存截图为baseImg
    # 遍历所有图片
    for filename in os.listdir(r"../images/images-fight"):  # listdir的参数是文件夹的路径
        imagePath = "../images/images-fight/" + filename
        res = matchImg(baseImg, imagePath, 0.9)
        if res is None:
            continue
        # if filename == "exp.png":
        #     y = rect[1] - 120
        # else:
        #     continue
        #     #y = rect[1] + res["result"][1]
        # x = rect[0] + res["result"][0]
        print(filename)

        if filename == "reward.png" or filename == "finded.png":
            x = rect[0] + 20
            y = rect[1] + 560
        else:
            x = rect[0] + res["result"][0]
            y = rect[1] + res["result"][1]
        move_x = random.randint(int(x) - 2, int(x) + 2)
        move_y = random.randint(int(y) - 2, int(y) + 2)
        click_it((move_x, move_y), hwnd)
        if filename == "3.png" or filename == "4.png" or filename == "5.png" or filename == "6.png" or filename == "1.png":
            break
Example #2
0
def loop_2(hwnd, baseImgPath="../images/background2.jpg", imageDirPath="../images/shower/"):
    while True:
        time.sleep(1)
        print("洗澡线程正在执行......")
        baseImg = baseImgPath  # 储存的文件名
        rect = win32gui.GetWindowRect(hwnd)
        WindowCapture.window_capture(baseImg, hwnd)  # 对整个屏幕截图,并保存截图为baseImg
        # 遍历所有图片
        for filename in os.listdir(imageDirPath):  # listdir的参数是文件夹的路径
            imagePath = imageDirPath + filename
            res = matchImg(baseImg, imagePath, 0.7)
            if res is None:
                continue
            if filename == "reward.png":
                x = rect[0] + 20
                y = rect[1] + 560
            else:
                x = rect[0] + res["result"][0]
                y = rect[1] + res["result"][1]
            move_x = random.randint(int(x) - 2, int(x) + 2)
            move_y = random.randint(int(y) - 2, int(y) + 2)
            print(move_x, move_y)
            click_it((move_x, move_y), hwnd)
            # 判断是否洗完澡
            if filename == "reward.png":
                print("洗澡线程停止执行......")
                return
    print("洗澡线程停止执行......")
    return
Example #3
0
def public(bg, hwnd, auto_ready=False):
    """处理公共事务,包括悬赏"""
    baseImg = f"./images/public/"  # 储存的图片文件夹

    xuanshang = matchImg(bg, baseImg + "xuanshang.png", 0.9)
    if xuanshang:
        # 出现悬赏 进行判断处理
        money = matchImg(bg, baseImg + "money.png", 0.9)
        if money:
            # 如果是勾玉悬赏,进行接受
            accept = matchImg(bg, baseImg + "accept.png", 0.9)
            if accept:
                click_random(accept, hwnd)
        else:
            refuse = matchImg(bg, baseImg + "refuse.png", 0.9)
            if refuse:
                click_random(refuse, hwnd)
    if auto_ready:  # 自动准备
        ready = matchImg(bg, baseImg + "ready.png", 0.9)
        if ready:
            click_random(ready, hwnd)

    win = matchImg(bg, baseImg + "win.png", 0.9)
    if win:
        click_random(win, hwnd)
    over = matchImg(bg, baseImg + "over.png", 0.9)
    if over:
        click_random(over, hwnd)
Example #4
0
def loop(hwnd):
    baseImg = "../images/blackground.jpg"  # 储存的文件名  # 储存的文件名
    rect = win32gui.GetWindowRect(hwnd)
    WindowCapture.window_capture(baseImg, hwnd)  # 对整个屏幕截图,并保存截图为baseImg
    # 遍历所有图片
    for filename in os.listdir(r"../images/images-fight"):  # listdir的参数是文件夹的路径
        imagePath = "../images/images-fight/" + filename
        res = matchImg(baseImg, imagePath, 0.7)
        if res is None:
            continue
        else:
            x = rect[0] + res["result"][0]
            y = rect[1] + res["result"][1]
        move_x = random.randint(int(x) - 2, int(x) + 2)
        move_y = random.randint(int(y) - 2, int(y) + 2)
        click_it((move_x, move_y), hwnd)
Example #5
0
def loop(hwnd, baseImgPath, imageDirPath):
    baseImg = baseImgPath  # 储存的文件名
    rect = win32gui.GetWindowRect(hwnd)
    WindowCapture.window_capture(baseImg, hwnd)  # 对整个屏幕截图,并保存截图为baseImg
    # 遍历所有图片
    for filename in os.listdir(imageDirPath):  # listdir的参数是文件夹的路径
        imagePath = "../images/images-fight/" + filename
        res = matchImg(baseImg, imagePath, 0.7)
        if res is None:
            continue
        print(filename)
        print(res)
        if filename == "reward.png":
            x = rect[0] + 20
            y = rect[1] + 560
        else:
            x = rect[0] + res["result"][0]
            y = rect[1] + res["result"][1]
        move_x = random.randint(int(x) - 2, int(x) + 2)
        move_y = random.randint(int(y) - 2, int(y) + 2)
        print(move_x, move_y)
        click_it((move_x, move_y), hwnd)
Example #6
0
def loop(hwnd):
    baseImg = "../images/blackground.jpg"  # 储存的文件名  # 储存的文件名
    rect = win32gui.GetWindowRect(hwnd)
    WindowCapture.window_capture(baseImg, hwnd)  # 对整个屏幕截图,并保存截图为baseImg
    # 遍历所有图片
    for filename in os.listdir(r"../images/images-fight"):  # listdir的参数是文件夹的路径
        imagePath = "../images/images-fight/" + filename
        res = matchImg(baseImg, imagePath, 0.99)
        # print("==================:" + filename)
        if res is None:
            continue
        print(filename)
        #疲劳值满之后,暂停100分钟
        if filename == "end.png":
            print("进入休眠....")
            time.sleep(1800)
            print("休眠完成,继续...")
            x1 = rect[0] + 837
            y1 = rect[1] + 207
            move_x1 = random.randint(int(x1) - 2, int(x1) + 2)
            move_y1 = random.randint(int(y1) - 2, int(y1) + 2)
            click_it((move_x1, move_y1), hwnd)
        if filename == "00.png":
            print("发现鬼王.......")
            x1 = rect[0] + 938
            y1 = rect[1] + 140
            move_x1 = random.randint(int(x1) - 2, int(x1) + 2)
            move_y1 = random.randint(int(y1) - 2, int(y1) + 2)
            click_it((move_x1, move_y1), hwnd)
        if filename == "reward.png":
            x = rect[0] + 20
            y = rect[1] + 560
        else:
            x = rect[0] + res["result"][0]
            y = rect[1] + res["result"][1]
        move_x = random.randint(int(x) - 2, int(x) + 2)
        move_y = random.randint(int(y) - 2, int(y) + 2)
        click_it((move_x, move_y), hwnd)