zoukankan      html  css  js  c++  java
  • 自动刷御魂以及觉醒副本

    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)

  • 相关阅读:
    C# -- HttpWebRequest 和 HttpWebResponse 的使用
    C# -- Lambda 表达式的使用
    ASP.NET -- WebForm -- HttpRequest类的方法和属性
    ASP.NET -- WebForm -- HttpResponse 类的方法和属性
    C# -- 索引器、枚举类型
    C#设计模式之七桥接模式(Bridge Pattern)【结构型】
    C#设计模式之六适配器模式(Adapter Pattern)【结构型】
    C#设计模式之五原型模式(Prototype Pattern)【创建型】
    C#设计模式之四建造者模式(Builder Pattern)【创建型】
    C#设计模式之三抽象工厂模式(AbstractFactory)【创建型】
  • 原文地址:https://www.cnblogs.com/sea-stream/p/13851701.html
Copyright © 2011-2022 走看看