Skip to content

Commit

Permalink
1111-G
Browse files Browse the repository at this point in the history
  • Loading branch information
MonsterNone authored Oct 25, 2023
1 parent 0c3a12c commit ed2557b
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 88 deletions.
68 changes: 31 additions & 37 deletions jd_hb.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const VERSION = '20231111-E'
const VERSION = '20231111-G'

if (!auto.service) {
toast('无障碍服务未启动!退出!')
Expand Down Expand Up @@ -130,7 +130,7 @@ function openTaskList() {
console.log('点击打开任务列表1')
let tmp = anchor.parent().parent()
tmp.child(tmp.childCount() - 1).click()
}
}

anchor = text('立即领取').findOne(10000)
if (!anchor) {
Expand Down Expand Up @@ -180,6 +180,8 @@ function reopenTaskList() {
anchor.child(1).click()
sleep(1000)

gesture(5000, [500, device.height - 200], [300, device.height - 500], [500, device.height - 200], [300, device.height - 500], [500, device.height - 500], [300, device.height - 200], [500, device.height - 500], [300, device.height - 200])

console.log('重新打开任务列表')
anchor = text('去领取').findOne(5000)
console.log('点击打开任务列表')
Expand Down Expand Up @@ -247,47 +249,39 @@ try {
openTaskList()
console.log('任务列表已打开,开始任务')

while (true) {
const tasks = findTimeout(textMatches(/|/), 5000)
if (!tasks) {
console.log('未找到任务')
break
}
let task
for (let i of tasks) {
if (i.text() == '已完成') continue
task = i
const tasks = findTimeout(textMatches(/|/), 5000)
if (!tasks) {
console.log('未找到任务,退出')
quit()
}
for (let task of tasks) {
if (task.text() == '已完成') continue
console.log(task)

// press(task.bounds().centerX(), task.bounds().centerY(), 1500)
console.log('尝试进入任务')
task.click()
sleep(3000)
// 根据任务列表存在情况判断
let flag = 0
let count = 0
if (textContains('打卡领').exists()) {
console.log('尝试进入任2')
task.click()
sleep(3000)
}
// console.log(task)
if (!task) {
console.log('任务已经全部完成')
break
if (textContains('打卡领').exists()) {
console.log('助手判断未能进入任务,退出')
// console.log('京东')
quit()
}
sleep(3000)
click(task.bounds().centerX(), task.bounds().centerY())
// task.click()
// // 根据任务列表存在情况判断
// let flag = 0
// let count = 0
// while (textContains('打卡领').exists()) {
// if (count > 20) { // 0.5*20= 10
// flag = 1
// break
// }
// sleep(500)
// count++
// }
// if (flag) {
// console.log('助手判断未能进入任务,退出')
// quit()
// }
console.log('由于任务标识为纯图片,无法判断情况,等待12秒后自动返回')
console.log('已进入。由于任务标识为纯图片,无法判断情况,等待12秒后自动返回')
sleep(12000)
console.log('完成,返回')
backToList()
reopenTaskList()
// reopenTaskList()
}
console.log('执行完成,退出')
console.log('任务已经全部完成,退出')
} catch (err) {
device.cancelKeepingAwake()
if (err.toString() != 'JavaException: com.stardust.autojs.runtime.exception.ScriptInterruptedException: null') {
Expand Down
6 changes: 3 additions & 3 deletions start.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const VERSION = '20231111-F'
const VERSION = '20231111-G'

if (!auto.service) {
toast('无障碍服务未启动!退出!')
Expand Down Expand Up @@ -153,7 +153,7 @@ try {
sleep(8000)
return findTask()
}
if (!(taskName.match(/|||||||||88||||||||||||穿||||||||||||||/) || content.match(/|/))) {
if (!(taskName.match(/||||||||||88||||||||||||穿||||||||||||||||/) || content.match(/|/))) {
return [taskName, jumpButtons[i], content]
}
}
Expand Down Expand Up @@ -299,7 +299,7 @@ try {
if (autoOpen) {
// 打开淘宝活动页面
console.log('正在打开淘宝...')
var url = 'pages.tmall.com/wow/z/hdwk/d11fy24/singleplayer?disableNav=YES&qd_from=tbsybutton'
var url = 'pages.tmall.com/wow/z/hdwk/d11fy24/singleplayer?disableNav=YES&qd_from=tbsyicon'

app.startActivity({
action: "VIEW",
Expand Down
100 changes: 53 additions & 47 deletions tb_huichang.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const VERSION = '20231111-F'
const VERSION = '20231111-G'

if (!auto.service) {
toast('无障碍服务未启动!退出!')
Expand Down Expand Up @@ -123,37 +123,42 @@ try {
} else {
throw '无法找到任务列表入口'
}
if (!textContains('O1CN01stVIJt1VSfFvIXWtd').findOne(8000)) {
console.log('默认方式打开失败,二次尝试')
console.log('首先检测弹窗')
try {
let anchor = textContains('O1CN010Zax611FU0Z5m6nnQ').findOne(5000)
anchor.parent().click()
sleep(2000)
console.log('领红包弹窗已关闭')
} catch (err) {
console.log(err)
console.log('领红包弹窗关闭失败。此问题不影响运行')
}
try {
idContains('CLOSE').findOnce().click()
sleep(1000)
} catch (err) {
console.log(err)
console.log('其他弹窗关闭失败。此问题不影响运行')
}
console.log('出现未能自动关闭的弹窗请手动关闭')
sleep(2000)
// let right = c.bounds().right
// let left = c.bounds().left
// let top = c.bounds().top
// let bottom = c.bounds().bottom
// click(random(right,left), random(top, bottom))
click(c.bounds().centerX(), c.bounds().centerY())
console.log('已点击,等待任务列表出现')
if (!textContains('O1CN01stVIJt1VSfFvIXWtd').findOne(8000)) {
throw '无法打开任务列表'
}
if (textContains('浏览商品领能量值').findOne(2000)) {
console.log('关闭弹窗')
idContains('CLOSE').findOnce().click()
sleep(1000)
c.click()
}
// if (!textContains('累计任务奖励').findOne(8000)) {
// console.log('默认方式打开失败,二次尝试')
// console.log('首先检测弹窗')
// try {
// let anchor = textContains('O1CN010Zax611FU0Z5m6nnQ').findOne(5000)
// anchor.parent().click()
// sleep(2000)
// console.log('领红包弹窗已关闭')
// } catch (err) {
// console.log(err)
// console.log('领红包弹窗关闭失败。此问题不影响运行')
// }
// try {
// idContains('CLOSE').findOne(2000).click()
// sleep(1000)
// } catch (err) {
// console.log(err)
// console.log('其他弹窗关闭失败。此问题不影响运行')
// }
// console.log('出现未能自动关闭的弹窗请手动关闭')
// sleep(2000)
// // let right = c.bounds().right
// // let left = c.bounds().left
// // let top = c.bounds().top
// // let bottom = c.bounds().bottom
// // click(random(right,left), random(top, bottom))
// click(c.bounds().centerX(), c.bounds().centerY())
// console.log('已点击,等待任务列表出现')
if (!textContains('累计任务奖励').findOne(8000)) {
throw '无法打开任务列表'
}
}

Expand All @@ -171,7 +176,7 @@ try {
var taskName, content
try {
taskName = jumpButtons[i].parent().child(1).text()
content = jumpButtons[i].parent().child(2).child(0).text()
// content = jumpButtons[i].parent().child(2).child(0).text()
} catch (err) {
console.log(err)
continue
Expand All @@ -184,10 +189,10 @@ try {
// sleep(8000)
// return findTask()
// }
// if (!(taskName.match(/淘金币|提醒|话费|斗地主|消消乐|流浪猫|开88|扔喵糖|占领|邀请|登录|组队|参与|施肥|浇水|特价版|小鸡|消除|穿搭|森林|点淘|人生|我的淘宝|庄园/) || content.match(/小互动/))) {
// return [taskName, jumpButtons[i]]
// }
return [taskName, jumpButtons[i]]
console.log(taskName)
if (!(taskName.match(//))) {
return [taskName, jumpButtons[i]]
}
}
}
return null
Expand All @@ -211,7 +216,7 @@ try {
swipe(device.width / 2, device.height - 200, device.width / 2 + 20, device.height - 500, 2000)
continue
}
let finish_reg = /.*[\s\S]*|.*.*|.*.*|.*.*/
let finish_reg = /.*[\s\S]*|.*.*|.*.*|.*.*|^\+[\d]*$/
if (textMatches(finish_reg).exists() || descMatches(finish_reg).exists()) { // 等待已完成出现,有可能失败
break
}
Expand All @@ -227,8 +232,8 @@ try {
}
if (finish_c && finish_c % 5 == 0) {
console.log('滑动防止页面卡顿')
swipe(device.width / 2, device.height - 400, device.width / 2 + 20, device.height - 500, 500)
// finish_c = finish_c + 5
swipe(device.width / 2, device.height - 400, device.width / 2 + 20, device.height - 500, 1000)
finish_c = finish_c + 2
}
sleep(500)
finish_c++
Expand Down Expand Up @@ -286,11 +291,12 @@ try {

console.log('首先关闭弹窗')
try {
let anchor = textContains('O1CN01cR2RJh1DIRHl5jiO7').findOne(5000)
anchor.parent().child(4).child(0).click()
// idContains('J_wfdlgwrap_14').findOne(5000).child(0).click()
sleep(2000)
console.log('领红包弹窗已关闭')
let anchor = idContains('J_wfdlgwrap_6').findOne(5000)
if (anchor) {
click(anchor.bounds().centerX(), anchor.bounds().centerY())
sleep(2000)
console.log('领红包弹窗已关闭')
}
} catch (err) {
console.log(err)
console.log('领红包弹窗关闭失败。此问题不影响运行')
Expand All @@ -303,9 +309,9 @@ try {
console.log(err)
console.log('其他弹窗关闭失败。此问题不影响运行')
}

console.log('检测任务列表是否打开')
if (textContains('O1CN01stVIJt1VSfFvIXWtd').findOne(5000)) {
if (textContains('累计任务奖励').findOne(5000)) {
console.log('先关闭列表')
idContains('close_btn').findOnce().click()
sleep(2000)
Expand Down
2 changes: 1 addition & 1 deletion tb_luck.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const VERSION = '20231111-E'
const VERSION = '20231111-G'

if (!auto.service) {
toast('无障碍服务未启动!退出!')
Expand Down

0 comments on commit ed2557b

Please sign in to comment.