Exemple #1
0
def processGuild():
    guild = findGuild()
    if guild is None:
        randSleepSec(60, 120)
        return
    else:
        pressEsc()
    with lock:
        checkIfPaused()
        x = guild.left
        y = guild.top + guild.height + 1
        leftRegion = (x + 3, y, 8, 7)
        rightRegion = (x + guild.width / 2 + 2, y, 8, 7)
        leftScreen = pyautogui.screenshot(region=leftRegion)
        rightScreen = pyautogui.screenshot(region=rightRegion)
        found = pyautogui.locate(leftScreen, rightScreen, confidence=0.8)
        if found:
            logging.info("Found full guild")
            pyautogui.moveTo(guild.left,
                             guild.top + guild.height + ydiff1,
                             duration=randDur())
            pyautogui.click()
            guildGet = findPic('guildGet')
            tries = 10
            while guildGet is None and tries > 0:
                tries = tries - 1
                randSleepSec(1, 3)
                guildGet = findPic('guildGet')
            pressButton(guildGet, False)
        else:
            logging.debug("Guild is not full")
            pressEsc()
    randSleepSec(60, 180)
Exemple #2
0
def unstuck():
    if findPic('sessionExpired') is not None:
        pressButton(findPic('rebootNow'), True)
        randSleepSec(5, 10)

    playBtn = findPic('play')
    if playBtn is not None:
        pressButton(playBtn, True)

    worldBtn = findPic('world')
    if worldBtn is not None:
        pressButton(worldBtn, True)
        randSleepSec(5, 10)

    eventsPanel = findPic('events')
    if eventsPanel is not None:
        pressEsc()
        randSleepSec(5, 10)

    if findPic('visitUnavailable') is not None:
        pressButton(findPic('ok'), True)

    returnToCity = findPic('returnToCity')
    if returnToCity is not None:
        pressButton(returnToCity, False)

    if findPic('cannotHelp') is not None:
        reboot()

    randSleepSec(5, 15)
def processSocialPage():
    output = True
    while output is not None:
        output = findAnySocialButton()
        if output is not None:
            logging.info("Precessing social button")
            pressButton(output, True)
            randSleepMs(500, 900)
def nextPage():
    nextBtn = findNext()
    friendsRegion = [nextBtn.left - 640, nextBtn.top - 50, 530, 80]
    before = pyautogui.screenshot(region=friendsRegion)
    pressButton(nextBtn, True)
    randSleepMs()
    after = pyautogui.screenshot(region=friendsRegion)
    return same(before, after)
def collectLoot():
    loot = findLoot()
    while loot is not None:
        if loot is None:
            return
        pressButton(loot, False)
        waitFor(findRewardReceived, 10)
        pressEsc()
        loot = findLoot()
def processAllSocialPages():
    pages = 16
    # pages = 3
    lastPage = False
    pressButton(findFullFf(), True)
    while pages >= 0 and not lastPage:
        pages = pages - 1
        processSocialPage()
        lastPage = nextPage()
def processFriends():
    logging.info("Precessing friends")
    pressButton(findFriends(), True)
    processAllSocialPages()
def processNeighbours():
    logging.info("Precessing neighbours")
    pressButton(findNeighbours(), True)
    processAllSocialPages()
def processSoguildians():
    logging.info("Precessing soguildians")
    pressButton(findSoguildians(), True)
    processAllSocialPages()