最近一直在研究Auto.js 就顺手写了个脚本,就是各种帮你玩日常小游戏,能薅一点是一点!

来个最直接的方式,百度云下载地址 链接:https://pan.baidu.com/s/1jradOvFF9-z53ycNaUd8MQ 密码:r8rh
说下APP使用方法,蚂蚁森林,主要在支付宝首页有蚂蚁森林入口,如果没有,点击更多去添加
代码完全开元,需要参考请拿走!
Github地址:https://github.com/MasterSumCloud/YangmaoHelper
提BUG群:567679111
最新版请到群里下载,最新支持蚂蚁庄园的一些小游戏,努力更新中!
下面就直接附上代码啦:代码已经更新:更新日期12月22日(暂时不会有什么大更新了,基本稳定了)
如果不是最新请移至Github获取最新完整代码

let deviceWidth = device.width;
let deviceHeight = device.height;function startAntForest(playFarm, getAliScore) {//进入支付宝launch("com.eg.android.AlipayGphone");sleep(1000);let witeInHome = 5;while (witeInHome > 0) {let inHome = id("tab_description").text("首页").findOnce();if (inHome == null) {sleep(1000);witeInHome--;} else {witeInHome = -10;}}//是否需要领取积分getNeedGetAliScore(getAliScore);//判断是否已经在游戏界面let gamePartHome = id("J_af_home").findOnce();if (witeInHome != -10 && gamePartHome == null) {toastLog("不在支付宝首页,也不在游戏界面!退出");exit();}//在首页寻找 蚂蚁深林和蚂蚁庄园的入口let antForest = id("app_text").textContains("蚂蚁森林").findOnce();if (antForest != null || gamePartHome != null) {//在蚂蚁森林if (gamePartHome == null) {//进入蚂蚁深林toastLog("进入蚂蚁深林");click(antForest.bounds().centerX(), antForest.bounds().centerY());sleep(5000);}toastLog("查询是否有能量可以收集");collectEnergy();//滑动半个屏幕swipe(deviceWidth / 2, deviceHeight * 0.8, deviceWidth / 2, deviceHeight * 0.2, 1000);//寻找定位点let weekTop = className("android.view.View").textContains("周排行榜").findOnce();if (weekTop != null) {weekTop.click();swipe(deviceWidth / 2, weekTop.bounds().top, deviceWidth / 2, 0, 1000);}toastLog("开始寻找偷能量");// seekToSteal(true);//去全部页面let seekMore = className("android.view.View").textContains("查看更多好友").findOnce();if (seekMore != null) {seekMore.click();sleep(3000);//判断是否还有更多let screen = getScreenImg();let noMore = images.read("./res/no_more.png");let hasMore = images.matchTemplate(screen, noMore, { threshold: 0.8, region: [deviceWidth / 3, deviceHeight - 150], max: 1 }).matches.length == 0;console.log("是否有更多", hasMore);let maxSearchTime = 32;//最大限制次数let handImg = images.read("./res/ghand.png");while (hasMore && maxSearchTime > 0) {let finded = getCanStealfriend(handImg);if (finded != null && finded.length > 0) {finded.forEach(item => {console.log("找到的点", item);stealAndBack(item);});}sleep(1000);swipe(deviceWidth / 2, deviceHeight * 0.8, deviceWidth / 2, deviceHeight * 0.1, 1000);if (maxSearchTime < 27) {//前5次不判断是否到底部let screen2 = getScreenImg();hasMore = images.matchTemplate(screen2, noMore, { threshold: 0.8, region: [deviceWidth / 3, deviceHeight - 150], max: 1 }).matches.length == 0;if (!hasMore) {toastLog("已经没有更多了")break;}}maxSearchTime--;}//回收资源handImg.recycle();noMore.recycle();}if (playFarm) {//返回一级back();sleep(1000);//滑动到顶部swipe(deviceWidth / 2, deviceHeight * 0.1, deviceWidth / 2, deviceHeight * 0.8, 1000);swipe(deviceWidth / 2, deviceHeight * 0.1, deviceWidth / 2, deviceHeight * 0.8, 1000);let antFf = id("J_antfarm_container").text("蚂蚁庄园").findOnce();if (antFf) {antFf.click();let antFramGame = require("./antFarm.js")antFramGame();}}back();sleep(500);back();sleep(500);back();sleep(500);toastLog("完成了");} else {toastLog("不在游戏界面,也不再主界面,结束");exit();}}function seekToSteal(simple) {if (simple) {let canSteal = className("android.widget.Button").textContains("可收取").findOnce() != null;while (canSteal) {stealAndBack(canSteal);//继续寻找let canStealItem = className("android.widget.Button").textContains("可收取").findOnce();if (canStealItem != null) {canStealItem.click();} else {canSteal = false;break;}}} else {let finded = getCanStealfriend();if (finded != null && finded.length > 0) {finded.forEach(item => {stealAndBack(item);});}}
}function stealAndBack(item) {click(deviceWidth / 2, item.point.y + 10);sleep(3000);//判断进入了游戏布局 否则不返回let gameV = id("J_app_outter").findOnce();if (gameV != null) {//开始偷collectEnergy();back();sleep(1000);}
}function collectEnergy() {let hasSelfPower = className("android.widget.Button").textContains("收集能量").findOnce() != null;while (hasSelfPower) {toastLog("开始收集");let collectSelf = className("android.widget.Button").textContains("收集能量").findOnce();if (collectSelf != null) {click(collectSelf.bounds().centerX(), collectSelf.bounds().centerY());sleep(300);} else {toastLog("采集完毕");hasSelfPower = false;break;}}
}/*** 从排行榜 找到可以收取能量的*/
function getCanStealfriend(handImg) {let img = getScreenImg();let pList = images.matchTemplate(img, handImg, { threshold: 0.8, region: [deviceWidth * 0.9, deviceHeight * 0.16], max: 9 });if (pList != null) {console.log("找到的做标记", pList.matches);return pList.matches;}
}/*** 获取屏幕图片*/
function getScreenImg() {let screenPic = captureScreen();console.log(screenPic);sleep(100);if (screenPic == null || typeof (screenPic) == "undifined") {toastLog("截图失败,退出脚本");exit();} else {return screenPic;}
}function getNeedGetAliScore(need) {//如果需要领取积分if (need) {let inMine = id("tab_description").text("我的").findOnce();click(inMine.bounds().centerX(), inMine.bounds().centerY());sleep(1000);//判断当前有没有积分可以领取let hasScore = textContains("个积分待领取").findOnce();if (hasScore != null) {let backCount = 0;let memeberAli = id("item_left_text").text("支付宝会员").findOnce();if (memeberAli != null) {click(memeberAli.bounds().centerX(), memeberAli.bounds().centerY());backCount++;sleep(2000);let getScoreV = className("android.view.View").text("领积分").findOnce();if (getScoreV != null) {click(getScoreV.bounds().centerX(), getScoreV.bounds().centerY());sleep(2000);backCount++;let clickGetScore = className("android.view.View").text("点击领取").findOnce();while (clickGetScore != null) {click(clickGetScore.bounds().centerX(), clickGetScore.bounds().centerY());sleep(300);clickGetScore = className("android.view.View").text("点击领取").findOnce();}}}for (let i = 0; i < backCount; i++) {back();sleep(500);}} else {toastLog("没有积分可领取")}let inHome = id("tab_description").text("首页").findOnce();click(inHome.bounds().centerX(), inHome.bounds().centerY());sleep(500);}
}
// collectEnergy();
module.exports = startAntForest;

最新请到Github下载;
还有其他功能正在完善中,有什么好的需要薅的,可以留言,人多妥妥的!!!

2020蚂蚁森林自动收能量-保持更新相关推荐

  1. 蚂蚁森林自动收能量的最新脚本

    环境必须是安卓7.0以上版本.中文界面. 安装软件,执行Auto.js代码.完成.注意自启动,锁定后台,无障碍服务,悬浮窗等权限允许. 注意需要把脚本和图片放到执行文件夹的同一目录下. 首先所有资料链 ...

  2. 苹果 python蚂蚁森林自动收能量_GitHub - dxp432/adb_python_alipay_AntForest: 蚂蚁森林自动收取能量、偷取能量、浇水(使用adb、python)...

    蚂蚁森林自动收取能量.偷取能量.浇水 蚂蚁森林自动收取能量.偷取能量.浇水(使用adb.python)adb_python_alipay_AntForest 涉及到的技术: 1.python 2.ad ...

  3. 苹果 python蚂蚁森林自动收能量_用Python实现定时自动化收取蚂蚁森林能量,再也不用担心忘记收取了...

    1. 概述 提到蚂蚁森林,大家应该都知道,你是否有因忘记收取能量而被好友收取的经历呢? 如果你不是蚂蚁森林重度用户,被别人收取了能量可能对你来说没什么. 但如果你是蚂蚁森林重度用户,遇到能量被偷 .. ...

  4. 好厉害!30 行代码实现蚂蚁森林自动收能量

    点击上方蓝色"终端研发部",选择"设为星标" 学最好的别人,做最好的我们 虽然我支付宝加了好多好友,平时有很多能量可以"偷",但由于太懒,至 ...

  5. 30 行代码实现蚂蚁森林自动收能量(附送源码)

    点击上方 IT牧场 ,选择 置顶或者星标技术干货每日送达! blog.csdn.net/article/details/113734855 推荐:https://www.xttblog.com/?p= ...

  6. 30 行Python代码实现蚂蚁森林自动收能量(附送源码)

    公众号 "菜鸟学Python", 设为 "星标" 带你一起学Python 编辑:业余草 blog.csdn.net/article/details/113734 ...

  7. 苹果 python蚂蚁森林自动收能量_Python自动化收取蚂蚁森林能量,不错过暗恋的她...

    作者 | 锅g头 来源 | Crossin的编程教室最近在家远程工作,结果作息更混乱了 ,早上起不来,导致我蚂蚁森林能量天天被偷,严重影响我沙漠造树"大业" .于是我决定用pyth ...

  8. 苹果 python蚂蚁森林自动收能量_通过测试工具自动收取蚂蚁森林能量

    本文仅为自动化工具appium的技术研究,请勿用于任何非正当用途 最近在家远程工作,结果作息更混乱了,早上起不来,导致我蚂蚁森林能量天天被偷,严重影响我沙漠造树"大业" ‍♂️.于 ...

  9. 苹果 python蚂蚁森林自动收能量_蚂蚁森林自动收取能量、偷取能量、浇水(使用adb、python)...

    涉及到的技术: 1.python 2.adb 具备的功能: 1.自动收取能量 2.自动偷取能量 3.自动给指定的朋友浇水 使用方法: 1.打开电脑,USB线一头接手机,一头接电脑. 2.电脑运行pyt ...

  10. Nexus 5X手机在支付宝的蚂蚁森林自动收能量的过程

    用其他手机,其他刷机包,都是可以的. 下载刷机包 https://downloads.aospextended.com/bullhead 个人觉得aospextended的rom比较省电,其他刷机包或 ...

最新文章

  1. 支付宝发布黑科技“如影计划”,这真的不是愚人节的玩笑
  2. NET(C#)连接各类数据库-集锦
  3. 鸿蒙系统手机用户体验,鸿蒙系统真的来了!用户体验流畅度远超安卓,任正非扳回一城!...
  4. nginx忽略文件名大小写
  5. 带文件卖面,老坛酸菜面重回超市货架!你会买账吗?京东、淘宝依然屏蔽
  6. 写了个项目 Web-Rtmp: 使用 WebSocket 在网页上播放 RTMP 直播流
  7. C#3 分部方法,简单标记一下
  8. http://www.spiceworks.com
  9. 供应商管理系统SRM
  10. 计算机能连上手机热点却无法连上无线网络,笔记本电脑win10系统无法连接手机热点,却能连上WiFi怎么办?...
  11. 在2016年,Linux是否还需要Windows的支持呢
  12. 解决Linux中Ubuntu16.04声音一直静音的方法
  13. GM7150,振芯科技,视频解码器,CVBS转BT656/601,QFN32,替换TVP5150/CJC5150
  14. R语言基于ARCH模型股价波动率建模
  15. 树莓派4B最新系统bullseye更换国内源方法
  16. fiddler抓包指南(浏览器、app抓包及证书安装)
  17. 如何让git commit更简洁
  18. fota 差分包_FOTA相关知识总结
  19. Smart Tomcat插件的使用详解
  20. 英利分布式:国内最高光伏空调3大亮点引关注

热门文章

  1. stm32f103c8t9控制TFT显示屏
  2. windows10使用administrator登录后出现“无法使用内置管理员账户打开应用”的解决方法
  3. MATLAB 手写签名拍照 转换黑白图片 方便插入文件签名
  4. Compose Modifier.swipeable() 写个侧拉组件
  5. C语言程序设计(2020)编程题答案——第14章结构体、共用体和用户定义类型
  6. JavaWeb-16 (E家园项目案例1)
  7. OkHttp3 (二)——请求
  8. 【Windows】windows10,11系统常用快捷键
  9. ps修改图片上文字的几种方法 图+文
  10. 天津美术学院2021级专升本新生报到前后相关要求