阴阳师python pyautogui 自动 辅助

''' 原文出处 实际使用挂机超过2小时会被封贵鬼是黑。res下贴图需要你自行根据你的电脑分辨率截取,比如开始,准备,我都用拼音命名'''
import gevent
import pyautogui
import random
import time

def click(picture):
    global External_variable,i#外部变量

    picture = './res/' + picture
    i=1
    while True:
        point = pyautogui.locateCenterOnScreen(picture, confidence=0.8)
        if point is None:
            gevent.sleep(1) #要让greenlet交替运行,可以通过gevent.sleep()交出控制权
        else:
            x=point.x+random.randint(0,9)
            y=point.y+random.randint(0,9)
            #加入随机偏移量 回来实现被封锁。然后事实是这样,建议不要超过2个小时。实际使用挂机超过2小时会被封贵鬼是黑。

            if i==1 :
                #不知道为什么会点击2次
                pyautogui.click(x,y, duration=0.5)
                #print(x,y)
                print(picture)
                #i=0
def cycle_fight():
    '''用于循环重复的战斗场景,如果刷觉醒材料,刷御魂'''
    gevent.joinall([        #利用joinall方法将每一步操作加入协程池中
        gevent.spawn(click,'zhandou.PNG'),   #每一个协程的加入方法是:(函数名,参数)
        gevent.spawn(click,'zhunbei.PNG'),
        gevent.spawn(click,'shenli.PNG'),
        gevent.spawn(click,'shibai.PNG'),
        gevent.spawn(click,'jixu.PNG'),
        gevent.spawn(click,'jiangli.PNG')
    ])

def story_task():
    ''''用于过废话连篇的剧情任务'''
    gevent.joinall([
        gevent.spawn(click, 'zhandou.PNG'),
        gevent.spawn(click, 'zhunbei.PNG'),
        gevent.spawn(click, 'wenhao.PNG'),
        gevent.spawn(click, 'tiaoguo.PNG'),
        gevent.spawn(click, 'shenli.PNG'),
        gevent.spawn(click, 'kuaijin.PNG'),
        gevent.spawn(click, 'guochang.PNG'),
        gevent.spawn(click,'shijian.png'),
        gevent.spawn(click,'boss.png'),
        gevent.spawn(click,'hezi.png'),
        gevent.spawn(click,'yanjing.png'),
        gevent.spawn(click,'jiangli.PNG')
    ])

'''用于过探索副本'''
'''def explore_task():

    gevent.joinall([
        gevent.spawn(click, 'fight.PNG'),
        gevent.spawn(click, 'masterFight.PNG'),
        gevent.spawn(click, 'zhunbei.PNG'),
        gevent.spawn(click, 'over.PNG')
    ])
'''
def jiejie_fight():
    '''结界突破好像不行 '''
    gevent.joinall([        #利用joinall方法将每一步操作加入协程池中
        gevent.spawn(click,'jiejie1.PNG'),   #每一个协程的加入方法是:(函数名,参数)
        gevent.spawn(click,'jiejie2.PNG'),
        gevent.spawn(click,'shenli.PNG'),
        gevent.spawn(click,'shibai.PNG'),
        gevent.spawn(click, 'zhunbei.PNG'),
        gevent.spawn(click,'jiangli.PNG')
    ])

def douji_fight():
    '''斗鸡 '''
    gevent.joinall([        #利用joinall方法将每一步操作加入协程池中
        gevent.spawn(click,'douji1.PNG'),   #每一个协程的加入方法是:(函数名,参数)
        gevent.spawn(click,'douji2.PNG'),
        gevent.spawn(click,'shenli.PNG'),
        gevent.spawn(click,'shibai.PNG'),
        gevent.spawn(click, 'zhunbei.PNG'),
        gevent.spawn(click,'jiangli.PNG')
    ])

story_task()
#cycle_fight()
#jiejie_fight()
#douji_fight()

你可能感兴趣的:(python,阴阳师)