You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
183 lines
6.8 KiB
183 lines
6.8 KiB
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
import { DPStarter, DPTask } from './lib/index';
|
|
import { clickForce, isNextElement, findPrevElement, withMakeSure, swipeToCenter, nextElement } from './lib/utils';
|
|
|
|
// 弹窗关闭按钮
|
|
const 弹窗关闭按钮 = className('com.lynx.tasm.behavior.ui.LynxFlattenUI')
|
|
.boundsInside(100, device.height / 2, device.width - 100, device.height)
|
|
.clickable(true)
|
|
.text('');
|
|
|
|
// 福利界面底部栏入口按钮
|
|
const 底部栏入口按钮 = id('di1').text('福利').visibleToUser();
|
|
|
|
class Hongguo extends DPStarter {
|
|
doInit() {
|
|
withMakeSure('打开红果', () => app.launch('com.phoenix.read'), {
|
|
hasModal: [
|
|
() => {
|
|
if (nextElement(弹窗关闭按钮, 'com.lynx.tasm.behavior.ui.LynxFlattenUI') === null) {
|
|
return 弹窗关闭按钮.findOne(500);
|
|
} else {
|
|
return null;
|
|
}
|
|
}
|
|
],
|
|
landOver: [() => 底部栏入口按钮.findOne(500)] // 确认是否到达目的页
|
|
});
|
|
clickForce(底部栏入口按钮.findOne(500));
|
|
}
|
|
doFinish() {
|
|
sleep(3000);
|
|
app.launch('org.autojs.autoxjs.v6');
|
|
}
|
|
}
|
|
|
|
const hongguo = new Hongguo();
|
|
|
|
const 新人见面礼task = new DPTask(hongguo, '新人见面礼');
|
|
// 新人见面礼立即领取
|
|
新人见面礼task.run((task) => {
|
|
swipe(device.width / 2, device.height * 0.2, device.width / 2, device.height * 0.9, 500);
|
|
swipe(device.width / 2, device.height * 0.2, device.width / 2, device.height * 0.9, 500);
|
|
const 额外福利 = className('com.lynx.tasm.behavior.ui.text.FlattenUIText').textContains('额外福利').visibleToUser();
|
|
const 开始立即领取 = findPrevElement(额外福利, 'com.lynx.tasm.behavior.ui.text.FlattenUIText');
|
|
const 弹窗里立即领取 = className('com.lynx.tasm.behavior.ui.text.FlattenUIText').text('立即领取').visibleToUser();
|
|
const 有金币奖励字样 = className('com.lynx.tasm.behavior.ui.text.FlattenUIText').text('金币奖励可在「福利」查看').visibleToUser();
|
|
const 明日再来 = className('com.lynx.tasm.behavior.ui.text.FlattenUIText').text('明日再来').visibleToUser();
|
|
|
|
const 确定有这个按钮 = withMakeSure(
|
|
'点击立即领取',
|
|
() => {
|
|
clickForce(开始立即领取);
|
|
return 开始立即领取;
|
|
},
|
|
{
|
|
landOver: [() => 弹窗关闭按钮.findOne(500), () => 有金币奖励字样.findOne(500)], // 确认是否到达目的页
|
|
retry: 2
|
|
}
|
|
);
|
|
|
|
if (确定有这个按钮) {
|
|
if (明日再来.findOne(500)) {
|
|
return clickForce(明日再来.findOne(500));
|
|
}
|
|
withMakeSure('弹窗里立即领取', () => clickForce(弹窗里立即领取.findOne(500)), {
|
|
landOver: [
|
|
() => 弹窗关闭按钮.findOne(500),
|
|
() => isNextElement(明日再来, 有金币奖励字样, 'com.lynx.tasm.behavior.ui.text.FlattenUIText')
|
|
] // 确认是否到达目的页
|
|
});
|
|
|
|
return clickForce(明日再来.findOne(500));
|
|
} else {
|
|
// 如果没有找到说明任务已经做了
|
|
task.log('新人任务已经做过了');
|
|
}
|
|
});
|
|
|
|
const 签到task = new DPTask(hongguo, '日常福利-签到');
|
|
签到task.run((task) => {
|
|
const 日常福利区域 = className('com.lynx.tasm.behavior.ui.text.FlattenUIText').text('日常福利').visibleToUser();
|
|
withMakeSure('确保在日常福利区域', () => 日常福利区域.findOne(500), {
|
|
landOver: [() => 日常福利区域.findOne(500)], // 确认是否到达目的页
|
|
auxAction: [
|
|
(makeSure) => {
|
|
// 如果有这个控件 直接划到可视区域
|
|
makeSure && swipe(makeSure.bounds().centerX(), makeSure.bounds().centerY(), makeSure.bounds().centerX(), 0, 500);
|
|
},
|
|
() => {
|
|
// 如果没有 滑到顶部
|
|
swipe(device.width / 2, device.height * 0.2, device.width / 2, device.height * 0.9, 500);
|
|
},
|
|
() => {
|
|
// 如果没有 往下滑动
|
|
swipe(device.width / 2, device.height * 0.7, device.width / 2, 0, 500);
|
|
}
|
|
]
|
|
});
|
|
|
|
const 签到Btn = className('com.lynx.tasm.behavior.ui.text.FlattenUIText').text('去签到').visibleToUser();
|
|
const 已签到 = className('com.lynx.tasm.behavior.ui.text.FlattenUIText').text('已签到').visibleToUser();
|
|
const 立即签到 = className('com.lynx.tasm.behavior.ui.text.FlattenUIText').textContains('立即签到').visibleToUser();
|
|
const 看视频再领 = className('com.lynx.tasm.behavior.ui.text.UIText').textContains('看视频最高再领').visibleToUser();
|
|
|
|
if (已签到.findOne(500)) {
|
|
task.log('签到任务已经做过了');
|
|
return;
|
|
}
|
|
withMakeSure('签到', () => clickForce(签到Btn.findOne(500)), {
|
|
landOver: [() => 弹窗关闭按钮.findOne(500)], // 确认是否到达目的页
|
|
retry: 2
|
|
});
|
|
|
|
clickForce(立即签到.findOne(1500));
|
|
|
|
clickForce(看视频再领.findOne(3000), false);
|
|
|
|
lookAD();
|
|
|
|
clickForce(弹窗关闭按钮.findOne(1500));
|
|
});
|
|
|
|
const 看广告视频task = new DPTask(hongguo, '看广告视频');
|
|
看广告视频task.run(() => {
|
|
const 日常福利区域 = className('com.lynx.tasm.behavior.ui.text.FlattenUIText').text('日常福利').visibleToUser();
|
|
withMakeSure('确保在日常福利区域', () => 日常福利区域.findOne(500), {
|
|
landOver: [() => 日常福利区域.findOne(500)], // 确认是否到达目的页
|
|
auxAction: [
|
|
(makeSure) => {
|
|
// 如果有这个控件 直接划到可视区域
|
|
makeSure && swipe(makeSure.bounds().centerX(), makeSure.bounds().centerY(), makeSure.bounds().centerX(), 0, 500);
|
|
},
|
|
() => {
|
|
// 如果没有 滑到顶部
|
|
swipe(device.width / 2, device.height * 0.2, device.width / 2, device.height * 0.9, 500);
|
|
},
|
|
() => {
|
|
// 如果没有 往下滑动
|
|
swipe(device.width / 2, device.height * 0.7, device.width / 2, 0, 500);
|
|
}
|
|
]
|
|
});
|
|
|
|
const 看视频立得 = className('com.lynx.tasm.behavior.ui.text.FlattenUIText').textContains('看视频立得').visibleToUser();
|
|
swipeToCenter(看视频立得.findOne(500)!);
|
|
const 立即领取 = findPrevElement(看视频立得, 'com.lynx.tasm.behavior.ui.text.FlattenUIText');
|
|
|
|
clickForce(立即领取);
|
|
lookAD();
|
|
});
|
|
|
|
function lookAD() {
|
|
//已经进入广告页面
|
|
const 领取成功 = className('com.lynx.tasm.behavior.ui.text.FlattenUIText').text('领取成功').visibleToUser();
|
|
const 再次领取奖励 = className('com.lynx.tasm.behavior.ui.text.FlattenUIText').text('领取奖励').visibleToUser();
|
|
sleep(3000);
|
|
let ok = false;
|
|
let times = 0;
|
|
while (!ok) {
|
|
if (times > 100) {
|
|
break;
|
|
}
|
|
ok = 领取成功.exists();
|
|
times % 2 === 1 && console.log('广告ing');
|
|
sleep(2000);
|
|
times++;
|
|
}
|
|
if (!ok) {
|
|
console.log('看广告失败');
|
|
return;
|
|
}
|
|
|
|
const bounds = 领取成功.findOne(500)!.bounds();
|
|
click(bounds.right + 5, bounds.top + 5);
|
|
sleep(1000);
|
|
if (再次领取奖励.exists()) {
|
|
clickForce(再次领取奖励.findOne(500), false);
|
|
console.log('看第二个广告再次领取奖励');
|
|
lookAD();
|
|
}
|
|
}
|
|
|
|
hongguo.start();
|
|
|