|
|
禁止求评分、诱导评分、互刷评分、互刷悬赏值,违规者封号处理。
禁止发布推广、邀请码、邀请链接、二维码或者有利益相关的任何推广行为。
所有非原创软件请发布在【精品软件区】,发帖必须按照本版块版规格式发帖。
论坛里有其他人发过 auto.js 版本,今天我来发一个 Lua 的。
软件是我公司开发的,名字叫 LuaBox,中文名【积木编程】。
代码很简单,逻辑呢大概就是先打开支付宝,然后查找蚂蚁森林的界面控件,找到了就点击,接着查找能量球界面控件,找到了继续点击,找不到就逛一逛,问题就是不能帮助别人收快过期的能量。
上源码:
- pkgname = app.getPackageName("支付宝")
- app.runApp(pkgname)
- mSleep(3000)
- while true do
- local collect = widget.find({["text"]="收集能量",["rule"]=2})
- if collect ~= nil then
- x1,y1,x2,y2 = widget.region( collect)
- if x1 ~= -1 then
- x = (x1+x2)/2
- y = (y1+y2)/2
- toast("点击能量")
- event.tap(x,y)
- mSleep(1000)
- end
- else
- local bag = widget.find({["text"]="背包",["path"]="/FrameLayout/LinearLayout/FrameLayout/FrameLayout/RelativeLayout/RelativeLayout/RelativeLayout/RelativeLayout/FrameLayout/WebView/ba/WebView/View/View/View/View/Button"})
- if bag ~= nil then
- x1,y1,x2,y2 = widget.region(bag)
- if x1 ~= -1 then
- x = x2 + 170
- y = y2 - 50
- toast("逛一逛")
- event.tap(x,y)
- mSleep(3000)
- end
- end
- local water = widget.find({["text"]="浇水",["path"]="/FrameLayout/LinearLayout/FrameLayout/FrameLayout/RelativeLayout/RelativeLayout/RelativeLayout/RelativeLayout/FrameLayout/WebView/ba/WebView/View/View/View/View/Button"})
- if water ~= nil then
- x1,y1,x2,y2 = widget.region(water)
- if x1 ~= -1 then
- x = x2 + 170
- y = y2 - 50
- toast("逛一逛")
- event.tap(x,y)
- mSleep(3000)
- end
- end
- end
- local forest = widget.find({["text"]="蚂蚁森林",["id"]="com.alipay.android.phone.openplatform:id/app_text"})
- if forest ~= nil then
- x,y,x1,y1 = widget.region(forest)
- if x ~= -1 then
- toast("点击蚂蚁森林")
- event.tap(x,y)
- mSleep(3000)
- end
- end
- end
复制代码
|
|