Пример #1
0
def stepintomap(ws):
    InTown = True
    count = 0
    cl = ControlWindow.windowcl()
    cl.move_window(ws._handle, 0, 0)
    cl.nomal_press_keyboard("down", slp=1)
    cl.nomal_press_keyboard("right", slp=4)
    while (InTown == True and count < 10):
        I_common.capture(ws)
        time.sleep(0.1)
        capimg = misc.imread("c:\\temp\\bla.bmp")
        itemempty = capimg[575, 181]
        if itemempty[0] > 15 and itemempty[0] < 25 and itemempty[
                1] > 15 and itemempty[1] < 25 and itemempty[
                    2] > 15 and itemempty[2] < 25:
            print "MoveDown MoveRight"
            cl = ControlWindow.windowcl()
            cl.move_window(ws._handle, 0, 0)
            cl.nomal_press_keyboard("down", slp=1)
            cl.nomal_press_keyboard("right", slp=4)
        else:
            InTown = False
            print "In pick dungon screen"
        time.sleep(0.3)
        count = count + 1
    if count == 10 and InTown == True:
        print "Have tried 10 times, Failed to the Map:"
        print "We need redo again"
        return False
    else:
        return True
Пример #2
0
def iamdead(ws):
    I_common.capture(ws)
    time.sleep(0.1)
    capimg = misc.imread("c:\\temp\\bla.bmp")
    ingamepixel = capimg[75, 407]
    if ingamepixel[0] < 50 and ingamepixel[1] < 50 and ingamepixel[2] < 50:
        return True
    else:
        return False
Пример #3
0
def startgame(ws, first):
    cl = ControlWindow.windowcl()
    cl.move_window(ws._handle, 0, 0)
    if first == True:
        cl.nomal_press_keyboard("space", slp=0.5)
    inselectscreen = False
    selected = False
    maxcount = 0
    while inselectscreen == False and maxcount < 100:
        maxcount = maxcount + 1
        I_common.capture(ws)
        time.sleep(0.1)
        capimg = misc.imread("c:\\temp\\bla.bmp")
        selectpixel1 = capimg[300, 473]
        selectpixel2 = capimg[300, 393]
        selectpixel3 = capimg[585, 429]
        inselectscreen1 = selectpixel1[0] > 200 and selectpixel1[
            1] > 200 and selectpixel1[2] > 200
        inselectscreen2 = selectpixel2[0] > 200 and selectpixel2[
            1] > 200 and selectpixel2[2] > 200
        inselectscreen3 = selectpixel3[0] > 200 and selectpixel3[
            0] < 210 and selectpixel3[1] > 180 and selectpixel3[
                1] < 190 and selectpixel3[2] > 130 and selectpixel3[2] < 140
        inselectscreen = inselectscreen1 and inselectscreen2 and inselectscreen3
        # inselectscreen = inselectscreen2
        if inselectscreen and selected == False:
            print "In select screen, press spacebar"
            cl.move_window(ws._handle, 0, 0)
            cl.nomal_press_keyboard("space", slp=0.5)
            time.sleep(2)
            selected = True
        elif inselectscreen == False and selected == True:
            print "In game now, start fight!"
            break
    if maxcount == 100:
        print "Did not find select Screen in 10s, But Let it go."
        #     endless_num = int(repeattimedict0[onecharacter]*5)
        #     I_move.BuyTickets(ws,endless_num,remove_pos)
        #     time.sleep(2)
        #     I_move.ToSelectCharacter(ws, onecharacter)


        time.sleep(2)
        I_move.MovetoPre(ws)

        print "Move to Map"
        inmap = I_move.stepintomap(ws)
        if inmap==False:

            for i in range(2):
                try:
                    I_common.closeDIE()
                except:
                    print "Close DIE"
            time.sleep(1)
            ws = windowsht()
            ws.active_window(".*Dungeon Fighter Online.*")
            cl = ControlWindow.windowcl()
            cl.move_window(ws._handle, 0, 0)

            cindex = cindex-1
            continue

        '''Start the fight, Notice, '''
        EndDead = False
        dead = False
        for i in range(repeattimes):