예제 #1
0
def clickCancelAll():
    # 点击空白区域取消所有操作
    pos = (window_func.NOX_window_rect[0] + 552,
           window_func.NOX_window_rect[1] + 725)
    for _ in range(5):
        clickRandomPos((pos[0] + 20, pos[1] + 4), 140, 12)
        delay.random_float_delay(0.1, 0.2)
예제 #2
0
def isGatePage():
    for _ in range(WAIT_FOR_GATE_PAGE_MAX_TIMES):
        if img_search.isGatePageSelected():
            return True
        delay.random_float_delay(0.5, 0.5)

    # retry too much times
    return False
예제 #3
0
def endDuel():
    pos = img_search.pos_rel2abs(DUEL_END_POS)
    clickRandomPos((pos[0] + 2, pos[1] + 2), 81, 16)
    delay.random_float_delay(0.3, 0.5)

    afterDuelNext()
    afterDuelNext()

    afterDuelActivityNext()
예제 #4
0
def summonMonster():
    selectMonster()
    for _ in range(SUMMON_MONSTER_MAX_TIMES):
        if not img_search.monsterSelected():
            return
        pos = img_search.pos_rel2abs(SUMMON_MONSTER_POS)
        clickRandomPos((pos[0] + 2, pos[1] + 2), 26, 26)
        delay.random_float_delay(0.6, 0.2)

    raise img_search.ButtonNotFoundException("monster summoned flag")
예제 #5
0
def openGate():
    pos = img_search.pos_rel2abs(GATE_POS)
    for _ in range(WAIT_FOR_GATE_MAX_TIMES):
        if img_search.isGateOpen():
            return
        clickRandomPos((pos[0] + 5, pos[1] + 5), 30, 30)
        delay.random_float_delay(1.0, 0.2)

    # retry too much times
    raise img_search.ButtonNotFoundException("gate open flag")
예제 #6
0
def skipTalking():
    pos = img_search.pos_rel2abs(SKIP_TALKING_POS)

    for _ in range(SKIP_TALKING_MAX_TIMES):
        if img_search.talkingEnd():
            return
        clickRandomPos((pos[0] + 10, pos[1] + 10), 30, 30)
        delay.random_float_delay(0.2, 0.2)

    # retry too much times
    raise img_search.ButtonNotFoundException("talking end flag")
예제 #7
0
def skipDuelAnimation():
    pos = img_search.pos_rel2abs(SKIP_DUEL_ANIMATION_POS)

    for _ in range(SKIP_DUEL_ANIMATION_MAX_TIMES):
        if img_search.duelAnimationEnd() or img_search.duelEnd():
            return
        clickRandomPos((pos[0] + 10, pos[1] + 10), 30, 30)
        delay.random_float_delay(0.2, 0.2)

    # retry too much times
    raise img_search.ButtonNotFoundException("talking end flag")
예제 #8
0
def selectMonster():
    # randomly select monster card
    for _ in range(SELECT_CARD_MAX_TIMES):
        if img_search.monsterSelected():
            return

        pos = img_search.pos_rel2abs(SELECT_CARD_POS)
        clickRandomPos((pos[0] + 5, pos[1] + 2), 170, 40)
        delay.random_float_delay(0.5, 0.2)

    raise img_search.ButtonNotFoundException("monster selected flag")
예제 #9
0
def clickClearTeam():
    # 清空队伍
    pos = (window_func.NOX_window_rect[0] + 680,
           window_func.NOX_window_rect[1] + 595)
    try_times = 0
    while not img_match.isEmptyTeam():
        clickRandomPos((pos[0] + 20, pos[1] + 20), 60, 60)
        try_times += 1
        if try_times >= 10:
            raise img_match.ButtonNotFoundException("clear team")
        delay.random_float_delay(0.3, 0.2)
    delay.random_float_delay(0.3, 0.2)
예제 #10
0
def afterDuelNext():
    pos = img_search.pos_rel2abs(DUEL_END_NEXT_POS)
    for _ in range(DUEL_END_NEXT_MAX_TIMES):
        if img_search.duelEndNextFlag():
            clickRandomPos((pos[0] + 2, pos[1] + 2), 86, 16)
            delay.random_float_delay(0.3, 0.2)
            return
        temp_pos = img_search.pos_rel2abs(SKIP_DUEL_ANIMATION_POS)
        clickRandomPos((temp_pos[0] + 10, temp_pos[1] + 10), 30, 30)
        delay.random_float_delay(0.5, 0.2)

    # retry too much times
    raise img_search.ButtonNotFoundException("duel end next flag")
예제 #11
0
def nextStage():
    pos = img_search.pos_rel2abs(NEXT_STAGE_POS)
    clickRandomPos((pos[0] + 2, pos[1] + 2), 20, 20)
    delay.random_float_delay(0.5, 0.5)

    stage_id = img_search.checkStage()
    if stage_id < 0:
        raise img_search.ButtonNotFoundException("unknown stage")

    clickRandomPos((pos[0] + 2, pos[1] + 2), 20, 20)
    delay.random_float_delay(0.3, 0.5)

    return stage_id
예제 #12
0
def afterDuelActivityNext():
    pos = img_search.pos_rel2abs(AFTER_DUEL_ACTIVITY_NEXT)
    skip_pos = img_search.pos_rel2abs(SKIP_TALKING_POS)
    overtime_flag = True
    for _ in range(AFTER_DUEL_ACTIVITY_CHECK_TIMES):
        for _ in range(AFTER_DUEL_ACTIVITY_MAX_TIMES):
            if img_search.afterDuelActivityNextFlag():
                overtime_flag = False
                break
            clickRandomPos((skip_pos[0] + 5, skip_pos[1] + 5), 40, 40)
            delay.random_float_delay(0.3, 0.2)

        if overtime_flag:
            #raise img_search.ButtonNotFoundException("after duel activity next flag")
            return

        for _ in range(AFTER_DUEL_ACTIVITY_MAX_TIMES):
            if not img_search.afterDuelActivityNextFlag():
                return
            clickRandomPos((pos[0] + 2, pos[1] + 2), 86, 16)
            delay.random_float_delay(0.3, 0.2)
예제 #13
0
def allMonsterAttack():
    my_monster_seats = img_search.getMyMonsterSeatsList()
    for my_seat_id in range(len(my_monster_seats)):
        if my_monster_seats[my_seat_id]:
            oppo_monster_seats = img_search.getOppoMonsterSeatsList()
            for oppo_seat_id in range(len(oppo_monster_seats)):
                if oppo_monster_seats[oppo_seat_id] or oppo_seat_id == 2:
                    # battle
                    pos = img_search.pos_rel2abs(
                        MY_MONSTER_SEATS_POS[my_seat_id])
                    moveToRandomPos((pos[0] + 27, pos[1] + 32), 15, 20)
                    pyautogui.mouseDown()
                    pos = img_search.pos_rel2abs(
                        OPPO_MONSTER_SEATS_POS[oppo_seat_id])
                    moveToRandomPos((pos[0] + 27, pos[1] + 32),
                                    15,
                                    20,
                                    duration=0.2)
                    pyautogui.mouseUp()
                    skipDuelAnimation()
                    delay.random_float_delay(0.8, 0.2)
                    break
예제 #14
0
def clickPrincessArena():
    # "公主竞技场"按钮
    pos = img_match.findPrincessArenaButton()

    clickRandomPos((pos[0] + 20, pos[1] + 10), 270, 90)
    delay.random_float_delay(0.3, 0.2)
예제 #15
0
def clickFinish():
    # 配队界面确认
    pos = (window_func.NOX_window_rect[0] + 1017,
           window_func.NOX_window_rect[1] + 608)
    clickRandomPos((pos[0] + 20, pos[1] + 10), 170, 40)
    delay.random_float_delay(0.3, 0.3)
예제 #16
0
def clickSelectTeam(team_id: int):
    # 选择队伍1-3
    pos = img_match.findTeamSelectButton(team_id)
    clickRandomPos((pos[0] + 20, pos[1] + 10), 90, 20)
    delay.random_float_delay(0.3, 0.2)
예제 #17
0
def clickChangeTeamButton():
    # "防守设定"按钮
    pos = img_match.findChangeTeamButton()

    clickRandomPos((pos[0] + 20, pos[1] + 10), 150, 40)
    delay.random_float_delay(1.5, 0.2)
예제 #18
0
def clickPreparedPage(page_id: int):
    # "我的队伍"界面选择指定队伍页1-5
    pos = (window_func.NOX_window_rect[0] + 68 + (page_id - 1) * 191,
           window_func.NOX_window_rect[1] + 131)
    clickRandomPos((pos[0] + 20, pos[1] + 10), 150, 20)
    delay.random_float_delay(0.5, 0.3)
예제 #19
0
def clickMyTeamButton():
    # "我的队伍"按钮
    pos = img_match.findMyTeamButton()

    clickRandomPos((pos[0] + 20, pos[1] + 10), 80, 10)
    delay.random_float_delay(0.8, 0.2)
예제 #20
0
def clickPreparedTeam(team_id: int):
    # "我的队伍"界面选择队伍1-3
    pos = (window_func.NOX_window_rect[0] + 949,
           window_func.NOX_window_rect[1] + 233 + (team_id - 1) * 159)
    clickRandomPos((pos[0] + 20, pos[1] + 10), 170, 40)
    delay.random_float_delay(0.5, 0.3)
예제 #21
0
def clickReverseRank():
    # "我的队伍"界面更改排序顺序
    pos = (window_func.NOX_window_rect[0] + 1089,
           window_func.NOX_window_rect[1] + 137)
    clickRandomPos((pos[0] + 20, pos[1] + 10), 80, 10)
    delay.random_float_delay(0.5, 0.3)
예제 #22
0
def reconnect():
    pos = img_search.pos_rel2abs(RECONNECT_POS)
    clickRandomPos((pos[0] + 10, pos[1] + 5), 80, 20)
    delay.random_float_delay(0.5, 0.2)
예제 #23
0
def duelReallyBegin():
    pos = img_search.pos_rel2abs(DUEL_REALLY_BEGIN_POS)
    clickRandomPos((pos[0] + 10, pos[1] + 5), 105, 10)
    delay.random_float_delay(0.8, 0.2)
예제 #24
0
def beginGateDuel():
    pos = img_search.pos_rel2abs(GATE_DUEL_START_POS)
    clickRandomPos((pos[0] + 20, pos[1] + 5), 100, 10)
    delay.random_float_delay(0.5, 0.2)
예제 #25
0
def selectGateLevel10():
    pos = img_search.pos_rel2abs(GATE_LEVEL_10_POS)
    clickRandomPos((pos[0] + 5, pos[1] + 5), 15, 10)
    delay.random_float_delay(0.3, 0.2)
예제 #26
0
def streetToPVP():
    pos = img_search.pos_rel2abs(PVP_POS)
    clickRandomPos((pos[0] + 5, pos[1] + 5), 15, 15)
    delay.random_float_delay(0.8, 0.2)
예제 #27
0
def clickAdventureButton():
    # 底部"冒险"按钮
    pos = img_match.findAdventureButton()

    clickRandomPos((pos[0] + 20, pos[1] + 10), 160, 30)
    delay.random_float_delay(0.3, 0.2)
예제 #28
0
def streetToWorkshop():
    pos = img_search.pos_rel2abs(WORKSHOP_POS)
    clickRandomPos((pos[0] + 5, pos[1] + 5), 15, 15)
    delay.random_float_delay(0.8, 0.2)