js:自动狗粮1.3.5 (#1163)

* js:自动狗粮1.3.4

* js:自动狗粮1.3.5
This commit is contained in:
mno
2025-06-22 09:22:40 +08:00
committed by GitHub
parent 6a93e6f78b
commit 266e034f86
3 changed files with 21 additions and 10 deletions

View File

@@ -1,4 +1,4 @@
# 自动好感与全富6A1B狗粮脚本
# 自动好感pro狗粮脚本
**重要免责声明:**
@@ -16,7 +16,7 @@
使用即表示您已阅读并同意上述条款。
**Last Updated:** 2025-06-21
**Last Updated:** 2025-06-22
---
@@ -129,6 +129,10 @@
3. 在执行过程中,确保游戏窗口保持在前台,避免干扰。
## 更新日志
### 1.3.52025.06.22
1.修复了对于四星狗粮数量的错误处理造成的统计结果中收益为负的问题
### 1.3.42025.06.21
1.优化了换队伍的逻辑
### 1.3.32025.06.21
1.尝试修复好感战斗超时时程序异常终止的问题
### 1.23.42025.06.16

View File

@@ -220,6 +220,9 @@ const DEFAULT_FIGHT_TIMEOUT_SECONDS = 120;
// 启用自动拾取的实时任务
dispatcher.addTimer(new RealtimeTimer("AutoPick"));
//切换至好感队
await switchPartyIfNeeded(friendshipPartyName);
let runnedTimes = 0;
wait: {
@@ -229,7 +232,6 @@ const DEFAULT_FIGHT_TIMEOUT_SECONDS = 120;
if (operationType !== "不卡时间ab交替运行") {
// 输出结果
log.info(`预期开始狗粮时间: ${endTime.toTimeString().slice(0, 8)}`);
// 检查当前时间是否晚于 endTime
if (timeNow > endTime) {
log.warn('无需卡时间')
@@ -305,10 +307,8 @@ const DEFAULT_FIGHT_TIMEOUT_SECONDS = 120;
break artifacts;
}
// 开始运行狗粮路线
//切换至狗粮队
await switchPartyIfNeeded(grindPartyName);
let runArtifactsResult = true;
runArtifactsResult = await runArtifactsPaths(runRouteA);
runArtifactsResult = await runArtifactsPaths(runRouteA, grindPartyName);
const result2 = await decomposeArtifacts(settings.keep4Star, settings.doDecompose);
// 计算 mora 和 artifactExperience 的差值
const moraDiff = Number(result2.mora) - Number(result1.mora); // 将字符串转换为数字后计算差值
@@ -340,8 +340,10 @@ const DEFAULT_FIGHT_TIMEOUT_SECONDS = 120;
//完成剩下好感
if (runnedTimes < settings.minTimesForFirendship) {
//切换至好感队
await switchPartyIfNeeded(friendshipPartyName);
// 验证超时设置
const ocrTimeout = validateTimeoutSetting(settings.ocrTimeout, DEFAULT_OCR_TIMEOUT_SECONDS, "OCR");
const fightTimeout = validateTimeoutSetting(settings.fightTimeout, DEFAULT_FIGHT_TIMEOUT_SECONDS, "战斗");
@@ -391,7 +393,7 @@ async function writeRecordFile(lastRunDate, lastEndTime, lastRunRoute, records,
}
//运行狗粮路线的逻辑
async function runArtifactsPaths(runRouteA) {
async function runArtifactsPaths(runRouteA, grindPartyName) {
// 根据 runRouteA 的值给 runningRoute 赋值
const runningRoute = runRouteA ? "A" : "B";
@@ -438,6 +440,10 @@ async function runArtifactsPaths(runRouteA) {
}
// 启用自动拾取的实时任务
dispatcher.addTimer(new RealtimeTimer("AutoPick"));
//切换至狗粮队
await switchPartyIfNeeded(grindPartyName);
// 运行普通路线
{
// 读取文件夹中的文件名并处理
@@ -1097,7 +1103,7 @@ async function decomposeArtifacts(keep4Star, doDecompose) {
log.warn(`在指定区域未识别到有效数字: ${initialValue}`);
}
let regionToCheck3 = { x: 100, y: 885, width: 170, height: 50 };
let decomposedNum = await recognizeTextInRegion(regionToCheck3);
let decomposedNum = 0;
let firstNumber = 0;
let firstNumber2 = 0;
@@ -1109,7 +1115,7 @@ async function decomposeArtifacts(keep4Star, doDecompose) {
await click(370, 1020); // 点击“确认选择”按钮
await sleep(1500);
decomposedNum = await recognizeTextInRegion(regionToCheck3);
// 使用正则表达式提取第一个数字
const match = decomposedNum.match(/已选(\d+)/);
@@ -1118,6 +1124,7 @@ async function decomposeArtifacts(keep4Star, doDecompose) {
if (match) {
// 将匹配到的第一个数字转换为数字类型并存储在变量中
firstNumber = Number(match[1]);
log.info(`1-4星总数量: ${firstNumber}`);
} else {
log.info("识别失败");
}

View File

@@ -1,7 +1,7 @@
{
"manifest_version": 1,
"name": "自动狗粮重制版",
"version": "1.3.3",
"version": "1.3.5",
"tags": ["好感", "盗宝团", "愚人众", "鳄鱼", "兽肉", "狗粮"],
"description": "通过不同好感任务卡时间后运行狗粮任务以提高狗粮总收益,需要正确配置好感队伍的战斗策略,并在自定义配置中指定好感和狗粮队伍名称",
"authors": [