def run(date=1, maxDate=31, delay=3):
    uart = poke_swsh_common.uart()
    try:
        poke_swsh_common.delay(uart, delay)
        times = 0
        invalidDate = False
        while True:
            poke_swsh_common.gotoHome(uart)
            poke_swsh_common.gotoDatetimeSettingFromHome(uart)
            poke_swsh_common.initialAddOneDay(uart)

            date += 1
            if date > maxDate:
                date = 1
                poke_swsh_common.followingAddOneDay(uart)
                date += 1
                invalidDate = False
            else:
                times += 1
                invalidDate = False

            poke_swsh_common.returnGame(uart)

            poke_swsh_common.gotoRaid(uart, isOnline=False, hasWatts=True)

            # 取消团战
            poke_swsh_common.send(uart, 'Button B', 0.1)
            sleep(2)
    except KeyboardInterrupt:
        poke_swsh_common.send(uart, 'RELEASE')
Example #2
0
def run(isSecondary=True, delay=3):
    uart = poke_swsh_common.uart()
    try:
        poke_swsh_common.delay(uart, delay)
        times = 0
        while True:
            poke_swsh_common.openGame(uart, isSecondary=isSecondary)
            poke_swsh_common.onlineModel(uart)
            poke_swsh_common.gotoRaid(uart)
            poke_swsh_common.setRaidPassword(uart)
            poke_swsh_common.waitForRaid(uart)
            poke_swsh_common.raid(uart)
            poke_swsh_common.closeGame(uart)
            times = times + 1
            print("[%s] 脚本运行中,已开启了%d次团战" % (datetime.now(), times))
    except KeyboardInterrupt:
        poke_swsh_common.send(uart, 'RELEASE')
def run(date=1, maxDate=31, isSecondary=True, delay=3.0):
    uart = poke_swsh_common.uart()
    try:
        poke_swsh_common.delay(uart, delay)

        while (True):
            poke_swsh_common.openGame(uart, isSecondary)

            times = 0
            invalidDate = False
            while (times < 4):
                if (times == 0) or invalidDate:
                    poke_swsh_common.gotoRaid(uart,
                                              isOnline=False,
                                              hasWatts=False)
                elif times == 3:
                    poke_swsh_common.onlineModel(uart)
                    poke_swsh_common.gotoRaid(uart,
                                              isOnline=True,
                                              hasWatts=True)
                    poke_swsh_common.setRaidPassword(uart)
                    poke_swsh_common.waitForRaid(uart)
                    poke_swsh_common.raid(uart)
                    break
                else:
                    poke_swsh_common.gotoRaid(uart,
                                              isOnline=False,
                                              hasWatts=True)

                # 点击 大家一起挑战
                poke_swsh_common.send(uart, 'Button A', 0.1)
                sleep(3)

                poke_swsh_common.gotoHome(uart)
                poke_swsh_common.gotoDatetimeSettingFromHome(uart)
                poke_swsh_common.initialAddOneDay(uart)

                date += 1
                if date > maxDate:
                    date = 1
                    invalidDate = True
                else:
                    times += 1
                    invalidDate = False

                poke_swsh_common.returnGame(uart)

                # 取消团战
                poke_swsh_common.send(uart, 'Button B', 0.1)
                sleep(1)
                poke_swsh_common.send(uart, 'Button A', 0.1)
                sleep(5)

            poke_swsh_common.closeGame(uart)
    except KeyboardInterrupt:
        poke_swsh_common.send(uart, 'RELEASE')
def run(frames=1000,date=1,maxDate=31,delay=3.0):
    times = 0
    uart = poke_swsh_common.uart()
    try:
        poke_swsh_common.delay(uart,delay)

        while(True):
            if times >= frames:
                break

            if times > 0:
                print("[%s] 任务进行中,已经跳过%d帧" % (datetime.now(),times))
                poke_swsh_common.returnGame(uart)
                poke_swsh_common.save(uart)
                poke_swsh_common.gotoHome(uart)
            poke_swsh_common.gotoDatetimeSettingFromHome(uart)
            poke_swsh_common.initialAddOneDay(uart)
            date += 1
            if date > maxDate:
                date = 1
            else:
                times += 1

            for num in range(0,999):
                if times >= frames:
                    break
                poke_swsh_common.followingAddOneDay(uart)
                date += 1
                if date > maxDate:
                    date = 1
                else:
                    times += 1

        print("[%s] 任务完成,已经跳过%d帧" % (datetime.now(),times))
    except KeyboardInterrupt:
        poke_swsh_common.send(uart,'RELEASE')
def run(isSecondary=False,delay=3):
    times = 0
    uart = poke_swsh_common.uart()
    try:
        poke_swsh_common.delay(uart,delay)
        while True:
            if isSecondary and (times % 150 == 149):
                poke_swsh_common.switchNetMode(uart)
                
            for i in range(0, 3): 
                # 人物移动
                poke_swsh_common.send(uart,'LX MIN', 1.7)
                sleep(0.5)
                poke_swsh_common.send(uart,'LX MAX', 1.8)
                # 调整角度
                poke_swsh_common.send(uart,'LY MIN', 0.5)
                sleep(0.1)

            # 取蛋
            poke_swsh_common.send(uart,'Button A', 0.1)
            sleep(0.8)
            poke_swsh_common.send(uart,'Button A', 0.1)
            sleep(0.8)
            delay = 0
            while delay < 8:
                poke_swsh_common.send(uart,'Button B', 0.1)
                sleep(0.9)
                delay = delay + 1
            sleep(1)
            times = times + 1
            if times % 10 == 0:
                print("[%s] 脚本运行中,已执行了%d次取蛋动作" % (datetime.now(),times))
    except KeyboardInterrupt:
        poke_swsh_common.send(uart,'RELEASE')
    print("[%s] 脚本运行结束,共执行了%d次取蛋动作" % (datetime.now(),times))
Example #6
0
def run(initCol=0,
        maxBox=0,
        maxCol=5,
        eggCycle=20,
        flamebody=True,
        isSecondary=False,
        delay=3):
    if flamebody:
        steps = math.ceil(257.0 * eggCycle / 2.0)
        cycles = math.ceil(eggCycle / 2.0)
    else:
        steps = 257 * eggCycle
        cycles = eggCycle
    col = initCol
    box = 0
    print("[%s] 孵化周期:%d,孵化步数:%d" % (datetime.now(), eggCycle, steps))
    print("[%s] 起始列:%d,终止箱子数:%d,终止列:%d" %
          (datetime.now(), initCol, maxBox, maxCol))
    uart = poke_swsh_common.uart()
    try:
        poke_swsh_common.delay(uart, delay)
        while True:
            # 进入盒子
            poke_swsh_common.send(uart, 'Button X', 0.1)
            sleep(1)
            poke_swsh_common.send(uart, 'Button A', 0.1)
            sleep(1.4)
            poke_swsh_common.send(uart, 'Button R', 0.1)
            sleep(1.6)

            # 选择范围移动
            poke_swsh_common.send(uart, 'Button Y', 0.1)
            sleep(0.2)
            poke_swsh_common.send(uart, 'Button Y', 0.1)
            sleep(0.2)

            # 移动光标到同行第二只宝可梦,然后选择2-6宝可梦
            poke_swsh_common.send(uart, 'LX MIN', 0.1)
            sleep(0.15)
            poke_swsh_common.send(uart, 'LY MAX', 0.1)
            sleep(0.15)
            poke_swsh_common.send(uart, 'Button A', 0.1)
            sleep(0.3)
            poke_swsh_common.send(uart, 'LY MIN', 0.1)
            sleep(0.15)
            poke_swsh_common.send(uart, 'LY MIN', 0.1)
            sleep(0.15)
            # poke_swsh_common.send(uart,'LY MAX', 0.1)
            # sleep(0.15)
            # poke_swsh_common.send(uart,'LY MAX', 0.1)
            # sleep(0.15)
            # poke_swsh_common.send(uart,'LY MAX', 0.1)
            sleep(0.15)
            poke_swsh_common.send(uart, 'Button A', 0.1)
            sleep(0.5)

            # 移动光标到0行col列
            poke_swsh_common.send(uart, 'LY MIN', 0.1)
            sleep(0.15)
            for num in range(0, col + 1):
                poke_swsh_common.send(uart, 'LX MAX', 0.1)
                sleep(0.15)
            # 放下移动宝可梦
            poke_swsh_common.send(uart, 'Button A', 0.1)
            sleep(0.5)

            # 光标移动到要孵的蛋的位置
            col = col + 1
            if col > 5:
                col = 0
                poke_swsh_common.send(uart, 'Button R', 0.1)
                sleep(0.5)
                # poke_swsh_common.send(uart,'LX MIN', 0.1)
                # sleep(0.15)
                # poke_swsh_common.send(uart,'LX MIN', 0.1)
                # sleep(0.15)
                # poke_swsh_common.send(uart,'LX MIN', 0.1)
                # sleep(0.15)
                # poke_swsh_common.send(uart,'LX MIN', 0.1)
                # sleep(0.15)
                # poke_swsh_common.send(uart,'LX MIN', 0.1)
                # sleep(0.15)
                poke_swsh_common.send(uart, 'LX MAX', 0.1)
                sleep(0.15)
                poke_swsh_common.send(uart, 'LX MAX', 0.1)
                sleep(0.15)
                box = box + 1
            else:
                poke_swsh_common.send(uart, 'LX MAX', 0.1)
                sleep(0.15)

            # 选中要孵的蛋
            poke_swsh_common.send(uart, 'Button A', 0.1)
            sleep(0.1)
            # poke_swsh_common.send(uart,'LY MAX', 0.1)
            # sleep(0.15)
            # poke_swsh_common.send(uart,'LY MAX', 0.1)
            # sleep(0.15)
            # poke_swsh_common.send(uart,'LY MAX', 0.1)
            # sleep(0.15)
            poke_swsh_common.send(uart, 'LY MIN', 0.1)
            sleep(0.15)
            poke_swsh_common.send(uart, 'Button A', 0.1)
            sleep(0.5)

            # 移动光标到同行第二只宝可梦,然后放下宝可梦
            for num in range(0, col + 1):
                poke_swsh_common.send(uart, 'LX MIN', 0.1)
                sleep(0.15)
            poke_swsh_common.send(uart, 'LY MAX', 0.1)
            sleep(0.15)
            poke_swsh_common.send(uart, 'Button A', 0.1)
            sleep(0.3)

            # 退出盒子
            poke_swsh_common.send(uart, 'Button B', 0.1)
            sleep(1.6)
            poke_swsh_common.send(uart, 'Button B', 0.1)
            sleep(1.4)
            poke_swsh_common.send(uart, 'Button B', 0.1)
            sleep(1.2)

            # 人物移动
            for num in range(0, cycles):
                poke_swsh_common.send(uart, 'LX MAX', 3.8)
                sleep(0.2)
                poke_swsh_common.send(uart, 'LX MIN', 3.8)
                sleep(0.2)

            # 孵化
            for num in range(0, 5):
                if num % 2 == 0:
                    poke_swsh_common.send(uart, 'LX MAX', 0.3)
                else:
                    poke_swsh_common.send(uart, 'LX MIN', 0.3)
                sleep(0.5)
                for delay in range(0, 18):
                    poke_swsh_common.send(uart, 'Button B', 0.1)
                    sleep(1)

            # 调整人物位置
            poke_swsh_common.send(uart, 'LX MIN', 3.8)
            sleep(0.5)
            poke_swsh_common.send(uart, 'LY MIN', 0.3)
            sleep(0.2)

            if col == 0:
                print("[%s] 脚本运行中,孵蛋到第%d箱,共%d箱,%d列" %
                      (datetime.now(), box, maxBox, maxCol))

                if box % 3 == 2:
                    # 保存进度
                    # poke_swsh_common.save(uart)
                    if isSecondary:
                        poke_swsh_common.switchNetMode(uart)

            # 判断是否完成
            if box > maxBox or (box == maxBox and col >= maxCol):
                break
    except KeyboardInterrupt:
        poke_swsh_common.send(uart, 'RELEASE')
    print("[%s] 脚本运行结束,成功孵蛋到第%d箱,%d列" % (datetime.now(), box, col))