Example #1
0
File: tft.py Project: yvanat/PE
def click_to(path, button="left"):
    if onscreen(path):
        auto.moveTo(search(path), duration=random.uniform(t1, t2))
        if button == "left":
            click_left()
        elif button == "right":
            click_right()
Example #2
0
File: tft.py Project: yvanat/PE
def carou(data, stage, substage):
    while not onscreenarea("./captures/stage/1-1.png", data.stage_pos[0],
                           data.stage_pos[1], data.stage_pos[2],
                           data.stage_pos[3]):
        time.sleep(0.1)
    time.sleep(4)
    auto.moveTo(data.carou[0], duration=random.uniform(t1fast, t2fast))
    click_right()
    time.sleep(1)
    while not onscreenarea(substage, data.stage_pos[0], data.stage_pos[1],
                           data.stage_pos[2], data.stage_pos[3]):
        item = "./captures/glove_carou.png"
        for i in data.carou:
            auto.moveTo(i, duration=random.uniform(t1fast, t2fast))
            click_right()
            pos = search(item, precision=prec)
            if i[0] > pos[0] - 15 and i[0] < pos[0] + 15:
                if data.carou.index(i) < 9 or data.carou.index(i) > 24:
                    auto.moveTo(x=i[0],
                                y=i[1] - 200,
                                duration=random.uniform(t1fast, t2fast))
                    click_right()
                    exit()
                else:
                    auto.moveTo(x=i[0],
                                y=i[1] + 200,
                                duration=random.uniform(t1fast, t2fast))
                    click_right()
                    exit()
        exit()
Example #3
0
def click_to(path, delay=.1):
    if onscreen(path):
        auto.moveTo(search(path))
        click_left(delay)
Example #4
0
def search_to(path):
    pos = search(path)
    if onscreen(path):
        auto.moveTo(pos)
        # print(path + " found")
        return pos
Example #5
0
def onscreen(path, precision=0.8):
    return search(path, precision)[0] != -1