示例#1
0
def card():
    while True:
        #鼠标移到右侧中止
        if pyautogui.position()[0] >= pyautogui.size()[0] * 0.98:
            select_mode()

        #截屏
        im = np.array(mss.mss().grab(monitor))
        screen = cv2.cvtColor(im, cv2.COLOR_BGRA2BGR)

        for i in ['taiyin2', 'sanshinei', 'taiyin3']:
            want = imgs[i]
            size = want[0].shape
            h, w, ___ = size
            target = screen
            pts = action.locate(target, want, 0)
            if not len(pts) == 0:
                print('结界卡*', i)
                xy = action.cheat(pts[0], w / 2, h - 10)
                pyautogui.click(xy)
                break
        if len(pts) == 0:
            print('结界卡不足')
            select_mode()

        for i in range(2):
            #截屏
            im = np.array(mss.mss().grab(monitor))
            screen = cv2.cvtColor(im, cv2.COLOR_BGRA2BGR)

            want = imgs['taiyin']
            size = want[0].shape
            h, w, ___ = size
            target = screen
            pts = action.locate(target, want, 0)
            if len(pts) == 0:
                print('结界卡不足')
                select_mode()
            else:
                print('结界卡', i)
                xy = action.cheat(pts[0], w / 2, h - 10)
                pyautogui.click(xy)
                pyautogui.moveTo(xy)

        #截屏
        im = np.array(mss.mss().grab(monitor))
        screen = cv2.cvtColor(im, cv2.COLOR_BGRA2BGR)

        want = imgs['hecheng']
        size = want[0].shape
        h, w, ___ = size
        target = screen
        pts = action.locate(target, want, 0)
        if not len(pts) == 0:
            print('合成中。。。')
            xy = action.cheat(pts[0], w, h - 10)
            pyautogui.click(xy)
            pyautogui.moveTo(xy)

        time.sleep(1)
示例#2
0
def yuhun2():
    cishu = 0
    while True:
        #鼠标移到最右侧中止
        if pyautogui.position()[0] >= pyautogui.size()[0] * 0.98:
            select_mode()

        #截屏
        im = np.array(mss.mss().grab(monitor))
        screen = cv2.cvtColor(im, cv2.COLOR_BGRA2BGR)

        #print('screen shot ok',time.ctime())
        #体力不足
        want = imgs['notili']
        size = want[0].shape
        h, w, ___ = size
        target = screen
        pts = action.locate(target, want, 0)
        if not len(pts) == 0:
            print('体力不足')
            select_mode()

        #如果队友推出则自己也退出
        want = imgs['tiaozhanhuise']
        size = want[0].shape
        h, w, ___ = size
        target = screen
        pts = action.locate(target, want, 0)
        if not len(pts) == 0:
            print('队友已退出')
            want = imgs['likaiduiwu']
            size = want[0].shape
            h, w, ___ = size
            target = screen
            pts = action.locate(target, want, 0)
            if not len(pts) == 0:
                xy = action.cheat(pts[0], w, h - 10)
                pyautogui.click(xy)
                t = random.randint(15, 30) / 100
                time.sleep(t)

        #自动点击通关结束后的页面
        for i in ['jujue','moren','queding','querenyuhun',\
                  'ying','jiangli','jixu',\
                  'jieshou2','jieshou','shibai']:
            want = imgs[i]
            size = want[0].shape
            h, w, ___ = size
            target = screen
            pts = action.locate(target, want, 0)
            if not len(pts) == 0:
                if i == 'yuhunbeijing':
                    cishu = cishu + 1
                    print('挑战次数:', cishu)
                print('挑战中。。。', i)
                xy = action.cheat(pts[0], w, h - 10)
                pyautogui.click(xy)
                t = random.randint(15, 30) / 100
                time.sleep(t)
                break
示例#3
0
def huodong():
    count = 0
    refresh = 0
    while True:  #直到取消,或者出错
        if pyautogui.position()[0] >= pyautogui.size()[0] * 0.98:
            select_mode()

        #截屏
        im = np.array(mss.mss().grab(monitor))
        screen = cv2.cvtColor(im, cv2.COLOR_BGRA2BGR)

        #体力不足
        want = imgs['notili']
        size = want[0].shape
        h, w, ___ = size
        target = screen
        pts = action.locate(target, want, 0)
        if not len(pts) == 0:
            print('体力不足')
            select_mode()

        #自动点击通关结束后的页面
        for i in ['jujue','hdtiaozhan','hdshijian','zhunbei',\
                  'ying','jiangli',\
                  'jixu','shibai']:
            want = imgs[i]
            size = want[0].shape
            h, w, ___ = size
            target = screen
            pts = action.locate(target, want, 0)
            if not len(pts) == 0:
                if i == 'hdtiaozhan' or i == 'hdchufa':
                    if not refresh == 0:
                        count = count - 1
                    if refresh >= 3:
                        print('次数不足')
                        t = random.randint(2000, 3000) / 100
                        select_mode()
                    refresh = refresh + 1
                    count = count + 1
                    print('挑战次数:', count)
                    t = random.randint(100, 200) / 100
                elif i == 'hdshijian':
                    #截屏
                    im = np.array(mss.mss().grab(monitor))
                    screen = cv2.cvtColor(im, cv2.COLOR_BGRA2BGR)
                    want = imgs['hdjiangli']
                    size = want[0].shape
                    h, w, ___ = size
                    pts = action.locate(screen, want, 0)
                    t = random.randint(100, 200) / 100
                    print('挑战结束')
                else:
                    refresh = 0
                    print('挑战中。。。', i)
                    t = random.randint(80, 100) / 100
                xy = action.cheat(pts[0], w, h - 10)
                pyautogui.click(xy)
                time.sleep(t)
                break
示例#4
0
def yuhun():
    global last_click
    cishu = 0
    refresh = 0
    while True:
        #鼠标移到最右侧中止
        if pyautogui.position()[0] >= pyautogui.size()[0] * 0.98:
            select_mode()

        #截屏
        screen = action.screenshot(monitor)

        #print('screen shot ok',time.ctime())
        #体力不足
        want = imgs['notili']
        size = want[0].shape
        h, w, ___ = size
        target = screen
        pts = action.locate(target, want, 0)
        if not len(pts) == 0:
            print('体力不足')
            select_mode()

        #自动点击通关结束后的页面
        for i in ['jujue','tiaozhan','tiaozhan2',\
                  'moren','queding','querenyuhun','ying','jiangli',\
                  'jixu','shibai']:
            want = imgs[i]
            size = want[0].shape
            h, w, ___ = size
            target = screen
            pts = action.locate(target, want, 0)
            if not len(pts) == 0:
                if last_click == i:
                    refresh = refresh + 1
                elif i == 'querenyuhun':
                    refresh = refresh + 2
                else:
                    refresh = 0
                last_click = i
                #print('重复次数:',refresh)
                if refresh > 6:
                    print('进攻次数上限')
                    select_mode()

                if i == 'tiaozhan' or i == 'tiaozhan2':
                    if refresh == 0:
                        cishu = cishu + 1
                    print('挑战次数:', cishu)
                    t = random.randint(50, 150) / 100
                    time.sleep(t)
                else:
                    print('挑战中。。。', i)
                    t = random.randint(50, 100) / 100
                xy = action.cheat(pts[0], w, h - 10)
                pyautogui.click(xy)
                time.sleep(t)
                break
示例#5
0
def yuhun():
    while True:
        #鼠标移到最右侧中止
        if pyautogui.position()[0] >= pyautogui.size()[0] * 0.98:
            select_mode()

        screen = ImageGrab.grab()
        screen.save('screen.jpg')
        screen = cv2.imread('screen.jpg')

        #截屏,并裁剪以加速
        upleft = (0, 0)
        downright = (2550, 770)  #上部并排

        a, b = upleft
        c, d = downright
        screen = screen[b:d, a:c]

        print('screen shot ok', time.ctime())

        #设定目标,开始查找
        #这里是自动接受组队
        for i in ['jieshou2', "jieshou"]:
            want = imgs[i]
            size = want[0].shape
            h, w, ___ = size
            x1, x2 = upleft, (430, 358)
            target = action.cut(screen, x1, x2)
            pts = action.locate(target, want, 0)
            if not len(pts) == 0:
                print('接受组队')
                xx = pts[0]
                xx = action.cheat(xx, w, h)
                if xx[0] > 120:
                    pyautogui.click(xx)
                    t = random.randint(40, 80) / 100
                    time.sleep(t)
                    break
                else:
                    pass
                continue

        #自动点击通关结束后的页面
        for i in ['ying', 'jiangli', 'kaishi', 'jixu']:
            want = imgs[i]
            size = want[0].shape
            h, w, ___ = size
            target = screen
            pts = action.locate(target, want, 0)
            if not len(pts) == 0:
                for pt in pts:
                    pt = action.cheat(pt, w, h)
                    pyautogui.click(pt)
                    t = random.randint(100, 200) / 1000
                    time.sleep(t)
                break
    select_mode()
示例#6
0
文件: yys.py 项目: wanghmalan/YYS
def yuhun():
    while True:
        #鼠标移到最右侧中止
        if pyautogui.position()[0] >= pyautogui.size()[0] * 0.98:
            select_mode()

        screen = np.array(ImageGrab.grab().convert('RGB'))

        #截屏,并裁剪以加速
        upleft = (0, 0)
        downright = (2550, 770)  #上部并排

        a, b = upleft
        c, d = downright
        screen = screen[b:d, a:c]

        #print('screen shot ok',time.ctime())
        #体力不足
        want = imgs['notili']
        size = want[0].shape
        h, w, ___ = size
        target = screen
        pts = action.locate(target, want, 0)
        if not len(pts) == 0:
            print('体力不足: ', pts[0])
            select_mode()

        #确定退出
        want = imgs['queding']
        size = want[0].shape
        h, w, ___ = size
        target = screen
        pts = action.locate(target, want, 0)
        if not len(pts) == 0:
            print('确定退出')
            xy = action.cheat(pts[0], w, h - 10)
            pyautogui.click(xy)
            t = random.randint(15, 30) / 100
            time.sleep(t)

        #自动点击通关结束后的页面
        for i in [
                'jujue', 'yuhuntiaozhan', 'ying', 'jiangli', 'jiangli2', 'jixu'
        ]:
            want = imgs[i]
            size = want[0].shape
            h, w, ___ = size
            target = screen
            pts = action.locate(target, want, 0)
            if not len(pts) == 0:
                for pt in pts:
                    print('挑战中。。。')
                    pt = action.cheat(pt, w, h)
                    pyautogui.click(pt)
                    t = random.randint(200, 300) / 1000
                    time.sleep(t)
                break
示例#7
0
def yaoqi():
    global last_click
    count = 0
    refresh = 0
    while True:  #直到取消,或者出错
        if pyautogui.position()[0] >= pyautogui.size()[0] * 0.98:
            select_mode()

        #截屏
        screen = action.screenshot(monitor)

        #委派任务
        for i in ['jujue','jiangli','jixu','zhunbei',\
                  'shibai','zidongpipei','zudui2',\
                  'ying','tiaozhan3','tiaozhan4']:
            want = imgs[i]
            size = want[0].shape
            h, w, ___ = size
            target = screen
            pts = action.locate(target, want, 0)
            if not len(pts) == 0:
                if last_click == i:
                    refresh = refresh + 1
                else:
                    refresh = 0
                last_click = i
                #print('重复次数:',refresh)
                if refresh > 6:
                    print('进攻次数上限')
                    select_mode()

                if i == 'zidongpipei' or i == 'tiaozhan3' or i == 'tiaozhan4':
                    if refresh == 0:
                        count = count + 1
                    print('次数:', count)
                    t = 100 / 100
                elif i == 'shibai':
                    print('自动结束')
                    select_mode()
                else:
                    print('活动中。。。', i)
                    t = random.randint(30, 80) / 100
                xy = action.cheat(pts[0], w, h - 10)
                pyautogui.click(xy)
                time.sleep(t)
                break

        #体力不足
        want = imgs['notili']
        size = want[0].shape
        h, w, ___ = size
        target = screen
        pts = action.locate(target, want, 0)
        if not len(pts) == 0:
            print('体力不足')
            select_mode()
示例#8
0
def yuhundanren():
    cishu=0
    while True :   #直到取消,或者出错
        if pyautogui.position()[0] >= pyautogui.size()[0] * 0.98:
            select_mode()

        #截屏,并裁剪以加速
        upleft = (0, 0)
        downright = (1358, 900)

        a,b = upleft
        c,d = downright
        
        #截屏
        monitor = {"top": b, "left": a, "width": c, "height": d}
        im = np.array(mss.mss().grab(monitor))
        screen = cv2.cvtColor(im, cv2.COLOR_BGRA2BGR)
        
        #体力不足
        want = imgs['notili']
        size = want[0].shape
        h, w , ___ = size
        target = screen
        pts = action.locate(target,want,0)
        if not len(pts) == 0:
            print('体力不足')
            select_mode()

        #次数检查
        if cishu > 500:
            print('次数上限')
            select_mode()
        
        #过关
        if cishu>=500:
            print('挑战次数上限')
            select_mode()
        for i in ['jujue','jixu','ying','jiangli',\
                  'tiaozhan','shibai']:
            want=imgs[i]
            size = want[0].shape
            h, w , ___ = size
            target=screen
            pts=action.locate(target,want,0)
            if not len(pts)==0:
                print('挑战中。。。',i)
                if i == 'tiaozhan' or i=='tiaozhan2':
                    cishu=cishu+1
                    print('挑战次数:',cishu)
                    t = random.randint(150,300) / 100
                else:
                    t = random.randint(15,30) / 100
                xy = action.cheat(pts[0], w, h-10 )
                pyautogui.click(xy)
                time.sleep(t)
                break
示例#9
0
def mijing():
    while True:
        #鼠标移到右侧中止    
        if pyautogui.position()[0] >= pyautogui.size()[0] * 0.98:
            select_mode()

        #截屏,并裁剪以加速
        upleft = (0, 0)
        downright = (1358, 900)
        downright2 = (1280, 720)

        a,b = upleft
        c,d = downright

        #截屏
        monitor = {"top": b, "left": a, "width": c, "height": d}
        im = np.array(mss.mss().grab(monitor))
        screen = cv2.cvtColor(im, cv2.COLOR_BGRA2BGR)

        #检测聊天界面
        want = imgs['liaotianguanbi']
        size = want[0].shape
        h, w , ___ = size
        target = screen
        pts = action.locate(target,want,0)
        if not len(pts) == 0:
            #print('搜索秘境车中。。。')

            for i in ['jujue','mijingzhaohuan','mijingzhaohuan2']:
                want = imgs[i]
                size = want[0].shape
                h, w , ___ = size
                target = screen
                pts = action.locate(target,want,0)
                if not len(pts) == 0:
                    print('秘境召唤。。。',i)
                    xy = action.cheat(pts[0], w, h-10 )
                    pyautogui.click(xy)
                    #t = random.randint(10,100) / 100
                    #time.sleep(t)
                    break
        else:
            for i in ['jujue','canjia','liaotian']:
                want = imgs[i]
                size = want[0].shape
                h, w , ___ = size
                target = screen
                pts = action.locate(target,want,0)
                if not len(pts) == 0:
                    if i=='canjia':
                        print('加入秘境召唤!',i)
                    xy = action.cheat(pts[0], w, h-10 )
                    pyautogui.click(xy)
                    t = random.randint(10,30) / 100
                    time.sleep(t)
                    break
示例#10
0
def huodong():
    global last_click
    count = 0
    refresh = 0
    while True:  #直到取消,或者出错
        if pyautogui.position()[0] >= pyautogui.size()[0] * 0.98:
            select_mode()

        #截屏
        screen = action.screenshot(monitor)

        #体力不足
        want = imgs['notili']
        size = want[0].shape
        h, w, ___ = size
        target = screen
        pts = action.locate(target, want, 0)
        if not len(pts) == 0:
            print('体力不足 ')
            select_mode()

        for i in ['jujue','hdxuanze','hdxuanze2','hdzhandou','hdjieshou',\
                  'hdtiaozhan','zhunbei','querenyuhun',\
                  'jiangli','ying','shibai','jixu','hdend','hdguanbi']:
            want = imgs[i]
            size = want[0].shape
            h, w, ___ = size
            target = screen
            pts = action.locate(target, want, 0)
            if not len(pts) == 0:
                if last_click == i:
                    refresh = refresh + 1
                else:
                    refresh = 0
                last_click = i
                #print('重复次数:',refresh)
                print('活动中', i)
                if refresh > 6:
                    print('进攻次数上限')
                    select_mode()

                if i == 'hdtiaozhan':
                    if refresh == 0:
                        count = count + 1
                    print('挑战次数:', count)
                if i == 'hdend':
                    if refresh == 0:
                        print('疲劳度满,休息1小时')
                        t = 60 * 60
                        time.sleep(t)
                else:
                    xy = action.cheat(pts[0], w, h - 10)
                    pyautogui.click(xy)
                    t = random.randint(300, 500) / 100
                    time.sleep(t)
示例#11
0
文件: yys.py 项目: wanghmalan/YYS
def huodong():
    while True:  #直到取消,或者出错
        if pyautogui.position()[0] >= pyautogui.size()[0] * 0.98:
            select_mode()

        screen = np.array(ImageGrab.grab().convert('RGB'))

        #截屏,并裁剪以加速
        upleft = (0, 0)
        downright = (1358, 768)
        downright2 = (1280, 720)

        a, b = upleft
        c, d = downright
        screen = screen[b:d, a:c]

        want = imgs['xiayihui']
        size = want[0].shape
        h, w, ___ = size
        target = screen
        pts = action.locate(target, want, 0)
        if not len(pts) == 0:
            print('下一回 ', pts[0])
            xy = action.cheat(pts[0], w, h - 10)
            pyautogui.click(xy)
            pyautogui.moveTo(xy)
            t = random.randint(15, 30) / 100
            time.sleep(t)

        for i in [
                'jujue', 'huodongtiaozhan', 'jiangli', 'jixu', 'zhunbei', 'yun'
        ]:
            want = imgs[i]
            size = want[0].shape
            h, w, ___ = size
            target = screen
            pts = action.locate(target, want, 0)
            if not len(pts) == 0:
                print('活动中。。。')
                xy = action.cheat(pts[0], w, h - 10)
                pyautogui.click(xy)
                t = random.randint(15, 30) / 100
                time.sleep(t)
                break

        #体力不足
        want = imgs['notili']
        size = want[0].shape
        h, w, ___ = size
        target = screen
        pts = action.locate(target, want, 0)
        if not len(pts) == 0:
            print('体力不足')
            select_mode()
示例#12
0
def yuhundanren():
    cishu = 0
    refresh = 0
    while True:  #直到取消,或者出错
        if pyautogui.position()[0] >= pyautogui.size()[0] * 0.98:
            select_mode()

        #截屏
        im = np.array(mss.mss().grab(monitor))
        screen = cv2.cvtColor(im, cv2.COLOR_BGRA2BGR)

        #体力不足
        want = imgs['notili']
        size = want[0].shape
        h, w, ___ = size
        target = screen
        pts = action.locate(target, want, 0)
        if not len(pts) == 0:
            print('体力不足')
            select_mode()

        #次数检查
        if cishu > 500:
            print('次数上限')
            select_mode()

        for i in ['jujue','querenyuhun','ying','jiangli','jixu',\
                  'tiaozhan','tiaozhan2','shibai']:
            want = imgs[i]
            size = want[0].shape
            h, w, ___ = size
            target = screen
            pts = action.locate(target, want, 0)
            if not len(pts) == 0:
                print('挑战中。。。', i)
                if i == 'tiaozhan' or i == 'tiaozhan2':
                    if refresh > 2:
                        select_mode()
                    elif refresh == 0:
                        cishu = cishu + 1
                    else:
                        cishu = cishu
                    refresh = refresh + 1
                    print('挑战次数:', cishu)
                    t = random.randint(150, 300) / 100
                else:
                    refresh = 0
                    t = random.randint(15, 30) / 100
                xy = action.cheat(pts[0], w, h - 10)
                pyautogui.click(xy)
                time.sleep(t)
                break
示例#13
0
def yuhun():
    cishu = 0
    refresh = 0
    while True:
        #鼠标移到最右侧中止
        if pyautogui.position()[0] >= pyautogui.size()[0] * 0.98:
            select_mode()

        #截屏
        im = np.array(mss.mss().grab(monitor))
        screen = cv2.cvtColor(im, cv2.COLOR_BGRA2BGR)

        #print('screen shot ok',time.ctime())
        #体力不足
        want = imgs['notili']
        size = want[0].shape
        h, w, ___ = size
        target = screen
        pts = action.locate(target, want, 0)
        if not len(pts) == 0:
            print('体力不足')
            select_mode()

        #自动点击通关结束后的页面
        for i in ['jujue','yuhuntiaozhan',\
                  'moren','queding','querenyuhun','ying','jiangli',\
                  'jixu','shibai']:
            want = imgs[i]
            size = want[0].shape
            h, w, ___ = size
            target = screen
            pts = action.locate(target, want, 0)
            if not len(pts) == 0:
                if i == 'tiaozhan' or i == 'tiaozhan2':
                    if refresh > 2:
                        select_mode()
                    elif refresh == 0:
                        cishu = cishu + 1
                    else:
                        cishu = cishu
                    refresh = refresh + 1
                    print('挑战次数:', cishu)
                    t = random.randint(250, 400) / 100
                else:
                    print('挑战中。。。', i)
                    refresh = 0
                    t = random.randint(50, 100) / 100
                xy = action.cheat(pts[0], w, h - 10)
                pyautogui.click(xy)
                time.sleep(t)
                break
示例#14
0
def chouka():
    while True:
        #鼠标移到右侧中止    
        if pyautogui.position()[0] >= pyautogui.size()[0] * 0.98:
            select_mode()

        #截屏,并裁剪以加速
        upleft = (0, 0)
        downright = (1358, 900)
        downright2 = (1280, 720)

        a,b = upleft
        c,d = downright

        #截屏
        monitor = {"top": b, "left": a, "width": c, "height": d}
        im = np.array(mss.mss().grab(monitor))
        screen = cv2.cvtColor(im, cv2.COLOR_BGRA2BGR)
        
        want = imgs['zaicizhaohuan']
        size = want[0].shape
        h, w , ___ = size
        target = screen
        pts = action.locate(target,want,0)
        if not len(pts) == 0:
            print('抽卡中。。。')
            xy = action.cheat(pts[0], w, h-10 )
            pyautogui.click(xy)
示例#15
0
文件: yys.py 项目: wanghmalan/YYS
def chouka():
    while True:
        #鼠标移到右侧中止
        if pyautogui.position()[0] >= pyautogui.size()[0] * 0.98:
            select_mode()

        #截图
        screen = np.array(ImageGrab.grab().convert('RGB'))

        #截屏,并裁剪以加速
        upleft = (0, 0)
        downright = (1358, 768)
        downright2 = (1280, 720)

        a, b = upleft
        c, d = downright
        screen = screen[b:d, a:c]

        for i in ['cezhi', 'zaicizhaohuan']:
            want = imgs[i]
            size = want[0].shape
            h, w, ___ = size
            target = screen
            pts = action.locate(target, want, 0)
            if not len(pts) == 0:
                print('抽卡中。。。')
                xy = action.cheat(pts[0], w, h - 10)
                pyautogui.click(xy)
                #t = random.randint(1,3) / 100
                #time.sleep(t)
                break
示例#16
0
文件: yys.py 项目: wanghmalan/YYS
def douji():
    while True:  #直到取消,或者出错
        if pyautogui.position()[0] >= pyautogui.size()[0] * 0.98:
            select_mode()

        screen = np.array(ImageGrab.grab().convert('RGB'))

        #截屏,并裁剪以加速
        upleft = (0, 0)
        downright = (1358, 768)
        downright2 = (1280, 720)

        a, b = upleft
        c, d = downright
        screen = screen[b:d, a:c]

        for i in [
                'douji', 'doujiend', 'ying', 'doujiqueren', 'tui', 'doujiother'
        ]:
            want = imgs[i]
            size = want[0].shape
            h, w, ___ = size
            target = screen
            pts = action.locate(target, want, 0)
            if not len(pts) == 0:
                print('领取奖励')
                xy = action.cheat(pts[0], w, h - 10)
                pyautogui.click(xy)
                t = random.randint(15, 30) / 100
                time.sleep(t)
                break
示例#17
0
def chouka():
    refresh = False
    count = 0
    while True:
        #鼠标移到右侧中止
        if pyautogui.position()[0] >= pyautogui.size()[0] * 0.98:
            select_mode()

        #截屏
        im = np.array(mss.mss().grab(monitor))
        screen = cv2.cvtColor(im, cv2.COLOR_BGRA2BGR)

        want = imgs['zaicizhaohuan']
        size = want[0].shape
        h, w, ___ = size
        target = screen
        pts = action.locate(target, want, 0)
        if not len(pts) == 0:
            if count > 200:
                print('次数上限')
                select_mode()
            count = count + 1
            print('抽卡中。。。', count)
            xy = action.cheat(pts[0], w, h - 10)
            pyautogui.click(xy)
示例#18
0
def shengxing():
    count=0
    refresh=0
    while True:
        #鼠标移到右侧中止    
        if pyautogui.position()[0] >= pyautogui.size()[0] * 0.98:
            select_mode()

        #截屏
        im = np.array(mss.mss().grab(monitor))
        screen = cv2.cvtColor(im, cv2.COLOR_BGRA2BGR)
            
        for i in ['jiarugouliang','jineng','jixushengxing','querenshengxing']:
            want = imgs[i]
            size = want[0].shape
            h, w , ___ = size
            target = screen
            pts = action.locate(target,want,0)
            if not len(pts) == 0:
                print('升星中。。。',i)
                xy = action.cheat(pts[0], w, h-10 )
                pyautogui.click(xy)
                if i=='jiarugouliang':
                    print('无式神')
                    select_mode()
                elif i=='querenshengxing':
                    if refresh==0:
                        count=count+1
                    refresh=refresh+1
                    print('升星个数:',count)
                    t = random.randint(250,350) / 100
                else:
                    refresh=0
                    t = random.randint(20,100) / 100
                time.sleep(t)
示例#19
0
def yeyuanhuo():
    while True:  #直到取消,或者出错
        if pyautogui.position()[0] >= pyautogui.size()[0] * 0.98:
            select_mode()

        screen = ImageGrab.grab()
        screen.save('screen.jpg')
        screen = cv2.imread('screen.jpg')

        #截屏,并裁剪以加速
        upleft = (0, 0)
        downright = (1426, 798)

        a, b = upleft
        c, d = downright
        screen = screen[b:d, a:c]

        print('screen shot ok', time.ctime())

        #设定目标,开始查找

        #过关
        for i in ['ying', 'jiangli', 'tiaozhan', 'jixu']:
            want = imgs[i]
            size = want[0].shape
            h, w, ___ = size
            target = screen
            pts = action.locate(target, want, 0)
            if not len(pts) == 0:
                for pt in pts:
                    pt = action.cheat(pt, w, h)
                    pyautogui.click(pt)
                    t = random.randint(20, 50) / 100
                    time.sleep(t)
                break
示例#20
0
def douji():
    global last_click
    doujipaidui = 0
    refresh = 0
    while True:  #直到取消,或者出错
        if pyautogui.position()[0] >= pyautogui.size()[0] * 0.98:
            select_mode()
        #截屏
        screen = action.screenshot(monitor)

        for i in ['jujue','shoudong','zidong','queren',\
                  'douji','douji3',\
                  'doujiqueren','doujiend','ying',\
                  'zhunbei','zhunbei2',\
                  'doujiquxiao']:
            want = imgs[i]
            size = want[0].shape
            h, w, ___ = size
            target = screen
            pts = action.locate(target, want, 0)
            if not len(pts) == 0:
                if last_click == i:
                    refresh = refresh + 1
                else:
                    refresh = 0
                last_click = i
                #print('重复次数:',refresh)
                if refresh > 6:
                    print('进攻次数上限')
                    select_mode()

                if i == 'douji':
                    doujipaidui = 0
                    print('斗技开始', i)
                    xy = action.cheat(pts[0], w, h - 10)
                    pyautogui.click(xy)
                    t = random.randint(15, 30) / 100
                    time.sleep(t)
                    break
                elif i == 'doujiquxiao':
                    refresh = 0
                    doujipaidui = doujipaidui + 1
                    print('斗技搜索:', doujipaidui)
                    if doujipaidui > 5:
                        doujipaidui = 0
                        print('取消搜索')
                        xy = action.cheat(pts[0], w, h - 10)
                        pyautogui.click(xy)
                        t = random.randint(15, 30) / 100
                        time.sleep(t)
                        break
                else:
                    print('斗技中。。。', i)
                    xy = action.cheat(pts[0], w, h - 10)
                    pyautogui.click(xy)
                    t = random.randint(50, 100) / 100
                    time.sleep(t)
                    break
示例#21
0
def huodong():
    count=0
    while True:   #直到取消,或者出错
        if pyautogui.position()[0] >= pyautogui.size()[0] * 0.98:
            select_mode()

        #截屏
        im = np.array(mss.mss().grab(monitor))
        screen = cv2.cvtColor(im, cv2.COLOR_BGRA2BGR)

        for i in ['jujue','jiangli','jixu',\
                  'shibai','hdtuizhi',\
                  'hdlingqu','hdtili',\
                  'hdtiaozhan']:
            want = imgs[i]
            size = want[0].shape
            h, w , ___ = size
            target = screen
            pts = action.locate(target,want,0)
            if not len(pts) == 0:
                if i=='hdtiaozhan':
                    count=count+1
                    print('活动次数:',count)
                    t=500/100
                elif i=='queding':
                    print('活动次数不足')
                    select_mode()
                else:
                    print('活动中。。。',i)
                    t = random.randint(15,30) / 100
                xy = action.cheat(pts[0], w, h-10 )
                pyautogui.click(xy)
                time.sleep(t)
                break
        
        #体力不足
        want = imgs['notili']
        size = want[0].shape
        h, w , ___ = size
        target = screen
        pts = action.locate(target,want,0)
        if not len(pts) == 0:
            print('体力不足')
            select_mode()
示例#22
0
def yaoqi():
    count = 0
    while True:  #直到取消,或者出错
        if pyautogui.position()[0] >= pyautogui.size()[0] * 0.98:
            select_mode()

        #截屏
        im = np.array(mss.mss().grab(monitor))
        screen = cv2.cvtColor(im, cv2.COLOR_BGRA2BGR)

        #委派任务
        for i in ['jujue','jiangli','jixu','zhunbei',\
                  'shibai','zidongpipei','zudui2',\
                  'ying','tiaozhan3','tiaozhan4']:
            want = imgs[i]
            size = want[0].shape
            h, w, ___ = size
            target = screen
            pts = action.locate(target, want, 0)
            if not len(pts) == 0:
                if i == 'zidongpipei':
                    count = count + 1
                    print('次数:', count)
                    t = 100 / 100
                elif i == 'shibai':
                    print('自动结束')
                    select_mode()
                else:
                    print('活动中。。。', i)
                    t = random.randint(30, 80) / 100
                xy = action.cheat(pts[0], w, h - 10)
                pyautogui.click(xy)
                time.sleep(t)
                break

        #体力不足
        want = imgs['notili']
        size = want[0].shape
        h, w, ___ = size
        target = screen
        pts = action.locate(target, want, 0)
        if not len(pts) == 0:
            print('体力不足')
            select_mode()
示例#23
0
def click(screen, s):
    want = imgs[s]
    size = want[0].shape
    h, w, ___ = size
    pts = action.locate(screen, want, 0)
    if len(pts) >= 1:
        xy = action.cheat(pts[0], w, h)
        pyautogui.click(xy)
        return True
    return False
示例#24
0
文件: yys.py 项目: wanghmalan/YYS
def yuhundanren():
    while True:  #直到取消,或者出错
        if pyautogui.position()[0] >= pyautogui.size()[0] * 0.98:
            select_mode()

        screen = np.array(ImageGrab.grab().convert('RGB'))

        #截屏,并裁剪以加速
        upleft = (0, 0)
        downright = (1426, 798)

        a, b = upleft
        c, d = downright
        screen = screen[b:d, a:c]

        #print('screen shot ok',time.ctime())

        #体力不足
        want = imgs['notili']
        size = want[0].shape
        h, w, ___ = size
        target = screen
        pts = action.locate(target, want, 0)
        if not len(pts) == 0:
            print('体力不足')
            select_mode()

        #过关
        for i in ['jujue', 'ying', 'jiangli', 'tiaozhan', 'jixu']:
            want = imgs[i]
            size = want[0].shape
            h, w, ___ = size
            target = screen
            pts = action.locate(target, want, 0)
            if not len(pts) == 0:
                print('挑战中。。。')
                for pt in pts:
                    pt = action.cheat(pt, w, h)
                    pyautogui.click(pt)
                    t = random.randint(20, 50) / 100
                    time.sleep(t)
                break
示例#25
0
def douji():
    doujipaidui = 0
    refresh = False
    while True:  #直到取消,或者出错
        if pyautogui.position()[0] >= pyautogui.size()[0] * 0.98:
            select_mode()

        #截屏
        im = np.array(mss.mss().grab(monitor))
        screen = cv2.cvtColor(im, cv2.COLOR_BGRA2BGR)



        for i in ['jujue','shoudong','zidong','queren',\
                  'douji','douji3',\
                  'doujiqueren','doujiend','ying',\
                  'zhunbei','zhunbei2',\
                  'doujiquxiao']:
            want = imgs[i]
            size = want[0].shape
            h, w, ___ = size
            target = screen
            pts = action.locate(target, want, 0)
            if not len(pts) == 0:
                if i == 'douji':
                    doujipaidui = 0
                    print('斗技开始', i)
                    xy = action.cheat(pts[0], w, h - 10)
                    pyautogui.click(xy)
                    t = random.randint(15, 30) / 100
                    time.sleep(t)
                    break
                elif i == 'doujiquxiao':
                    doujipaidui = doujipaidui + 1
                    print('斗技搜索:', doujipaidui)
                    if doujipaidui > 5:
                        doujipaidui = 0
                        print('取消搜索')
                        xy = action.cheat(pts[0], w, h - 10)
                        pyautogui.click(xy)
                        t = random.randint(15, 30) / 100
                        time.sleep(t)
                        break
                else:
                    print('斗技中。。。', i)
                    xy = action.cheat(pts[0], w, h - 10)
                    pyautogui.click(xy)
                    t = random.randint(50, 100) / 100
                    time.sleep(t)
                    break
示例#26
0
def getManXy():
    screen = ImageGrab.grab()
    screen.save('screen.jpg')
    screen = cv2.cv2.imread('screen.jpg')
    upleft = (500, 0)
    downright = (1200, 500)
    a, b = upleft
    c, d = downright
    screen = screen[b:d, a:c]
    manxy = []
    for i in ['man1', 'man']:
        want = imgs[i]
        pts = action.locate(screen, want, 0)
        if len(pts) >= 1:
            xy = action.cheat(pts[0], 5, 5)
            xy[0] = xy[0] + 500
            manxy.append(xy)
    return manxy
示例#27
0
def shengxing():
    global last_click
    count = 0
    refresh = 0
    while True:
        #鼠标移到右侧中止
        if pyautogui.position()[0] >= pyautogui.size()[0] * 0.98:
            select_mode()

        #截屏
        screen = action.screenshot(monitor)

        for i in ['jineng','jixushengxing',\
                  'jixuyucheng','querenshengxing']:
            want = imgs[i]
            size = want[0].shape
            h, w, ___ = size
            target = screen
            pts = action.locate(target, want, 0)
            if not len(pts) == 0:
                if last_click == i:
                    refresh = refresh + 1
                else:
                    refresh = 0
                last_click = i
                #print('重复次数:',refresh)
                if refresh > 6:
                    print('进攻次数上限')
                    select_mode()

                print('升级中。。。', i)
                xy = action.cheat(pts[0], w, h - 10)
                pyautogui.click(xy)
                if i == 'querenshengxing':
                    if refresh == 0:
                        count = count + 1
                    print('升级个数:', count)
                    t = random.randint(250, 350) / 100
                else:
                    t = random.randint(20, 100) / 100

                time.sleep(t)
示例#28
0
def shengxing():
    cishu=0
    refresh=False
    while True:
        #鼠标移到右侧中止    
        if pyautogui.position()[0] >= pyautogui.size()[0] * 0.98:
            select_mode()

        #截屏,并裁剪以加速
        upleft = (0, 0)
        downright = (1358, 900)
        downright2 = (1280, 720)

        a,b = upleft
        c,d = downright

        #截屏
        monitor = {"top": b, "left": a, "width": c, "height": d}
        im = np.array(mss.mss().grab(monitor))
        screen = cv2.cvtColor(im, cv2.COLOR_BGRA2BGR)
            
        for i in ['jixushengxing','querenshengxing']:
            want = imgs[i]
            size = want[0].shape
            h, w , ___ = size
            target = screen
            pts = action.locate(target,want,0)
            if not len(pts) == 0:
                print('升星中。。。',i)
                xy = action.cheat(pts[0], w, h-10 )
                pyautogui.click(xy)
                if i=='querenshengxing':
                    if refresh==True:
                        print('无式神')
                        select_mode()
                    t=random.randint(250,300) / 100
                    refresh=True
                else:
                    t = random.randint(30,100) / 100
                    refresh=False
                time.sleep(t)
                break
示例#29
0
文件: yys.py 项目: voyagingmk/YYS
def yeyuanhuo():
    while True:  #直到取消,或者出错
        #鼠标移到最右侧中止
        if pyautogui.position()[0] >= pyautogui.size()[0] * 0.98:
            sys.exit(0)

        screen = ImageGrab.grab()
        screen.save('screen.jpg')
        screen = cv2.imread('screen.jpg')

        #截屏,并裁剪以加速
        upleft = (0, 0)
        downright = (1426, 798)

        a, b = upleft
        c, d = downright
        #screen = screen[b:d,a:c]

        print('screen shot ok', time.ctime())

        #设定目标,开始查找

        #过关
        for i in ['tiaozhan', 'ying', 'jiangli', 'jiangli2', '333', 'ok']:
            want = imgs[i]
            size = want[0].shape
            h, w, ___ = size
            #print 'h', h, 'w',w, want[1], want[2]
            target = screen
            pts = action.locate(target, want, 0, 1)
            print 'pts', pts
            if not len(pts) == 0:
                for pt in pts:
                    pt = action.cheat(pt, w, h)
                    print('click', pt[0], pt[1], want[2])
                    pyautogui.click(x=pt[0], y=pt[1], clicks=2)
                    pyautogui.mouseDown()
                    pyautogui.mouseUp()
                    t = random.randint(100, 200) / 100
                    time.sleep(t)
                    break
                break
示例#30
0
    def shibie(self, name, times, force=True):
        i = 1
        while times == 0 or i <= times:
            screen = self.screen(force)
            want = self.imgs[name]
            size = want[0].shape
            h, w = size
            target = screen
            pts = action.locate(target, want, 0)
            result = []
            if not len(pts) == 0:
                for pt in pts:
                    # 减去数值
                    pt = action.cheat(pt, w, h)
                    result.append(pt)
                    print("\r" + name + ' is clicked')
                return result

            i += 1
            # time.sleep(0.6)
        print("\r" + name + ' is not found')
        return False