@@ -1,4 +1,4 @@
|
|||||||
(async function () {
|
(async function() {
|
||||||
|
|
||||||
function logTimeTaken(startTime) {
|
function logTimeTaken(startTime) {
|
||||||
const currentTime = Date.now();
|
const currentTime = Date.now();
|
||||||
@@ -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;
|
||||||
|
|
||||||
@@ -75,19 +78,27 @@
|
|||||||
if ((i + 1) % statueTimes === 0) { // 判断当前循环次数否达到去神像设置值
|
if ((i + 1) % statueTimes === 0) { // 判断当前循环次数否达到去神像设置值
|
||||||
await genshin.tpToStatueOfTheSeven();
|
await genshin.tpToStatueOfTheSeven();
|
||||||
await AutoPath(`好感-张牙舞爪的恶党-触发位置(二净甸)`);
|
await AutoPath(`好感-张牙舞爪的恶党-触发位置(二净甸)`);
|
||||||
} else if (!await comparePosition()){ // 对比触发位置坐标,如果不符合预期坐标则重新执行触发线路
|
} else if (!await comparePosition()) { // 对比触发位置坐标,如果不符合预期坐标则重新执行触发线路
|
||||||
log.info(`导航至突发任务(张牙舞爪的恶党)触发位置(二净甸)`);
|
log.info(`导航至突发任务(张牙舞爪的恶党)触发位置(二净甸)`);
|
||||||
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);
|
||||||
@@ -104,8 +115,8 @@
|
|||||||
let goStatue = settings.goStatue ? settings.goStatue : false;
|
let goStatue = settings.goStatue ? settings.goStatue : false;
|
||||||
let statueTimes = goStatue ? (isNaN(settings.statueTimes) ? 5 : settings.statueTimes) : 0;
|
let statueTimes = goStatue ? (isNaN(settings.statueTimes) ? 5 : settings.statueTimes) : 0;
|
||||||
// 卡时间相关参数
|
// 卡时间相关参数
|
||||||
if(settings.waitTimeMode){
|
if (settings.waitTimeMode) {
|
||||||
let maxTimes = settings.maxTimes ? settings.maxTimes : runTimes ;
|
let maxTimes = settings.maxTimes ? settings.maxTimes : runTimes;
|
||||||
let waitTimeModeDay = settings.waitTimeModeDay
|
let waitTimeModeDay = settings.waitTimeModeDay
|
||||||
const datePattern = /^\d{4}-\d{2}-\d{2}$/; // 日期正则
|
const datePattern = /^\d{4}-\d{2}-\d{2}$/; // 日期正则
|
||||||
if (!datePattern.test(settings.waitTimeModeDay)) {
|
if (!datePattern.test(settings.waitTimeModeDay)) {
|
||||||
@@ -118,11 +129,11 @@
|
|||||||
const timeDiff = now.getTime() - benchmark.getTime();
|
const timeDiff = now.getTime() - benchmark.getTime();
|
||||||
const daysDiff = Math.floor(timeDiff / (1000 * 60 * 60 * 24));
|
const daysDiff = Math.floor(timeDiff / (1000 * 60 * 60 * 24));
|
||||||
let period = Number(settings.waitTimeModePeriod);
|
let period = Number(settings.waitTimeModePeriod);
|
||||||
if(isNaN(period)){
|
if (isNaN(period)) {
|
||||||
log.warn(`错误的卡时间模式周期 ${period}!使用 7 天作为周期。`);
|
log.warn(`错误的卡时间模式周期 ${period}!使用 7 天作为周期。`);
|
||||||
period = 7.0;
|
period = 7.0;
|
||||||
}
|
}
|
||||||
if(period < 1 || period > 48){
|
if (period < 1 || period > 48) {
|
||||||
log.warn(`卡时间模式周期 ${period} 超过范围!使用 7 天作为周期。`);
|
log.warn(`卡时间模式周期 ${period} 超过范围!使用 7 天作为周期。`);
|
||||||
period = 7.0;
|
period = 7.0;
|
||||||
}
|
}
|
||||||
@@ -159,7 +170,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
const startTime = Date.now();
|
const startTime = Date.now();
|
||||||
await AutoFriendship(runTimes,statueTimes,GetMeatMode,startTime);
|
await AutoFriendship(runTimes, statueTimes, GetMeatMode, startTime);
|
||||||
log.info(`兽肉好感运行总时长:${LogTimeTaken(startTime)}`);
|
log.info(`兽肉好感运行总时长:${LogTimeTaken(startTime)}`);
|
||||||
|
|
||||||
})();
|
})();
|
||||||
@@ -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": [
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user