示例#1
0
def onMap2():
    global enterMap2
    m1=picture.match_multiple(img_gray,'./img/map2_a.jpg',0.9)
    if m1!=False and enterMap2==False:
        enterMap2=True
        print('刚进入图2')
    else:
        m2=picture.match_multiple(img_gray,'./img/map2_b_1.jpg',0.9)
        if m2!=False:
            #图1 结束
            print('图2 行走')
            dnf_function.pick()
            dnf_function.chart_to_center(img_gray)
            moveNext.map2MoveNext()
            # updateImgGray()
        else:
            m3=picture.match_multiple(img_gray,'./img/map2_b_2.jpg',0.9)
            if m3!=False:
                print('图2 行走')
                dnf_function.pick()
                dnf_function.chart_to_center(img_gray)
                moveNext.map2MoveNext()
                # updateImgGray()
            else:
                print('no map2')
示例#2
0
def onMap1():
    global enterMap1
    m1=picture.match_multiple(img_gray,'./img/map1_a.jpg',0.9)
    
    if m1!=False and enterMap1==False:
        # 刚进入图1
        enterMap1=True
        print('图1a 召唤兽')
        callAll()
        
    else:
        m2=picture.match_multiple(img_gray,'./img/map1_b_1.jpg',0.9)
        if m2!=False:
            #图1 结束
            dnf_function.pick()
            dnf_function.chart_to_center(img_gray)
            print('图1 行走')
            print(m2)
            
            moveNext.map1MoveNext()
            # updateImgGray()
        else:
            m3=picture.match_multiple(img_gray,'./img/map1_b_2.jpg',0.9)
            if m3!=False:
                dnf_function.pick()
                dnf_function.chart_to_center(img_gray)
                print('图1 行走')
                print(m3)
                moveNext.map1MoveNext()
            else:
                print('no map1')
示例#3
0
def onMap7():
    # BOSS 房间
    global enterMap1
    global enterMap2
    global enterMap3
    global enterMap4
    global enterMap5
    global enterMap6
    global enterMap7
    m1=picture.match_multiple(img_gray,'./img/map7_a.jpg',0.9)
    if m1!=False and enterMap7==False:
        print('刚进入图7')
        enterMap7=True
        dm.KeyPressStr('hy',2000)
    else:
        # 翻牌
        fanpai=picture.match_multiple(img_gray,'./img/map7_b.jpg',0.9)
        if fanpai!=False:
            print('翻牌')
            dm.KeyPressStr('37',200)
        # 加百利商店
        # 再次挑战
        agint=picture.match_multiple(img_gray,'./img/map7_c.jpg',0.7)
        if agint!=False:

            dnf_function.pick()
            print('再次挑战')
            dm.KeyPress(121)
            enterMap1=False
            enterMap2=False
            enterMap3=False
            enterMap4=False
            enterMap5=False
            enterMap6=False
            enterMap7=False
示例#4
0
def onMap5():
    global enterMap5
    m1=picture.match_multiple(img_gray,'./img/map5_a.jpg',0.9)
    if m1!=False and enterMap5==False:
        enterMap5=True
        print('刚进入图5')
        print('召唤兽')
        callAll()
    else:
        m2=picture.match_multiple(img_gray,'./img/map5_b_1.jpg',0.9)
        if m2!=False:
            #图1 结束
            print('图5 行走')
            dnf_function.pick()
            dnf_function.chart_to_center(img_gray)
            moveNext.map5MoveNext()
            # updateImgGray()
        else:
            m3=picture.match_multiple(img_gray,'./img/map5_b_2.jpg',0.9)
            if m3!=False:
                print('图5 行走')
                dnf_function.pick()
                dnf_function.chart_to_center(img_gray)
                moveNext.map5MoveNext()
                # updateImgGray()
            else:
                print('no map5')
示例#5
0
def chart_is_hidden():
    global img_gray
    global hidden_count
    # 确保可以发现人物
    lv = picture.match_multiple(img_gray, '../map1/img/pointA.jpg', 0.6)
    if lv == False:
        if hidden_count < 3:
            dm.keyDownChar('left')
            time.sleep(300 / 1000)
            dm.keyUpChar('left')
        elif hidden_count < 6:
            dm.keyDownChar('right')
            time.sleep(300 / 1000)
            dm.keyUpChar('right')
        elif hidden_count < 9:
            dm.keyDownChar('up')
            time.sleep(300 / 1000)
            dm.keyUpChar('up')
        elif hidden_count < 12:
            dm.keyDownChar('down')
            time.sleep(300 / 1000)
            dm.keyUpChar('down')
        img_gray = picture.get_image_gray()
        hidden_count += 1
        chart_is_hidden()
    else:
        hidden_count = 0
示例#6
0
def findImgAndClick(img_gray,
target,
value=0.5,
offsetX=0,
offsetY=0,
clickNum=1,
sleepTime=500):
    pick_map=picture.match_multiple(img_gray,target,value)
    if pick_map!=False:
        # print(target)
        # print(pick_map)
        # print(pick_map[0]+offsetX,pick_map[1]+offsetY)
        dm.MoveTo(pick_map[0]+offsetX,pick_map[1]+offsetY)
        for clickIndex in range(clickNum):
            print('click')
            dm.LeftClick()
            time.sleep(sleepTime/1000)
        
        return True
    else:
        return False