mirror of
https://github.com/babalae/better-genshin-impact.git
synced 2026-05-08 00:24:12 +08:00
* 修改调度器任务和部分独立任务失去焦点时,强制切换回游戏窗口,如果用常规的方式无法激活窗口,则第10次会尝试最小化所有窗口后激活游戏。 * 去除未引入的类引用 * 修正战斗结束后,大概率打开队伍界面的问题 * 修复有些电脑上因未知原因,战斗0秒打断 * 把失焦激活放入了设置-通用设置-其他设置中,默认关闭。暂停恢复时,重置移动的起始时间,防止因暂停而导致超时放弃任务。 * 在调度器里面的任务之前,增加月卡处理,解决4点如果未进入任务会卡住的问题。增加了日志分析小怪详细。解决日志分析兜底结束日期不生效的问题。 * 在设置=》其他设置中 增加调度器任务传送过程中自动领取探索奖励功能配置。 * 调整自动派遣后恢复原任务的逻辑 * 自动领取派遣奖励时,跳过异常,防止整个配置组任务被打断。 * 把打开大地图方法从TpTask中抽出为公共方法,自动领取派遣代码调整到了调度器中。 * 去除了未使用的引用 * 暂停恢复逻辑增加恢复中条件和非空判断 * 增加了临时暂停自动拾取的逻辑(RunnerContext.AutoPickTriggerStopCount 为0时不限制,大于0时停止,多次暂停会累加该值,每次恢复-1),支持嵌套情况的暂停,在自动派遣(和结束后5秒)或暂停调度器任务时,同时暂停自动拾取功能。 * 调整暂停拾取方法 * 调整个日志输出 * 路径追踪复苏时,暂停拾取 * 增加根据点位配置,支持能在点位未识别情况下,使用大地图中心点的方式来定位,从而支持像铜锁小岛处这种小地图无法识别的点位。调整了对未识别点位的默认逻辑,未配置点位配置情况下,未识别点位,会取上一个识别的点位,从而支持在某些地方断续小地图能识别情况下的脚本。 * Changes * 修复暂停后,距离过远,小地图无法识别时,无限取当前一个坐标,导致无法正常恢复的问题。调度器管理增加了按天为单位的周期配置,适用于批量执行时,无需人工判断当天执行哪个任务。 * 调度器配置增加,或开启万叶拾取,并且不存在万叶,但配置了万叶队伍情况下,会切换队伍进行拾取。
67 lines
1.9 KiB
C#
67 lines
1.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using BetterGenshinImpact.GameTask.AutoPathing.Model;
|
|
|
|
namespace BetterGenshinImpact.GameTask.AutoPathing.Suspend;
|
|
|
|
//暂停逻辑相关实现,这里主要用来记录,用来恢复相应操作
|
|
public class PathExecutorSuspend(PathExecutor pathExecutor) : ISuspendable
|
|
{
|
|
private bool _isSuspended;
|
|
|
|
private bool _resuming = false;
|
|
//记录当前相关点位数组
|
|
private (int, List<WaypointForTrack>) _waypoints;
|
|
|
|
//记录当前点位
|
|
private (int, WaypointForTrack) _waypoint;
|
|
|
|
public bool IsSuspended => _isSuspended;
|
|
|
|
public void Suspend()
|
|
{
|
|
_waypoints = pathExecutor.CurWaypoints;
|
|
_waypoint = pathExecutor.CurWaypoint;
|
|
_isSuspended = true;
|
|
_resuming = false;
|
|
//暂停时记录,获取点位的暂停标志
|
|
pathExecutor.GetPositionAndTimeSuspendFlag = true;
|
|
}
|
|
|
|
//路径过远时,检查地图追踪点位经过暂停(当前点位和后一个点位算经过暂停),并重置状态
|
|
public bool CheckAndResetSuspendPoint()
|
|
{
|
|
if (_isSuspended || !_resuming)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
if (pathExecutor.CurWaypoints == default || pathExecutor.CurWaypoint == default)
|
|
{
|
|
Reset();
|
|
return false;
|
|
}
|
|
if (pathExecutor.CurWaypoints == _waypoints && (pathExecutor.CurWaypoint == _waypoint || (pathExecutor.CurWaypoint.Item1 - 1) == _waypoint.Item1))
|
|
{
|
|
return true;
|
|
}
|
|
|
|
Reset();
|
|
return false;
|
|
}
|
|
|
|
public void Resume()
|
|
{
|
|
//暂定恢复时,重置移动时的时间,防止因暂停而导致超时
|
|
pathExecutor.moveToStartTime = DateTime.UtcNow;
|
|
_isSuspended = false;
|
|
_resuming = true;
|
|
}
|
|
|
|
public void Reset()
|
|
{
|
|
_resuming = false;
|
|
_waypoints = default;
|
|
_waypoint = default;
|
|
}
|
|
} |