JS脚本:兽肉好感:fix:判断本轮是否执行完毕,并对代码格式化 (#561)

fix部分:86-102
This commit is contained in:
起个名字好难的喵
2025-04-12 10:44:17 +08:00
committed by GitHub
parent 02d78bce52
commit 00df712e0c
2 changed files with 152 additions and 141 deletions

View File

@@ -32,7 +32,10 @@
} }
async function comparePosition() { async function comparePosition() {
const targetPosition = { X: 3615.48, Y: -521.27 }; const targetPosition = {
X: 3615.48,
Y: -521.27
};
const maxDistance = 20; const maxDistance = 20;
let currentPosition; let currentPosition;
@@ -80,14 +83,22 @@
await AutoPath(`好感-张牙舞爪的恶党-触发位置(二净甸)`); await AutoPath(`好感-张牙舞爪的恶党-触发位置(二净甸)`);
notification.send(`已抵达突发任务(张牙舞爪的恶党)触发位置`); notification.send(`已抵达突发任务(张牙舞爪的恶党)触发位置`);
} }
if (await comparePosition()){ // 开启急速拾取
dispatcher.addTimer(new RealtimeTimer("AutoPick", {
"forceInteraction": true
}));
log.info(`当前次数:${i + 1}/${runTimes}`); log.info(`当前次数:${i + 1}/${runTimes}`);
dispatcher.addTimer(new RealtimeTimer("AutoPick", { "forceInteraction": true }));
await AutoPath(`好感-张牙舞爪的恶党-循环${GetMeatMode ? '(二净甸刷肉版)' : '(二净甸)'}`); await AutoPath(`好感-张牙舞爪的恶党-循环${GetMeatMode ? '(二净甸刷肉版)' : '(二净甸)'}`);
dispatcher.addTimer(new RealtimeTimer("AutoPick", { "forceInteraction": false })); // 关闭急速拾取
dispatcher.addTimer(new RealtimeTimer("AutoPick", {
"forceInteraction": false
}));
// 判定本轮循环是否执行完毕
if (await comparePosition()) {
log.info(`已完成次数:${i + 1}/${runTimes}`); log.info(`已完成次数:${i + 1}/${runTimes}`);
} else { } else {
i = i - 1; // 退回这次次数 i = i - 1; // 退回这次次数
log.warn(`判定本轮循环执行失败,退回本轮执行次数:${i + 1}/${runTimes}`);
} }
const estimatedCompletion = calculateEstimatedCompletion(startTime, i + 1, runTimes); const estimatedCompletion = calculateEstimatedCompletion(startTime, i + 1, runTimes);
logTimeTaken(startTime); logTimeTaken(startTime);

View File

@@ -1,7 +1,7 @@
{ {
"manifest_version": 1, "manifest_version": 1,
"name": "兽肉好感:自动好感度&刷两只鳄鱼兽肉&卡时间", "name": "兽肉好感:自动好感度&刷两只鳄鱼兽肉&卡时间",
"version": "1.3.1", "version": "1.3.2",
"description": "通过突发事件:张牙舞爪的恶党刷兽肉并顺带获取好感度超过10次后不再获取请使用满员好感度队伍并为全体队伍角色配置相应的战斗策略", "description": "通过突发事件:张牙舞爪的恶党刷兽肉并顺带获取好感度超过10次后不再获取请使用满员好感度队伍并为全体队伍角色配置相应的战斗策略",
"authors": [ "authors": [
{ {