找回密码
 立即注册
查看: 327|回复: 1

[脚本工具] Autojs6-道聚城自动签到任务脚本

[复制链接]
发表于 2023-12-25 13:57:23 | 显示全部楼层 |阅读模式

用于TX道聚城自动签到及自动完成任务领豆。
分辨率2340*1080可直接使用。

[JavaScript] 纯文本查看 复制代码
"auto" //系统配置初始化auto.waitFor();sleep(3000);
wakeup()
unlock()
device.setBrightnessMode(0);
device.setBrightness(1);
device.setMusicVolume(0);
clearrecents()
//floatyPermission(); 
let state = false; //是否执行成功状态
const verCode = app.versionCode;
const verName = app.versionName;
const kx = device.width / 1080; //横坐标比例系数
const ky = device.height / 2340; //纵比例系数
let backX = 83 * kx; //左上角返回按钮的横坐标
let backY = 185 * ky; //左上角返回按钮的纵坐标
let gotY = false; //是否已获取新的backY
let step=1500;
sleep(1000);
console.show();
sleep(500);
console.setSize(800, 500);
sleep(500);
console.setPosition(0, 1400);
console.hide();
DJC()
home();
sleep(1000);
clearrecents()
sleep(1000);
lock()
engines.stopAllAndToast();  
//道聚城签到
function DJC()
{
     
launch("com.tencent.djcity");
waitForPackage("com.tencent.djcity");
 
text("首页").untilFind();
log("道聚城启动完必");
sleep(5000);
desc("签到成功").findOne(5000);
 
var signinok=className("android.view.View").desc("好的").findOne(2000)
if(signinok!=null)
{
click(signinok.bounds().centerX(), signinok.bounds().centerY());
}
sleep(2000);
click(546,1320);
sleep(2000);
back();
sleep(2000);
 
var libao=className("android.view.View").desc("礼包中心").findOne(1000);
if(libao!=null)
{
click(libao.bounds().centerX(), libao.bounds().centerY());
log("点击礼包中心");
}
sleep(5000);
var shouyou=className("android.view.View").desc("手游").findOne(3000);
if(shouyou!=null)
{
click(shouyou.bounds().centerX(), shouyou.bounds().centerY());
log("点击手游");
}
sleep(3000);
click(540,932)
sleep(2000);
click(906,1046);
sleep(2000);
click(220,1451);
sleep(1000);
click(713,1332);
sleep(2000);
djbackhome()
sleep(1000);
click(116,189)
 
sleep(2000);
 
sml_move(540, step, 540, 900, 200);
sleep(2000);
click(526,1568);
sleep(2000);
djautorw()
 
djgetjl()
sleep(2000);
djopenbox()
sleep(1000);
}
 
function djgetjl()
{
    let i = 0;
    while(i<6)
    {
        var LJL=className("android.view.View").desc("领取奖励").findOne(1000);
        if(LJL!=null)
        {
               click(LJL.bounds().centerX(), LJL.bounds().centerY());
               sleep(2000);
               click(538,1521);
               sleep(2000);
                   
                     
          
        }
        else
        {
            log("已无奖励退出");
            break;
        }
   }
}
 
//自动完成道聚城任务
function djautorw()
{
   
      for(let i = 1; i< 5; i++)
    {
        var gojoin=className("android.view.View").desc("去参与").findOne(2000);
        if(gojoin!=null)
        {
            click(gojoin.bounds().centerX(), gojoin.bounds().centerY());
 
            sleep(5000);
            back();
            sleep(1000);
        }
        else
        {
            log("参与任务已结束");
            break;
         }
     }
 
sleep(1000);
 
var gotolook=className("android.view.View").desc("去浏览").findOne(2000);
if (gotolook!=null)
{
    click(gotolook.bounds().centerX(), gotolook.bounds().centerY());
sleep(2000);
click(516,900)
sleep(6000);
back();
sleep(2000);
click(554,1804)
sleep(6000);
back();
sleep(2000);
 
scrollForward()
 
sleep(2000);
click(516,800)
sleep(6000);
back();
sleep(2000);
click(554,1645)
sleep(6000);
back();
sleep(500);
back();
sleep(2000);
}
}
 
 
//打开宝箱
function djopenbox()
{
var openboxed=className("android.view.View").desc("打开宝箱").findOne(2000);
 
    if (openboxed!=null)
    {
    click(829,580)
sleep(2000);
click(538,1521);
sleep(2000);
click(829,580)
sleep(2000);
click(538,1521);
sleep(500);
}
}
 
 
//道聚城返回主页面
function djbackhome()
{
    log("检测是否在主界面");
    for(let i = 1; i< 11; i++)
    {
        var homepage=text("首页").findOne(2000);
        if(homepage!=null)
        {
            log("已在主界面");
            break;
        }
        else if(i==10)
        {
            log("返回主界面失败退出");
            exit();
        }
        else
        {
            back();
            log("正在返回主界面中...");
            sleep(1000);
         }
     }
}
 
 
//仿真曲线滑动
function bezier_curves(cp, t) {
    cx = 3.0 * (cp[1].x - cp[0].x); 
    bx = 3.0 * (cp[2].x - cp[1].x) - cx; 
    ax = cp[3].x - cp[0].x - cx - bx; 
    cy = 3.0 * (cp[1].y - cp[0].y); 
    by = 3.0 * (cp[2].y - cp[1].y) - cy; 
    ay = cp[3].y - cp[0].y - cy - by; 
     
    tSquared = t * t; 
    tCubed = tSquared * t; 
    result = {
        "x": 0,
        "y": 0
    };
    result.x = (ax * tCubed) + (bx * tSquared) + (cx * t) + cp[0].x; 
    result.y = (ay * tCubed) + (by * tSquared) + (cy * t) + cp[0].y; 
    return result; 
};
 
//仿真随机带曲线滑动  
//qx, qy, zx, zy, time 代表起点x,起点y,终点x,终点y,过程耗时单位毫秒
function sml_move(qx, qy, zx, zy, time) {
    var xxy = [time];
    var point = [];
    var dx0 = {
        "x": qx,
        "y": qy
    };
 
    var dx1 = {
        "x": random(qx - 100, qx + 100),
        "y": random(qy , qy + 50)
    };
    var dx2 = {
        "x": random(zx - 100, zx + 100),
        "y": random(zy , zy + 50),
    };
    var dx3 = {
        "x": zx,
        "y": zy
    };
    for (var i = 0; i < 4; i++) {
 
        eval("point.push(dx" + i + ")");
 
    };
    //log(point[3].x)
 
    for (let i = 0; i < 1; i += 0.08) {
        xxyy = [parseInt(bezier_curves(point, i).x), parseInt(bezier_curves(point, i).y)]
 
        xxy.push(xxyy);
 
    }
 
    //log(xxy);
    gesture.apply(null, xxy);
};
 
 
//清理后台
function clearrecents()
{
    recents()
sleep(1000);
var clearbox=id("clearbox").findOne(1000);
if (clearbox!=null)
{
    click(clearbox.bounds().centerX(), clearbox.bounds().centerY());
    sleep(1000);
    home();
 } 
else
{
    home();
}
}
function lock()
{
    var lockscreen=className("android.widget.TextView").desc("一键锁屏,应用在托盘上").findOne(1000);
    if (lockscreen!=null)
    {
        click(lockscreen.bounds().centerX(), lockscreen.bounds().centerY());
        sleep(1000);
    }
}
 
//关闭屏幕
function closescreen() 
{
    var w = floaty.rawWindow(
    <frame gravity="center" bg="#000000"/>
    );
    w.setSize(device.width,device.height);
    w.setPosition(0, -60);
    w.setTouchable(false);
    //保持脚本运行
    setInterval(()=>{}, 1000);
}
 
 
//唤醒屏幕
function wakeup()
{
    for(let i = 1;i<11;i++)
    {
        if (!device.isScreenOn())
        {
            device.wakeUp() // 唤醒设备 
            log("亮屏"+i+"次");
            sleep(1000);
        }
        else if(i==10)
        {
            log("亮屏失败退出");
            exit();
        }
        else
        {
            log("已亮屏");
            device.keepScreenOn(1200*1000); // 保持亮屏
            break;
        }
    }
}
//判断是否有屏幕锁
function isDeviceLocked() 
{
  importClass(android.app.KeyguardManager);
  importClass(android.content.Context);
  var km = context.getSystemService(Context.KEYGUARD_SERVICE);
  return km.isKeyguardLocked();
}
 // 输入密码
function password_input()
{
    var password = "******"
    for(var i = 0; i < password.length; i++)
    {
         
        var p = text(password[i].toString()).findOne(1000)
        longClick(p.centerX(), p.centerY());
        sleep(100);
    }
    log("解锁成功");
}
//解锁屏幕
function unlock()
{
    for(let l=1;l<6;l++)
    {
        if(isDeviceLocked())
        {
            sml_move(540,1800,600,1000,500);
            log("滑动屏幕"+l+"次");
            var mima=text("输入密码").findOne(2000);
            if(mima!=null)
            {
                log("输入密码");
                password_input();
                break;
            }
        }
        else if(l==5)
        {
            log("解锁失败退出");
            exit();
        }
        else
        {
            log("无需解锁");
            break;
        }
    }
}





上一篇:python抖音批量无水印解析下载工具
下一篇:赛博灯泡一键关闭软件
回复

使用道具 举报

发表于 2024-4-28 07:13:21 | 显示全部楼层
66666666666666
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|27CaT资源论坛

GMT+8, 2024-11-24 02:25

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表