/*
软件作者:https://xuhss.com/oxox/pro
*/
/*
* @Author:攀登
* @Last Modified by: sqzhang
* @Last Modified time: 2019-03-04 02:23:31
* @Description:蚂蚁森林自动收
* @Auto.js Version: 4.1.0 Alpha5
* @Android Version: 安卓7及以上
*/
var screen_password = "9821";
//九宫格锁屏密码
var app_password = "9821";
//应用锁密码没有可以忽略
var local_set = storages.create("蚂蚁森林");//本地配置
//local_set.clear()//清空本地配置 取消注释可以不判断时间直接执行
if (local_set.get("蚂蚁森林") > new Date().getTime()){
exit()
}
//获取屏幕方向类型 1表示portrait(竖屏),2表示landscape(横屏)
if (context.getResources().getConfiguration().orientation == 2){
toastLog("支付宝有能量可以收取");
exit()
}
//停止除自身之外的其他auto.js脚本
stop_other_script()
//解锁手机 锁屏为九宫格
//若手机无锁屏密码 可注释本行代码
while (unlock());
//申请截图权限
if (!requestScreenCapture()) {
toastLog("请求截图失败,请重新运行");
exit();
}
var energy_now = 0;//当前能量
var lock_flag = 0;//锁屏标志
var friend_name;//好友名字对象
var swpe_phone;//滑动手机对象
var have_shielding = JSON.parse(local_set.get(" 有保护罩")||"{}");//保护罩名单
var shortest_time = 99;//最短时间
//启动检测最短时间线程
threads.start(function() {
events.observeToast();//监听toast消息
events.onToast(function(toast) {
var pkg = toast.getPackageName();
if (pkg == "com.eg.android.AlipayGphone") { //监听到支付宝发来的toast
let str = toast.getText()
if (str = str.match(/00:(\d+)后/ )) {
if (str[1] < shortest_time) {
shortest_time = str[1]
log("๋Ꭸᳵԅ", shortest_time)
}
}
}
});
})
//开始收取能量
while (1) {
sleep(200)
var img = captureScreen();
if ((images.findColorInRegion(img, "#108ee9", 40, 100, 100, 100, threshold = 25) && images.detectsColor(img, "#ffffffff", 10, 100, threshold = 66, algorithm = "diff")) || text("好友排行榜".idEndsWith("h5_tv_title").findOnce())
{
//log("好友排行榜")
let a = 460
for (a = 460; a < 1000; a += random(10, 50)) {
if (!images.detectsColor(img, "#ffffffff", 170, a, threshold = 66,
algorithm = "diff")) {
a = 460
break
}
}
if (a > 900) {
toastLog("好友列表载入中")
if (desc("ٚ再试一次").findOnce()) back()
sleep(3000)
continue
}
find_more().open()
let status = 0
let hand = find_hand()
for (let a = 0; a < hand.length; a++) {
find_more().close()
let name = (control_first([240, hand[a].y, 1008, hand[a].y + 200], depth(13)))
if (name) {
name = name.desc().replace(/\s/gi, "")
}
log(name, have_shielding[name + "的蚂蚁森林"])
if (!have_shielding[name + "的蚂蚁森林"] || have_shielding[name + "的蚂蚁森林"] - (-1000 * 60 * 60) < new Date().getTime()) {
local_set.remove(name + "的蚂蚁森林")
click(hand[0].x - 100, hand[0].y + 50)
sleep(1000)
status = 1
break
} else {
toastLog(name + " 有保护罩" )
}
}
if (status) continue;
var img = captureScreen();
if (images.findColorInRegion(img, "#30bf6c", 842, 600, 10, 600, threshold = 25)) {
log("没有了")
let last_energy = descEndsWith("’").find()
for (let a = 0; a < last_energy.length; a++) {
let b = last_energy[a].desc().match(/\d+/)
if (b && shortest_time > b[0]) {
shortest_time = b[0]
}
}
back()
if (shortest_time == 1) {
toastLog("还剩"+ shortest_time + "分钟有能量")
local_set.put("蚂蚁森林", 5 * 60 * 1000 + new Date().getTime())
} else {
sleep(1000)
let energy_g = depth(15).descEndsWith("g").findOnce()
if (energy_g) energy_g = energy_g.desc().match(/\d+/)[0] - energy_now
toastLog(" + "本次共收取到" + energy_g + "g能量\n等待" + shortest_time )+ "分钟会有能量"
toastLog(" + "本次共收取到" + energy_g + "g能量\n等待" + shortest_time )+ "分钟会有能量"
toastLog(" + "本次共收取到" + energy_g + "g能量\n等待" + shortest_time )+ "分钟会有能量"
local_set.put("蚂蚁森林", shortest_time * 60 * 1000 + new Date().getTime())
if (lock_flag) Power()
exit()
}
shortest_time = 99
sleep(1000)
} else {
swipe(500, 1688, 565, 248, 100)
}
sleep(20)
continue
} else {
find_more().close()
}
if (friend_name = textEndsWith("蚂蚁森林").findOnce()) {
log("进入", friend_name.text())
if (control_first([], desc("地图"))) {
var energy_shielding = images.findColorInRegion(img, "#ffc3fb58", 429, 345, 651 - 429, 23, threshold = 20)
if (energy_shielding) {
have_shielding[friend_name.text().replace(/\s/gi, "")] = new Date().getTime()
local_set.put("蚂蚁森林",JSON.stringify(have_shielding))
toastLog(friend_name.text() + "有保护罩啊你")
back()
sleep(500)
} else {
collect_energy()
collect_energy(1)
}
}
sleep(1000)
} else if (text("蚂蚁森林").idEndsWith("h5_tv_title").findOnce()) {
if (control_first([627, 166, 1080, 1001], desc("地图"))) {
if (!energy_now) {
energy_now = depth(15).descEndsWith("g").findOnce()
if (energy_now) energy_now = energy_now.desc().match(/\d+/)[0]
}
collect_energy()
collect_energy()
if (control_first(desc("查看更多好友"), 1)) {
sleep(1000)
continue
}
swpe_phone = scrollable(true).findOnce()
if (swpe_phone) {
swpe_phone.scrollForward()
sleep(300)
swpe_phone.scrollForward()
sleep(300)
swpe_phone.scrollForward()
sleep(300)
swpe_phone.scrollForward()
sleep(300)
swpe_phone.scrollForward()
}
control_first([], desc("查看更多好友"), 2)
sleep(1000)
} else {
swpe_phone = scrollable(true).findOnce()
if (swpe_phone) {
swpe_phone.scrollBackward() //下滑()
sleep(300)
swpe_phone.scrollBackward()
sleep(300)
swpe_phone.scrollBackward()
}
}
} else if (unlock()) {
sleep(100)
} else {
star_alipay()
sleep(1000)
}
}
//停止其他脚本
function stop_other_script() {
var now_script = engines.myEngine()
log(now_script + "")
var runing_script = engines.all();
log("正在运行的脚本有", runing_script.length, "个")
for (var i = 0; i < runing_script.length; i++) {
if (runing_script[i].toString() != now_script.toString()) {
log("停止脚本", runing_script[i].toString());
runing_script[i].forceStop();
}
}
}
//解锁
没有合适的资源?快使用搜索试试~ 我知道了~
AutoJs源码-能量。本资源购买前提醒:本源码都是实际autojs项目模板,安装好autojs直接运行即可打开。1、支持低版本autojs。2、资源仅供学习与参考,请勿用于商业用途,否则产生的一切后果将由您自己承担!。3、安装过程详见具体资源,不会使用autojs谨慎下载
资源推荐
资源详情
资源评论
收起资源包目录
AutoJs源码-能量.7z (1个子文件)
AutoJs源码-能量.js 15KB
共 1 条
- 1
资源评论
[虚幻私塾】
- 粉丝: 333
- 资源: 1559
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功