• 自动刷御魂以及觉醒副本


    airtest环境搭建,将下面的图片和代码文件放在同一个目录下,

    确保手机已开启usb调试,

    将游戏调整到副本页面,

    运行py文件,即可!

    pic

     #

     #

     #

     #

    code

    from airtest.core.api import *
    import time
    import datetime
    import logging
    logging.basicConfig(level=None)
    
    init_device("Android")
    
    def gen(times,nstatus):
        duration=30
        for i in range(0,times):
            print(i+1)
            print(duration,"*"*20)
            status=nstatus  
            while(1):
                if(exists(Template(r"tpl1602912634311.png", record_pos=(0.331, 0.173), resolution=(1560, 720)))):
                    touch(Template(r"tpl1602864978373.png", record_pos=(1.34, -0.201), resolution=(720, 1560)))
                    status=False
                    t1=time.time()
                    time.sleep(duration)
                else:
                    if(exists(Template(r"tpl1602912796157.png", record_pos=(0.005, 0.092), resolution=(1560, 720)))):
                        t2=time.time()
                        tmp=(datetime.datetime.fromtimestamp(t2)-datetime.datetime.fromtimestamp(t1)).seconds-6
                        if(duration==30):
                            duration=tmp
                        else:
                            if(tmp>duration):
                                pass
                            else:
                                duration=tmp
                        status=True
                        touch(Template(r"tpl1602912825170.png", record_pos=(0.001, 0.09), resolution=(1560, 720)))
                    
                if(not status):
                    #开始
                    time.sleep(3)
                else:
                    #结束
                    time.sleep(3)
                    break
    
    nstatus=False
    #传入的数字代表刷副本的次数 gen(
    2,nstatus) time.sleep(5)

     升级版2020-11-10

    from airtest.core.api import *
    import time
    import datetime
    import logging
    logging.basicConfig(level=None)
    
    init_device("Android")
    
    #传入的数字代表刷副本的次数
    times=17
    duration=30
    for i in range(0,times):
        print(i+1)
        print(duration,"*"*20)
        sleep(5)
        while(1):
            #点击挑战按钮
            if(exists(Template(r"tpl1604980109297.png", record_pos=(0.331, 0.173), resolution=(1560, 720)))):
                touch(Template(r"tpl1604980109297.png", record_pos=(0.331, 0.173), resolution=(1560, 720)))
                t1=time.time()
                sleep(duration)
    
            #点击返回图片
            if(exists(Template(r"tpl1604980219758.png", record_pos=(0.005, 0.092), resolution=(1560, 720)))):
                t2=time.time()
                tmp=(datetime.datetime.fromtimestamp(t2)-datetime.datetime.fromtimestamp(t1)).seconds-6
                if(duration==30):
                    duration=tmp
                else:
                    if(tmp>duration):
                        pass
                    else:
                        duration=tmp
                
                #确认已经返回到副本首页
                while(1):
                    if(exists(Template(r"tpl1604980109297.png", record_pos=(0.331, 0.173), resolution=(1560, 720)))):
                        break
                    else:
                        if(exists(Template(r"tpl1604980219758.png", record_pos=(0.005, 0.092), resolution=(1560, 720)))):
                            touch(Template(r"tpl1604980219758.png", record_pos=(0.005, 0.092), resolution=(1560, 720)))
                    sleep(3)
                break
            sleep(3)
    sleep(5)

  • 相关阅读:
    酷商城新闻客户端源码
    一款类似塔防类的保卫羊村游戏android源码
    躲避球游戏ios源码
    卡通投掷游戏ios源码
    爱拼图游戏源码完整版
    newsstand杂志阅读应用源码ipad版
    linux下proxy设定的一般方法
    android中调用App市场对自身App评分
    Android AChartEngine
    设计模式之单例模式
  • 原文地址:https://www.cnblogs.com/sea-stream/p/13851701.html
Copyright © 2020-2023  润新知