mirror of
https://github.com/babalae/bettergi-scripts-list.git
synced 2026-03-29 05:39:51 +08:00
[圣遗物批量强化] 添加语言刷新设置功能 并优化命中属性 (#1966)
* feat: 添加语言刷新设置功能 * feat: 添加语言刷新设置功能 * fix: 修复多语言标签格式和调试日志输出 * refactor: 替换硬编码的降序文本为国际化方法调用 * refactor: 移除ocrTestHolyRelic函数,优化属性百分比处理 * fix(HolyRelicsUp): 修复设置更新时的JSON解析问题 * fix: 修复圣遗物强化命中功能的验证逻辑和错误处理 * feat: 添加多语言支持和相关配置项 * feat(HolyRelicsUp): 添加验证开始提示信息
This commit is contained in:
@@ -40,67 +40,79 @@
|
||||
|
||||
以下为脚本的配置项(基于 `settings.json`),可在脚本运行前调整:
|
||||
|
||||
1. **启用自动进入背包** (`toBag`)
|
||||
1. **根据语言刷新设置列表** (`refreshSettingsByLanguage`) **[1.1.5 新增]**
|
||||
- 类型:复选框
|
||||
- 描述:是否根据选择的语言刷新设置列表的显示内容。
|
||||
- 默认:禁用
|
||||
|
||||
2. **语言选择** (`language`) **[1.1.5 新增]**
|
||||
- 类型:下拉菜单
|
||||
- 描述:选择界面显示的语言。
|
||||
- 选项:`简体中文`、`繁體中文`、`English`、`日本語`、`한국어`
|
||||
- 默认:`简体中文`
|
||||
|
||||
3. **启用自动进入背包** (`toBag`)
|
||||
- 类型:复选框
|
||||
- 描述:是否自动打开背包页面。
|
||||
- 默认:启用
|
||||
|
||||
2. **启用批量强化** (`enableBatchUp`)
|
||||
4. **启用批量强化** (`enableBatchUp`)
|
||||
- 类型:复选框
|
||||
- 描述:启用批量强化功能。单独使用时,请确保圣遗物背包已筛选为未满级状态。
|
||||
- 默认:禁用
|
||||
|
||||
3. **自动启用放入方式** (`enableInsertionMethod`)
|
||||
5. **自动启用放入方式** (`enableInsertionMethod`)
|
||||
- 类型:复选框
|
||||
- 描述:自动选择素材放入方式(快捷放入/阶段放入)。
|
||||
- 默认:禁用
|
||||
|
||||
4. **放入方式** (`insertionMethod`)
|
||||
6. **放入方式** (`insertionMethod`)
|
||||
- 类型:下拉菜单
|
||||
- 描述:选择素材放入方式(默认:自动识别)。当最大强化等级为4、8、16时,强制使用“阶段放入”。
|
||||
- 选项:`默认`、`快捷放入`、`阶段放入`
|
||||
- 默认:`默认`
|
||||
|
||||
5. **选择素材** (`material`)
|
||||
7. **选择素材** (`material`)
|
||||
- 类型:下拉菜单
|
||||
- 描述:选择强化使用的素材(默认:自动识别)。**注:此功能存在问题消失太快无法识别,禁用**。
|
||||
- 选项:`默认`、`1星素材`、`2星及以下素材`、`3星及以下素材`、`4星及以下素材`
|
||||
- 默认:`默认`
|
||||
|
||||
6. **最大圣遗物强化个数** (`upMaxCount`)
|
||||
8. **最大圣遗物强化个数** (`upMaxCount`)
|
||||
- 类型:文本输入
|
||||
- 描述:设置需要强化的圣遗物数量。
|
||||
- 默认:空
|
||||
|
||||
7. **最大强化等级** (`upMax`)
|
||||
9. **最大强化等级** (`upMax`)
|
||||
- 类型:下拉菜单
|
||||
- 描述:设置圣遗物强化的目标等级。
|
||||
- 选项:`4`、`8`、`16`、`20`
|
||||
- 默认:`4`
|
||||
|
||||
8. **启用命中属性** (`enableAttributeHolyRelic`)
|
||||
10. **启用命中属性** (`enableAttributeHolyRelic`)
|
||||
- 类型:复选框
|
||||
- 描述:是否启用命中属性功能(实验功能)。不支持在升序情况下使用。
|
||||
- 描述:是否启用命中属性功能(实验功能)。不支持在升序情况下使用,不支持降序选中满级|未满级条件下强化+20操作。
|
||||
- 默认:禁用
|
||||
|
||||
9. **启用自定义命中属性覆盖通用命中属性** (`coverAttributeHolyRelic`)
|
||||
11. **启用自定义命中属性覆盖通用命中属性** (`coverAttributeHolyRelic`)
|
||||
- 类型:复选框
|
||||
- 描述:启用后,自定义命中属性将覆盖通用命中属性(以部件为单位)。若禁用,则仅使用自定义命中属性,不使用通用命中属性(实验功能)。
|
||||
**特别说明**:假设通用命中属性为 `@花*爆率*爆伤|@羽*爆率*爆伤|@沙*爆率*爆伤|@冠#爆率#爆伤&*爆率*爆伤|@杯#物伤#风伤#水伤#火伤#雷伤#岩伤#冰伤#草伤&*爆率*爆伤`,自定义命中属性为 `@花*爆率`,启用此选项时,仅“花”部件的命中属性会被覆盖为 `@花*爆率`,其他部件仍使用通用命中属性。若禁用此选项,则仅使用自定义命中属性(如 `@花*爆率`),完全忽略通用命中属性。
|
||||
- 默认:启用
|
||||
|
||||
10. **通用命中属性** (`commonAttributeHolyRelic`)
|
||||
12. **通用命中属性** (`commonAttributeHolyRelic`)
|
||||
- 类型:文本输入
|
||||
- 描述:设置通用的命中属性,格式需遵循特定语法(实验功能)。
|
||||
**语法说明**:
|
||||
- `@`:表示部件,需使用以下部件简称或全称(两者均可):
|
||||
|
||||
|
||||
| 简称 | 全称 | 简称 | 全称 |
|
||||
|:----:|:----:|:----:|:----:|
|
||||
| 羽 | 死之羽 | 花 | 生之花 |
|
||||
| 羽毛 | 死之羽 | 沙 | 时之沙 |
|
||||
| 杯 | 空之杯 | 冠 | 理之冠 |
|
||||
| 杯子 | 空之杯 |
|
||||
|
||||
- `#`:表示主词条(如生命%、物伤)。主词条存在时不可忽略,需以 `&` 终止。
|
||||
- `*`:表示副词条(如爆率、爆伤)。副词条可忽略终止符 `!`,但建议添加以提高清晰度。
|
||||
- `|`:表示部件终止,多个部件时不可忽略。
|
||||
@@ -115,119 +127,129 @@
|
||||
- 使用全称:`@生之花*生命%*攻击|@空之杯#生命%#物伤&*生命%`(效果同上)。
|
||||
- 默认:`@花*爆率*爆伤|@羽*爆率*爆伤|@沙*爆率*爆伤|@冠#爆率#爆伤&*爆率*爆伤|@杯#物伤#风伤#水伤#火伤#雷伤#岩伤#冰伤#草伤&*爆率*爆伤`
|
||||
|
||||
11. **自定义命中属性** (`inputAttributeHolyRelic`)
|
||||
13. **自定义命中属性** (`inputAttributeHolyRelic`)
|
||||
- 类型:文本输入
|
||||
- 描述:设置自定义的命中属性,格式直接参考通用命中属性(`commonAttributeHolyRelic`)的语法(实验功能)。支持使用“核心功能”中属性排序的简称表及部件简称或全称。
|
||||
- 默认:空
|
||||
|
||||
12. **启用筛选圣遗物自定义命中属性覆盖筛选圣遗物通用命中属性** (`coverSiftAttributeHolyRelic`) **[1.1.3 新增]**
|
||||
14. **启用筛选圣遗物自定义命中属性覆盖筛选圣遗物通用命中属性** (`coverSiftAttributeHolyRelic`) **[1.1.3 新增]**
|
||||
- 类型:复选框
|
||||
- 描述:启用后,自定义筛选圣遗物属性(`inputSiftAttributeHolyRelic`)将覆盖通用筛选圣遗物属性(`commonSiftAttributeHolyRelic`),以部件为单位。若禁用,则仅使用自定义筛选圣遗物属性,完全忽略通用筛选圣遗物属性(实验功能)。
|
||||
**特别说明**:假设通用筛选属性为 `@花*爆率*爆伤|@羽*爆率*爆伤`,自定义筛选属性为 `@花*生命%`,启用此选项时,仅“花”部件的筛选属性会被覆盖为 `@花*生命%`,其他部件仍使用通用筛选属性。若禁用此选项,则仅使用自定义筛选属性(如 `@花*生命%`),完全忽略通用筛选属性。
|
||||
**注意**:此配置仅用于强化前的第一次圣遗物筛选。
|
||||
- 默认:启用
|
||||
|
||||
13. **启用筛选圣遗物满足所有指定的子属性命中条件** (`meetAllSiftAttributeHolyRelic`) **[1.1.3 新增]**
|
||||
15. **启用筛选圣遗物满足所有指定的子属性命中条件** (`meetAllSiftAttributeHolyRelic`) **[1.1.3 新增]**
|
||||
- 类型:复选框
|
||||
- 描述:启用后,筛选圣遗物时将严格要求满足所有指定的子属性条件(实验功能)。若禁用,则筛选条件可能不要求全部子属性都满足。
|
||||
**注意**:此配置仅用于强化前的第一次圣遗物筛选。
|
||||
- 默认:关闭
|
||||
|
||||
14. **筛选圣遗物通用命中属性** (`commonSiftAttributeHolyRelic`) **[1.1.3 新增]**
|
||||
16. **筛选圣遗物通用命中属性** (`commonSiftAttributeHolyRelic`) **[1.1.3 新增]**
|
||||
- 类型:文本输入
|
||||
- 描述:设置通用的圣遗物筛选属性,格式遵循与通用命中属性(`commonAttributeHolyRelic`)相同的语法(实验功能)。用于在强化前筛选符合条件的圣遗物。
|
||||
**语法说明**:同 `commonAttributeHolyRelic`,支持使用“核心功能”中属性排序的简称表及部件简称或全称。
|
||||
**示例**:`@花*生命%*攻击|@杯#生命%#物伤&*生命%` 表示筛选“花”部件副词条包含生命%和攻击、“杯”部件主词条为生命%或物伤且副词条包含生命%的圣遗物。
|
||||
**注意**:此配置仅用于强化前的第一次圣遗物筛选。
|
||||
**注意**:此配置仅用于强化前的第一次圣遗物筛选。
|
||||
- 默认:`@花*爆率*爆伤|@羽*爆率*爆伤|@沙*爆率*爆伤|@冠#爆率#爆伤&*爆率*爆伤|@杯#物伤#风伤#水伤#火伤#雷伤#岩伤#冰伤#草伤&*爆率*爆伤`
|
||||
|
||||
15. **筛选圣遗物自定义命中属性** (`inputSiftAttributeHolyRelic`) **[1.1.3 新增]**
|
||||
17. **筛选圣遗物自定义命中属性** (`inputSiftAttributeHolyRelic`) **[1.1.3 新增]**
|
||||
- 类型:文本输入
|
||||
- 描述:设置自定义的圣遗物筛选属性,格式直接参考通用筛选圣遗物属性(`commonSiftAttributeHolyRelic`)的语法(实验功能)。用于在强化前筛选符合条件的圣遗物。
|
||||
**语法说明**:同 `commonAttributeHolyRelic`,支持使用“核心功能”中属性排序的简称表及部件简称或全称。
|
||||
**注意**:此配置仅用于强化前的第一次圣遗物筛选。
|
||||
**注意**:此配置仅用于强化前的第一次圣遗物筛选。
|
||||
- 默认:空
|
||||
|
||||
16. **启用自动排序** (`toSort`)
|
||||
18. **启用自动排序** (`toSort`)
|
||||
- 类型:复选框
|
||||
- 描述:是否启用自动排序功能。若禁用,以下排序相关配置无效。
|
||||
- 默认:启用
|
||||
|
||||
17. **属性排序** (`sortAttribute`)
|
||||
19. **属性排序** (`sortAttribute`)
|
||||
- 类型:文本输入
|
||||
- 描述:设置排序属性,使用“|”分隔,支持简称(如:`生命%|雷伤|充能|通用`)。
|
||||
- 默认:空
|
||||
|
||||
18. **主排序** (`sortMain`)
|
||||
20. **主排序** (`sortMain`)
|
||||
- 类型:下拉菜单
|
||||
- 描述:设置主排序方式。
|
||||
- 选项:`升序`、`降序`
|
||||
- 默认:`升序`
|
||||
|
||||
19. **辅助排序** (`sortAuxiliary`)
|
||||
21. **辅助排序** (`sortAuxiliary`)
|
||||
- 类型:下拉菜单
|
||||
- 描述:设置辅助排序方式。
|
||||
- 选项:`等级顺序`、`品质顺序`
|
||||
- 默认:`等级顺序`
|
||||
|
||||
20. **启用筛选圣遗物开关** (`toSift`)
|
||||
22. **启用筛选圣遗物开关** (`toSift`)
|
||||
- 类型:复选框
|
||||
- 描述:是否启用圣遗物筛选功能。若禁用,以下筛选相关配置无效。
|
||||
- 默认:启用
|
||||
|
||||
21. **圣遗物筛选** (`suit`)
|
||||
23. **圣遗物筛选** (`suit`)
|
||||
- 类型:文本输入
|
||||
- 描述:按圣遗物套装筛选,使用 `|` 分隔,支持模糊匹配(如:`如雷|苍白`)。
|
||||
- 默认:空
|
||||
|
||||
22. **筛选圣遗物界面最大翻页次数** (`countMaxByHoly`)
|
||||
24. **筛选圣遗物界面最大翻页次数** (`countMaxByHoly`)
|
||||
- 类型:下拉菜单
|
||||
- 描述:设置筛选圣遗物时的最大翻页次数。
|
||||
- 选项:`1`、`2`、`3`、`4`、`5`、`6`、`7`、`8`
|
||||
- 默认:`4`
|
||||
|
||||
23. **圣遗物筛选:锁定状态(标记)** (`holyRelicsLockMark`)
|
||||
25. **圣遗物筛选:锁定状态(标记)** (`holyRelicsLockMark`)
|
||||
- 类型:复选框
|
||||
- 描述:筛选带有标记的圣遗物。
|
||||
- 默认:禁用
|
||||
|
||||
24. **圣遗物筛选:仅锁定** (`holyRelicsLockY`)
|
||||
26. **圣遗物筛选:仅锁定** (`holyRelicsLockY`)
|
||||
- 类型:复选框
|
||||
- 描述:筛选已锁定的圣遗物。
|
||||
- 默认:禁用
|
||||
|
||||
25. **圣遗物筛选:未锁定** (`holyRelicsLockN`)
|
||||
27. **圣遗物筛选:未锁定** (`holyRelicsLockN`)
|
||||
- 类型:复选框
|
||||
- 描述:筛选未锁定的圣遗物。
|
||||
- 默认:禁用
|
||||
|
||||
26. **圣遗物筛选:已装备** (`holyRelicsEquipY`)
|
||||
28. **圣遗物筛选:已装备** (`holyRelicsEquipY`)
|
||||
- 类型:复选框
|
||||
- 描述:筛选已装备的圣遗物。
|
||||
- 默认:禁用
|
||||
|
||||
27. **圣遗物筛选:未装备** (`holyRelicsEquipN`)
|
||||
29. **圣遗物筛选:未装备** (`holyRelicsEquipN`)
|
||||
- 类型:复选框
|
||||
- 描述:筛选未装备的圣遗物。
|
||||
- 默认:禁用
|
||||
|
||||
28. **圣遗物筛选:来源(祝圣之霜定义)** (`holyRelicsSourceFrostSaint`)
|
||||
30. **圣遗物筛选:来源(祝圣之霜定义)** (`holyRelicsSourceFrostSaint`)
|
||||
- 类型:复选框
|
||||
- 描述:筛选来源为“祝圣之霜定义”的圣遗物。
|
||||
- 默认:禁用
|
||||
|
||||
29. **打开背包按键** (`knapsackKey`)
|
||||
31. **打开背包按键** (`knapsackKey`)
|
||||
- 类型:文本输入
|
||||
- 描述:设置打开背包的快捷键。
|
||||
- 默认:`B`
|
||||
|
||||
30. **日志开关** (`log_off`)
|
||||
32. **日志开关** (`log_off`)
|
||||
- 类型:复选框
|
||||
- 描述:启用日志记录,用于开发者调试。
|
||||
- 默认:禁用
|
||||
|
||||
## 版本历史
|
||||
|
||||
### 1.1.5 (2025-09-21)
|
||||
- **新增** **[1.1.5 新增]**:
|
||||
- 添加 `refreshSettingsByLanguage` 配置项,支持根据语言刷新设置列表的显示内容。
|
||||
- 添加 `language` 配置项,支持选择界面语言(简体中文、繁體中文、English、日本語、한국어)。
|
||||
- 更新界面标签,支持多语言动态显示。
|
||||
- **优化** **[1.1.5 新增]**:
|
||||
- 优化多语言模块,增强语言切换的流畅性和稳定性。
|
||||
- 改进 `languageMap` 管理,支持动态加载多语言配置文件。
|
||||
- 提高错误提示的友好性,语言切换失败时提供更清晰的反馈。
|
||||
|
||||
### 1.1.4 (2025-09-12)
|
||||
- **新增**:添加多语言模块框架,支持动态语言配置(当前仅实现简体中文 `zh-cn`,其他语言如英文 `en-us` 等尚未实现,期待其他作者贡献)。
|
||||
- **适配**:
|
||||
@@ -236,19 +258,21 @@
|
||||
- 改进错误提示,语言配置缺失时提供支持语言列表。
|
||||
|
||||
### 1.1.3 (2025-09-11)
|
||||
- **新增**:添加筛选圣遗物属性相关配置:
|
||||
- `coverSiftAttributeHolyRelic`:支持自定义筛选属性覆盖通用筛选属性。
|
||||
- `meetAllSiftAttributeHolyRelic`:支持严格要求满足所有子属性条件。
|
||||
- `commonSiftAttributeHolyRelic`:定义通用命中筛选属性。
|
||||
- `inputSiftAttributeHolyRelic`:支持自定义命中筛选属性。
|
||||
- 以上配置仅用于强化前的第一次圣遗物筛选。
|
||||
- **适配**
|
||||
- 圣遗物属性 待激活 属性适配
|
||||
- **新增** **[1.1.3 新增]**:
|
||||
- 添加筛选圣遗物属性相关配置:
|
||||
- `coverSiftAttributeHolyRelic`:支持自定义筛选属性覆盖通用筛选属性。
|
||||
- `meetAllSiftAttributeHolyRelic`:支持严格要求满足所有子属性条件。
|
||||
- `commonSiftAttributeHolyRelic`:定义通用命中筛选属性。
|
||||
- `inputSiftAttributeHolyRelic`:支持自定义命中筛选属性。
|
||||
- 以上配置仅用于强化前的第一次圣遗物筛选。
|
||||
- **适配**:
|
||||
- 圣遗物属性待激活属性适配。
|
||||
|
||||
## 其他
|
||||
|
||||
- **多语言适配(开发者)请注意**:
|
||||
- utils/languageUtils 为 多语言模块框架 的全部配置
|
||||
- assets/language/ 为 多语言模块框架 的本地语言匹配图片
|
||||
- utils/languageUtils 为 多语言模块框架 的全部配置
|
||||
- assets/language/ 为 多语言模块框架 的本地语言匹配图片
|
||||
|
||||
- **作者**:云端客
|
||||
- **脚本反馈邮箱**:doutianmianxia@qq.com
|
||||
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
BIN
repo/js/HolyRelicsUp/assets/language/zh-cn/未筛选满级.jpg
Normal file
BIN
repo/js/HolyRelicsUp/assets/language/zh-cn/未筛选满级.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
@@ -16,6 +16,12 @@ async function main(log_off = config.log_off) {
|
||||
return
|
||||
}
|
||||
|
||||
if (config.refreshSettingsByLanguage) {
|
||||
await refreshSettings()
|
||||
holyRelicsUpUtils.sendMessage(`update ${config.language} to settings ok`)
|
||||
return
|
||||
}
|
||||
|
||||
if (config.enableBatchUp) { // 检查是否启用
|
||||
if (config.toBag) {
|
||||
await wait(ms);
|
||||
@@ -43,10 +49,20 @@ async function main(log_off = config.log_off) {
|
||||
|
||||
await wait(ms);
|
||||
if (config.enableAttributeHolyRelic) {
|
||||
if (config.sortMain.includes('升序')) {
|
||||
|
||||
if (config.sortMain.includes(mana.get('asc_order'))) {
|
||||
throwError(`不支持在升序情况下使用`)
|
||||
}
|
||||
warn(`启用圣遗物强化命中功能(实验功能)`, must)
|
||||
if (config.meetAllSiftAttributeHolyRelic && config.upMax === 20) {
|
||||
await info(`开始验证...`,must)
|
||||
let valid = await validHitPreamble()
|
||||
//验证不属于 未选中满级 未选中未满级条件下
|
||||
if (!valid) {
|
||||
throwError(`启用圣遗物强化命中功能(实验功能)时,不支持降序选中满级|未满级条件下强化+20操作`)
|
||||
return
|
||||
}
|
||||
}
|
||||
await bathClickUpLv2(config.insertionMethod)
|
||||
} else {
|
||||
await bathClickUpLv1(config.insertionMethod)
|
||||
@@ -141,14 +157,20 @@ const LanguageMsgMap = languageUtils.getLanguageMsgMap()
|
||||
const LanguageKey = LanguageMap.get(settings.language)
|
||||
if (LanguageKey === null || !LanguageKey) {
|
||||
let languageMsg = LanguageMsgMap.get(settings.language)
|
||||
.replace('language-key',`${settings.language}`)
|
||||
.replace('languageList-key',`${Array.from(LanguageMap.keys()).join(',')}`)
|
||||
.replace('language-key', `${settings.language}`)
|
||||
.replace('languageList-key', `${Array.from(LanguageMap.keys()).join(',')}`)
|
||||
throwError(languageMsg)
|
||||
}
|
||||
const LanguageConfigJson = LanguageALLConfigMap.get(LanguageKey)
|
||||
//魔法值
|
||||
const mana = LanguageConfigJson.mana
|
||||
|
||||
//刷新设置列表
|
||||
async function refreshSettings() {
|
||||
await warn(JSON.stringify("settings==>" + LanguageConfigJson.settings), must)
|
||||
await holyRelicsUpUtils.updateSettingsFile(JSON.parse(LanguageConfigJson.settings))
|
||||
}
|
||||
|
||||
function siftAll() {
|
||||
//筛选条件
|
||||
let baseSiftArray = new Array()
|
||||
@@ -187,35 +209,42 @@ function sortAll() {
|
||||
}
|
||||
|
||||
const must = true
|
||||
const config = {
|
||||
suit: settings.suit,
|
||||
log_off: settings.log_off,
|
||||
countMaxByHoly: Math.floor(settings.countMaxByHoly),//筛选圣遗物界面最大翻页次数
|
||||
enableBatchUp: settings.enableBatchUp,//启用批量强化
|
||||
toBag: settings.toBag,//启用自动进入背包
|
||||
enableInsertionMethod: settings.enableInsertionMethod,//是否开启插入方式
|
||||
insertionMethod: settings.insertionMethod,//插入方式
|
||||
material: settings.material,//材料
|
||||
upMax: parseInt(settings.upMax + ''),//升级次数
|
||||
upMaxCount: settings.upMaxCount + '',//设置升级圣遗物个数
|
||||
knapsackKey: settings.knapsackKey,//背包快捷键
|
||||
toSort: settings.toSort,
|
||||
sortAuxiliary: settings.sortAuxiliary,//辅助排序
|
||||
sortMain: settings.sortMain,//主排序
|
||||
sortAttribute: settings.sortAttribute,//属性条件
|
||||
sortArray: (sortAll()),
|
||||
toSift: settings.toSift,
|
||||
siftArray: (siftAll()),//筛选条件
|
||||
enableAttributeHolyRelic: settings.enableAttributeHolyRelic,//启用圣遗物属性
|
||||
inputAttributeHolyRelic: settings.inputAttributeHolyRelic,//自定义圣遗物属性
|
||||
commonAttributeHolyRelic: settings.commonAttributeHolyRelic,//通用圣遗物属性
|
||||
coverAttributeHolyRelic: settings.coverAttributeHolyRelic,//覆盖圣遗物通用属性以部件为单位
|
||||
coverSiftAttributeHolyRelic: settings.coverSiftAttributeHolyRelic,//覆盖圣遗物通用属性以筛选条件为单位
|
||||
meetAllSiftAttributeHolyRelic: settings.meetAllSiftAttributeHolyRelic,//满足所有筛选条件
|
||||
commonSiftAttributeHolyRelic: settings.commonSiftAttributeHolyRelic,//通用筛选条件
|
||||
inputSiftAttributeHolyRelic: settings.inputSiftAttributeHolyRelic,//自定义筛选条件
|
||||
language: settings.language,
|
||||
}
|
||||
const config = settings.refreshSettingsByLanguage ?
|
||||
{
|
||||
language: settings.language,
|
||||
refreshSettingsByLanguage: settings.refreshSettingsByLanguage,
|
||||
}
|
||||
:
|
||||
{
|
||||
suit: settings.suit,
|
||||
log_off: settings.log_off,
|
||||
countMaxByHoly: Math.floor(settings.countMaxByHoly),//筛选圣遗物界面最大翻页次数
|
||||
enableBatchUp: settings.enableBatchUp,//启用批量强化
|
||||
toBag: settings.toBag,//启用自动进入背包
|
||||
enableInsertionMethod: settings.enableInsertionMethod,//是否开启插入方式
|
||||
insertionMethod: settings.insertionMethod,//插入方式
|
||||
material: settings.material,//材料
|
||||
upMax: parseInt(settings.upMax + ''),//升级次数
|
||||
upMaxCount: settings.upMaxCount + '',//设置升级圣遗物个数
|
||||
knapsackKey: settings.knapsackKey,//背包快捷键
|
||||
toSort: settings.toSort,
|
||||
sortAuxiliary: settings.sortAuxiliary,//辅助排序
|
||||
sortMain: settings.sortMain,//主排序
|
||||
sortAttribute: settings.sortAttribute,//属性条件
|
||||
sortArray: (sortAll()),
|
||||
toSift: settings.toSift,
|
||||
siftArray: (siftAll()),//筛选条件
|
||||
enableAttributeHolyRelic: settings.enableAttributeHolyRelic,//启用圣遗物属性
|
||||
inputAttributeHolyRelic: settings.inputAttributeHolyRelic,//自定义圣遗物属性
|
||||
commonAttributeHolyRelic: settings.commonAttributeHolyRelic,//通用圣遗物属性
|
||||
coverAttributeHolyRelic: settings.coverAttributeHolyRelic,//覆盖圣遗物通用属性以部件为单位
|
||||
coverSiftAttributeHolyRelic: settings.coverSiftAttributeHolyRelic,//覆盖圣遗物通用属性以筛选条件为单位
|
||||
meetAllSiftAttributeHolyRelic: settings.meetAllSiftAttributeHolyRelic,//满足所有筛选条件
|
||||
commonSiftAttributeHolyRelic: settings.commonSiftAttributeHolyRelic,//通用筛选条件
|
||||
inputSiftAttributeHolyRelic: settings.inputSiftAttributeHolyRelic,//自定义筛选条件
|
||||
language: settings.language,
|
||||
refreshSettingsByLanguage: settings.refreshSettingsByLanguage,
|
||||
}
|
||||
|
||||
|
||||
const genshinJson = {
|
||||
@@ -245,7 +274,10 @@ const commonHolyRelicPartMap = !config.enableAttributeHolyRelic ? [] : parseHoly
|
||||
const holyRelicPartMap = !config.enableAttributeHolyRelic ? [] : (!config.coverAttributeHolyRelic ? parseHolyRelicToMap() : takeDifferentHolyRelicToMap(parseHolyRelicToMap(), commonHolyRelicPartMap))
|
||||
|
||||
const commonHolyRelicPartMapBySift = !config.enableAttributeHolyRelic ? [] : parseHolyRelicToMap(config.commonSiftAttributeHolyRelic)
|
||||
const holyRelicPartMapBySift = !config.enableAttributeHolyRelic ? [] : (!config.coverSiftAttributeHolyRelic ? parseHolyRelicToMap(config.inputSiftAttributeHolyRelic) : takeDifferentHolyRelicToMap(parseHolyRelicToMap(config.inputSiftAttributeHolyRelic), commonHolyRelicPartMapBySift))
|
||||
const holyRelicPartMapBySift = !config.enableAttributeHolyRelic ? [] :
|
||||
(!config.coverSiftAttributeHolyRelic ? parseHolyRelicToMap(config.inputSiftAttributeHolyRelic) :
|
||||
takeDifferentHolyRelicToMap(parseHolyRelicToMap(config.inputSiftAttributeHolyRelic), commonHolyRelicPartMapBySift))
|
||||
warn('holyRelicPartMapBySift==>' + JSON.stringify(Array.from(holyRelicPartMapBySift)), must)
|
||||
|
||||
/**
|
||||
* 属性值替换函数
|
||||
@@ -678,17 +710,7 @@ async function openHolyRelicsKnapsack() {
|
||||
return re
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 重置筛选功能
|
||||
* 该函数用于在游戏界面中重置当前的筛选条件
|
||||
* 首先检查是否存在筛选按钮,如果存在则点击打开筛选面板
|
||||
* 然后检查是否存在重置按钮,如果存在则点击进行重置操作
|
||||
* 每次操作后都有短暂的延迟以确保界面响应
|
||||
* @returns {Promise<boolean>} - 返回一个Promise,表示异步操作的完成
|
||||
* <前置条件:处于圣遗物背包 筛选界面|测试通过:v>
|
||||
*/
|
||||
async function resetSift() {
|
||||
async function openSift() {
|
||||
let ms = 600
|
||||
let siftJson = getJsonPath('sift')
|
||||
let templateMatchJson = {
|
||||
@@ -705,10 +727,72 @@ async function resetSift() {
|
||||
await wait(ms);
|
||||
// 判断筛选按钮是否存在
|
||||
let exist = isExist(sift);
|
||||
let exist1 = false
|
||||
if (exist) {
|
||||
await info('打开筛选'); // 记录日志:打开筛选
|
||||
await sift.click(); // 点击筛选按钮
|
||||
// await wait(ms);
|
||||
}
|
||||
return exist
|
||||
}
|
||||
async function validHitPreamble(){
|
||||
let ms = 600
|
||||
let open_sift = await openSift()
|
||||
if (!open_sift) {
|
||||
throwError(`验证出错==>未打开筛选界面`)
|
||||
return true
|
||||
}
|
||||
let notLevelNotMax = getJsonPath('not_level_not_max', false)
|
||||
let notLevelMax = getJsonPath('not_level_max', false)
|
||||
|
||||
let jsonNLNM = {
|
||||
path_base: notLevelNotMax.path,
|
||||
text: notLevelNotMax.name,
|
||||
type: notLevelNotMax.type,
|
||||
}
|
||||
let jsonNLM = {
|
||||
path_base: notLevelMax.path,
|
||||
text: notLevelMax.name,
|
||||
type: notLevelMax.type,
|
||||
}
|
||||
let tmNLNM = await templateMatchFindByJson(jsonNLNM)
|
||||
let tmNLM = await templateMatchFindByJson(jsonNLM)
|
||||
await wait(ms)
|
||||
//跳出筛选页面
|
||||
downClick(genshinJson.width / 2, genshinJson.height / 2)
|
||||
|
||||
//属于 未选中满级 未选中未满级条件下
|
||||
return isExist(tmNLNM) && isExist(tmNLM)
|
||||
}
|
||||
/**
|
||||
* 重置筛选功能
|
||||
* 该函数用于在游戏界面中重置当前的筛选条件
|
||||
* 首先检查是否存在筛选按钮,如果存在则点击打开筛选面板
|
||||
* 然后检查是否存在重置按钮,如果存在则点击进行重置操作
|
||||
* 每次操作后都有短暂的延迟以确保界面响应
|
||||
* @returns {Promise<boolean>} - 返回一个Promise,表示异步操作的完成
|
||||
* <前置条件:处于圣遗物背包 筛选界面|测试通过:v>
|
||||
*/
|
||||
async function resetSift() {
|
||||
let ms = 600
|
||||
/* let siftJson = getJsonPath('sift')
|
||||
let templateMatchJson = {
|
||||
path_base: siftJson.path,
|
||||
text: siftJson.name,
|
||||
type: siftJson.type,
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: genshinJson.width / 3.0,
|
||||
height: genshinJson.height
|
||||
}
|
||||
// 查找筛选按钮元素
|
||||
let sift = templateMatchFindByJson(templateMatchJson)
|
||||
await wait(ms);*/
|
||||
// 判断筛选按钮是否存在
|
||||
let exist = await openSift();
|
||||
let exist1 = false
|
||||
if (exist) {
|
||||
/* await info('打开筛选'); // 记录日志:打开筛选
|
||||
await sift.click(); // 点击筛选按钮*/
|
||||
await wait(ms);
|
||||
|
||||
// const resetRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("${path_base_main}重置.jpg"), 0, 0, genshinJson.width / 3.0, genshinJson.height);
|
||||
@@ -1043,7 +1127,7 @@ async function openUpSort() {
|
||||
// 检查OCR识别结果是否存在(即升序按钮是否可见)
|
||||
if (isExist(templateMatch)) {
|
||||
// 更新按钮名称为选中状态
|
||||
up_name = '升序'
|
||||
up_name = mana.get('asc_order')
|
||||
// 点击升序按钮
|
||||
templateMatch.click()
|
||||
// 记录切换成功的日志信息
|
||||
@@ -1289,40 +1373,6 @@ async function getSubFirstDifferentValues(sub1, sub2) {
|
||||
return diffJson;
|
||||
}
|
||||
|
||||
async function ocrTestHolyRelic() {
|
||||
//逻辑模拟
|
||||
let key = parseHolyRelicToMap()
|
||||
let holyRelic = await ocrHolyRelicName();
|
||||
let one = await ocrAttributeHolyRelic()
|
||||
//需要识别部件名称 todo:
|
||||
let name = holyRelic.name
|
||||
if (!key.get(name)) {
|
||||
// 未命中圣遗物部件跳过 '@杯#攻击力%#火伤&*暴击伤害*元素精通|@冠#攻击力%#暴击率&*暴击伤害*元素精通'
|
||||
warn("未命中圣遗物部件跳过")
|
||||
} else if (key.get(name) && !key.get(name).main.includes(one.main)) {
|
||||
//未命中主属性跳过
|
||||
warn("未命中主属性跳过")
|
||||
}
|
||||
//强化开始
|
||||
//...省略
|
||||
//强化完成
|
||||
let two = await ocrAttributeHolyRelic()
|
||||
let diffJson = await getSubFirstDifferentValues(one.sub, two.sub)
|
||||
warn('diffJson==>' + JSON.stringify(diffJson))
|
||||
let upKey
|
||||
if (diffJson.length > 0) {
|
||||
upKey = diffJson.diff[diffJson.length - 1]
|
||||
} else {
|
||||
warn('新版本3词条显示4词条可能识别到 取最后一条')
|
||||
//新版本3词条显示4词条可能识别到 取最后一条
|
||||
upKey = two.sub[two.sub.length - 1]
|
||||
}
|
||||
if (key.get(name) && !key.get(name).sub.includes(upKey)) {
|
||||
//未命中子属性跳过
|
||||
warn("未命中子属性跳过")
|
||||
}
|
||||
}
|
||||
|
||||
async function ocrHolyRelicName() {
|
||||
let holyRelic = {
|
||||
name: null,//部件名称
|
||||
@@ -1402,7 +1452,7 @@ async function ocrAttributeHolyRelic() {
|
||||
holyRelicAttribute.value = mainVRes.text
|
||||
|
||||
if (holyRelicAttribute.value.includes('%') && AttributeHolyRelickeys.includes(holyRelicAttribute.main)) {
|
||||
holyRelicAttribute.main = holyRelicAttribute.main + '百分比'
|
||||
holyRelicAttribute.main = holyRelicAttribute.main + mana.get('percentage')
|
||||
}
|
||||
captureRegion = openCaptureGameRegion(); // 截取游戏画面
|
||||
let subList = new Array()
|
||||
@@ -1834,9 +1884,10 @@ async function clickProgressBarTopByHolyRelics() {
|
||||
width: genshinJson.width / 3.0,
|
||||
height: genshinJson.height
|
||||
}
|
||||
await wait(ms)
|
||||
// 查找筛选按钮元素
|
||||
let sift = await templateMatchFindByJson(templateMatchJson)
|
||||
|
||||
await wait(ms)
|
||||
// let templateMatch = await templateMatch(`${path_base_main}确认.jpg`, 0, 0, Math.floor(genshinJson.width / 2), Math.floor(genshinJson.height / 2))
|
||||
// logInfoTemplate(templateMatch)
|
||||
if (isExist(sift)) {
|
||||
@@ -2448,13 +2499,7 @@ async function UpClickLv1(operate, source = 'UpClickLv1', log_off = config.log_o
|
||||
let holyRelic = await ocrHolyRelicName()
|
||||
name = holyRelic.name
|
||||
await wait(ms)
|
||||
if (!holyRelicPartMap.get(name)) {
|
||||
reJson.start = false
|
||||
reJson.missed = true
|
||||
reJson.missedMsg = `未命中圣遗物部件${Array.from(holyRelicPartMap.keys()).join(',')}跳过`
|
||||
warn(reJson.missedMsg)
|
||||
return reJson
|
||||
}
|
||||
|
||||
warn(`执行`)
|
||||
if (operate === '阶段放入') {
|
||||
count = upMax / 4;
|
||||
@@ -2464,24 +2509,36 @@ async function UpClickLv1(operate, source = 'UpClickLv1', log_off = config.log_o
|
||||
let one = await ocrAttributeHolyRelic()
|
||||
|
||||
if (i < 1) {
|
||||
if (holyRelicPartMap.get(name) && holyRelicPartMap.get(name).main.length > 0 && !holyRelicPartMap.get(name).main.includes(one.main)) {
|
||||
//未命中主属性跳过
|
||||
reJson.start = false
|
||||
reJson.missed = true
|
||||
reJson.missedMsg = `未命中主属性${JSON.stringify(holyRelicPartMap.get(name).main.join(','))}跳过`
|
||||
await warn(reJson.missedMsg)
|
||||
return reJson
|
||||
}
|
||||
|
||||
if (config.meetAllSiftAttributeHolyRelic) {
|
||||
//&&操作
|
||||
let meetCount = 0
|
||||
if (!holyRelicPartMapBySift.get(name)) {
|
||||
warn("holyRelicPartMapBySift==>" + JSON.stringify(Array.from(holyRelicPartMapBySift)));
|
||||
reJson.start = false
|
||||
reJson.missed = true
|
||||
reJson.missedMsg = `未命中圣遗物部件${Array.from(holyRelicPartMapBySift.keys()).join(',')}跳过`
|
||||
warn(reJson.missedMsg)
|
||||
return reJson
|
||||
}
|
||||
|
||||
if (holyRelicPartMapBySift.get(name) && holyRelicPartMapBySift.get(name).main.length > 0 && !holyRelicPartMapBySift.get(name).main.includes(one.main)) {
|
||||
//未命中主属性跳过
|
||||
warn("holyRelicPartMapBySift==>" + JSON.stringify(Array.from(holyRelicPartMapBySift)));
|
||||
reJson.start = false
|
||||
reJson.missed = true
|
||||
reJson.missedMsg = `未命中主属性${JSON.stringify(holyRelicPartMapBySift.get(name).main.join(','))}跳过`
|
||||
await warn(reJson.missedMsg)
|
||||
return reJson
|
||||
}
|
||||
|
||||
one.sub.forEach((item) => {
|
||||
if (holyRelicPartMapBySift.get(name).sub.includes(item.name)) {
|
||||
if (holyRelicPartMapBySift.get(name) && holyRelicPartMapBySift.get(name).sub.includes(item.name)) {
|
||||
meetCount++
|
||||
}
|
||||
})
|
||||
|
||||
if (meetCount !== one.sub.length) {
|
||||
warn("holyRelicPartMap==>" + JSON.stringify(Array.from(holyRelicPartMap)));
|
||||
//未命中全部子属性跳过
|
||||
reJson.start = false
|
||||
reJson.missed = true
|
||||
@@ -2490,7 +2547,27 @@ async function UpClickLv1(operate, source = 'UpClickLv1', log_off = config.log_o
|
||||
return reJson
|
||||
}
|
||||
} else {
|
||||
if (!holyRelicPartMap.get(name)) {
|
||||
warn("holyRelicPartMap==>" + JSON.stringify(Array.from(holyRelicPartMap)));
|
||||
reJson.start = false
|
||||
reJson.missed = true
|
||||
reJson.missedMsg = `未命中圣遗物部件${Array.from(holyRelicPartMap.keys()).join(',')}跳过`
|
||||
warn(reJson.missedMsg)
|
||||
return reJson
|
||||
}
|
||||
|
||||
if (holyRelicPartMap.get(name) && holyRelicPartMap.get(name).main.length > 0 && !holyRelicPartMap.get(name).main.includes(one.main)) {
|
||||
//未命中主属性跳过
|
||||
warn("holyRelicPartMap==>" + JSON.stringify(Array.from(holyRelicPartMap)));
|
||||
reJson.start = false
|
||||
reJson.missed = true
|
||||
reJson.missedMsg = `未命中主属性${JSON.stringify(holyRelicPartMap.get(name).main.join(','))}跳过`
|
||||
await warn(reJson.missedMsg)
|
||||
return reJson
|
||||
}
|
||||
|
||||
if (holyRelicPartMapBySift.get(name) && holyRelicPartMapBySift.get(name).sub.length > 0 && !one.sub.find((item => holyRelicPartMapBySift.get(name).sub.includes(item.name)))) {
|
||||
warn("holyRelicPartMap==>" + JSON.stringify(Array.from(holyRelicPartMap)));
|
||||
//未命中子属性跳过
|
||||
reJson.start = false
|
||||
reJson.missed = true
|
||||
@@ -2501,6 +2578,7 @@ async function UpClickLv1(operate, source = 'UpClickLv1', log_off = config.log_o
|
||||
}
|
||||
} else {
|
||||
if (holyRelicPartMap.get(name) && holyRelicPartMap.get(name).sub.length > 0 && !one.sub.find((item => holyRelicPartMap.get(name).sub.includes(item.name)))) {
|
||||
warn("holyRelicPartMap==>" + JSON.stringify(Array.from(holyRelicPartMap)));
|
||||
//未命中子属性跳过
|
||||
reJson.start = false
|
||||
reJson.missed = true
|
||||
@@ -2799,7 +2877,7 @@ async function bathClickUpLv1(operate, source = 'bathClickUpLv1', log_off = conf
|
||||
break
|
||||
}
|
||||
|
||||
if (config.sortMain.includes('降序') && isDown) {
|
||||
if (config.sortMain.includes(mana.get('desc_order')) && isDown) {
|
||||
base_y = Math.floor(genshinJson.height * 270 / 1080)
|
||||
}
|
||||
|
||||
@@ -2810,7 +2888,7 @@ async function bathClickUpLv1(operate, source = 'bathClickUpLv1', log_off = conf
|
||||
warn(`i:${i},base_count_x:${base_count_x},base_count_y:${base_count_y},x:${x},y:${y}`)
|
||||
lastJson.t_y = y
|
||||
lastJson.t_x = x
|
||||
let isBool = config.sortMain.includes('降序') && config.upMax < 20;
|
||||
let isBool = config.sortMain.includes(mana.get('desc_order')) && config.upMax < 20;
|
||||
if (isBool) {
|
||||
if (i < 1) {
|
||||
//强制拉到顶
|
||||
@@ -2898,8 +2976,8 @@ async function bathClickUpLv1(operate, source = 'bathClickUpLv1', log_off = conf
|
||||
await templateMatchClickByJson(upJson, `圣遗物已经强化到+${config.upMax}退出强化页面 到圣遗物背包界面`, source, log_off)
|
||||
//返回圣遗物背包
|
||||
if (!re.start) {
|
||||
if (!config.sortMain.includes('降序')) {
|
||||
await clickProgressBarTopByHolyRelics()
|
||||
if (!config.sortMain.includes(mana.get('desc_order'))) {
|
||||
// await clickProgressBarTopByHolyRelics()
|
||||
}
|
||||
continue
|
||||
}
|
||||
@@ -2978,7 +3056,7 @@ async function bathClickUpLv2(operate, source = 'bathClickUpLv2', log_off = conf
|
||||
break
|
||||
}
|
||||
|
||||
if (config.sortMain.includes('降序') && isDown) {
|
||||
if (config.sortMain.includes(mana.get('desc_order')) && isDown) {
|
||||
base_y = Math.floor(genshinJson.height * 270 / 1080)
|
||||
}
|
||||
|
||||
@@ -2989,7 +3067,7 @@ async function bathClickUpLv2(operate, source = 'bathClickUpLv2', log_off = conf
|
||||
warn(`i:${i},base_count_x:${base_count_x},base_count_y:${base_count_y},x:${x},y:${y}`)
|
||||
lastJson.t_y = y
|
||||
lastJson.t_x = x
|
||||
let isBool = config.sortMain.includes('降序') && config.upMax < 20;
|
||||
let isBool = config.sortMain.includes(mana.get('desc_order')) && config.upMax < 20;
|
||||
if (isBool) {
|
||||
if (i < 1) {
|
||||
//强制拉到顶
|
||||
@@ -3094,8 +3172,8 @@ async function bathClickUpLv2(operate, source = 'bathClickUpLv2', log_off = conf
|
||||
await templateMatchClickByJson(upJson, `${msg_log},退出强化页面 到圣遗物背包界面`, source, log_off)
|
||||
//返回圣遗物背包
|
||||
if (re.missed || !re.start) {
|
||||
if (!config.sortMain.includes('降序')) {
|
||||
await clickProgressBarTopByHolyRelics()
|
||||
if (!config.sortMain.includes(mana.get('desc_order'))) {
|
||||
// await clickProgressBarTopByHolyRelics()
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "圣遗物批量强化",
|
||||
"version": "1.1.4",
|
||||
"version": "1.1.5",
|
||||
"description": "一个批量强化圣遗物的脚本",
|
||||
"settings_ui": "settings.json",
|
||||
"main": "main.js",
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
[
|
||||
{
|
||||
"name": "refreshSettingsByLanguage",
|
||||
"type": "checkbox",
|
||||
"label": "<优先级最高>根据语言刷新设置列表\n<優先級最高>根據語言重新整理設置列表\n<Highest priority>Refresh the settings list based on language\n<最高優先順位>言語に基づいて設定リストを更新する\n<최우선 순위>언어에 따라 설정 목록을 새로 고침",
|
||||
"default": false
|
||||
},
|
||||
{
|
||||
"name": "language",
|
||||
"type": "select",
|
||||
@@ -75,7 +81,7 @@
|
||||
{
|
||||
"name": "enableAttributeHolyRelic",
|
||||
"type": "checkbox",
|
||||
"label": "启用命中属性\n(默认关闭,不支持在升序情况下使用)-实验功能",
|
||||
"label": "启用命中属性\n(默认关闭,\n不支持在升序情况下使用,\n不支持降序选中满级|未满级条件下强化+20操作)-实验功能",
|
||||
"default": false
|
||||
},
|
||||
{
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
function info(msg, must = false,log_off=false) {
|
||||
function info(msg, must = false, log_off = false) {
|
||||
if (log_off || must) {
|
||||
log.info(msg)
|
||||
}
|
||||
}
|
||||
|
||||
function warn(msg, must = false,log_off=false) {
|
||||
function warn(msg, must = false, log_off = false) {
|
||||
if (log_off || must) {
|
||||
log.warn(msg)
|
||||
}
|
||||
}
|
||||
|
||||
function debug(msg, must = false,log_off=false) {
|
||||
function debug(msg, must = false, log_off = false) {
|
||||
if (log_off || must) {
|
||||
log.debug(msg)
|
||||
}
|
||||
}
|
||||
|
||||
function error(msg, must = false,log_off=false) {
|
||||
function error(msg, must = false, log_off = false) {
|
||||
if (log_off || must) {
|
||||
log.error(msg)
|
||||
}
|
||||
@@ -24,6 +24,7 @@ function error(msg, must = false,log_off=false) {
|
||||
|
||||
function throwError(msg) {
|
||||
notification.error(`${msg}`);
|
||||
throw new Error(msg);
|
||||
}
|
||||
|
||||
function openCaptureGameRegion() {
|
||||
@@ -81,6 +82,39 @@ function isExist(res) {
|
||||
return res.isExist() // 调用资源对象的isExist方法获取存在状态
|
||||
}
|
||||
|
||||
function sendMessage(msg) {
|
||||
notification.Send(msg);
|
||||
}
|
||||
|
||||
// 更新settings.json文件
|
||||
async function updateSettingsFile(settingsArray) {
|
||||
const settingsPath = "./settings.json";
|
||||
// let settingsArray = JSON.parse(await file.readText(settingsPath));
|
||||
if (!(settingsArray.length >= 2)) {
|
||||
try {
|
||||
// 读取现有设置
|
||||
const content = file.readTextSync(settingsPath);
|
||||
settingsArray = JSON.parse(content);
|
||||
} catch (e) {
|
||||
// 文件不存在或解析失败时创建默认设置
|
||||
throw new Error("设置文件不存在");
|
||||
}
|
||||
warn("设置文件格式不正确,请检查settings.json文件", true)
|
||||
}
|
||||
let json = JSON.stringify(settingsArray, null, 2)
|
||||
.replaceAll(']"', ']')
|
||||
.replaceAll('"[','[')
|
||||
.replaceAll('\\"', '"')
|
||||
.replaceAll('\\\\n', '\\n')
|
||||
// warn("settings==>"+json, true)
|
||||
// 写入更新后的设置
|
||||
const success = file.writeTextSync(settingsPath, json);
|
||||
if (!success) {
|
||||
throwError("写入设置文件失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.holyRelicsUpUtils = {
|
||||
isExist,
|
||||
info,
|
||||
@@ -98,5 +132,7 @@ this.holyRelicsUpUtils = {
|
||||
upLeftButton,
|
||||
moveByMouse,
|
||||
wait,
|
||||
downClick
|
||||
downClick,
|
||||
updateSettingsFile,
|
||||
sendMessage,
|
||||
};
|
||||
@@ -85,7 +85,8 @@ function getLanguageALLConfigMap() {
|
||||
['consecration_oil_paste', {name: '祝圣油膏', type: '.jpg'}],
|
||||
['consecration_essence', {name: '祝圣精华', type: '.jpg'}],
|
||||
['level_sort', {name: '等级顺序排序', type: '.jpg'}],
|
||||
// ['level_not_max', {name: '筛选未满级', type: '.jpg'}],
|
||||
['not_level_not_max', {name: '未筛选未满级', type: '.jpg'}],
|
||||
['not_level_max', {name: '未筛选满级', type: '.jpg'}],
|
||||
['info', {name: '详情', type: '.jpg'}],
|
||||
// ['up_materials_select', {name: '请选择升级材料', type: '.jpg'}],
|
||||
// ['morra_need', {name: '需要摩拉', type: '.jpg'}],
|
||||
@@ -108,6 +109,245 @@ function getLanguageALLConfigMap() {
|
||||
['percentage', '百分比'],
|
||||
['toBeActivated', '(待激活)']
|
||||
]),
|
||||
settings:JSON.stringify([
|
||||
{
|
||||
"name": "refreshSettingsByLanguage",
|
||||
"type": "checkbox",
|
||||
"label": "<优先级最高>根据语言刷新设置列表\n<優先級最高>根據語言重新整理設置列表\n<Highest priority>Refresh the settings list based on language\n<最高優先順位>言語に基づいて設定リストを更新する\n<최우선 순위>언어에 따라 설정 목록을 새로 고침",
|
||||
"default": false
|
||||
},
|
||||
{
|
||||
"name": "language",
|
||||
"type": "select",
|
||||
"label": "语言|語言|Language|言語|언어",
|
||||
"options": [
|
||||
"简体中文",
|
||||
"繁體中文",
|
||||
"English",
|
||||
"日本語",
|
||||
"한국어",
|
||||
],
|
||||
"default": "简体中文"
|
||||
},
|
||||
{
|
||||
"name": "toBag",
|
||||
"type": "checkbox",
|
||||
"label": "启用自动进入背包",
|
||||
"default": true
|
||||
},
|
||||
{
|
||||
"name": "enableBatchUp",
|
||||
"type": "checkbox",
|
||||
"label": "启用批量强化(注:可单独使用单独使用时\n请处于圣遗物背包筛选未满级状态后)",
|
||||
"default": false
|
||||
},
|
||||
{
|
||||
"name": "enableInsertionMethod",
|
||||
"type": "checkbox",
|
||||
"label": "自动启用放入方式 快捷放入/阶段放入(优先级高)",
|
||||
"default": false
|
||||
},
|
||||
{
|
||||
"name": "insertionMethod",
|
||||
"type": "select",
|
||||
"label": "放入方式(默认:自动识别,\n注意:最大强化等级设置为4,8,16时\n强制使用放入方式为阶段放入)",
|
||||
"options": [
|
||||
"默认",
|
||||
"快捷放入",
|
||||
"阶段放入"
|
||||
],
|
||||
"default": "默认"
|
||||
},
|
||||
{
|
||||
"name": "material",
|
||||
"type": "select",
|
||||
"label": "选择素材(默认:自动识别)\n(消失太快无法识别禁用)",
|
||||
"options": [
|
||||
"默认",
|
||||
"1星素材",
|
||||
"2星及以下素材",
|
||||
"3星及以下素材",
|
||||
"4星及以下素材"
|
||||
],
|
||||
"default": "默认"
|
||||
},
|
||||
{
|
||||
"name": "upMaxCount",
|
||||
"type": "input-text",
|
||||
"label": "最大圣遗物强化个数",
|
||||
"default": ""
|
||||
},
|
||||
{
|
||||
"name": "upMax",
|
||||
"type": "select",
|
||||
"label": "最大强化等级(默认4)",
|
||||
"options": [
|
||||
"4",
|
||||
"8",
|
||||
"16",
|
||||
"20"
|
||||
],
|
||||
"default": "4"
|
||||
},
|
||||
{
|
||||
"name": "enableAttributeHolyRelic",
|
||||
"type": "checkbox",
|
||||
"label": "启用命中属性\n(默认关闭,\n不支持在升序情况下使用,\n不支持降序选中满级|未满级条件下强化+20操作)-实验功能",
|
||||
"default": false
|
||||
},
|
||||
{
|
||||
"name": "coverAttributeHolyRelic",
|
||||
"type": "checkbox",
|
||||
"label": "启用自定义命中属性覆盖通用命中属性\n(默认开启,以部件为单位,不启用则使用自定义命中属性)-实验功能",
|
||||
"default": true
|
||||
},
|
||||
{
|
||||
"name": "commonAttributeHolyRelic",
|
||||
"type": "input-text",
|
||||
"label": "通用命中属性\n(编写语法请查看文档)-实验功能",
|
||||
"default": "@花*爆率*爆伤|@羽*爆率*爆伤|@沙*爆率*爆伤|@冠#爆率#爆伤&*爆率*爆伤|@杯#物伤#风伤#水伤#火伤#雷伤#岩伤#冰伤#草伤&*爆率*爆伤"
|
||||
},
|
||||
{
|
||||
"name": "inputAttributeHolyRelic",
|
||||
"type": "input-text",
|
||||
"label": "自定义命中属性\n(编写语法请查看文档)-实验功能",
|
||||
"default": ""
|
||||
},
|
||||
{
|
||||
"name": "coverSiftAttributeHolyRelic",
|
||||
"type": "checkbox",
|
||||
"label": "启用筛选圣遗物自定义命中属性覆盖筛选圣遗物通用命中属性\n(默认开启,以部件为单位,不启用则使用自定义属性)-实验功能",
|
||||
"default": true
|
||||
},
|
||||
{
|
||||
"name": "meetAllSiftAttributeHolyRelic",
|
||||
"type": "checkbox",
|
||||
"label": "启用筛选圣遗物满足所有指定的子属性命中条件\n(默认关闭)-实验功能",
|
||||
"default": false
|
||||
},
|
||||
{
|
||||
"name": "commonSiftAttributeHolyRelic",
|
||||
"type": "input-text",
|
||||
"label": "筛选圣遗物通用命中属性\n(编写语法请查看文档)-实验功能",
|
||||
"default": "@花*爆率*爆伤|@羽*爆率*爆伤|@沙*爆率*爆伤|@冠#爆率#爆伤&*爆率*爆伤|@杯#物伤#风伤#水伤#火伤#雷伤#岩伤#冰伤#草伤&*爆率*爆伤"
|
||||
},
|
||||
{
|
||||
"name": "inputSiftAttributeHolyRelic",
|
||||
"type": "input-text",
|
||||
"label": "筛选圣遗物自定义命中属性\n(编写语法请查看文档)-实验功能",
|
||||
"default": ""
|
||||
},
|
||||
{
|
||||
"name": "toSort",
|
||||
"type": "checkbox",
|
||||
"label": "启用自动排序(未启用时以下配置 排序 均无效)",
|
||||
"default": true
|
||||
},
|
||||
{
|
||||
"name": "sortAttribute",
|
||||
"type": "input-text",
|
||||
"label": "属性排序(使用|分割)\n可使用简称如: 生命%|雷伤|充能",
|
||||
"default": ""
|
||||
},
|
||||
{
|
||||
"name": "sortMain",
|
||||
"type": "select",
|
||||
"label": "主排序",
|
||||
"options": [
|
||||
"升序",
|
||||
"降序",
|
||||
],
|
||||
"default": "升序"
|
||||
},
|
||||
{
|
||||
"name": "sortAuxiliary",
|
||||
"type": "select",
|
||||
"label": "辅助排序",
|
||||
"options": [
|
||||
"等级顺序",
|
||||
"品质顺序",
|
||||
],
|
||||
"default": "等级顺序"
|
||||
},
|
||||
{
|
||||
"name": "toSift",
|
||||
"type": "checkbox",
|
||||
"label": "启用筛选圣遗物开关(未启用时以下配置 圣遗物筛选 均无效)",
|
||||
"default": true
|
||||
},
|
||||
{
|
||||
"name": "suit",
|
||||
"type": "input-text",
|
||||
"label": "圣遗物筛选(使用|分割 的模糊匹配 <无个数限制>如: 如雷|苍白|...)",
|
||||
"default": ""
|
||||
},
|
||||
{
|
||||
"name": "countMaxByHoly",
|
||||
"type": "select",
|
||||
"label": "筛选圣遗物界面最大翻页次数 (默认4)",
|
||||
"options": [
|
||||
"1",
|
||||
"2",
|
||||
"3",
|
||||
"4",
|
||||
"5",
|
||||
"6",
|
||||
"7",
|
||||
"8",
|
||||
],
|
||||
"default": "4"
|
||||
},
|
||||
{
|
||||
"name": "holyRelicsLockMark",
|
||||
"type": "checkbox",
|
||||
"label": "圣遗物筛选:(锁定状态)|标记",
|
||||
"default": false
|
||||
},
|
||||
{
|
||||
"name": "holyRelicsLockY",
|
||||
"type": "checkbox",
|
||||
"label": "圣遗物筛选:(锁定状态)|仅锁定",
|
||||
"default": false
|
||||
},
|
||||
{
|
||||
"name": "holyRelicsLockN",
|
||||
"type": "checkbox",
|
||||
"label": "圣遗物筛选:(锁定状态)|未锁定",
|
||||
"default": false
|
||||
},
|
||||
{
|
||||
"name": "holyRelicsEquipY",
|
||||
"type": "checkbox",
|
||||
"label": "圣遗物筛选:(装备状态)|已装备",
|
||||
"default": false
|
||||
},
|
||||
{
|
||||
"name": "holyRelicsEquipN",
|
||||
"type": "checkbox",
|
||||
"label": "圣遗物筛选:(装备状态)|未装备",
|
||||
"default": false
|
||||
},
|
||||
{
|
||||
"name": "holyRelicsSourceFrostSaint",
|
||||
"type": "checkbox",
|
||||
"label": "圣遗物筛选:(来源)|祝圣之霜定义",
|
||||
"default": false
|
||||
},
|
||||
{
|
||||
"name": "knapsackKey",
|
||||
"type": "input-text",
|
||||
"label": "打开背包按键(不填,默认:B)",
|
||||
"default": "B"
|
||||
},
|
||||
{
|
||||
"name": "log_off",
|
||||
"type": "checkbox",
|
||||
"label": "日志开关(用于开发者调试-日志输出为中文)",
|
||||
"default": false
|
||||
}
|
||||
])
|
||||
,
|
||||
|
||||
}
|
||||
],
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user