当前位置: 首页 > 后端技术 > Node.js

自动建造建筑,使用淘宝喵币!能够不自觉地坚决不去做,是程序员的基本素质!

时间:2023-04-03 22:34:07 Node.js

这几天,双十一的活动有没有让你觉得不舒服?如果没有,只有两种可能:一,你没有女朋友;二,你没有女朋友。二,你没有女性朋友。要知道阿里每年都会发大量的红包、各种优惠券、各种互助游戏……而这两天,马爸爸的“提款机”都沉迷于这些互助游戏。对自己的三个反思:登录?你完成任务了吗?你升级了吗?:一般我们程序员对这种游戏不是很感兴趣。毕竟每天都有找不完的BUG和加班加点,但是如果这个时候你的女神找你帮忙,那只是你水平够了吗?那么,这样一个在女神面前大展身手的时刻,程序员怎能错过呢?这不,今天猿娘在GitHub上发现有程序员写了一个小脚本,可以每天自动做任务,领取喵币。现在帮女神盖楼,再也不用担心水平低了:可见这个小脚本并没有引起程序员的注意,也没有获得一星(GitHub地址:https://github.com/sleepybear。。。)其实这个脚本并不难。它是基于auto.js框架实现的。auto.js是Android平台上支持无障碍服务的JavaScriptIDE。基于控件,可以自动运行一些操作,实现悬浮窗。录制并运行。所以这个脚本只支持安卓系统。详细的脚本代码如下:letdeviceWidth=device.width;letdeviceHeight=device.height;functionopenBeginningBtnItem(delay){letitems=textStartsWith("gif;base64").depth(19).find();console.log("寻找--灵喵币");如果(items.length>0){让item=items[items.length-1];console.log("点击--灵喵币");点击项目中心(项目);睡眠(延迟);返回1;}return-1;}functionisOpenBeginning(){letsignIn=textContains("登录").findOnce();if(signIn!=null){console.log("Success--Return1;}return-1;}functionensureOpenBeginning(waitDelay){if(isOpenBeginning()===-1){openBeginningBtnItem(waitDelay);}if(isOpenBeginning()===1)return1;console.error("失败--开启理赔中心");toast("失败--开启理赔中心");return-1;}functionclickItemInCenter(item,time){if(time==null)time=50;if(item==null)return;letx=item.bounds().centerX();lety=item.bounds}().centerY();press(x,y,time);}functiongoShopping(){letshopping=text("去浏览").findOne(1000);if(shopping==null){toastLog("结束--未知问题");返回-1;}console.log("开始浏览...");clickItemInCenter(购物);return1;}functionswipeUp(){让x=parseInt(deviceWidth/2);让持续时间=500;让y=[parseInt(deviceHeight*0.75),parseInt(deviceHeight*0.25)];滑动(x,y[0],x,y[1],持续时间);swipe(x,y[0],x,y[1],duration);}functionisFull(){for(leti=0;i<10;i++){if(descContains("已达到上限").findOnce()||textContains("已达到上限").findOnce()){console.log("今天已达到上限");返回1;}睡眠(1000);}return0}functionwaitSwipe(){让swipeAppear出现;让购物满满;for(leti=0;i<3;i++){swipeAppear=desc("滑动浏览").findOne(1000);如果(swipeAppear!=null)中断;shoppingFull=descContains("已达到上限").找到一个(1000);如果(shoppingFull!=null)返回0;console.log("i"+i);}睡眠(1000);if(swipeAppear!=null){console.log("开始滑动");向上滑动();console.log("等待15s");睡眠(1000*16);}else{console.log("慢");console.log("等待20s");睡眠(1000*20);}letshoppingFinish=desc("任务完成").findOne(2000);if(shoppingFinish!=null){console.log("购物完毕,准备退货");}else{toastLog("未知购物完毕,退货");}return1;}functionbrowseFinish(){for(leti=0;i<10;i++){letnormalFinishDesc=descContains("obtained").findOnce();让normalFinishText=textContains("获得").findOnce();letswipeFinish=desc("任务完成").findOnce();if(normalFinishDesc!=null||swipeFinish!=null||normalFinishText!=null){console.log("浏览结束");返回0;}睡眠(250);}console.log("浏览未知");返回-1;}functionjudgeWay(){让timeOut=1000*7;让延迟=250;letloops=parseInt(timeOut/delay);for(leti=0;i=2)中断;}如果(isSuccess===-1)中断;让st=waitSwipe();if(st===0){toastLog("已达到限制,结束脚本");返回0;}后退();睡眠(1000);}if(isSuccess===0){toastLog("正常结束");返回0;}elseif(isSuccess===-1){toastLog("异常结束");返回1;}}函数clickGoBrowse(){letbrowse=text("去浏览").findOne(1000);if(browse!=null){letguessYouLike=textContains("猜你喜欢").findOnce();if(guessYouLike!=null){console.log("似乎猜你喜欢");让pp=browse.parent.bounds().top;让ppp=guessYouLike.parent.parent.bounds().top;if(ppp===pp){console.log("跳过-猜你喜欢");letallBrowse=text("去浏览").find();for(leti=0;i=0){if(index===0){threads.start(function(){sleep(1000);runRun(n);});}elseif(index===1){clearNewScript();}elseif(index===2){alert("你在哪里下载旧应用,下载新应用,我不想发布");}}});}functionrunRun(n){sleep(500);让status=runGoBrowse();toastLog("转到浏览--浏览结束");alert("End");}functionmoveFloating(n){让i=-1;dialogs.confirm("请将悬浮窗移至左侧Keep。","点击确定表示完成,直接运行脚本。\n点击取消可手动调整。\n"+"(中间浏览过程中可能会跳转到淘宝首页浏览,此时需要再次手动切换回猫店。)",function(clear){if(clear){console.log("直接运行");i=1;}else{toastLog("请将悬浮窗向左移动");i=0;}});while(i===-1){sleepp(100);}if(i===1){runRun(n);}}functionrunChoose(n){letcurrentVersion=app.versionCode;if(currentVersion===1){warning(n);}else{moveFloating(n);}}module.exports=runChoose;不懂就直接下载使用,记得打开悬浮窗,然后切换到淘宝:可以实现如下效果:——结束—APK下载:1.扫描二维码关注“旁观者”qing”订阅号2.回复“apk”获取