Exemplo n.º 1
0
def check_fight(img):
    leftImg = cat_img(img, 55, 55, 64, 64)
    rightImg = cat_img(img, 1865, 55, 64, 64)
    left = classify_hist_with_split(fightLeftImg, leftImg)
    right = classify_hist_with_split(fightRightImg, rightImg)
    print("识别战斗中界面 left", left, "right", right)
    if (left > 0.5) or (right > 0.5):
        print("战斗中中")
        return True
    else:
        print("未战斗中中")
        return False
Exemplo n.º 2
0
def check_main_view(img):
    btn = cat_img(img, 360, 978, 80, 80)
    jjcEnterImg = cat_img(mainImg, 360, 978, 80, 80)
    matchJjc = (classify_hist_with_split(btn, jjcEnterImg))

    btn = cat_img(img, 560, 978, 80, 80)
    gameEnterImg = cat_img(mainImg, 560, 978, 80, 80)
    matchGame = (classify_hist_with_split(btn, gameEnterImg))

    print("识别主界面:matchJjc", matchJjc, "matchGame", matchGame)

    if matchJjc > 0.5 and matchGame > 0.5:
        return True
Exemplo n.º 3
0
def check_casting(img):
    leftImg = cat_img(img, 55, 55, 64, 64)
    rightImg = cat_img(img, 1865, 55, 64, 64)

    castingLeftImg = cat_img(castingImg, 55, 55, 64, 64)
    castingRightImg = cat_img(castingImg, 1865, 55, 64, 64)

    left = classify_hist_with_split(castingLeftImg, leftImg)
    right = classify_hist_with_split(castingRightImg, rightImg)
    print("识别施法中界面 left", left, "right", right)
    if (left > 0.5) or (right > 0.5):
        print("施法中")
        return True
    else:
        print("未施法中")
        return False
Exemplo n.º 4
0
def check_windows(img):
    #截取左下角 ,比较windows 开始按钮
    btn = cat_img(img, 20, 1060, 40, 40)
    matchWindows = classify_hist_with_split(btn, windowsImg)
    print("比较桌面", matchWindows)
    if matchWindows > 0.5:
        return True
    return False
Exemplo n.º 5
0
def check_left(img):
    for obj in leftList:
        if obj["name"]:
            castImg = obj["castImg"]
            leftCastImg = cat_img(img, obj["x"], obj["y"], 100, 100)
            ready = (classify_hist_with_split(castImg, leftCastImg) > 0.5)
            obj["ready"] = ready
            print(obj["name"], "ready", ready)
    return True
Exemplo n.º 6
0
def check_jjc_prepare(img):
    btn = cat_img(img, 959, 1009, 241, 53)
    if (classify_hist_with_split(btn, jjcPrepareBtn) > 0.5):
        #竞技场准备
        jjcArr = [[1469, 600], [959, 600], [449, 600]]
        #jjcArr = [[449,600]]
        for arr in jjcArr:
            target = cat_img(img, arr[0], arr[1], 100, 100)
            if (classify_hist_with_split(target, jjcHuozhadanImg) > 0.5):
                print("遇到火炸弹,点炸弹")
                #遇到火炸弹,点炸弹
                m.click(arr[0], 600)
                time.sleep(0.2)
                return True
        #未遇到火炸弹,点最左
        print("未遇到火炸弹,点中")
        m.click(jjcArr[1][0], 900)
        time.sleep(0.25)
        return True
    else:
        return False
Exemplo n.º 7
0
def check_prepare(img):
    curPrepareBtn = cat_img(img, 952, 1010, 200, 50)
    if (classify_hist_with_split(curPrepareBtn, prepareBtn) > 0.5):
        #准备中
        #重置敌方数组
        reset_right_list()
        print("检查到准备中")
        #点击继续
        m.click(1002, 1020)
        time.sleep(0.25)
        return True
    else:
        print("未检查到准备中")
        return False
Exemplo n.º 8
0
def compare_color(imgPart):
    if (classify_hist_with_split(imgPart, bImg)[0] > 0.48):
        return "b"
    if (classify_hist_with_split(imgPart, wImg) > 0.48):
        return "w"
    if (classify_hist_with_split(imgPart, yImg) > 0.48):
        return "y"
    if (classify_hist_with_split(imgPart, rImg) > 0.48):
        return "r"
    if (classify_hist_with_split(imgPart, pImg) > 0.48):
        return "p"
    if (classify_hist_with_split(imgPart, nImg) > 0.48):
        return "n"
    if (classify_hist_with_split(imgPart, gImg) > 0.48):
        return "g"
    if (classify_hist_with_split(imgPart, sImg) > 0.48):
        return "s"
Exemplo n.º 9
0
def check_PVP(img):
    curRefreshBtn = cat_img(img, 960, 1010, 368, 96)
    rate = classify_hist_with_split(curRefreshBtn, refreshBtn)
    print("classify_hist_with_split(curRefreshBtn,refreshBtn)", rate)
    if (rate > 0.8):
        #识别到PVP
        #重置敌方数组
        reset_right_list()
        print("检查到PVP")
        #点击继续
        m.click(960, 540)
        time.sleep(0.25)
        return True
    else:
        print("未检查到PVP")
        return False
Exemplo n.º 10
0
def is_all_right_dead(img):
    centerImg = cat_img(img, 960, 540, 80, 80)
    return (classify_hist_with_split(centerImg, overImg) > 0.5)