From 8de0bf9b39b2898a61d26eab92986d1f5f962e3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=91=E7=AB=AF=E5=AE=A2?= <107686912+Kirito520Asuna@users.noreply.github.com> Date: Thu, 23 Apr 2026 12:39:29 +0800 Subject: [PATCH] =?UTF-8?q?(=E9=80=82=E9=85=8D=20https://github.com/babala?= =?UTF-8?q?e/better-genshin-impact/pull/3069)=20(#3153)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- repo/js/AutoPlan/README.md | 8 +++- repo/js/AutoPlan/config/config.js | 68 ++++++++++++++++++++++++++++++- repo/js/AutoPlan/main.js | 3 +- repo/js/AutoPlan/manifest.json | 2 +- 4 files changed, 76 insertions(+), 5 deletions(-) diff --git a/repo/js/AutoPlan/README.md b/repo/js/AutoPlan/README.md index 69502910d..77fe7731d 100644 --- a/repo/js/AutoPlan/README.md +++ b/repo/js/AutoPlan/README.md @@ -304,9 +304,15 @@ | 0.0.3 | oiJbmjU2R0NniiwiZxh | 0.0.6+ | | 0.0.4 | oiJbmjU2R0NniiwiZxh | 0.0.6+ | | 0.0.5 | oiJbmjU2R0NniiwiZxh | 0.0.6+ | +| 0.0.6 | oiJbmjU2R0NniiwiZxh | 0.0.6+ | ## 版本历史(简要) -### 0.0.4 2026.04.11 + +--- +### 0.0.6 2026.04.23 + + - 限制单例模式配置 +### 0.0.5 2026.04.11 - 调整幽境危战 查找结果判断条件,增加名称不存在的情况处理 - 默认滚动页面次数为4 ### 0.0.4 2026.03.25 diff --git a/repo/js/AutoPlan/config/config.js b/repo/js/AutoPlan/config/config.js index df0cd2c37..bb9e374a4 100644 --- a/repo/js/AutoPlan/config/config.js +++ b/repo/js/AutoPlan/config/config.js @@ -1,6 +1,6 @@ import {ocrUid} from "../utils/uid"; -const config = { +let config = { //setting设置放在这个json run: { exclude_run_exception: false,//忽略运行异常 @@ -71,7 +71,71 @@ const LoadMap = new Map([ ['输入加载', LoadType.input], ['bgi_tools加载', LoadType.bgi_tools], ]) - +/** + * 构建初始化配置设置函数 + * 该函数用于创建并返回一个包含各种配置项的对象 + * @returns {Object} 包含所有配置项的对象 + */ +export async function buildInitConfigSettings(){ + // 初始化配置对象,包含运行设置、工具配置、信息、用户、路径等 + config = { + //setting设置放在这个json + run: { + exclude_run_exception: false,//忽略运行异常 + loop_plan: false,//启用循环体力计划 + retry_count: 3,//复活重试次数 + config: '', + // load_uid_config: false, + loads: [],//加载方式list + }, + bgi_tools: { + //授权token + token: { + name: 'Authorization', + value: '' + }, + api: { + httpPullJsonConfig: undefined, + httpPushAllJsonConfig: undefined, + httpPushAllCountryConfig: undefined, + }, + open: {open_push: false} + }, + info: { + key: undefined,//密钥 + manifest: {}, + settings: undefined + }, + user: { + uid: undefined, + physical: { + min: 20,//最小体力 + current: 0,//当前体力 + names: ["原粹树脂", "浓缩树脂", "须臾树脂", "脆弱树脂"] + }, + runTypes: ['秘境', '地脉', '幽境'] + }, + // + path: { + manifest: "manifest.json", + domain: "config/domain.json", + runConfig: "config/run_config.json", + countryList: "config/countryList.json" + }, + //所有秘境信息 + domainList: [], + //所有秘境名称 + domainNames: new Set(), + //物品名称(只记录顶级的名称->金色物品名称) + itemNames: new Set(), + //秘境名称映射物品列表 + domainMap: new Map(), + //秘境名称映射秘境列表顺序 + domainOrderMap: new Map(), + //物品名称映射秘境名称 + domainItemsMap: new Map(), + } +} /** * 初始化设置函数 * 从配置文件中读取设置信息并返回 diff --git a/repo/js/AutoPlan/main.js b/repo/js/AutoPlan/main.js index 05a634b09..d987d62d9 100644 --- a/repo/js/AutoPlan/main.js +++ b/repo/js/AutoPlan/main.js @@ -1,4 +1,4 @@ -import {config, initConfig, initSettings, LoadType} from './config/config'; +import {buildInitConfigSettings, config, initConfig, initSettings, LoadType} from './config/config'; import {ocrUid} from './utils/uid'; import {getDayOfWeek, outDomainUI, outStygianOnslaughtUI, throwError,toMainUi} from './utils/tool'; import {pullJsonConfig, pushAllCountryConfig, pushAllJsonConfig} from './utils/bgi_tools'; @@ -653,6 +653,7 @@ async function initRunOrderList(domainConfig) { * 该函数用于执行初始化操作,使用async/await处理异步操作 */ async function init() { + await buildInitConfigSettings() // 调用initConfig函数并等待其完成 // 这是一个异步初始化配置的步骤 await initSettings() diff --git a/repo/js/AutoPlan/manifest.json b/repo/js/AutoPlan/manifest.json index f5584fcc1..feb2ad5e4 100644 --- a/repo/js/AutoPlan/manifest.json +++ b/repo/js/AutoPlan/manifest.json @@ -1,6 +1,6 @@ { "name": "自动体力计划", - "version": "0.0.5", + "version": "0.0.6", "description": "", "settings_ui": "settings.json", "main": "main.js",