MCPcopy Create free account
hub / github.com/Semporia/Scripts / browserTask

Function browserTask

jd_jxnc.js:373–408  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

371}
372
373function browserTask() {
374 return new Promise(async resolve => {
375 const tasks = $.allTask.filter(x => x.tasklevel !== 6);
376 const times = Math.max(...[...tasks].map(x => x.limit));
377 for (let i = 0; i < tasks.length; i++) {
378 const task = tasks[i];
379 $.log(`开始第${i + 1}个任务:${task.taskname}`);
380 const status = [0];
381 for (let i = 0; i < times; i++) {
382 const random = Math.random() * 3;
383 await $.wait(random * 1000);
384 if (status[0] === 0) {
385 status[0] = await doTask(task);
386 }
387 if (status[0] !== 0) {
388 break;
389 }
390 }
391 if (status[0] === 1017) { // ret:1017 retmsg:"score full" 水滴已满,果实成熟,跳过所有任务
392 $.log('水滴已满,果实成熟,跳过所有任务');
393 resolve(true);
394 break;
395 }
396 if (status[0] === 1032) {
397 $.log('任务执行失败,种植的 APP 专属种子,请提供 token 或种植非 APP 种子');
398 message += '任务执行失败,种植的 APP 专属种子,请提供 token 或种植非 APP 种子\n';
399 notifyBool = notifyBool && notifyLevel >= 2;
400 resolve(false);
401 return;
402 }
403
404 $.log(`结束第${i + 1}个任务:${task.taskname}`);
405 }
406 resolve(true);
407 });
408}
409
410function answerTask() {
411 const _answerTask = $.allTask.filter(x => x.tasklevel === 6);

Callers 1

jdJXNCFunction · 0.70

Calls 3

doTaskFunction · 0.70
logMethod · 0.45
waitMethod · 0.45

Tested by

no test coverage detected