QQ穿越福城辅助线源码,autojs脚本引擎写的,免root权限运行

说明

本文提供的代码仅供参考。不建议用于生产环境。
可能有些地方在最新版本的Auto.js上面需要做修改,才能运行。

Auto.js简介

Auto.js是利用安卓系统的“辅助功能”实现类似于按键精灵一样,可以通过代码模拟一系列界面动作的辅助工作。
与“按键精灵”不同的是,它的模拟动作并不是简单的使用在界面定坐标点来实现,而是类似与win一般,找窗口句柄来实现的。

Auto.js使用JavaScript作为脚本语言,目前使用Rhino 1.7.7.2作为脚本引擎,支持ES5与部分ES6特性。

开发文档

Auto.js Pro开发文档
文档尚在完善中,可能有文档描述和代码实际行为有出入的情况。

为什么要使用Auto.js Pro开发脚本,有什么特点?

吸引我使用Auto.js Pro的原因有很多。最主要的几个原因是:

  • Auto.js Pro能开发免ROOT的安卓脚本
  • Auto.js Pro基于节点操作,能开发全分辨率的脚本,自动适配各种安卓机型
  • Auto.js Pro丰富的UI组件,能自定义各种样式的安卓界面
  • Auto.js Pro使用的javascript的语法比较优雅,代码可读性强
  • Auto.js Pro的命令库非常的丰富,接口比较多
  • Auto.js Pro脚本文件体积比较小。1000行的代码,打包后的apk文件只有3-5M,还没有广告

推荐教程

Auto.js Pro安卓全分辨率免ROOT引流脚本开发视频教程(HD超清1080p)

示例代码

/**
 *完成时间: 2019年1月27日 下午2:51:02
 *测试机型: meizu_M5 Note
 *Auto.js版本: 4.1.0 Alpha5
 *屏幕: 1080*1920
 *API: 24
 *备注: 暂无备注
 **/
//此代码由飞云脚本圈整理提供(www.feiyunjs.com)
var 绘布 = function(view) {
    if (view.accessibilityClassName != "android.widget.ImageView") {
        throw "我报错";
    };
    this.width = view.getWidth();
    this.height = view.getHeight();
    this.bitmap = android.graphics.Bitmap.createBitmap(this.width || 1, this.height || 1, android.graphics.Bitmap.Config.ARGB_8888);
    this.canvas = new android.graphics.Canvas(this.bitmap);
    this.matrix = new android.graphics.Matrix();
    threads.start(new java.lang.Runnable(() => {
        while (true) {
            if (view.getWidth() != this.width || view.getHeight() != this.height) {
                this.width = view.getWidth();
                this.height = view.getHeight();
                this.bitmap = android.graphics.Bitmap.createBitmap(this.width || 1, this.height || 1, android.graphics.Bitmap.Config.ARGB_8888);
                this.canvas = new android.graphics.Canvas(this.bitmap);
            };
            sleep(500);
        };
    }));
    this.Draw = function() {};
    this.setDraw = function(fun) {
        if (typeof fun == "function") {
            this.Draw = fun;
        };
    };
    setInterval(() => {
        try {
            this.bitmap.eraseColor(0);
            this.canvas.setMatrix(this.matrix);
            this.Draw(this.canvas);
            ui.run(() => {
                view.setImageBitmap(this.bitmap);
            });
        } catch (e) {
            toastLog(e);
        };
    }, 200);
};

var rainbowColor = [-65536, -23296, -256, -16711936, -16744449, -16776961, -7667457];;

importClass(android.graphics.Paint);
var csx = device.width / 1080;
var csy = device.height / 1920;
setInterval(() => {}, 250);
var window = floaty.rawWindow(
    <ImageView id="img"/>
);
window.setSize(-1, -1);
window.setTouchable(false);
var paint = new android.graphics.Paint;
paint.setStrokeWidth(2);
paint.setStyle(Paint.Style.STROKE);
paint.setColor(colors.GREEN);
//paint.setTextAlign(Paint.Align.CENTER); //写字左右中心

var size = 30;
paint.setTextSize(size);
var xy = {
    y: size
};

var ad = new 绘布(window.img);
ad.setDraw(function(canvas) {
    //生成(UiObject, canvas);
    var w = canvas.getWidth();
    var h = canvas.getHeight();
    var c = w / Math.sqrt(3);
    var s = c / 8;
    var y = 0;
    var cx = 0;
    var x = 0;
    paint.setColor(colors.GREEN);
    do {
        canvas.drawLine(w / 2 + x, 0, w / 2 + x, h, paint);
        canvas.drawLine(w / 2 - x, 0, w / 2 - x, h, paint);
        x += (w / 16);
    } while (x < w / 2);
    //paint.setColor(colors.GREEN);
    do {
        paint.setColor(rainbowColor[cx]);
        canvas.drawLine(0, y, w, y + c, paint);
        canvas.drawLine(w, y, 0, y + c, paint);
        y += s;
        cx++;
        if (cx >= rainbowColor.length) {
            cx = 0;
        };
    } while (y < h);

});

function getsd(s, ary) {
    var sum = weiyi(ary);
    var S = s / sum;
    for (var i = 0; i < ary.length; i++) {
        ary[i] = ary[i] * S;
    };
    return ary;
};

function weiyi(ary) {
    var sum = 0;
    for (var i = 0; i < ary.length; i++) {
        sum += Math.pow(ary[i], 2);
    };
    return Math.sqrt(sum);
};

function kdfx(Y) {
    var x = Math.cos(Y % 360 / 360 * 2 * Math.PI);
    var y = Math.sin(Y % 360 / 360 * 2 * Math.PI);
    return {
        x: x,
        y: y
    };
};


function 绘制(UiObject, canvas, x, C, D) {
    D = D || 0;
    if (UiObject) {
        //var r=UiObject.bounds();
        var r = UiObject.bounds();
        paint.setColor(rainbowColor[Math.floor(D % 7)]);
        paint.setStyle(Paint.Style.STROKE);
        canvas.drawRect(r, paint);
        paint.setStyle(Paint.Style.FILL);
        canvas.drawText(UiObject.className(), x, xy.y, paint);
        canvas.drawLine(r.left, r.top, x, xy.y, paint);
        xy.y += size;
        //paint.setStrokeWidth(3);
        //canvas.drawText(String(D), Math.floor(r.centerX()), r.centerY() + 0.365 * size, paint);
        if (UiObject.childCount() && ((!C && C != 0) || C > 0)) {
            for (var i = 0; i < UiObject.childCount(); i++) {
                arguments.callee(UiObject.child(i), canvas, x + size, C - 1, D + 1);
            };
        };
    };
};



function 生成(UiObject, canvas, C, D) {
    D = D || 0;
    if (UiObject) {
        var r = UiObject.bounds();
        paint.setColor(rainbowColor[Math.floor(D % 7)]);
        canvas.drawRect(r, paint);
        //paint.setStrokeWidth(3);
        //paint.setStyle(Paint.Style.FILL);
        //canvas.drawText(String(D), Math.floor(r.centerX()), r.centerY() + 0.365 * size, paint);
        // if (UiObject.childCount() && ((!C && C != 0) || C > 0)) {
        for (var i = 0; i < UiObject.childCount(); i++) {
            arguments.callee(UiObject.child(i), canvas, C - 1, D + 1);
        };
        // };
    };
};
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值