diff --git a/repo/js/WeeklyThousandStarRealm/README.md b/repo/js/WeeklyThousandStarRealm/README.md index 9ce221cee..99832d3e7 100644 --- a/repo/js/WeeklyThousandStarRealm/README.md +++ b/repo/js/WeeklyThousandStarRealm/README.md @@ -24,7 +24,7 @@ 自己发布的千星奇域的地图也可以用来增长经验,但是并不需要发布成功,仅需要点击一下发布再预览详情,即可在弹窗中进行收藏。 这就意味着可以自行制作秒刷图,然后“发布”进行收藏,在收藏中使用自己实际上并未真正发布的地图进行秒刷。 最新版脚本进行了重构,优化了点击速度,秒刷图一周刷完仅需8分45秒。 -地图制作请自行学习。 +焚诀存档地图已存放至BetterGI/User/JsScript/WeeklyThousandStarRealm/map目录下,可自行在游戏中导入。 ## 🌟 功能特点 diff --git a/repo/js/WeeklyThousandStarRealm/assets/disclaimer-mask.html b/repo/js/WeeklyThousandStarRealm/assets/disclaimer-mask.html new file mode 100644 index 000000000..395857816 --- /dev/null +++ b/repo/js/WeeklyThousandStarRealm/assets/disclaimer-mask.html @@ -0,0 +1,4682 @@ + + + + + + + + +
+ + + diff --git a/repo/js/WeeklyThousandStarRealm/assets/progress-mask.html b/repo/js/WeeklyThousandStarRealm/assets/progress-mask.html new file mode 100644 index 000000000..fd36a2e9f --- /dev/null +++ b/repo/js/WeeklyThousandStarRealm/assets/progress-mask.html @@ -0,0 +1,4712 @@ + + + + + + + + +
+ + + diff --git a/repo/js/WeeklyThousandStarRealm/disclaimer-mask/index.html b/repo/js/WeeklyThousandStarRealm/disclaimer-mask/index.html new file mode 100644 index 000000000..3ca1cb741 --- /dev/null +++ b/repo/js/WeeklyThousandStarRealm/disclaimer-mask/index.html @@ -0,0 +1,10 @@ + + + + + + +
+ + + diff --git a/repo/js/WeeklyThousandStarRealm/disclaimer-mask/package.json b/repo/js/WeeklyThousandStarRealm/disclaimer-mask/package.json new file mode 100644 index 000000000..f0e7834b1 --- /dev/null +++ b/repo/js/WeeklyThousandStarRealm/disclaimer-mask/package.json @@ -0,0 +1,18 @@ +{ + "name": "disclaimer-mask", + "version": "0.0.0", + "private": true, + "type": "module", + "scripts": { + "dev": "vite", + "build": "vite build && node ../../build/rename.js dist/index.html dist/disclaimer-mask.html", + "preview": "vite preview" + }, + "dependencies": { + "gsap": "^3.12.7", + "vue": "^3.5.30" + }, + "devDependencies": { + "@vitejs/plugin-vue": "^6.0.4" + } +} diff --git a/repo/js/WeeklyThousandStarRealm/disclaimer-mask/src/App.vue b/repo/js/WeeklyThousandStarRealm/disclaimer-mask/src/App.vue new file mode 100644 index 000000000..092ea5fd4 --- /dev/null +++ b/repo/js/WeeklyThousandStarRealm/disclaimer-mask/src/App.vue @@ -0,0 +1,229 @@ + + + + + diff --git a/repo/js/WeeklyThousandStarRealm/disclaimer-mask/src/main.js b/repo/js/WeeklyThousandStarRealm/disclaimer-mask/src/main.js new file mode 100644 index 000000000..01433bca2 --- /dev/null +++ b/repo/js/WeeklyThousandStarRealm/disclaimer-mask/src/main.js @@ -0,0 +1,4 @@ +import { createApp } from 'vue' +import App from './App.vue' + +createApp(App).mount('#app') diff --git a/repo/js/WeeklyThousandStarRealm/disclaimer-mask/vite.config.js b/repo/js/WeeklyThousandStarRealm/disclaimer-mask/vite.config.js new file mode 100644 index 000000000..9a9dd3731 --- /dev/null +++ b/repo/js/WeeklyThousandStarRealm/disclaimer-mask/vite.config.js @@ -0,0 +1,4 @@ +import { createConfig } from '../../vite.base.config.js' +import vue from '@vitejs/plugin-vue' + +export default createConfig([vue()]) diff --git a/repo/js/WeeklyThousandStarRealm/main.js b/repo/js/WeeklyThousandStarRealm/main.js index c679746a3..0586be116 100644 --- a/repo/js/WeeklyThousandStarRealm/main.js +++ b/repo/js/WeeklyThousandStarRealm/main.js @@ -4,7 +4,8 @@ import { findImgAndClick, waitUntilTextAppear, waitUntilImgDisappear, - waitUntilImgAppear, findImg + waitUntilImgAppear, + findImg } from "../../../packages/utils/tool"; import fold_triangle from "assets/fold_triangle.png"; @@ -12,6 +13,7 @@ import check_box from "assets/check_box.png"; import exit_room from "assets/exit_room.png"; import room_ready from "assets/room_ready.png"; import paimon from "../../../packages/assets/imgs/paimon_menu.png"; +import { checkVersion } from "../../../packages/utils/tool"; const duration = 1000; // 默认点击等待延时 @@ -26,6 +28,19 @@ const useFixedAttempts = userAttempts > 0; const weekMaxExp = Number(settings.weekMaxExp || "4000"); const singleExp = Number(settings.singleExp || "270"); let weekTotal = initWeekTotal(); +let progressWinId = null; +let useMask = false; + +function sendProgress(pct, text, cur, tot) { + if (!progressWinId) return; + htmlMask.send(progressWinId, "/progress", JSON.stringify({ + title: "运行进度", + progress: pct, + current: cur || 0, + total: tot || 0, + status: text + })); +} // 读取存档 function loadWeekData() { @@ -85,8 +100,8 @@ function initWeekTotal() { // 配置变化 -> 重算 if ( - stored.weekMaxExp !== weekMaxExp || - stored.singleExp !== singleExp + stored.weekMaxExp !== weekMaxExp || + stored.singleExp !== singleExp ) { stored.weekMaxExp = weekMaxExp; stored.singleExp = singleExp; @@ -315,6 +330,9 @@ async function playMap() { await findTextAndClick("开始游戏", 960, 540, 960, 540, 5, 50, 50); log.info("开始执行第{i}/{total}次奇域挑战", 1, total); + if (useMask) { + sendProgress(0, `正在执行第1/${total}次挑战`, 1, total); + } let firstOutputCount = 0; await waitUntilTextAppear( "返回大厅", @@ -337,6 +355,9 @@ async function playMap() { decreaseWeekTotal(); } log.info("本次关卡结束"); + if (useMask) { + sendProgress(Math.round(1 / total * 100), `第1/${total}次挑战完成`, 1, total); + } await deleteSource(); @@ -348,6 +369,9 @@ async function playMap() { await sleep(duration); await findTextAndClick("开始游戏", 960, 540, 960, 540, 20, 50, 50); log.info("开始执行第{i}/{total}次奇域挑战", i + 1, total); + if (useMask) { + sendProgress(Math.round(i / total * 100), `正在执行第${i + 1}/${total}次挑战`, i + 1, total); + } let outputCount = 0; await waitUntilTextAppear( "返回大厅", @@ -369,6 +393,9 @@ async function playMap() { if (!useFixedAttempts) { decreaseWeekTotal(); } + if (useMask) { + sendProgress(Math.round((i + 1) / total * 100), `第${i + 1}/${total}次挑战完成`, i + 1, total); + } await deleteSource(); } } @@ -386,21 +413,43 @@ async function exitToTeyvat() { await waitUntilImgAppear(paimon); // 有镜头拉近动画 await sleep(duration); + log.info("运行结束"); } (async function () { + const version = getVersion(); + const minVersion = '0.60.2-alpha.3'; + + useMask = checkVersion(version, minVersion); + if (!runJS) { log.error("您未同意此脚本的免责声明,请先同意后重新运行此脚本!"); + if (useMask) { + htmlMask.show("assets/disclaimer-mask.html"); + await sleep(10000); + } return; } + if (useMask) { + const showSkill = roomID === "37135473336"; + progressWinId = htmlMask.show("assets/progress-mask.html"); + await sleep(duration); + sendProgress(0, "准备中..."); + if (showSkill && progressWinId) { + htmlMask.request(progressWinId, "/showskill", JSON.stringify({ + show: showSkill + })); + } + } + await genshin.returnMainUi(); if (useFixedAttempts) { // 手动模式:忽略本周计数 log.info( - "已进入指定次数模式,本次将执行{count}次挑战(不计入周进度)", - userAttempts + "已进入指定次数模式,本次将执行{count}次挑战(不计入周进度)", + userAttempts ); } else { // 每周模式 @@ -409,11 +458,16 @@ async function exitToTeyvat() { const done = Math.ceil(weekMaxExp / singleExp) - leave; log.info( - "本周共需刷取 {total} 次,已刷 {done} 次,剩余 {leave} 次", - Math.ceil(weekMaxExp / singleExp), - done, - leave + "本周共需刷取 {total} 次,已刷 {done} 次,剩余 {leave} 次", + Math.ceil(weekMaxExp / singleExp), + done, + leave ); + + if (leave < 1) { + log.info("本周任务已完成,结束运行"); + return; + } } if (starMode) { @@ -424,4 +478,8 @@ async function exitToTeyvat() { } await playMap(); await exitToTeyvat(); + if (useMask) { + sendProgress(100, "全部完成!"); + } + await sleep(3000); })(); diff --git a/repo/js/WeeklyThousandStarRealm/manifest.json b/repo/js/WeeklyThousandStarRealm/manifest.json index efd571759..2ee83da36 100644 --- a/repo/js/WeeklyThousandStarRealm/manifest.json +++ b/repo/js/WeeklyThousandStarRealm/manifest.json @@ -1,8 +1,8 @@ { "manifest_version": 1, "name": "千星奇域每周成就经验刷取", - "version": "3.4", - "bgi_version": "0.57.0", + "version": "3.5", + "bgi_version": "0.60.0", "description": "无需自己找图,可用于利用成就高经验值刷取经验,默认配置每周刷满需要22分钟,秒刷图仅需9分钟", "authors": [ { diff --git a/repo/js/WeeklyThousandStarRealm/map/焚诀.gil b/repo/js/WeeklyThousandStarRealm/map/焚诀.gil new file mode 100644 index 000000000..3acdccc78 Binary files /dev/null and b/repo/js/WeeklyThousandStarRealm/map/焚诀.gil differ diff --git a/repo/js/WeeklyThousandStarRealm/progress-mask/index.html b/repo/js/WeeklyThousandStarRealm/progress-mask/index.html new file mode 100644 index 000000000..3ca1cb741 --- /dev/null +++ b/repo/js/WeeklyThousandStarRealm/progress-mask/index.html @@ -0,0 +1,10 @@ + + + + + + +
+ + + diff --git a/repo/js/WeeklyThousandStarRealm/progress-mask/package.json b/repo/js/WeeklyThousandStarRealm/progress-mask/package.json new file mode 100644 index 000000000..ba25b0061 --- /dev/null +++ b/repo/js/WeeklyThousandStarRealm/progress-mask/package.json @@ -0,0 +1,18 @@ +{ + "name": "progress-mask", + "version": "0.0.0", + "private": true, + "type": "module", + "scripts": { + "dev": "vite", + "build": "vite build && node ../../build/rename.js dist/index.html dist/progress-mask.html", + "preview": "vite preview" + }, + "dependencies": { + "gsap": "^3.12.7", + "vue": "^3.5.30" + }, + "devDependencies": { + "@vitejs/plugin-vue": "^6.0.4" + } +} diff --git a/repo/js/WeeklyThousandStarRealm/progress-mask/src/App.vue b/repo/js/WeeklyThousandStarRealm/progress-mask/src/App.vue new file mode 100644 index 000000000..406c30fad --- /dev/null +++ b/repo/js/WeeklyThousandStarRealm/progress-mask/src/App.vue @@ -0,0 +1,318 @@ + + + + + diff --git a/repo/js/WeeklyThousandStarRealm/progress-mask/src/main.js b/repo/js/WeeklyThousandStarRealm/progress-mask/src/main.js new file mode 100644 index 000000000..01433bca2 --- /dev/null +++ b/repo/js/WeeklyThousandStarRealm/progress-mask/src/main.js @@ -0,0 +1,4 @@ +import { createApp } from 'vue' +import App from './App.vue' + +createApp(App).mount('#app') diff --git a/repo/js/WeeklyThousandStarRealm/progress-mask/vite.config.js b/repo/js/WeeklyThousandStarRealm/progress-mask/vite.config.js new file mode 100644 index 000000000..9a9dd3731 --- /dev/null +++ b/repo/js/WeeklyThousandStarRealm/progress-mask/vite.config.js @@ -0,0 +1,4 @@ +import { createConfig } from '../../vite.base.config.js' +import vue from '@vitejs/plugin-vue' + +export default createConfig([vue()])