Ejemplo n.º 1
0
def tianting(i):
    time.sleep(1)
    fiter.isWalking()
    while True:
        catchScreen.catchAllScreen()
        time.sleep(1)
        if (isinstance(getOffset.getOffsetValue_tiantingStart(), list)):
            fiter.moveAndClick(200 + random.randint(-20, 20), 355)
            break
    fiter.isFight(i)
    # 判断是否关闭大话精灵
    catchScreen.catchAllScreen()
    time.sleep(1)
    if (isinstance(getOffset.getOffsetValue_Dahuajingling(), list)):
        time.sleep(0.5)
        fiter.moveAndClick_fast2(400, 172)
    # 关闭物品栏
    catchScreen.catchAllScreen()
    time.sleep(1)
    if (isinstance(getOffset.getOffsetValue_Wupinlan(), list)):
        time.sleep(0.5)
        fiter.moveAndClick_fast2(190 + random.randint(-10, 10), 121)
    # 领取礼盒
    catchScreen.catchAllScreen()
    time.sleep(1)
    if (isinstance(getOffset.getOffsetValue_Box(), list)):
        print("领取礼盒")
        time.sleep(0.5)
        attr5 = getOffset.getOffsetValue_Box()
        if (attr5[0] > 900):
            time.sleep(1)
        else:
            fiter.moveAndClick(attr5[0] + random.randint(-10, 10) + 50,
                               attr5[1] + 50 + random.randint(0, 5))
            time.sleep(1)
Ejemplo n.º 2
0
def bangpai_task():
    # catchScreen.catchScreen2(805, 205, 915, 240, "fight")
    while(True):
        time.sleep(2)
        fiter.moveAndClick(906 + random.randint(0, 5), 240 + random.randint(0, 5))
        time.sleep(2)
        catchScreen.catchScreen(40, 65, 1100, 800, "test")
        time.sleep(1)
        #attr1 = getOffset.getOffsetValue_my("bangpai2")
        attr2 = getOffset.getOffsetValue_my("bangpai2")
        for num in range(0,10):
            time.sleep(1)
            if(False):
                print("挑战帮主")
                break
            elif(isinstance(attr2,list)):
                print("交付药材")
                time.sleep(1)
                fiter.moveAndClick(attr2[0] + 20 + random.randint(0, 5), attr2[1] + 60 + random.randint(0, 5))
                break
            elif (isinstance(getOffset.getOffsetValue_my("bangpai3"), list)):
                print("药店购买")
                time.sleep(1)
                fiter.moveAndClick(802 + random.randint(0, 5), 625 + random.randint(0, 5))
                break
            elif (isinstance(getOffset.getOffsetValue_my("bangpai4"), list)):
                print("宣读公告")
                time.sleep(1)
                fiter.moveAndClick(854 + random.randint(0, 5), 683 + random.randint(0, 5))
                break
Ejemplo n.º 3
0
def xuncha():
    # 判断是否是巡视的鬼
    while True:
        print("是否巡视鬼")
        time.sleep(1)
        catchScreen.catchScreen(10, 220, 190, 260, "smallGhost\\1")
        time.sleep(1)
        if (getInfoFromScreen.getInfomation("smallGhost\\1").find("捉") == -1):
            print("巡查")
            time.sleep(1)
            catchScreen.catchScreen(40, 65, 140, 85, "position1")
            time.sleep(1)
            dealScreen.dealScreen("position1")
            time.sleep(1)
            print(getInfoFromScreen.getInfomation("position1"))
            if (getInfoFromScreen.getInfomation("position1").find("地府") != -1
                    or getInfoFromScreen.getInfomation("position1").find("岫")
                    != -1):
                print("巡查在地府")
                while True:
                    getScreen.window_capture(
                        "D:\\zhaoyq\\screen\\allScreen.png")
                    dealScreen.dealPicture_NPC("smallGhost")
                    attr44 = getOffset.getOffsetValue_NPC(
                        "smallGhost", "zhongkui")
                    if (isinstance(attr44, list)):
                        fiter.moveAndClick(
                            attr44[0] + random.randint(10, 20) + 200 + 10,
                            attr44[1] + random.randint(0, 10) + 200 - 50)
                        break
            else:
                print("巡查在长安")
                while True:
                    getScreen.window_capture(
                        "D:\\zhaoyq\\screen\\allScreen.png")
                    dealScreen.dealPicture_NPC("smallGhost")
                    attr45 = getOffset.getOffsetValue_NPC(
                        "smallGhost", "zhongkui2")
                    if (isinstance(attr45, list)):
                        fiter.moveAndClick(
                            attr45[0] + random.randint(10, 20) + 200 - 20,
                            attr45[1] + random.randint(0, 10) + 200 - 50)
                        break
            while True:
                catchScreen.catchAllScreen()
                attr_start = getOffset.getOffsetValue_smallGhostStart()
                if (isinstance(attr_start, list)):
                    fiter.moveAndClick(attr_start[0] + random.randint(-20, 20),
                                       attr_start[1])
                    fiter.moveAndClick(222 + random.randint(0, 5),
                                       333 + random.randint(0, 10))
                break
            time.sleep(1)
        else:
            print("普通捉拿")
            break
Ejemplo n.º 4
0
def findNPC(classify):
    time.sleep(1)
    # 判断是否走到NPC面前
    x1 = ""
    while True:
        # 截取左上地图坐标
        catchScreen.catchScreen(40, 65, 140, 85, "position")
        position = getInfoFromScreen.getInfomation_nodeal("position")
        if (x1 == position):
            break
        else:
            x1 = position
    # 点击
    if (classify == "xiaoyao"):
        fiter.moveAndClick(202, 328)
        fiter.isFighting()
    elif (classify == "yuanding"):
        fiter.moveAndClick(210, 346)
    elif (classify == "gongshuban"):
        return True
Ejemplo n.º 5
0
def testx():
    while(True):
        time.sleep(5)
        catchScreen.catchScreen(40, 65, 1100, 585, "test")
        time.sleep(1)
        attr_start = getOffset.getOffsetValue_smallGhostStart()
        time.sleep(1)
        if(isinstance(attr_start,list)):
            # 点击确认
            print("一轮结束")
            time.sleep(2)
            fiter.moveAndClick(605+random.randint(0,5),490+random.randint(0,5))
            time.sleep(5)
            fiter.moveAndClick(852+random.randint(0,5),464+random.randint(0,5))
            time.sleep(2)
            fiter.moveAndClick(906 + random.randint(0, 5), 240 + random.randint(0, 5))
            time.sleep(1)
            fiter.moveAndClick(906 + random.randint(0, 5), 240 + random.randint(0, 5))
Ejemplo n.º 6
0
def findUser(x, y, classify, attr, offset):
    a = False
    time.sleep(1)
    fiter.moveAndClick(x, y)
    time.sleep(1)
    fiter.moveAndClick(175, 328)
    fiter.moveAndClick(attr[0] + offset, attr[1])
    catchScreen.catchAllScreen()
    if (getOffset.getOffsetValue("home\\users") == "none"):
        findNPC(classify)
        a = True
    return a
Ejemplo n.º 7
0
def monkeyTaskStart():
    autopy.mouse.move(100, 20)  # 平滑移动鼠标(上面那个是瞬间的)
    autopy.mouse.click()  # 单击
    #(地图大小为120,100)
    for i in range(1, 60):
        while True:
            print("finding...")
            getScreen.window_capture("D:\\zhaoyq\\screen\\allScreen.png")
            dealScreenMonkey.dealMonkeyPicture()
            attr = getOffset.getOffsetValue_Monkey()
            print(attr)
            if (isinstance(attr, list)):
                autopy.mouse.move(attr[0] + 200, attr[1] - 50 + 200)
                autopy.mouse.click()  # 单击
                time.sleep(1)
                catchScreen.catchAllScreen()
                time.sleep(1)
                dealScreen.dealScreen("allScreen")
                if (isinstance(getOffset.getOffsetValue("monkey\\monkey_1"),
                               list)):
                    break
                else:
                    fiter.isWalking()
        fiter.moveAndClick(310 + random.randint(0, 10),
                           343 + random.randint(0, 10))
        time.sleep(1)
        fiter.moveAndClick(228 + random.randint(0, 10),
                           325 + random.randint(0, 10))
        fiter.isFight(i)
        time.sleep(1)
        # autopy.key.toggle('c', True, autopy.key.MOD_ALT)
        # autopy.key.toggle('c', False, autopy.key.MOD_ALT)
        fiter.moveAndClick(131 + random.randint(0, 10),
                           240 + random.randint(0, 10))
        fiter.isWalking()
        fiter.moveAndClick(290 + random.randint(0, 10),
                           365 + random.randint(0, 10))
Ejemplo n.º 8
0
def newPlayerStart():
    autopy.mouse.move(100, 20)  # 平滑移动鼠标(上面那个是瞬间的)
    autopy.mouse.click()  # 单击
    while True:
        catchScreen.catchAllScreen()
        if(isinstance(getOffset.getOffsetValue("new\\begin"), list)):
            break
    # 点击第一个任务 npc仙子
    attr = getOffset.getOffsetValue("new\\begin")
    fiter.moveAndClick(attr[0]-20+random.randint(-20,20),attr[1]-10)
    fiter.isWalking()
    fiter.moveAndClick(250+random.randint(-10,20),329)
    time.sleep(1)
    fiter.isAuto()
    # 关闭大话精灵对话框
    fiter.moveAndClick(652, 165)
    # 点击第二个任务 npc王二愣
    fiter.moveAndClick(40+random.randint(-10,10), 240)
    fiter.isWalking()
    fiter.moveAndClick(218+random.randint(-10,20), 328)
    fiter.isAuto
    # 点击第三个任务 npc猎户
    print("任务3")
    fiter.moveAndClick(80+random.randint(0,5), 240)
    fiter.isWalking()
    fiter.moveAndClick(218+random.randint(-10,20), 328)
    fiter.isAuto()
    fiter.moveAndClick(655, 165)

    # 点击第四个任务 npc小黄金兽
    print("任务4")
    fiter.moveAndClick(78+random.randint(-20,20), 240)
    fiter.isWalking()
    fiter.moveAndClick(207+random.randint(-10,20), 328)
    fiter.isFight()
    fiter.isAuto()
    # 点击第五个任务 npc猎户
    time.sleep(0.5)
    fiter.moveAndClick(80+random.randint(0,5), 240)
    fiter.isWalking()
    fiter.moveAndClick(200+random.randint(-15,15), 328)
    fiter.isAuto()
    # 点击第六个任务 npc渔村村子
    time.sleep(0.5)
    fiter.moveAndClick(70+random.randint(-10,20), 240)
    fiter.isWalking()
    fiter.moveAndClick(200+random.randint(-15,15), 328)
    fiter.isAuto()
    # 点击第七个任务 npc王二愣
    fiter.moveAndClick(65+random.randint(-10,10), 240)
    fiter.isWalking()
    fiter.moveAndClick(200+random.randint(-15,15), 328)
    fiter.isAuto()
    # 点击第八个任务 npc渔村村长
    time.sleep(1)
    fiter.moveAndClick(88+random.randint(-10,20), 240)
    fiter.isWalking()
    fiter.moveAndClick(200+random.randint(-20,20), 328)
    fiter.isAuto()
    # 点击第九个任务 npc大侠
    time.sleep(1)
    fiter.moveAndClick(60+random.randint(0,5), 240)
    fiter.isWalking()
    fiter.moveAndClick(200+random.randint(-15,15), 328)
    fiter.isAuto()
    # 点击第十个任务 npc渔村村长
    time.sleep(1)
    fiter.moveAndClick(100+random.randint(-10,20), 240)
    fiter.isWalking()
    fiter.moveAndClick(200+random.randint(-15,15), 328)
    fiter.isAuto()
    # 礼包中心
    time.sleep(1)
    fiter.moveAndClick(229, 368)
    time.sleep(1)
    fiter.moveAndClick(229, 368)
    # 点击第十一个任务 npc服装店老板
    time.sleep(1)
    fiter.moveAndClick(70+random.randint(-10,20), 240)
    fiter.isWalking()
    fiter.moveAndClick(170+random.randint(0,5), 328)
    fiter.isAuto()
    # 点击第十二个任务 npc仙子姐姐
    time.sleep(1)
    fiter.moveAndClick(142+random.randint(-10,20), 240)
    fiter.isWalking()
    fiter.moveAndClick(185+random.randint(-15,15), 328)
    fiter.isAuto()
    time.sleep(1)
    # 点击第十三个任务 npc王大妈
    fiter.moveAndClick(161+random.randint(-10,10), 240)
    fiter.isWalking()
    fiter.moveAndClick(200+random.randint(-20,20), 328)
    fiter.isAuto()
    # 服用摄妖香
    fiter.moveAndClick(330, 400)
    # 点击第十四个任务 npc隐藏的妖怪
    time.sleep(1)
    fiter.moveAndClick(136+random.randint(-10,20), 240)
    fiter.isWalking()
    fiter.moveAndClick(185+random.randint(-20,20), 328)
    fiter.isAuto()
    # 穿装备
    time.sleep(1)
    autopy.key.toggle('e', True, autopy.key.MOD_ALT)
    autopy.key.toggle('e', False, autopy.key.MOD_ALT)
    fiter.moveAndClick_fast2(258, 410)
    fiter.moveAndClick_fast2(308, 410)
    fiter.moveAndClick_fast2(50, 460)
    fiter.moveAndClick_fast2(100, 460)
    fiter.moveAndClick_fast2(150, 460)
    time.sleep(1)
    autopy.key.toggle('e', True, autopy.key.MOD_ALT)
    autopy.key.toggle('e', False, autopy.key.MOD_ALT)
    # 点击第十六个任务 npc妖怪
    time.sleep(1)
    fiter.moveAndClick(130+random.randint(0,5), 240)
    fiter.isWalking()
    fiter.moveAndClick(185+random.randint(-15,15), 328)
    fiter.isFight()
    fiter.isAuto()
    # 点击第十六个任务 npc王二愣
    time.sleep(1)
    fiter.moveAndClick(40+random.randint(-10,10), 240)
    fiter.isWalking()
    fiter.moveAndClick(185+random.randint(-20,20), 328)
    fiter.isAuto()
    # 点击第十七个任务 npc 小小
    time.sleep(1)
    fiter.moveAndClick(50+random.randint(0,5), 240)
    fiter.isWalking()
    fiter.moveAndClick(170+random.randint(0,5), 328)
    fiter.isAuto()
    fiter.moveAndClick(105+random.randint(0,5), 240)
    fiter.isWalking()
    fiter.moveAndClick(195+random.randint(-15,15), 328)
    fiter.isAuto()
    # 点击第十八个任务 npc鬼婆婆
    time.sleep(1)
    fiter.moveAndClick(135+random.randint(-10,10), 240)
    fiter.isWalking()
    fiter.moveAndClick(185+random.randint(-15,15), 344)
    fiter.isAuto()
    fiter.moveAndClick(100+random.randint(-10,20), 240)
    fiter.isWalking()
    fiter.moveAndClick(185+random.randint(-20,20), 328)
    fiter.isAuto()
    fiter.moveAndClick(65+random.randint(-10,10), 240)
    fiter.isWalking()
    fiter.moveAndClick(190+random.randint(-20,20), 344)
    fiter.isAuto()
    fiter.moveAndClick(125+random.randint(0,5), 240)
    fiter.isWalking()
    fiter.moveAndClick(185+random.randint(-15,15), 328)
    fiter.isAuto()
    fiter.moveAndClick(50+random.randint(-10,10), 240)
    fiter.isWalking()
    fiter.moveAndClick(222+random.randint(-25,25), 344)
    fiter.isAuto()
    # 点击第十九个任务 npc道士
    time.sleep(1)
    fiter.moveAndClick(50+random.randint(0,5), 240)
    fiter.isWalking()
    fiter.moveAndClick(190+random.randint(-20,20), 328)
    fiter.isAuto()
    fiter.moveAndClick(55+random.randint(-10,10), 240)
    fiter.isWalking()
    fiter.moveAndClick(240+random.randint(-10,20), 344)
    fiter.isAuto()
    fiter.moveAndClick(60+random.randint(0,5), 240)
    fiter.isWalking()
    fiter.moveAndClick(190+random.randint(-15,15), 328)
    fiter.isFight()
    fiter.moveAndClick(190+random.randint(0,50), 328)
    # 点击第二十个任务 npc仙子姐姐
    time.sleep(1)
    fiter.moveAndClick(60+random.randint(-10,20), 240)
    fiter.isWalking()
    fiter.moveAndClick(190+random.randint(-20,20), 328)
    fiter.isAuto()
    fiter.moveAndClick(80+random.randint(-10,20), 240)
    fiter.isWalking()
    fiter.moveAndClick(195+random.randint(-20,20), 328)
    fiter.isAuto()
    fiter.moveAndClick(100+random.randint(0,5), 240)
    fiter.isWalking()
    fiter.moveAndClick(230+random.randint(-20,20), 328)
    fiter.isAuto()
    fiter.moveAndClick(95+random.randint(-10,20), 240)
    fiter.isWalking()
    fiter.moveAndClick(215+random.randint(-20,20), 344)
    fiter.isAuto()
    fiter.moveAndClick(115+random.randint(-10,20), 240)
    fiter.isWalking()
    fiter.moveAndClick(200+random.randint(-15,15), 344)
    fiter.isAuto()
    fiter.moveAndClick(55+random.randint(-10,10), 240)
    fiter.isWalking()
    autopy.key.toggle('5', True, autopy.key.MOD_ALT)
    autopy.key.toggle('5', False, autopy.key.MOD_ALT)
    time.sleep(2)
    fiter.moveAndClick(200+random.randint(0,50), 328)
    fiter.moveAndClick(65+random.randint(-10,20), 240)
    fiter.isWalking()
    fiter.moveAndClick(200+random.randint(-15,15), 328)
    fiter.isAuto()
    fiter.moveAndClick(80+random.randint(-10,20), 240)
    fiter.isWalking()
    fiter.moveAndClick(222+random.randint(-20,20), 328)
    fiter.isAuto()
    fiter.moveAndClick(100+random.randint(0,5), 240)
    fiter.isWalking()
    fiter.moveAndClick(222+random.randint(-20,20), 328)
    fiter.isAuto()
    fiter.moveAndClick(60+random.randint(0,5), 240)
    fiter.moveAndClick(230+random.randint(-20,20), 328)
    # 渔夫考验
    test_yufu = 0
    while True:
        if((test_yufu%3) == 0):
            fiter.moveAndClick(175, 328)
        elif((test_yufu%3) == 1):
            fiter.moveAndClick(175, 344)
        else:
            fiter.moveAndClick(175, 364)
        catchScreen.catchAllScreen()
        if (isinstance(getOffset.getOffsetValue("new\\auto"), list)):
            break
        test_yufu+=1
    fiter.isAuto()
    # 点击第二十一个任务 npc袁天罡
    fiter.moveAndClick(55+random.randint(-10,10), 240)
    fiter.isWalking()
    fiter.moveAndClick(185+random.randint(-10,10), 328)
    fiter.moveAndClick(229, 368)
    time.sleep(1)
    fiter.moveAndClick(229, 368)
    fiter.moveAndClick(490, 400)
    fiter.isAuto()
    fiter.moveAndClick(55+random.randint(-10,10), 240)
    fiter.moveAndClick(185+random.randint(-10,10), 328)
    autopy.key.toggle('j', True, autopy.key.MOD_ALT)
    autopy.key.toggle('j', False, autopy.key.MOD_ALT)
    time.sleep(2)
    fiter.moveAndClick(338, 376)
    time.sleep(1)
    fiter.moveAndClick(338+random.randint(0,50), 376)
    time.sleep(1)
    fiter.moveAndClick(185+random.randint(-10,10), 344)
    fiter.moveAndClick(55+random.randint(-10,10), 240)
    fiter.moveAndClick(185+random.randint(-10,10), 344)
    time.sleep(1)
    autopy.key.toggle('f', True, autopy.key.MOD_ALT)
    autopy.key.toggle('f', False, autopy.key.MOD_ALT)
    fiter.moveAndClick(734+random.randint(-10,10), 196)
    fiter.moveAndClick(579+random.randint(-10,10), 513)
    # 郭三才
    time.sleep(1)
    fiter.moveAndClick(55+random.randint(-10,10), 240)
    fiter.isWalking()
    fiter.moveAndClick(253+random.randint(-10,10), 343)
    fiter.moveAndClick(77+random.randint(-10,10), 240)
    fiter.moveAndClick(205+random.randint(-10,10), 358)
Ejemplo n.º 9
0
def isFight(i):
    if (i % 4 == 1):
        time.sleep(1)
        fiter.moveAndClick(88 + random.randint(-10, 10), 42)
        autopy.key.toggle('8', True, autopy.key.MOD_ALT)
        autopy.key.toggle('8', False, autopy.key.MOD_ALT)
        time.sleep(1)
        fiter.moveAndClick(238 + random.randint(-10, 10), 42)
        autopy.key.toggle('8', True, autopy.key.MOD_ALT)
        autopy.key.toggle('8', False, autopy.key.MOD_ALT)
        time.sleep(1)
        fiter.moveAndClick(388 + random.randint(-10, 10), 42)
        autopy.key.toggle('8', True, autopy.key.MOD_ALT)
        autopy.key.toggle('8', False, autopy.key.MOD_ALT)
        time.sleep(1)
        fiter.moveAndClick(538 + random.randint(-10, 10), 42)
        autopy.key.toggle('8', True, autopy.key.MOD_ALT)
        autopy.key.toggle('8', False, autopy.key.MOD_ALT)
        time.sleep(1)
        fiter.moveAndClick(688 + random.randint(-10, 10), 42)
        autopy.key.toggle('8', True, autopy.key.MOD_ALT)
        autopy.key.toggle('8', False, autopy.key.MOD_ALT)
        time.sleep(1)
        fiter.moveAndClick(88 + random.randint(-10, 10), 42)
    time.sleep(1)
    x = True
    while True:
        catchScreen.catchAllScreen()
        if (isinstance(getOffset.getOffsetValue("zidong"), list)):
            x = True
        else:
            print("over")
            break
Ejemplo n.º 10
0
def tiantingStart():
    autopy.mouse.move(100, 20)  # 平滑移动鼠标(上面那个是瞬间的)
    autopy.mouse.click()  # 单击
    time.sleep(0.5)
    autopy.key.toggle('5', True, autopy.key.MOD_ALT)
    autopy.key.toggle('5', False, autopy.key.MOD_ALT)
    fiter.moveAndClick(388 + random.randint(0, 10), 336)
    time.sleep(0.5)
    getScreen.window_capture("D:\\zhaoyq\\screen\\allScreen.png")
    dealScreen.dealPicture_NPC("tianting")
    attr = getOffset.getOffsetValue_NPC("tianting", "lijing")
    x = attr[0] + random.randint(0, 5) + 200 - 20
    y = attr[1] + random.randint(-10, 10) + 200 - 50
    fiter.moveAndClick(x, y)
    for i in range(1, 240):
        fiter.moveAndClick(180 + random.randint(-10, 10), 400)
        # 第一只怪
        time.sleep(1)
        fiter.moveAndClick(110 + random.randint(-5, 5), 240)
        tianting(i)
        # 第二只怪
        time.sleep(1)
        fiter.moveAndClick(160 + random.randint(-5, 5), 240)
        tianting(i + 1)
        # 第三只怪
        time.sleep(1)
        fiter.moveAndClick(50 + random.randint(-5, 5), 255)
        tianting(i + 2)
        # 第四只怪
        time.sleep(1)
        fiter.moveAndClick(100 + random.randint(-5, 5), 255)
        tianting(i + 3)
        # 返回
        time.sleep(1)
        fiter.moveAndClick(25 + random.randint(0, 5),
                           265 + random.randint(0, 5))
        time.sleep(1)
        fiter.isWalking()
        while True:
            time.sleep(1)
            catchScreen.catchAllScreen()
            time.sleep(1)
            if (isinstance(getOffset.getOffsetValue_tiantingStart1(), list)):
                break
Ejemplo n.º 11
0
def smallGhostStart():
    autopy.mouse.move(100, 20)  # 平滑移动鼠标(上面那个是瞬间的)
    autopy.mouse.click()  # 单击
    for i in range(1, 240):
        time.sleep(0.5)
        autopy.key.toggle('5', True, autopy.key.MOD_ALT)
        autopy.key.toggle('5', False, autopy.key.MOD_ALT)
        fiter.moveAndClick(388 + random.randint(0, 10), 336)
        catchScreen.catchAllScreen()
        time.sleep(1)
        attr = getOffset.getOffsetValue_smallGhostMove()
        if (attr == "none"):
            print("不需要移动")
            getScreen.window_capture("D:\\zhaoyq\\screen\\allScreen.png")
            dealScreen.dealPicture_NPC("smallGhost")
            attr2 = getOffset.getOffsetValue_NPC("smallGhost", "zhongkui2")
            if (attr2 == "none"):
                global x
                global y
                print("在地府")
                fiter.moveAndClick2(350 + random.randint(0, 10), 350)
                fiter.isWalking()
                autopy.key.toggle('5', True, autopy.key.MOD_ALT)
                autopy.key.toggle('5', False, autopy.key.MOD_ALT)
                time.sleep(0.5)
                fiter.moveAndClick(388 + random.randint(0, 10), 336)
                time.sleep(0.5)
                getScreen.window_capture("D:\\zhaoyq\\screen\\allScreen.png")
                dealScreen.dealPicture_NPC("smallGhost")
                attr3 = getOffset.getOffsetValue_NPC("smallGhost", "zhongkui")
                while True:
                    if (attr3 == "none"):
                        getScreen.window_capture(
                            "D:\\zhaoyq\\screen\\allScreen.png")
                        dealScreen.dealPicture_NPC("smallGhost")
                        attr33 = getOffset.getOffsetValue_NPC(
                            "smallGhost", "zhongkui")
                        if (isinstance(attr33, list)):
                            x = attr33[0] + random.randint(0, 5) + 200 - 20
                            y = attr33[1] + random.randint(-10, 10) + 200 - 50
                            fiter.moveAndClick(x, y)
                            break
                    else:
                        x = attr3[0] + random.randint(0, 5) + 200
                        y = attr3[1] + random.randint(-10, 10) + 200 - 50 + 10
                        break
                fiter.moveAndClick(x, y)
                while True:
                    print("是否点击钟馗成功")
                    time.sleep(0.5)
                    catchScreen.catchAllScreen()
                    attr_start = getOffset.getOffsetValue_smallGhostStart()
                    if (attr_start == "none"):
                        getScreen.window_capture(
                            "D:\\zhaoyq\\screen\\allScreen.png")
                        time.sleep(0.5)
                        dealScreen.dealPicture_NPC("smallGhost")
                        time.sleep(0.5)
                        attr335 = getOffset.getOffsetValue_NPC(
                            "smallGhost", "zhongkui")
                        x1 = attr335[0] + random.randint(0, 5) + 200 - 20
                        y1 = attr335[1] + random.randint(-10, 10) + 200 - 50
                        fiter.moveAndClick(x1, y1)
                        time.sleep(1)
                    else:
                        break
                time.sleep(0.5)
            else:
                print("不在地府")
                x = attr2[0] + random.randint(0, 5) + 200
                y = attr2[1] + random.randint(-10, 10) + 200 - 50 + 10
                fiter.moveAndClick(
                    attr2[0] + random.randint(0, 5) + 200,
                    attr2[1] + random.randint(-10, 10) + 200 - 50 + 10)
                time.sleep(1)
        else:
            print("需要移动")
            if (attr[0] > 500):
                autopy.mouse.move(350 + random.randint(-10, 10), 370)
            else:
                autopy.mouse.move(attr[0] + random.randint(-10, 10), attr[1])
            autopy.mouse.click(autopy.mouse.RIGHT_BUTTON)
            fiter.isWalking()
            time.sleep(0.5)
            autopy.key.toggle('5', True, autopy.key.MOD_ALT)
            autopy.key.toggle('5', False, autopy.key.MOD_ALT)
            fiter.moveAndClick(388 + random.randint(0, 10), 336)
            time.sleep(0.5)
            fiter.moveAndClick(460 + random.randint(0, 5),
                               460 + random.randint(-10, 10))
            time.sleep(0.5)
        while True:
            print("是否点击开始任务")
            catchScreen.catchAllScreen()
            time.sleep(1)
            attr_start = getOffset.getOffsetValue_smallGhostStart()
            if (isinstance(attr_start, list)):
                fiter.moveAndClick(attr_start[0] + random.randint(-20, 20),
                                   attr_start[1])
                break
            else:
                catchScreen.catchScreen(40, 65, 140, 85, "position1")
                time.sleep(1)
                dealScreen.dealScreen("position1")
                time.sleep(1)
                if (getInfoFromScreen.getInfomation("position1").find("地府") !=
                        -1 or
                        getInfoFromScreen.getInfomation("position1").find("岫")
                        != -1):
                    print("在地府")
                    getScreen.window_capture(
                        "D:\\zhaoyq\\screen\\allScreen.png")
                    dealScreen.dealPicture_NPC("smallGhost")
                    time.sleep(1)
                    attr333 = getOffset.getOffsetValue_NPC(
                        "smallGhost", "zhongkui")
                    if (isinstance(attr333, list)):
                        x = attr333[0] + random.randint(0, 5) + 200
                        y = attr333[1] + random.randint(-10, 10) + 200 - 50
                        fiter.moveAndClick(x, y)
                else:
                    print("在长安")
                    getScreen.window_capture(
                        "D:\\zhaoyq\\screen\\allScreen.png")
                    dealScreen.dealPicture_NPC("smallGhost")
                    time.sleep(1)
                    attr444 = getOffset.getOffsetValue_NPC(
                        "smallGhost", "zhongkui2")
                    if (isinstance(attr444, list)):
                        x = attr444[0] + random.randint(0, 5) + 200 - 20
                        y = attr444[1] + random.randint(-10, 10) + 200 - 50
                        fiter.moveAndClick(x, y)
                time.sleep(1)
        time.sleep(1)
        fiter.moveAndClick(222 + random.randint(0, 5),
                           333 + random.randint(0, 10))
        time.sleep(1)
        xuncha()
        fiter.moveAndClick_fast2(222, 222)
        time.sleep(1)
        fiter.moveAndClick(39 + random.randint(0, 10), 254)
        fiter.isWalking()
        fiter.moveAndClick(205 + random.randint(-10, 10), 357)
        fiter.isFight(i)
        # 判断是否关闭大话精灵
        catchScreen.catchAllScreen()
        time.sleep(1)
        if (isinstance(getOffset.getOffsetValue_Dahuajingling(), list)):
            time.sleep(0.5)
            fiter.moveAndClick_fast2(400, 172)
        # 关闭物品栏
        catchScreen.catchAllScreen()
        time.sleep(1)
        if (isinstance(getOffset.getOffsetValue_Wupinlan(), list)):
            time.sleep(0.5)
            fiter.moveAndClick_fast2(190 + random.randint(-10, 10), 121)
        # 领取礼盒
        catchScreen.catchAllScreen()
        time.sleep(1)
        if (isinstance(getOffset.getOffsetValue_Box(), list)):
            print("领取礼盒")
            time.sleep(0.5)
            attr5 = getOffset.getOffsetValue_Box()
            if (attr5[0] > 900):
                time.sleep(1)
            else:
                fiter.moveAndClick(attr5[0] + random.randint(-10, 10) + 50,
                                   attr5[1] + 50 + random.randint(0, 5))
                time.sleep(40)
        # 返回
        time.sleep(1)
        print("点击回程")
        catchScreen.catchAllScreen()
        time.sleep(1)
        if (isinstance(getOffset.taskRight(), list)):
            time.sleep(0.5)
            attr6 = getOffset.taskRight()
            fiter.moveAndClick(attr6[0] + random.randint(0, 10) + 30,
                               attr6[1] - 60 + random.randint(0, 10))
        else:
            fiter.moveAndClick(800 + random.randint(0, 10),
                               530 + random.randint(0, 10))
        time.sleep(1)
        i += 1
Ejemplo n.º 12
0
def homeTaskStart():
    autopy.mouse.move(397, 390)  # 平滑移动鼠标(上面那个是瞬间的)
    autopy.mouse.click()  # 单击
    times = 0
    while times < 10:
        # 移动街坊图标并点击
        fiter.moveAndClick(775, 182)
        # 移动祭坛图标并点击
        fiter.moveAndClick(420, 352)
        # 点击领取任务
        fiter.moveAndClick(205, 328)
        # 打开任务列表
        time.sleep(1)
        if (times == 0):
            autopy.key.toggle('q', True, autopy.key.MOD_ALT)
            autopy.key.toggle('q', False, autopy.key.MOD_ALT)
        else:
            autopy.key.toggle('q', True, autopy.key.MOD_ALT)
            autopy.key.toggle('q', False, autopy.key.MOD_ALT)
            time.sleep(1)
            autopy.key.toggle('q', True, autopy.key.MOD_ALT)
            autopy.key.toggle('q', False, autopy.key.MOD_ALT)
        # 判断任务的类型
        catchScreen.catchAllScreen()
        time.sleep(1)
        while True:
            if (isinstance(getOffset.getOffsetValue("home\\xiaoyao"), list)):
                print("小妖")
                attr = getOffset.getOffsetValue("home\\xiaoyao")
                fiter.moveAndClick(attr[0] + 70, attr[1])
                isUser("xiaoyao", 70)
                break
            elif (isinstance(getOffset.getOffsetValue("home\\yuanding"),
                             list)):
                print("园丁")
                attr = getOffset.getOffsetValue("home\\yuanding")
                fiter.moveAndClick(attr[0] + 65, attr[1])
                isUser("yuanding", 65)
                break
            elif (isinstance(getOffset.getOffsetValue("home\\gongshuban"),
                             list)):
                print("公输般")
                attr = getOffset.getOffsetValue("home\\gongshuban")
                fiter.moveAndClick(attr[0] - 45, attr[1])
                if (findNPC("gongshuban")):
                    print("haha")
                    fiter.moveAndClick(249, 379)
                    fiter.moveAndClick(216, 330)
                break
        # 点击回家
        fiter.moveAndClick(785, 551)
        times += 1