Compare commits
44
Commits
feat/script
...
0.40
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9a421860d0 | ||
|
|
edaf5ac443 | ||
|
|
0468854ac5 | ||
|
|
af0a869c70 | ||
|
|
f0baf74dc8 | ||
|
|
8862f57958 | ||
|
|
bd72e6420d | ||
|
|
8c45a02deb | ||
|
|
9ba3447ab1 | ||
|
|
218029b2e6 | ||
|
|
718db28e51 | ||
|
|
b639b1902e | ||
|
|
e97e04f9db | ||
|
|
4b65370e9f | ||
|
|
5259b1f351 | ||
|
|
1afeb0818a | ||
|
|
99ab38d950 | ||
|
|
1d5f5c772e | ||
|
|
869050283b | ||
|
|
bb692a476e | ||
|
|
518ed95dbe | ||
|
|
987e723b8c | ||
|
|
3c84f3817d | ||
|
|
6beb9fddba | ||
|
|
020c841bc2 | ||
|
|
b445c71e52 | ||
|
|
a5e1478ecf | ||
|
|
158688d435 | ||
|
|
8caa52e988 | ||
|
|
82275bd1e5 | ||
|
|
4129510029 | ||
|
|
917ba1460d | ||
|
|
3cc3eb44a4 | ||
|
|
29f219aee9 | ||
|
|
1af75ecc64 | ||
|
|
39d7422ab9 | ||
|
|
12cc958705 | ||
|
|
197e991a89 | ||
|
|
6ee4318d24 | ||
|
|
6fcc0685e6 | ||
|
|
0b17dc30fe | ||
|
|
919818a424 | ||
|
|
28cc3fb3e3 | ||
|
|
ae954fceb8 |
No files matched your search
Binary file not shown.
@@ -10,7 +10,7 @@
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<ApplicationIcon>Assets\Images\logo.ico</ApplicationIcon>
|
||||
<AssemblyName>BetterGI</AssemblyName>
|
||||
<AssemblyVersion>0.39.4</AssemblyVersion>
|
||||
<AssemblyVersion>0.40.0</AssemblyVersion>
|
||||
<Platforms>x64</Platforms>
|
||||
<DebugType>embedded</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -17,6 +17,7 @@ using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
using BetterGenshinImpact.GameTask.AutoTrackPath;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Config;
|
||||
|
||||
@@ -175,7 +176,11 @@ public partial class AllConfig : ObservableObject
|
||||
/// 原神按键绑定配置
|
||||
/// </summary>
|
||||
public KeyBindingsConfig KeyBindingsConfig { get; set; } = new();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 传送相关配置
|
||||
/// </summary>
|
||||
public TpConfig TpConfig { get; set; } = new();
|
||||
[JsonIgnore]
|
||||
public Action? OnAnyChangedAction { get; set; }
|
||||
|
||||
@@ -188,7 +193,6 @@ public partial class AllConfig : ObservableObject
|
||||
NotificationConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
NotificationConfig.PropertyChanged += OnNotificationPropertyChanged;
|
||||
KeyBindingsConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
|
||||
AutoPickConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
AutoSkipConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
AutoFishingConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
@@ -200,7 +204,7 @@ public partial class AllConfig : ObservableObject
|
||||
AutoFightConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
AutoDomainConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
AutoMusicGameConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
|
||||
TpConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
ScriptConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
PathingConditionConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
}
|
||||
|
||||
@@ -69,6 +69,10 @@ public partial class PathingPartyConfig : ObservableObject
|
||||
[ObservableProperty]
|
||||
private bool _soloTaskUseFightEnabled = false;
|
||||
|
||||
//不在某时执行
|
||||
[ObservableProperty]
|
||||
private string _skipDuring = "";
|
||||
|
||||
// 使用小道具的间隔时间
|
||||
[ObservableProperty]
|
||||
private int _useGadgetIntervalMs = 0;
|
||||
|
||||
@@ -436,6 +436,7 @@ public class AutoDomainTask : ISoloTask
|
||||
finally
|
||||
{
|
||||
Logger.LogInformation("自动战斗线程结束");
|
||||
combatScenes.AfterTask();
|
||||
}
|
||||
}, cts.Token);
|
||||
|
||||
|
||||
@@ -25,6 +25,13 @@ public partial class AutoFightConfig : ObservableObject
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _fightFinishDetectEnabled = true;
|
||||
/// <summary>
|
||||
/// 根据技能CD优化出招人员
|
||||
/// 根据填入人或人和cd,来决定当此人元素战技cd未结束时,跳过此人出招,来优化战斗流程,可填入人名或人名数字(用逗号分隔),
|
||||
/// 多种用分号分隔,例如:白术;钟离,12;,如果人名,则用内置cd检查,如果是人名和数字,则把数字当做出招cd(秒)。
|
||||
/// </summary>
|
||||
[ObservableProperty] private string _actionSchedulerByCd = "";
|
||||
|
||||
[Serializable]
|
||||
public partial class FightFinishDetectConfig : ObservableObject
|
||||
{
|
||||
|
||||
@@ -26,6 +26,7 @@ public class AutoFightParam : BaseTaskParam
|
||||
FightFinishDetectEnabled = autoFightConfig.FightFinishDetectEnabled;
|
||||
PickDropsAfterFightEnabled = autoFightConfig.PickDropsAfterFightEnabled;
|
||||
KazuhaPickupEnabled = autoFightConfig.KazuhaPickupEnabled;
|
||||
ActionSchedulerByCd = autoFightConfig.ActionSchedulerByCd;
|
||||
|
||||
FinishDetectConfig.FastCheckEnabled = autoFightConfig.FinishDetectConfig.FastCheckEnabled;
|
||||
FinishDetectConfig.FastCheckParams = autoFightConfig.FinishDetectConfig.FastCheckParams;
|
||||
@@ -47,6 +48,7 @@ public class AutoFightParam : BaseTaskParam
|
||||
public int Timeout { get; set; } = 120;
|
||||
|
||||
public bool KazuhaPickupEnabled = true;
|
||||
public string ActionSchedulerByCd = "";
|
||||
|
||||
|
||||
}
|
||||
@@ -202,6 +202,7 @@ public class AutoFightTask : ISoloTask
|
||||
throw new Exception("识别队伍角色失败");
|
||||
}
|
||||
|
||||
var actionSchedulerByCd = ParseStringToDictionary(_taskParam.ActionSchedulerByCd);
|
||||
var combatCommands = _combatScriptBag.FindCombatScript(combatScenes.Avatars);
|
||||
|
||||
// 新的取消token
|
||||
@@ -221,7 +222,8 @@ public class AutoFightTask : ISoloTask
|
||||
return;
|
||||
}*/
|
||||
var fightEndFlag = false;
|
||||
string lastFighttName = "";
|
||||
string lastFightName = "";
|
||||
string skipFightName = "";
|
||||
//统计切换人打架次数
|
||||
var countFight = 0;
|
||||
// 战斗操作
|
||||
@@ -242,6 +244,34 @@ public class AutoFightTask : ISoloTask
|
||||
break;
|
||||
}
|
||||
|
||||
//根据元素技能冷却事件优化出招流程,只有当人物切换后才会触发检查
|
||||
double skillCd;
|
||||
if (lastFightName != command.Name && actionSchedulerByCd.TryGetValue(command.Name,out skillCd))
|
||||
{
|
||||
var avatar = combatScenes.SelectAvatar(command.Name);
|
||||
if (avatar == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (skillCd < 0)
|
||||
{
|
||||
skillCd = FindMax([avatar.SkillCd,avatar.SkillHoldCd]);
|
||||
}
|
||||
var dif=(DateTime.UtcNow - avatar.LastSkillTime);
|
||||
//当技能未冷却时,跳过此次出招
|
||||
if ((DateTime.UtcNow -avatar.LastSkillTime).TotalSeconds < skillCd)
|
||||
{
|
||||
if (skipFightName != command.Name)
|
||||
{
|
||||
Logger.LogInformation($"{command.Name}cd冷却为{skillCd}秒,剩余{skillCd-dif.TotalSeconds}秒,跳过此次行动");
|
||||
}
|
||||
skipFightName = command.Name;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
command.Execute(combatScenes);
|
||||
//统计战斗人次
|
||||
if (i == combatCommands.Count - 1 || command.Name != combatCommands[i + 1].Name)
|
||||
@@ -249,7 +279,7 @@ public class AutoFightTask : ISoloTask
|
||||
countFight++;
|
||||
}
|
||||
|
||||
lastFighttName = command.Name;
|
||||
lastFightName = command.Name;
|
||||
if (!fightEndFlag && _taskParam is { FightFinishDetectEnabled: true })
|
||||
{
|
||||
//处于最后一个位置,或者当前执行人和下一个人名字不一样的情况,满足一定条件(开启快速检查,并且检查时间大于0或人名存在配置)检查战斗
|
||||
@@ -341,7 +371,7 @@ public class AutoFightTask : ISoloTask
|
||||
{
|
||||
var time = DateTime.UtcNow - kazuha.LastSkillTime;
|
||||
//当万叶cd大于3时或战斗人次少于2时(通常无怪物情况下),此时不再触发万叶拾取,
|
||||
if (!(countFight < 2 || lastFighttName == "枫原万叶" && time.TotalSeconds > 3))
|
||||
if (!(countFight < 2 || lastFightName == "枫原万叶" && time.TotalSeconds > 3))
|
||||
{
|
||||
Logger.LogInformation("使用枫原万叶长E拾取掉落物");
|
||||
await Delay(300, ct);
|
||||
@@ -470,6 +500,53 @@ public class AutoFightTask : ISoloTask
|
||||
(g >= 240 && g <= 255) &&
|
||||
(b >= 240 && b <= 255);
|
||||
}
|
||||
static double FindMax(double[] numbers)
|
||||
{
|
||||
if (numbers == null || numbers.Length == 0)
|
||||
{
|
||||
throw new ArgumentException("The array is empty or null.");
|
||||
}
|
||||
|
||||
double max = numbers[0]>10000 ? 0 : numbers[0];
|
||||
foreach (var num in numbers)
|
||||
{
|
||||
var cpnum = numbers[0]>10000 ? 0 : num;
|
||||
max = Math.Max(max, num);
|
||||
}
|
||||
|
||||
return max;
|
||||
}
|
||||
private static Dictionary<string, double> ParseStringToDictionary(string input,double defaultValue=-1)
|
||||
{
|
||||
var dictionary = new Dictionary<string, double>();
|
||||
|
||||
if (string.IsNullOrEmpty(input))
|
||||
{
|
||||
return dictionary; // 返回空字典
|
||||
}
|
||||
|
||||
string[] pairs = input.Split(';', StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
foreach (var pair in pairs)
|
||||
{
|
||||
var parts = pair.Split(',', StringSplitOptions.TrimEntries);
|
||||
|
||||
if (parts.Length > 0)
|
||||
{
|
||||
string name = parts[0];
|
||||
double value = defaultValue;
|
||||
|
||||
if (parts.Length > 1 && double.TryParse(parts[1], out var parsedValue))
|
||||
{
|
||||
value = parsedValue;
|
||||
}
|
||||
|
||||
dictionary[name] = value;
|
||||
}
|
||||
}
|
||||
|
||||
return dictionary;
|
||||
}
|
||||
|
||||
private bool HasFightFlagByYolo(ImageRegion imageRegion)
|
||||
{
|
||||
|
||||
@@ -31,7 +31,7 @@ public class CombatScenes : IDisposable
|
||||
/// <summary>
|
||||
/// 当前配队
|
||||
/// </summary>
|
||||
public Avatar[] Avatars { get; set; } = Array.Empty<Avatar>();
|
||||
public Avatar[] Avatars { get; set; } = [];
|
||||
|
||||
public Dictionary<string, Avatar> AvatarMap { get; set; } = [];
|
||||
|
||||
@@ -70,6 +70,7 @@ public class CombatScenes : IDisposable
|
||||
{
|
||||
throw new Exception("当前处于联机状态,但是队伍人数超过4人,无法识别");
|
||||
}
|
||||
|
||||
// 联机状态下判断
|
||||
var onePRa = imageRegion.Find(AutoFightAssets.Instance.OnePRa);
|
||||
var p = "p";
|
||||
@@ -246,6 +247,21 @@ public class CombatScenes : IDisposable
|
||||
}
|
||||
}
|
||||
|
||||
public void AfterTask()
|
||||
{
|
||||
var mwk = SelectAvatar("玛薇卡");
|
||||
if (mwk != null)
|
||||
{
|
||||
foreach (var avatar in Avatars)
|
||||
{
|
||||
if (avatar.Name != "玛薇卡")
|
||||
{
|
||||
avatar.Switch();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Avatar? SelectAvatar(string name)
|
||||
{
|
||||
return AvatarMap.GetValueOrDefault(name);
|
||||
@@ -381,4 +397,4 @@ public class CombatScenes : IDisposable
|
||||
{
|
||||
_predictor.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using BetterGenshinImpact.GameTask.Common;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace BetterGenshinImpact.GameTask.AutoGeniusInvokation;
|
||||
|
||||
@@ -9,9 +11,17 @@ public class AutoGeniusInvokationTask(GeniusInvokationTaskParam taskParam) : ISo
|
||||
|
||||
public Task Start(CancellationToken ct)
|
||||
{
|
||||
// 读取策略信息
|
||||
var duel = ScriptParser.Parse(taskParam.StrategyContent);
|
||||
duel.Run(ct);
|
||||
try
|
||||
{
|
||||
// 读取策略信息
|
||||
var duel = ScriptParser.Parse(taskParam.StrategyContent);
|
||||
duel.Run(ct);
|
||||
}
|
||||
catch (System.Exception e)
|
||||
{
|
||||
TaskControl.Logger.LogDebug(e, "执行自动七圣召唤任务异常");
|
||||
TaskControl.Logger.LogError("执行自动七圣召唤任务异常:{Exception}", e.Message);
|
||||
}
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -117,7 +117,7 @@ public class ScriptParser
|
||||
var characterAndSkill = line.Split('{');
|
||||
|
||||
var parts = characterAndSkill[0].Split('=');
|
||||
character.Index = int.Parse(RegexHelper.ExcludeNumberRegex().Replace(parts[0], ""));
|
||||
character.Index = int.Parse(RegexHelper.ExcludeNumberRegex().Replace(parts[0].Trim(), ""));
|
||||
MyAssert(character.Index >= 1 && character.Index <= 3, "角色序号必须在1-3之间");
|
||||
|
||||
if (parts[1].Contains('|'))
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using BetterGenshinImpact.Core.Recognition;
|
||||
using BetterGenshinImpact.GameTask.AutoGeniusInvokation.Exception;
|
||||
using BetterGenshinImpact.GameTask.AutoMusicGame.Assets;
|
||||
using BetterGenshinImpact.GameTask.Common.BgiVision;
|
||||
using BetterGenshinImpact.GameTask.Model.Area;
|
||||
@@ -27,6 +30,10 @@ public class AutoAlbumTask(AutoMusicGameParam taskParam) : ISoloTask
|
||||
Logger.LogInformation("开始自动演奏整个专辑未完成的音乐");
|
||||
await StartOneAlbum(ct);
|
||||
}
|
||||
catch (NormalEndException e)
|
||||
{
|
||||
Logger.LogError("手动取消任务 - {Msg}", e.Message);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.LogError("自动音乐专辑任务异常:{Msg}", e.Message);
|
||||
@@ -35,10 +42,20 @@ public class AutoAlbumTask(AutoMusicGameParam taskParam) : ISoloTask
|
||||
|
||||
public async Task StartOneAlbum(CancellationToken ct)
|
||||
{
|
||||
using var iconRa = CaptureToRectArea().Find(AutoMusicAssets.Instance.UiLeftTopAlbumIcon);
|
||||
using var ra1 = CaptureToRectArea();
|
||||
using var iconRa = ra1.Find(AutoMusicAssets.Instance.UiLeftTopAlbumIcon);
|
||||
if (!iconRa.IsExist())
|
||||
{
|
||||
throw new Exception("当前未处于专辑界面,请在专辑界面运行本任务");
|
||||
throw new Exception("当前未处于主题专辑界面,请在专辑界面运行本任务。注意全部歌曲列表页面无法运行本任务!");
|
||||
}
|
||||
else
|
||||
{
|
||||
// OCR 后再次判断,区分是否是全部歌曲页面
|
||||
var ocrRes = ra1.DeriveCrop(iconRa.Right, iconRa.Top, ra1.Width * 0.16, iconRa.Height).FindMulti(RecognitionObject.OcrThis);
|
||||
if (ocrRes.Any(region => region.Text.Contains("全部")))
|
||||
{
|
||||
throw new Exception("当前在全部歌曲页面,此页面无法运行本任务。请返回到主界面选择专辑列表中以国家为主题的专辑页!");
|
||||
}
|
||||
}
|
||||
|
||||
var musicLevel = TaskContext.Instance().Config.AutoMusicGameConfig.MusicLevel;
|
||||
@@ -46,13 +63,14 @@ public class AutoAlbumTask(AutoMusicGameParam taskParam) : ISoloTask
|
||||
{
|
||||
musicLevel = "传说";
|
||||
}
|
||||
|
||||
Logger.LogInformation("自动音游乐曲难度等级:{Text}", musicLevel);
|
||||
|
||||
|
||||
// 遍历4个难度等级
|
||||
var defaultDifficultyLevels = new[]
|
||||
{
|
||||
("普通", 480, 600, AutoMusicAssets.Instance.MusicCanorusLevel1),
|
||||
("困难", 800, 600, AutoMusicAssets.Instance.MusicCanorusLevel2),
|
||||
("困难", 800, 600, AutoMusicAssets.Instance.MusicCanorusLevel2),
|
||||
("大师", 1150, 600, AutoMusicAssets.Instance.MusicCanorusLevel3),
|
||||
("传说", 1400, 600, AutoMusicAssets.Instance.MusicCanorusLevel4)
|
||||
};
|
||||
@@ -66,34 +84,52 @@ public class AutoAlbumTask(AutoMusicGameParam taskParam) : ISoloTask
|
||||
foreach (var (difficultyName, xPos, yPos, canorusAsset) in difficultyLevels)
|
||||
{
|
||||
Logger.LogInformation("开始演奏{Difficulty}难度的乐曲", difficultyName);
|
||||
|
||||
|
||||
// 每个难度12首曲子
|
||||
for (int i = 0; i < 13; i++)
|
||||
{
|
||||
using var canoraRa = CaptureToRectArea().Find(canorusAsset);
|
||||
if (canoraRa.IsExist())
|
||||
if (TaskContext.Instance().Config.AutoMusicGameConfig.MustCanorusLevel)
|
||||
{
|
||||
Logger.LogInformation("乐曲{Num} - {Difficulty}级别:已完成【大音天籁】,切换下一首", i + 1, difficultyName);
|
||||
GameCaptureRegion.GameRegion1080PPosClick(310, 220);
|
||||
await Delay(800, ct);
|
||||
continue;
|
||||
using var canoraRa = CaptureToRectArea().Find(canorusAsset);
|
||||
if (canoraRa.IsExist())
|
||||
{
|
||||
Logger.LogInformation("乐曲{Num} - {Difficulty}级别:已完成【大音天籁】,切换下一首", i + 1, difficultyName);
|
||||
GameCaptureRegion.GameRegion1080PPosClick(310, 220);
|
||||
await Delay(800, ct);
|
||||
continue;
|
||||
}
|
||||
|
||||
Logger.LogInformation("第{Num}首{Difficulty}难度的乐曲:{Message}", i + 1, difficultyName, "没有完成【大音天籁】");
|
||||
}
|
||||
else
|
||||
{
|
||||
using var doneRa = CaptureToRectArea().Find(AutoMusicAssets.Instance.AlbumMusicComplate);
|
||||
if (doneRa.IsExist())
|
||||
{
|
||||
Logger.LogInformation("当前乐曲{Num}所有奖励已领取,切换下一首", i + 1);
|
||||
GameCaptureRegion.GameRegion1080PPosClick(310, 220);
|
||||
await Delay(800, ct);
|
||||
continue;
|
||||
}
|
||||
|
||||
Logger.LogInformation("当前乐曲{Num}存在未领取奖励,前往演奏", i + 1);
|
||||
}
|
||||
|
||||
Logger.LogInformation("第{Num}首{Difficulty}难度的乐曲:{Message}", i + 1, difficultyName, "没有完成【大音天籁】");
|
||||
|
||||
|
||||
|
||||
// 点击确认按钮
|
||||
Bv.ClickWhiteConfirmButton(CaptureToRectArea());
|
||||
await Delay(800, ct);
|
||||
|
||||
|
||||
// 选择难度
|
||||
GameCaptureRegion.GameRegion1080PPosClick(xPos, yPos);
|
||||
await Delay(200, ct);
|
||||
|
||||
|
||||
// 开始演奏
|
||||
Bv.ClickWhiteConfirmButton(CaptureToRectArea());
|
||||
await Delay(500, ct);
|
||||
|
||||
using var cts = new CancellationTokenSource();
|
||||
var cts = new CancellationTokenSource();
|
||||
ct.Register(cts.Cancel);
|
||||
|
||||
// 演奏结束检查任务
|
||||
@@ -118,16 +154,16 @@ public class AutoAlbumTask(AutoMusicGameParam taskParam) : ISoloTask
|
||||
// 等待任意一个任务完成
|
||||
await Task.WhenAny(checkTask, musicTask);
|
||||
await cts.CancelAsync();
|
||||
|
||||
|
||||
Logger.LogInformation("第{Num}首{Difficulty}难度乐曲演奏完成", i + 1, difficultyName);
|
||||
await Delay(2000, ct);
|
||||
|
||||
|
||||
await Bv.WaitUntilFound(AutoMusicAssets.Instance.UiLeftTopAlbumIcon, ct);
|
||||
Logger.LogDebug("切换到下一首乐曲");
|
||||
GameCaptureRegion.GameRegion1080PPosClick(310, 220);
|
||||
await Delay(800, ct);
|
||||
}
|
||||
|
||||
|
||||
Logger.LogInformation("完成{Difficulty}难度所有乐曲的演奏", difficultyName);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,10 @@ namespace BetterGenshinImpact.GameTask.AutoMusicGame;
|
||||
[Serializable]
|
||||
public partial class AutoMusicGameConfig : ObservableObject
|
||||
{
|
||||
// 自动达到大音天籁的级别
|
||||
[ObservableProperty]
|
||||
private bool _mustCanorusLevel = false;
|
||||
|
||||
// 乐曲级别
|
||||
[ObservableProperty]
|
||||
private string _musicLevel = "";
|
||||
|
||||
@@ -6,6 +6,7 @@ public class MoveModeEnum(string code, string msg)
|
||||
{
|
||||
public static readonly MoveModeEnum Walk = new("walk", "步行");
|
||||
public static readonly MoveModeEnum Run = new("run", "奔跑");
|
||||
public static readonly MoveModeEnum Dash = new("dash", "持续冲刺");
|
||||
public static readonly MoveModeEnum Climb = new("climb", "攀爬");
|
||||
public static readonly MoveModeEnum Fly = new("fly", "飞行");
|
||||
public static readonly MoveModeEnum Jump = new("jump", "跳跃");
|
||||
|
||||
@@ -680,7 +680,23 @@ public class PathExecutor
|
||||
// 只有设置为run才会一直疾跑
|
||||
if (waypoint.MoveMode == MoveModeEnum.Run.Code)
|
||||
{
|
||||
if (distance > 25) // 距离大于25时可以使用疾跑
|
||||
if (distance > 20 != fastMode) // 距离大于20时可以使用疾跑/自由泳
|
||||
{
|
||||
if (fastMode)
|
||||
{
|
||||
Simulation.SendInput.SimulateAction(GIActions.SprintMouse, KeyType.KeyUp);
|
||||
}
|
||||
else
|
||||
{
|
||||
Simulation.SendInput.SimulateAction(GIActions.SprintMouse, KeyType.KeyDown);
|
||||
}
|
||||
|
||||
fastMode = !fastMode;
|
||||
}
|
||||
}
|
||||
else if (waypoint.MoveMode == MoveModeEnum.Dash.Code)
|
||||
{
|
||||
if (distance > 20) // 距离大于25时可以使用疾跑
|
||||
{
|
||||
if (Math.Abs((fastModeColdTime - DateTime.UtcNow).TotalMilliseconds) > 1000) //冷却一会
|
||||
{
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using System;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace BetterGenshinImpact.GameTask.AutoTrackPath;
|
||||
|
||||
public partial class TpConfig : ObservableObject
|
||||
{
|
||||
[ObservableProperty]
|
||||
private bool _mapZoomEnabled = true; // 地图缩放开关
|
||||
|
||||
[ObservableProperty]
|
||||
private int _mapZoomOutDistance = 2000; // 地图缩小的最小距离,单位:像素
|
||||
|
||||
[ObservableProperty]
|
||||
private int _mapZoomInDistance = 400; // 地图放大的最大距离,单位:像素
|
||||
|
||||
[ObservableProperty]
|
||||
private int _stepIntervalMilliseconds = 20; // 鼠标移动时间间隔,单位:ms
|
||||
|
||||
[ObservableProperty]
|
||||
private double _maxZoomLevel = 5.0; // 最大缩放等级
|
||||
|
||||
[ObservableProperty]
|
||||
private double _minZoomLevel = 1.7; // 最小缩放等级
|
||||
|
||||
[ObservableProperty]
|
||||
private double _reviveStatueOfTheSevenPointX = 2296.4; // 七天神像点位X坐标
|
||||
|
||||
[ObservableProperty]
|
||||
private double _reviveStatueOfTheSevenPointY = -824.4; // 七天神像点位Y坐标
|
||||
|
||||
[ObservableProperty]
|
||||
[property: JsonIgnore]
|
||||
private int _zoomOutButtonY = 654; // y-coordinate for zoom-out button
|
||||
|
||||
[ObservableProperty]
|
||||
[property: JsonIgnore]
|
||||
private int _zoomInButtonY = 428; // y-coordinate for zoom-in button
|
||||
|
||||
[ObservableProperty]
|
||||
[property: JsonIgnore]
|
||||
private int _zoomButtonX = 49; // x-coordinate for zoom button
|
||||
|
||||
[ObservableProperty]
|
||||
[property: JsonIgnore]
|
||||
private int _zoomStartY = 453; // y-coordinate for zoom start
|
||||
|
||||
[ObservableProperty]
|
||||
[property: JsonIgnore]
|
||||
private int _zoomEndY = 628; // y-coordinate for zoom end
|
||||
|
||||
[ObservableProperty]
|
||||
private double _tolerance = 200; // 允许的移动误差
|
||||
|
||||
[ObservableProperty]
|
||||
private int _maxIterations = 30; // 移动最大次数
|
||||
|
||||
[ObservableProperty]
|
||||
private int _maxMouseMove = 300; // 单次移动最大距离
|
||||
}
|
||||
@@ -1,28 +1,26 @@
|
||||
using BetterGenshinImpact.Core.Recognition;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using BetterGenshinImpact.Core.Recognition;
|
||||
using BetterGenshinImpact.Core.Recognition.OpenCv;
|
||||
using BetterGenshinImpact.Core.Script.Dependence;
|
||||
using BetterGenshinImpact.Core.Simulator;
|
||||
using BetterGenshinImpact.Core.Simulator.Extensions;
|
||||
using BetterGenshinImpact.GameTask.AutoGeniusInvokation.Exception;
|
||||
using BetterGenshinImpact.GameTask.Common;
|
||||
using BetterGenshinImpact.GameTask.Common.BgiVision;
|
||||
using BetterGenshinImpact.GameTask.Common.Element.Assets;
|
||||
using BetterGenshinImpact.GameTask.Common.Exceptions;
|
||||
using BetterGenshinImpact.GameTask.Common.Map;
|
||||
using BetterGenshinImpact.GameTask.Model.Area;
|
||||
using BetterGenshinImpact.GameTask.QuickTeleport.Assets;
|
||||
using BetterGenshinImpact.Helpers.Extensions;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using OpenCvSharp;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using BetterGenshinImpact.GameTask.Common.Exceptions;
|
||||
using Vanara.PInvoke;
|
||||
using static BetterGenshinImpact.GameTask.Common.TaskControl;
|
||||
using BetterGenshinImpact.Core.Simulator.Extensions;
|
||||
using BetterGenshinImpact.GameTask.Common.Job;
|
||||
using BetterGenshinImpact.Core.Script.Dependence;
|
||||
using Microsoft.Diagnostics.Utilities;
|
||||
|
||||
namespace BetterGenshinImpact.GameTask.AutoTrackPath;
|
||||
|
||||
@@ -34,89 +32,17 @@ public class TpTask(CancellationToken ct)
|
||||
private readonly QuickTeleportAssets _assets = QuickTeleportAssets.Instance;
|
||||
private readonly Rect _captureRect = TaskContext.Instance().SystemInfo.ScaleMax1080PCaptureRect;
|
||||
private readonly double _zoomOutMax1080PRatio = TaskContext.Instance().SystemInfo.ZoomOutMax1080PRatio;
|
||||
|
||||
private static double ReviveStatueOfTheSevenPointX = 2296.4;
|
||||
private static double ReviveStatueOfTheSevenPointY = -824.4;
|
||||
|
||||
private static int zoomOutButtonY = 654; // y-coordinate for zoom-out button
|
||||
private static int zoomInButtonY = 428; // y-coordinate for zoom-in button
|
||||
private static int zoomButtonX = 49; // x-coordinate for zoom button
|
||||
private static int zoomStartY = 453; // y-coordinate for zoom start
|
||||
private static int zoomEndY = 628; // y-coordinate for zoom end
|
||||
private static bool _mapZoomEnabled = true;
|
||||
private static int _mapZoomOutDistance = 1000;
|
||||
private static int _mapZoomInDistance = 400;
|
||||
|
||||
private static int _stepIntervalMilliseconds = 20;
|
||||
|
||||
public static bool MapZoomEnabled
|
||||
{
|
||||
get => _mapZoomEnabled;
|
||||
set
|
||||
{
|
||||
_mapZoomEnabled = value;
|
||||
if(!value)
|
||||
{
|
||||
Logger.LogInformation("禁用了缩放功能,请自行调整合适的缩放,部分脚本可能会因为禁用缩放功能无法使用");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static int MapZoomOutDistance
|
||||
{
|
||||
get => _mapZoomOutDistance;
|
||||
set
|
||||
{
|
||||
if (value < 500 || value > 5000) // 自动设置合理范围
|
||||
{
|
||||
_mapZoomOutDistance = 1000;
|
||||
}
|
||||
if (value <= _mapZoomInDistance)
|
||||
{
|
||||
_mapZoomOutDistance = _mapZoomInDistance * 2;
|
||||
}
|
||||
_mapZoomOutDistance = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static int MapZoomInDistance
|
||||
{
|
||||
get => _mapZoomInDistance;
|
||||
set
|
||||
{
|
||||
if (value < 200 || value > 1000) // 自动设置合理范围
|
||||
{
|
||||
_mapZoomInDistance = 400;
|
||||
}
|
||||
if (value >= _mapZoomOutDistance)
|
||||
{
|
||||
_mapZoomInDistance = _mapZoomOutDistance / 2;
|
||||
}
|
||||
_mapZoomInDistance = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static int StepIntervalMilliseconds
|
||||
{
|
||||
get => _stepIntervalMilliseconds;
|
||||
set
|
||||
{
|
||||
if (value < 5 || value > 100)
|
||||
{
|
||||
_stepIntervalMilliseconds = 20;
|
||||
}
|
||||
_stepIntervalMilliseconds = value;
|
||||
}
|
||||
}
|
||||
|
||||
private readonly TpConfig _tpConfig = TaskContext.Instance().Config.TpConfig;
|
||||
|
||||
/// <summary>
|
||||
/// 传送到须弥七天神像
|
||||
/// </summary>
|
||||
public async Task TpToStatueOfTheSeven()
|
||||
{
|
||||
await CheckInBigMapUi();
|
||||
if (_mapZoomEnabled)
|
||||
if (_tpConfig.MapZoomEnabled)
|
||||
{
|
||||
double currentZoomLevel = GetBigMapZoomLevel(CaptureToRectArea());
|
||||
bool tempMapZoomEnable = _mapZoomEnabled;
|
||||
_mapZoomEnabled = false; // 临时禁用缩放功能
|
||||
if (currentZoomLevel > 4.5)
|
||||
{
|
||||
await AdjustMapZoomLevel(currentZoomLevel, 4.5);
|
||||
@@ -125,13 +51,8 @@ public class TpTask(CancellationToken ct)
|
||||
{
|
||||
await AdjustMapZoomLevel(currentZoomLevel, 3);
|
||||
}
|
||||
await Tp(ReviveStatueOfTheSevenPointX, ReviveStatueOfTheSevenPointY);
|
||||
_mapZoomEnabled = tempMapZoomEnable;
|
||||
}
|
||||
else
|
||||
{
|
||||
await Tp(ReviveStatueOfTheSevenPointX, ReviveStatueOfTheSevenPointY);
|
||||
}
|
||||
await Tp(_tpConfig.ReviveStatueOfTheSevenPointX, _tpConfig.ReviveStatueOfTheSevenPointY);
|
||||
}
|
||||
/// <summary>
|
||||
/// 通过大地图传送到指定坐标最近的传送点,然后移动到指定坐标
|
||||
@@ -139,9 +60,10 @@ public class TpTask(CancellationToken ct)
|
||||
/// <param name="tpX"></param>
|
||||
/// <param name="tpY"></param>
|
||||
/// <param name="force">强制以当前的tpX,tpY坐标进行自动传送</param>
|
||||
public async Task<(double, double)> TpOnce(double tpX, double tpY, bool force = false)
|
||||
private async Task<(double, double)> TpOnce(double tpX, double tpY, bool force = false)
|
||||
{
|
||||
var (x, y) = (tpX, tpY);
|
||||
|
||||
string? country = null;
|
||||
if (!force)
|
||||
{
|
||||
@@ -152,25 +74,23 @@ public class TpTask(CancellationToken ct)
|
||||
|
||||
// 计算传送点位置离哪个地图切换后的中心点最近,切换到该地图
|
||||
await SwitchRecentlyCountryMap(x, y, country);
|
||||
|
||||
// 计算坐标后点击
|
||||
var bigMapInAllMapRect = GetBigMapRect();
|
||||
if (_mapZoomEnabled)
|
||||
|
||||
if (_tpConfig.MapZoomEnabled)
|
||||
{
|
||||
double zoomLevel = GetBigMapZoomLevel(CaptureToRectArea());
|
||||
if (zoomLevel > 4.5)
|
||||
{
|
||||
// 显示传送锚点和秘境的缩放等级
|
||||
await AdjustMapZoomLevel(zoomLevel, 4.5);
|
||||
Logger.LogInformation("当前缩放等级过大,调整为 {zoomLevel:0.000}", 4.5);
|
||||
Logger.LogInformation("当前缩放等级过大,调整为 {zoomLevel:0.00}", 4.5);
|
||||
}
|
||||
}
|
||||
|
||||
var bigMapInAllMapRect = GetBigMapRect();
|
||||
while (!IsPointInBigMapWindow(bigMapInAllMapRect, x, y)) // 左上角 350x400也属于禁止点击区域
|
||||
{
|
||||
Debug.WriteLine($"({x},{y}) 不在 {bigMapInAllMapRect} 内,继续移动");
|
||||
Logger.LogInformation("传送点不在当前大地图范围内,继续移动");
|
||||
await MoveMapTo(x, y, maxMouseMove: 400);
|
||||
await MoveMapTo(x, y);
|
||||
await Delay(300, ct); // 等待地图移动完成
|
||||
bigMapInAllMapRect = GetBigMapRect();
|
||||
}
|
||||
@@ -318,10 +238,8 @@ public class TpTask(CancellationToken ct)
|
||||
/// </summary>
|
||||
/// <param name="x">目标x坐标</param>
|
||||
/// <param name="y">目标y坐标</param>
|
||||
/// <param name="tolerance">允许误差,默认200</param>
|
||||
/// <param name="maxIterations">最大尝试次数,默认30</param>
|
||||
/// <param name="maxMouseMove">单次移动最大距离,默认250</param>
|
||||
public async Task MoveMapTo(double x, double y, double tolerance = 200, int maxIterations = 30, int maxMouseMove = 250)
|
||||
|
||||
private async Task MoveMapTo(double x, double y)
|
||||
{
|
||||
// 获取当前地图中心点并计算到目标传送点的初始偏移
|
||||
// await AdjustMapZoomLevel(mapZoomLevel);
|
||||
@@ -333,7 +251,7 @@ public class TpTask(CancellationToken ct)
|
||||
int moveSteps = 10;
|
||||
double totalMoveMouseX = Double.MaxValue;
|
||||
double totalMoveMouseY = Double.MaxValue;
|
||||
for (int iteration = 0; iteration < maxIterations; iteration++)
|
||||
for (int iteration = 0; iteration < _tpConfig.MaxIterations; iteration++)
|
||||
{
|
||||
// 尝试移动鼠标
|
||||
await MouseMoveMap(moveMouseX, moveMouseY, moveSteps);
|
||||
@@ -363,20 +281,22 @@ public class TpTask(CancellationToken ct)
|
||||
totalMoveMouseY = Math.Abs(moveMouseY * yOffset / diffMapY);
|
||||
double mouseDistance = Math.Sqrt(totalMoveMouseX * totalMoveMouseX + totalMoveMouseY * totalMoveMouseY);
|
||||
|
||||
if (_mapZoomEnabled)
|
||||
if (_tpConfig.MapZoomEnabled)
|
||||
{
|
||||
// 调整地图缩放
|
||||
// mapZoomLevel<5 才显示传送锚点和秘境; mapZoomLevel>1.7 可以避免点错传送锚点
|
||||
double currentZoomLevel = GetBigMapZoomLevel(CaptureToRectArea());
|
||||
double oldZoomLevel = currentZoomLevel;
|
||||
|
||||
while (mouseDistance > MapZoomOutDistance || mouseDistance < MapZoomInDistance)
|
||||
while (mouseDistance > _tpConfig.MapZoomOutDistance || mouseDistance < _tpConfig.MapZoomInDistance)
|
||||
{
|
||||
bool zoomOut = mouseDistance > MapZoomOutDistance;
|
||||
bool zoomIn = mouseDistance < MapZoomInDistance;
|
||||
if (zoomOut && currentZoomLevel < 4.0 || zoomIn && currentZoomLevel > 2.7)
|
||||
bool zoomOut = mouseDistance > _tpConfig.MapZoomOutDistance;
|
||||
bool zoomIn = mouseDistance < _tpConfig.MapZoomInDistance;
|
||||
if (zoomOut && currentZoomLevel < _tpConfig.MaxZoomLevel - 1.0
|
||||
|| zoomIn && currentZoomLevel > _tpConfig.MinZoomLevel + 1.0)
|
||||
{
|
||||
await AdjustMapZoomLevel(zoomIn);
|
||||
await Delay(50, ct);
|
||||
currentZoomLevel = GetBigMapZoomLevel(CaptureToRectArea());
|
||||
totalMoveMouseX *= oldZoomLevel / currentZoomLevel;
|
||||
totalMoveMouseY *= oldZoomLevel / currentZoomLevel;
|
||||
@@ -385,9 +305,9 @@ public class TpTask(CancellationToken ct)
|
||||
}
|
||||
else
|
||||
{
|
||||
double targetZoom = zoomIn ? 1.7 : 5.0;
|
||||
double targetZoom = zoomIn ? _tpConfig.MinZoomLevel : _tpConfig.MaxZoomLevel;
|
||||
// 考虑调整和识别误差,所以相差0.05就不再调整。
|
||||
if (currentZoomLevel > 4.95 || currentZoomLevel < 1.75)
|
||||
if (currentZoomLevel > _tpConfig.MaxZoomLevel - 0.05 || currentZoomLevel < _tpConfig.MinZoomLevel + 0.05)
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -398,21 +318,20 @@ public class TpTask(CancellationToken ct)
|
||||
}
|
||||
|
||||
// 非常接近目标点,不再进一步调整
|
||||
if (mouseDistance < tolerance)
|
||||
if (mouseDistance < _tpConfig.Tolerance)
|
||||
{
|
||||
Logger.LogInformation("移动 {I} 次鼠标后,已经接近目标点,不再移动地图。", iteration + 1);
|
||||
break;
|
||||
}
|
||||
|
||||
// 单次移动最大距离为 maxMouseMove
|
||||
moveMouseX = (int)Math.Min(totalMoveMouseX, maxMouseMove * totalMoveMouseX / mouseDistance) * Math.Sign(xOffset);
|
||||
moveMouseY = (int)Math.Min(totalMoveMouseY, maxMouseMove * totalMoveMouseY / mouseDistance) * Math.Sign(yOffset);
|
||||
|
||||
moveMouseX = (int)Math.Min(totalMoveMouseX, _tpConfig.MaxMouseMove * totalMoveMouseX / mouseDistance) * Math.Sign(xOffset);
|
||||
moveMouseY = (int)Math.Min(totalMoveMouseY, _tpConfig.MaxMouseMove * totalMoveMouseY / mouseDistance) * Math.Sign(yOffset);
|
||||
double moveMouseLength = Math.Sqrt(moveMouseX * moveMouseX + moveMouseY * moveMouseY);
|
||||
moveSteps = Math.Max((int)moveMouseLength / 10, 3); // 每次移动的步数最小为3,避免除0错误
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.LogDebug($"第 {iteration} 次移动鼠标失败,可能是点击了传送点或者其他交互对象。");
|
||||
Logger.LogDebug($"第 {iteration + 1} 次移动鼠标失败,可能是点击了传送点或者其他交互对象。");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -440,25 +359,26 @@ public class TpTask(CancellationToken ct)
|
||||
/// 调整地图缩放级别以加速移动
|
||||
/// </summary>
|
||||
/// <param name="zoomIn">是否放大地图</param>
|
||||
public async Task AdjustMapZoomLevel(bool zoomIn)
|
||||
private async Task AdjustMapZoomLevel(bool zoomIn)
|
||||
{
|
||||
if (zoomIn)
|
||||
{
|
||||
GameCaptureRegion.GameRegionClick((rect, scale) => (zoomButtonX * scale, zoomInButtonY * scale));
|
||||
GameCaptureRegion.GameRegionClick((rect, scale) => (_tpConfig.ZoomButtonX * scale, _tpConfig.ZoomInButtonY * scale));
|
||||
}
|
||||
else
|
||||
{
|
||||
GameCaptureRegion.GameRegionClick((rect, scale) => (zoomButtonX * scale, zoomOutButtonY * scale));
|
||||
GameCaptureRegion.GameRegionClick((rect, scale) => (_tpConfig.ZoomButtonX * scale, _tpConfig.ZoomOutButtonY * scale));
|
||||
}
|
||||
|
||||
await Delay(50, ct);
|
||||
}
|
||||
|
||||
[Obsolete]
|
||||
|
||||
/// <summary>
|
||||
/// 调整地图的缩放等级(整数缩放级别)。
|
||||
/// </summary>
|
||||
/// <param name="zoomLevel">目标等级:1-6。整数。随着数字变大地图越小,细节越少。</param>
|
||||
[Obsolete]
|
||||
public async Task AdjustMapZoomLevel(int zoomLevel)
|
||||
{
|
||||
for (int i = 0; i < 5; i++)
|
||||
@@ -478,15 +398,15 @@ public class TpTask(CancellationToken ct)
|
||||
/// </summary>
|
||||
/// <param name="zoomLevel">当前缩放等级:1.0-6.0,浮点数。</param>
|
||||
/// <param name="targetZoomLevel">目标缩放等级:1.0-6.0,浮点数。</param>
|
||||
public async Task AdjustMapZoomLevel(double zoomLevel, double targetZoomLevel)
|
||||
private async Task AdjustMapZoomLevel(double zoomLevel, double targetZoomLevel)
|
||||
{
|
||||
// Logger.LogInformation("调整地图缩放等级:{zoomLevel:0.000} -> {targetZoomLevel:0.000}", zoomLevel, targetZoomLevel);
|
||||
int initialY = (int)(zoomStartY + (zoomEndY - zoomStartY) * (zoomLevel - 1) / 5d);
|
||||
int targetY = (int)(zoomStartY + (zoomEndY - zoomStartY) * (targetZoomLevel - 1) / 5d);
|
||||
await MouseClickAndMove(zoomButtonX, initialY, zoomButtonX, targetY);
|
||||
int initialY = (int)(_tpConfig.ZoomStartY + (_tpConfig.ZoomEndY - _tpConfig.ZoomStartY) * (zoomLevel - 1) / 5d);
|
||||
int targetY = (int)(_tpConfig.ZoomStartY + (_tpConfig.ZoomEndY - _tpConfig.ZoomStartY) * (targetZoomLevel - 1) / 5d);
|
||||
await MouseClickAndMove(_tpConfig.ZoomButtonX, initialY, _tpConfig.ZoomButtonX, targetY);
|
||||
}
|
||||
|
||||
public async Task MouseMoveMap(int pixelDeltaX, int pixelDeltaY, int steps = 10)
|
||||
private async Task MouseMoveMap(int pixelDeltaX, int pixelDeltaY, int steps = 10)
|
||||
{
|
||||
// 确保不影响总移动距离
|
||||
int totalX = 0;
|
||||
@@ -506,8 +426,8 @@ public class TpTask(CancellationToken ct)
|
||||
}
|
||||
|
||||
// 均匀分配多余的部分到前半段
|
||||
int remainingX = (int)(pixelDeltaX - totalX);
|
||||
int remainingY = (int)(pixelDeltaY - totalY);
|
||||
int remainingX = (pixelDeltaX - totalX);
|
||||
int remainingY = (pixelDeltaY - totalY);
|
||||
for (int i = 0; i < steps / 2 + 1; i++)
|
||||
{
|
||||
stepX[i] += remainingX / (steps / 2 + 1) + ((remainingX % (steps / 2 + 1) > i) ? 0 : 1);
|
||||
@@ -523,7 +443,7 @@ public class TpTask(CancellationToken ct)
|
||||
for (var i = 0; i < steps; i++)
|
||||
{
|
||||
GlobalMethod.MoveMouseBy(stepX[i], stepY[i]);
|
||||
await Delay(StepIntervalMilliseconds, ct);
|
||||
await Delay(_tpConfig.StepIntervalMilliseconds, ct);
|
||||
}
|
||||
GlobalMethod.LeftButtonUp();
|
||||
}
|
||||
@@ -604,7 +524,7 @@ public class TpTask(CancellationToken ct)
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取最近的传送点位置
|
||||
/// 获取最近的传送点位置和所处区域
|
||||
/// </summary>
|
||||
/// <param name="x"></param>
|
||||
/// <param name="y"></param>
|
||||
@@ -820,4 +740,4 @@ public class TpTask(CancellationToken ct)
|
||||
// 1~6 的缩放等级
|
||||
return (-5 * s) + 6;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -102,6 +102,33 @@ namespace LogParse
|
||||
|
||||
if (configTask != null)
|
||||
{
|
||||
|
||||
//前往七天神像复活
|
||||
if (logstr.EndsWith("前往七天神像复活"))
|
||||
{
|
||||
configTask.Fault.ReviveCount++;
|
||||
}
|
||||
//传送失败,重试 n 次
|
||||
result = parseBgiLine($@"传送失败,重试 (\d+) 次", logstr);
|
||||
if (result.Item1)
|
||||
{
|
||||
configTask.Fault.TeleportFailCount = int.Parse(result.Item2[1]);
|
||||
|
||||
}
|
||||
//战斗超时结束
|
||||
if (logstr == "战斗超时结束")
|
||||
{
|
||||
configTask.Fault.BattleTimeoutCount ++;
|
||||
}
|
||||
|
||||
//重试一次路线或放弃此路线!
|
||||
if (logstr.EndsWith("重试一次路线或放弃此路线!"))
|
||||
{
|
||||
configTask.Fault.RetryCount++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (logstr.StartsWith("→ 脚本执行结束: \"" + configTask.Name + "\""))
|
||||
{
|
||||
configTask.EndDate = parsePreDataTime(logLines, i - 1, logrq);
|
||||
@@ -182,6 +209,8 @@ namespace LogParse
|
||||
//配置人物列表xxx.json
|
||||
public List<ConfigTask> ConfigTaskList { get; } = new();
|
||||
|
||||
|
||||
|
||||
public class ConfigTask
|
||||
{
|
||||
public string Name { get; set; }
|
||||
@@ -204,6 +233,21 @@ namespace LogParse
|
||||
|
||||
Picks[val] = Picks[val] + 1;
|
||||
}
|
||||
public FaultScenario Fault { get; set; } = new();
|
||||
|
||||
public class FaultScenario
|
||||
{
|
||||
//复活次数
|
||||
public int ReviveCount { get; set; } = 0;
|
||||
//传送失败次数
|
||||
public int TeleportFailCount { get; set; } = 0;
|
||||
//重试次数
|
||||
public int RetryCount { get; set; } = 0;
|
||||
//战斗超时
|
||||
public int BattleTimeoutCount { get; set; } = 0;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -307,7 +351,42 @@ namespace LogParse
|
||||
return customDayStart;
|
||||
}
|
||||
|
||||
public static string GenerHtmlByConfigGroupEntity(List<ConfigGroupEntity> configGroups, GameInfo gameInfo)
|
||||
public static string FormatNumberWithStyle(int a, int b=3)
|
||||
{
|
||||
if (a== 0)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
// Determine the style based on the condition
|
||||
string colorStyle = a >= b ? "color:red;" : string.Empty;
|
||||
|
||||
// Return the formatted HTML string
|
||||
return $"<span style=\"font-weight:bold;{colorStyle}\">{a}</span>";
|
||||
}
|
||||
public static string GetNumberOrEmptyString(int number)
|
||||
{
|
||||
// 如果数字为0,返回空字符串,否则返回数字的字符串形式
|
||||
return number == 0 ? string.Empty : number.ToString();
|
||||
}
|
||||
public static string SubtractFiveSeconds(string inputTime,int seconds)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 将输入的字符串解析为 DateTime
|
||||
DateTime parsedTime = DateTime.ParseExact(inputTime, "yyyy-MM-dd HH:mm:ss", null);
|
||||
|
||||
// 减去 5 秒
|
||||
DateTime resultTime = parsedTime.AddSeconds(-seconds);
|
||||
|
||||
// 转换回指定格式的字符串并返回
|
||||
return resultTime.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
}
|
||||
catch (FormatException)
|
||||
{
|
||||
return "Invalid input time format. Please use 'yyyy-MM-dd HH:mm:ss'.";
|
||||
}
|
||||
}
|
||||
public static string GenerHtmlByConfigGroupEntity(List<ConfigGroupEntity> configGroups, GameInfo gameInfo,LogParseConfig.ScriptGroupLogParseConfig scriptGroupLogParseConfig)
|
||||
{
|
||||
(string name, Func<ConfigTask, string> value)[] colConfigs =
|
||||
[
|
||||
@@ -316,19 +395,28 @@ namespace LogParse
|
||||
(name: "结束日期", value: task => task.EndDate?.ToString("yyyy-MM-dd HH:mm:ss") ?? ""),
|
||||
(name: "耗时", value: task => ConvertSecondsToTime((task.EndDate - task.StartDate)?.TotalSeconds ?? 0))
|
||||
];
|
||||
|
||||
|
||||
List<(string name, Func<ConfigTask, string> value)> colConfigList = new();
|
||||
colConfigList.AddRange(colConfigs);
|
||||
if (scriptGroupLogParseConfig.FaultStatsSwitch)
|
||||
{
|
||||
colConfigList.Add((name: "复活次数", value: task => FormatNumberWithStyle(task.Fault.ReviveCount)));
|
||||
colConfigList.Add((name: "重试次数", value: task => FormatNumberWithStyle(task.Fault.RetryCount)));
|
||||
colConfigList.Add((name: "战斗超时次数", value: task => FormatNumberWithStyle(task.Fault.BattleTimeoutCount)));
|
||||
colConfigList.Add((name: "传送失败次数", value: task => FormatNumberWithStyle(task.Fault.TeleportFailCount)));
|
||||
}
|
||||
|
||||
|
||||
(string name, Func<MoraStatistics, string> value)[] msColConfigs =
|
||||
[
|
||||
(name: "日期", value: ms => ms.Name), (name: "小怪", value: ms => ms.SmallMonsterStatistics.ToString()),
|
||||
(name: "日期", value: ms => ms.Name), (name: "小怪", value: ms => GetNumberOrEmptyString(ms.SmallMonsterStatistics)),
|
||||
(name: "最后小怪日期", value: ms => ms.LastSmallTime),
|
||||
(name: "精英", value: ms => ms.EliteGameStatistics.ToString()),
|
||||
(name: "精英", value: ms => GetNumberOrEmptyString(ms.EliteGameStatistics)),
|
||||
(name: "精英详细", value: ms => ms.EliteDetails), (name: "最后精英日期", value: ms => ms.LastEliteTime),
|
||||
(name: "总计锄地摩拉", value: ms => ms.TotalMoraKillingMonstersMora.ToString())
|
||||
(name: "总计锄地摩拉", value: ms => ms.TotalMoraKillingMonstersMora.ToString()),
|
||||
(name: "突发事件获取摩拉", value: ms => ms.EmergencyBonus)
|
||||
];
|
||||
//锄地部分新曾字段
|
||||
(string name, Func<MoraStatistics, string> value)[] col2Configs=[..msColConfigs.ToList().Where(item=>item.name!="日期" && item.name!="最后小怪日期" && item.name!="最后精英日期"),
|
||||
(string name, Func<MoraStatistics, string> value)[] col2Configs=[..msColConfigs.ToList().Where(item=>item.name!="日期" && item.name!="最后小怪日期" && item.name!="最后精英日期" && item.name!="突发事件获取摩拉"),
|
||||
(name: "摩拉(每秒)", value: ms => (ms.TotalMoraKillingMonstersMora/(ms.StatisticsEnd-ms.StatisticsStart)?.TotalSeconds ?? 0).ToString("F2")),
|
||||
];
|
||||
|
||||
@@ -339,11 +427,19 @@ namespace LogParse
|
||||
List<ActionItem> actionItems = new();
|
||||
if (gameInfo != null)
|
||||
{
|
||||
|
||||
actionItems = TravelsDiaryDetailManager.loadAllActionItems(gameInfo, configGroups);
|
||||
int hoeingDelay;
|
||||
if (int.TryParse(scriptGroupLogParseConfig.HoeingDelay, out hoeingDelay))
|
||||
{
|
||||
foreach (var actionItem in actionItems)
|
||||
{
|
||||
actionItem.Time = SubtractFiveSeconds(actionItem.Time,hoeingDelay);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return GenerHtmlByConfigGroupEntity(configGroups, "日志分析", colConfigs,col2Configs, actionItems, msColConfigs);
|
||||
return GenerHtmlByConfigGroupEntity(configGroups, "日志分析", colConfigList.ToArray(),col2Configs, actionItems, msColConfigs);
|
||||
}
|
||||
public static string ConcatenateStrings(string a, string b)
|
||||
{
|
||||
@@ -372,6 +468,8 @@ namespace LogParse
|
||||
html.AppendLine(" table { border-collapse: collapse; width: 100%; margin-bottom: 20px; }");
|
||||
html.AppendLine(" th, td { border: 1px solid black; padding: 8px; text-align: left; }");
|
||||
html.AppendLine(" th { background-color: #f2f2f2; }");
|
||||
html.AppendLine(" tr:nth-child(odd) { background-color: #eaeaea; /* 奇数行颜色 */ }");
|
||||
html.AppendLine(" tr:nth-child(even) { background-color: #f9f9f9; /* 偶数行颜色 */}");
|
||||
html.AppendLine(" </style>");
|
||||
html.AppendLine("</head>");
|
||||
html.AppendLine("<body>");
|
||||
@@ -386,7 +484,7 @@ namespace LogParse
|
||||
.OrderBy(group => group.Key)
|
||||
.Reverse().ToList();
|
||||
|
||||
html.AppendLine($"<h2>按日锄地摩拉统计</h2>");
|
||||
html.AppendLine($"<h2>按日摩拉收益统计</h2>");
|
||||
html.AppendLine("<table>");
|
||||
|
||||
html.AppendLine(" <tr>");
|
||||
|
||||
@@ -14,5 +14,7 @@ public partial class LogParseConfig : ObservableObject
|
||||
[ObservableProperty] private string _rangeValue = "CurrentConfig";
|
||||
[ObservableProperty] private string _dayRangeValue = "7";
|
||||
[ObservableProperty] private bool _hoeingStatsSwitch = false;
|
||||
[ObservableProperty] private bool _faultStatsSwitch = false;
|
||||
[ObservableProperty] private string _hoeingDelay= "0";
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,21 @@ namespace LogParse
|
||||
|
||||
public List<ActionItem> SmallMonsterActionItems =>
|
||||
this.MonsterActionItems.Except(EliteMonsterActionItems).ToList();
|
||||
public string EmergencyBonus
|
||||
{
|
||||
get
|
||||
{
|
||||
var ls = this.ActionItems.Where(item => item.ActionId == 28).ToList();
|
||||
var count = ls.Count();
|
||||
if (count == 0)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
return ls.Sum(item=>item.Num)+(count>=10?"":$"({count}/10)");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public string LastEliteTime => EliteMonsterActionItems.MaxBy(item => item?.Time)?.Time ?? null;
|
||||
public string LastSmallTime => SmallMonsterActionItems.MaxBy(item => item?.Time)?.Time ?? null;
|
||||
|
||||
@@ -50,8 +50,8 @@ public class TravelsDiaryDetailManager
|
||||
var _temp = JsonSerializer.Deserialize<ApiResponse<ActionItem>>(File.ReadAllText(tddfile));
|
||||
if (_temp != null)
|
||||
{
|
||||
//只统计杀怪的
|
||||
actionItems.AddRange(_temp.Data.List.Where(item => item.ActionId == 37));
|
||||
//统计杀怪或突发事件奖励
|
||||
actionItems.AddRange(_temp.Data.List.Where(item => item.ActionId == 37 || item.ActionId == 28));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using BetterGenshinImpact.GameTask.AutoGeniusInvokation;
|
||||
using BetterGenshinImpact.GameTask.AutoMusicGame;
|
||||
using BetterGenshinImpact.Helpers;
|
||||
using Wpf.Ui.Violeta.Controls;
|
||||
using static BetterGenshinImpact.GameTask.Common.TaskControl;
|
||||
@@ -120,7 +122,8 @@ public class TaskRunner
|
||||
public async Task RunSoloTaskAsync(ISoloTask soloTask)
|
||||
{
|
||||
// 没启动的时候先启动
|
||||
await ScriptService.StartGameTask();
|
||||
bool waitForMainUi = soloTask.Name != "自动七圣召唤" && !soloTask.Name.Contains("自动音游");
|
||||
await ScriptService.StartGameTask(waitForMainUi);
|
||||
await Task.Run(() => RunCurrentAsync(async () => await soloTask.Start(CancellationContext.Instance.Cts.Token)));
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,15 @@ public class DirectoryHelper
|
||||
|
||||
private static void DeleteDirectory(DirectoryInfo directoryInfo)
|
||||
{
|
||||
|
||||
//通过软链接生成的目录,直接删除该链接目录,而不涉及其文件本体
|
||||
var attributes = directoryInfo.Attributes;
|
||||
if ((attributes & FileAttributes.ReparsePoint) == FileAttributes.ReparsePoint)
|
||||
{
|
||||
directoryInfo.Delete();
|
||||
return;
|
||||
}
|
||||
|
||||
// 递归处理子目录
|
||||
foreach (var subDirectory in directoryInfo.GetDirectories())
|
||||
{
|
||||
@@ -100,4 +109,34 @@ public class DirectoryHelper
|
||||
CopyDirectory(subDir, destSubDir); // 递归拷贝子目录
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 递归删除指定目录及其所有子目录和文件
|
||||
/// </summary>
|
||||
/// <param name="directoryPath">要删除的目录的路径</param>
|
||||
public static void DeleteDirectoryRecursively(string directoryPath)
|
||||
{
|
||||
// 检查目录是否存在
|
||||
if (Directory.Exists(directoryPath))
|
||||
{
|
||||
// 获取目录中的所有子目录
|
||||
string[] subDirectories = Directory.GetDirectories(directoryPath);
|
||||
foreach (string subDirectory in subDirectories)
|
||||
{
|
||||
// 递归调用删除子目录
|
||||
DeleteDirectoryRecursively(subDirectory);
|
||||
}
|
||||
|
||||
// 获取目录中的所有文件
|
||||
string[] files = Directory.GetFiles(directoryPath);
|
||||
foreach (string file in files)
|
||||
{
|
||||
// 删除文件
|
||||
File.Delete(file);
|
||||
}
|
||||
|
||||
// 删除空目录
|
||||
Directory.Delete(directoryPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Windows.Media;
|
||||
using System.Diagnostics;
|
||||
using System.Windows.Media;
|
||||
using BetterGenshinImpact.GameTask;
|
||||
using Wpf.Ui.Controls;
|
||||
|
||||
@@ -8,31 +9,32 @@ public class WindowHelper
|
||||
{
|
||||
public static void TryApplySystemBackdrop(System.Windows.Window window)
|
||||
{
|
||||
window.Background = new SolidColorBrush(Colors.Transparent);
|
||||
|
||||
if (WindowBackdrop.IsSupported(TaskContext.Instance().Config.CommonConfig.CurrentBackdropType))
|
||||
if (OsVersionHelper.IsWindows11_OrGreater)
|
||||
{
|
||||
if (TaskContext.Instance().Config.CommonConfig.CurrentBackdropType == WindowBackdropType.Acrylic)
|
||||
if (WindowBackdrop.IsSupported(TaskContext.Instance().Config.CommonConfig.CurrentBackdropType))
|
||||
{
|
||||
if (TaskContext.Instance().Config.CommonConfig.CurrentBackdropType == WindowBackdropType.Acrylic)
|
||||
{
|
||||
window.Background = new SolidColorBrush(Color.FromArgb(100, 0, 0, 0));
|
||||
}
|
||||
else
|
||||
{
|
||||
window.Background = new SolidColorBrush(Colors.Transparent);
|
||||
}
|
||||
|
||||
WindowBackdrop.ApplyBackdrop(window, TaskContext.Instance().Config.CommonConfig.CurrentBackdropType);
|
||||
return;
|
||||
}
|
||||
if (WindowBackdrop.IsSupported(WindowBackdropType.Mica))
|
||||
{
|
||||
window.Background = new SolidColorBrush(Colors.Transparent);
|
||||
WindowBackdrop.ApplyBackdrop(window, WindowBackdropType.Mica);
|
||||
}
|
||||
else if (WindowBackdrop.IsSupported(WindowBackdropType.Acrylic))
|
||||
{
|
||||
window.Background = new SolidColorBrush(Color.FromArgb(100, 0, 0, 0));
|
||||
WindowBackdrop.ApplyBackdrop(window, WindowBackdropType.Acrylic);
|
||||
}
|
||||
|
||||
WindowBackdrop.ApplyBackdrop(window, TaskContext.Instance().Config.CommonConfig.CurrentBackdropType);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (WindowBackdrop.IsSupported(WindowBackdropType.Mica))
|
||||
{
|
||||
WindowBackdrop.ApplyBackdrop(window, WindowBackdropType.Mica);
|
||||
}
|
||||
else if (WindowBackdrop.IsSupported(WindowBackdropType.Tabbed))
|
||||
{
|
||||
WindowBackdrop.ApplyBackdrop(window, WindowBackdropType.Tabbed);
|
||||
}
|
||||
else if (WindowBackdrop.IsSupported(WindowBackdropType.Acrylic))
|
||||
{
|
||||
WindowBackdrop.ApplyBackdrop(window, WindowBackdropType.Acrylic);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,24 @@ namespace BetterGenshinImpact.Service;
|
||||
public partial class ScriptService : IScriptService
|
||||
{
|
||||
private readonly ILogger<ScriptService> _logger = App.GetLogger<ScriptService>();
|
||||
private static bool IsCurrentHourEqual(string input)
|
||||
{
|
||||
// 尝试将输入字符串转换为整数
|
||||
if (int.TryParse(input, out int hour))
|
||||
{
|
||||
// 验证小时是否在合法范围内(0-23)
|
||||
if (hour >= 0 && hour <= 23)
|
||||
{
|
||||
// 获取当前小时数
|
||||
int currentHour = DateTime.Now.Hour;
|
||||
// 判断是否相等
|
||||
return currentHour == hour;
|
||||
}
|
||||
}
|
||||
|
||||
// 如果输入非数字或不合法,返回 false
|
||||
return false;
|
||||
}
|
||||
public async Task RunMulti(IEnumerable<ScriptGroupProject> projectList, string? groupName = null)
|
||||
{
|
||||
groupName ??= "默认";
|
||||
@@ -59,6 +76,13 @@ public partial class ScriptService : IScriptService
|
||||
|
||||
foreach (var project in list)
|
||||
{
|
||||
|
||||
if (project.GroupInfo.Config.PathingConfig.Enabled && IsCurrentHourEqual(project.GroupInfo.Config.PathingConfig.SkipDuring))
|
||||
{
|
||||
_logger.LogInformation($"{project.Name}任务已到禁止执行时段,将跳过!");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (project.Status != "Enabled")
|
||||
{
|
||||
_logger.LogInformation("脚本 {Name} 状态为禁用,跳过执行", project.Name);
|
||||
@@ -85,6 +109,14 @@ public partial class ScriptService : IScriptService
|
||||
stopwatch.Reset();
|
||||
stopwatch.Start();
|
||||
await ExecuteProject(project);
|
||||
|
||||
//多次执行时及时中断
|
||||
if (project.GroupInfo.Config.PathingConfig.Enabled && IsCurrentHourEqual(project.GroupInfo.Config.PathingConfig.SkipDuring))
|
||||
{
|
||||
_logger.LogInformation($"{project.Name}任务已到禁止执行时段,将跳过!");
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
catch (NormalEndException e)
|
||||
{
|
||||
@@ -175,6 +207,7 @@ public partial class ScriptService : IScriptService
|
||||
|
||||
private async Task ExecuteProject(ScriptGroupProject project)
|
||||
{
|
||||
|
||||
if (project.Type == "Javascript")
|
||||
{
|
||||
if (project.Project == null)
|
||||
@@ -218,7 +251,7 @@ public partial class ScriptService : IScriptService
|
||||
private static partial Regex DispatcherAddTimerRegex();
|
||||
|
||||
|
||||
public static async Task StartGameTask()
|
||||
public static async Task StartGameTask(bool waitForMainUi = true)
|
||||
{
|
||||
// 没启动时候,启动截图器
|
||||
var homePageViewModel = App.GetService<HomePageViewModel>();
|
||||
@@ -226,29 +259,33 @@ public partial class ScriptService : IScriptService
|
||||
{
|
||||
await homePageViewModel.OnStartTriggerAsync();
|
||||
|
||||
await Task.Run(() =>
|
||||
if (waitForMainUi)
|
||||
{
|
||||
var first = true;
|
||||
while (true)
|
||||
await Task.Run(() =>
|
||||
{
|
||||
if (!homePageViewModel.TaskDispatcherEnabled || !TaskContext.Instance().IsInitialized)
|
||||
var first = true;
|
||||
while (true)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (!homePageViewModel.TaskDispatcherEnabled || !TaskContext.Instance().IsInitialized)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var content = TaskControl.CaptureToRectArea();
|
||||
if (Bv.IsInMainUi(content) || Bv.IsInAnyClosableUi(content))
|
||||
{
|
||||
return;
|
||||
}
|
||||
var content = TaskControl.CaptureToRectArea();
|
||||
if (Bv.IsInMainUi(content) || Bv.IsInAnyClosableUi(content))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (first)
|
||||
{
|
||||
first = false;
|
||||
TaskControl.Logger.LogInformation("当前不在游戏主界面,等待进入主界面后执行任务...");
|
||||
if (first)
|
||||
{
|
||||
first = false;
|
||||
TaskControl.Logger.LogInformation("当前不在游戏主界面,等待进入主界面后执行任务...");
|
||||
TaskControl.Logger.LogInformation("如果你已经在游戏内的其他界面,请自行退出当前界面(ESC),使当前任务能够继续运行!");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -93,14 +93,14 @@ public class UpdateService : IUpdateService
|
||||
case CheckUpdateWindow.CheckUpdateWindowButton.Update:
|
||||
{
|
||||
// 唤起更新程序
|
||||
string updaterExePath = Global.Absolute("updater.exe");
|
||||
string updaterExePath = Global.Absolute("BetterGI.update.exe");
|
||||
if (!File.Exists(updaterExePath))
|
||||
{
|
||||
await MessageBox.ErrorAsync("更新程序不存在,请选择其他更新方式!");
|
||||
return;
|
||||
}
|
||||
// 启动
|
||||
Process.Start(updaterExePath);
|
||||
Process.Start(updaterExePath, "-I");
|
||||
|
||||
// 退出程序
|
||||
Application.Current.Shutdown();
|
||||
|
||||
@@ -324,6 +324,7 @@
|
||||
"百晓",
|
||||
"伍德",
|
||||
"蓝川丞",
|
||||
"蓝砚",
|
||||
"松本",
|
||||
"甘乐",
|
||||
"卯师傅",
|
||||
|
||||
@@ -533,6 +533,168 @@
|
||||
</StackPanel>
|
||||
</ui:CardExpander>
|
||||
|
||||
<ui:TextBlock Margin="0,0,0,8"
|
||||
FontTypography="BodyStrong"
|
||||
Text="通用功能置" />
|
||||
<!-- 快速传送 -->
|
||||
<ui:CardExpander Margin="0,0,0,12" ContentPadding="0">
|
||||
<ui:CardExpander.Icon>
|
||||
<ui:FontIcon Glyph="" Style="{StaticResource FaFontIconStyle}" />
|
||||
</ui:CardExpander.Icon>
|
||||
<ui:CardExpander.Header>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ui:TextBlock Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
FontTypography="Body"
|
||||
Text="大地图地图传送设置"
|
||||
TextWrapping="Wrap" />
|
||||
<ui:TextBlock Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}"
|
||||
Text="用于地图追踪、自动秘境、一条龙灯功能中传送功能的配置"
|
||||
TextWrapping="Wrap" />
|
||||
</Grid>
|
||||
</ui:CardExpander.Header>
|
||||
<StackPanel>
|
||||
<Grid Margin="16">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ui:TextBlock Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
FontTypography="Body"
|
||||
Text="地图移动过程中是否缩放地图"
|
||||
TextWrapping="Wrap" />
|
||||
<ui:TextBlock Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}"
|
||||
Text="建议开启,关闭该设置可能在运行部分脚本时发生错误"
|
||||
TextWrapping="Wrap" />
|
||||
<ui:ToggleSwitch Grid.Row="0"
|
||||
Grid.RowSpan="2"
|
||||
Grid.Column="1"
|
||||
Margin="0,0,36,0"
|
||||
IsChecked="{Binding Config.TpConfig.MapZoomEnabled, Mode=TwoWay}" />
|
||||
</Grid>
|
||||
<Grid Margin="16">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ui:TextBlock Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
FontTypography="Body"
|
||||
Text="单次鼠标移动的最大距离"
|
||||
TextWrapping="Wrap" />
|
||||
<ui:TextBlock Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}"
|
||||
Text="过大可能会导致鼠标移动出窗口"
|
||||
TextWrapping="Wrap" />
|
||||
<ui:TextBox Grid.Row="0"
|
||||
Grid.RowSpan="2"
|
||||
Grid.Column="1"
|
||||
MinWidth="90"
|
||||
Margin="0,0,36,0"
|
||||
Text="{Binding Config.TpConfig.MaxMouseMove, Mode=TwoWay}" />
|
||||
</Grid>
|
||||
<Grid Margin="16">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ui:TextBlock Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
FontTypography="Body"
|
||||
Text="地图缩小的距离"
|
||||
TextWrapping="Wrap" />
|
||||
<ui:TextBlock Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}"
|
||||
Text="大于这个距离会缩小地图以加快传送"
|
||||
TextWrapping="Wrap" />
|
||||
<ui:TextBox Grid.Row="0"
|
||||
Grid.RowSpan="2"
|
||||
Grid.Column="1"
|
||||
MinWidth="90"
|
||||
Margin="0,0,36,0"
|
||||
Text="{Binding Config.TpConfig.MapZoomOutDistance, Mode=TwoWay}" />
|
||||
</Grid>
|
||||
<Grid Margin="16">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ui:TextBlock Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
FontTypography="Body"
|
||||
Text="地图放大的距离"
|
||||
TextWrapping="Wrap" />
|
||||
<ui:TextBlock Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}"
|
||||
Text="小于这个距离会放大地图以提高移动的精度"
|
||||
TextWrapping="Wrap" />
|
||||
<ui:TextBox Grid.Row="0"
|
||||
Grid.RowSpan="2"
|
||||
Grid.Column="1"
|
||||
MinWidth="90"
|
||||
Margin="0,0,36,0"
|
||||
Text="{Binding Config.TpConfig.MapZoomInDistance, Mode=TwoWay}" />
|
||||
</Grid>
|
||||
<Grid Margin="16">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ui:TextBlock Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
FontTypography="Body"
|
||||
Text="鼠标移动的时间间隔(毫秒)"
|
||||
TextWrapping="Wrap" />
|
||||
<ui:TextBlock Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}"
|
||||
Text="数字越小移动鼠标的速度越快,如果移动地图时产生卡顿,请提高这个数值"
|
||||
TextWrapping="Wrap" />
|
||||
<ui:TextBox Grid.Row="0"
|
||||
Grid.RowSpan="2"
|
||||
Grid.Column="1"
|
||||
MinWidth="90"
|
||||
Margin="0,0,36,0"
|
||||
Text="{Binding Config.TpConfig.StepIntervalMilliseconds, Mode=TwoWay}" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</ui:CardExpander>
|
||||
<!-- 地图 -->
|
||||
<!--<ui:CardControl Margin="0,0,0,12"
|
||||
Icon="{ui:SymbolIcon Cursor24}"
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
FontFamily="{StaticResource TextThemeFontFamily}"
|
||||
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
|
||||
mc:Ignorable="d">
|
||||
<Grid Margin="22,16,22,12">
|
||||
<Grid Margin="22,16,8,12">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="*" MaxWidth="300" />
|
||||
<ColumnDefinition Width="2*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
@@ -156,10 +156,9 @@
|
||||
</ContentControl>-->
|
||||
|
||||
<!-- 右侧配置 -->
|
||||
<DockPanel Grid.Column="1" Margin="20,0,0,0">
|
||||
<DockPanel Grid.Column="1" Margin="16,0,0,0">
|
||||
<StackPanel Margin="0,0,0,10" DockPanel.Dock="Top">
|
||||
|
||||
<Grid>
|
||||
<Grid Margin="0,0,9,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
@@ -199,7 +198,7 @@
|
||||
</StackPanel>
|
||||
|
||||
<ScrollViewer>
|
||||
<StackPanel>
|
||||
<StackPanel Margin="0,0,18,0">
|
||||
<!-- 合成树脂 -->
|
||||
<TextBlock Margin="4,0,0,4"
|
||||
FontSize="14"
|
||||
@@ -267,7 +266,7 @@
|
||||
<ui:ToggleSwitch Grid.Row="0"
|
||||
Grid.RowSpan="2"
|
||||
Grid.Column="1"
|
||||
Margin="0,0,36,0"
|
||||
Margin="0,0,20,0"
|
||||
IsChecked="{Binding SelectedConfig.WeeklyDomainEnabled, Converter={StaticResource InverseBooleanConverter}, Mode=TwoWay}" />
|
||||
</Grid>
|
||||
</ui:CardExpander.Header>
|
||||
@@ -361,7 +360,7 @@
|
||||
<ui:ToggleSwitch Grid.Row="0"
|
||||
Grid.RowSpan="2"
|
||||
Grid.Column="1"
|
||||
Margin="0,0,36,0"
|
||||
Margin="0,0,20,0"
|
||||
IsChecked="{Binding SelectedConfig.WeeklyDomainEnabled, Mode=TwoWay}" />
|
||||
</Grid>
|
||||
</ui:CardExpander.Header>
|
||||
@@ -472,6 +471,41 @@
|
||||
</StackPanel>
|
||||
</ui:CardExpander>
|
||||
|
||||
<ui:CardControl Margin="0,0,0,12">
|
||||
<ui:CardControl.Icon>
|
||||
<ui:FontIcon Glyph="" Style="{StaticResource FaFontIconStyle}" />
|
||||
</ui:CardControl.Icon>
|
||||
<ui:CardControl.Header>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<ui:TextBlock Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
FontTypography="Body"
|
||||
Text="结束后自动分解圣遗物"
|
||||
TextWrapping="Wrap" />
|
||||
<ui:TextBlock Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}"
|
||||
Text="需要分解圣遗物的最高星级"
|
||||
TextWrapping="Wrap" />
|
||||
</Grid>
|
||||
</ui:CardControl.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<ComboBox
|
||||
Width="80"
|
||||
Margin="0,0,10,0"
|
||||
ItemsSource="{Binding Source={x:Static pages:TaskSettingsPageViewModel.ArtifactSalvageStarList}}"
|
||||
SelectedItem="{Binding Config.AutoDomainConfig.MaxArtifactStar, Mode=TwoWay}">
|
||||
</ComboBox>
|
||||
<ui:ToggleSwitch
|
||||
Margin="0,0,36,0"
|
||||
IsChecked="{Binding Config.AutoDomainConfig.AutoArtifactSalvage, Mode=TwoWay}" />
|
||||
</StackPanel>
|
||||
</ui:CardControl>
|
||||
|
||||
<!-- 领取奖励 -->
|
||||
<TextBlock Margin="4,0,0,4"
|
||||
FontSize="14"
|
||||
@@ -504,10 +538,10 @@
|
||||
SelectedItem="{Binding SelectedConfig.AdventurersGuildCountry, Mode=TwoWay}"
|
||||
ItemsSource="{Binding AdventurersGuildCountry}" />
|
||||
</ui:CardControl>
|
||||
|
||||
|
||||
<ui:CardControl Margin="0,0,0,12">
|
||||
<ui:CardControl.Icon>
|
||||
<ui:FontIcon Glyph="" Style="{StaticResource FaFontIconStyle}" />
|
||||
<ui:FontIcon Glyph="" Style="{StaticResource FaFontIconStyle}" />
|
||||
</ui:CardControl.Icon>
|
||||
<ui:CardControl.Header>
|
||||
<Grid>
|
||||
@@ -527,13 +561,13 @@
|
||||
TextWrapping="Wrap" />
|
||||
</Grid>
|
||||
</ui:CardControl.Header>
|
||||
<ui:TextBox
|
||||
MinWidth="150"
|
||||
MaxWidth="800"
|
||||
Margin="0,0,28,0"
|
||||
Text="{Binding SelectedConfig.DailyRewardPartyName, Mode=TwoWay}"
|
||||
PlaceholderText="填写好感队名称"
|
||||
TextWrapping="Wrap" />
|
||||
<ui:TextBox
|
||||
MinWidth="150"
|
||||
MaxWidth="800"
|
||||
Margin="0,0,28,0"
|
||||
Text="{Binding SelectedConfig.DailyRewardPartyName, Mode=TwoWay}"
|
||||
PlaceholderText="填写好感队名称"
|
||||
TextWrapping="Wrap" />
|
||||
</ui:CardControl>
|
||||
|
||||
<!-- 可以继续添加其他设置项 -->
|
||||
|
||||
@@ -217,6 +217,7 @@
|
||||
<MenuItem Header="日志分析" Command="{Binding OpenLogParseCommand}" />
|
||||
<MenuItem Header="打开脚本仓库" Command="{Binding OpenLocalScriptRepoCommand}" />
|
||||
<MenuItem Header="根据文件夹更新" Command="{Binding UpdateTasksCommand}" />
|
||||
<MenuItem Header="任务倒序排列" Command="{Binding ReverseTaskOrderCommand}" />
|
||||
</ContextMenu>
|
||||
</ui:DropDownButton.Flyout>
|
||||
</ui:DropDownButton>
|
||||
|
||||
@@ -428,7 +428,34 @@
|
||||
</b:Interaction.Triggers>
|
||||
</ComboBox>
|
||||
</Grid>
|
||||
|
||||
<Grid Margin="16">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ui:TextBlock Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
FontTypography="Body"
|
||||
Text="根据技能CD优化出招人员"
|
||||
TextWrapping="Wrap" />
|
||||
<ui:TextBlock Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}"
|
||||
Text="根据填入人或人和cd,来决定当此人元素战技cd未结束时,跳过此人出招,来优化战斗流程,可填入人名或人名数字(用逗号分隔),多种用分号分隔,例如:白术;钟离,12;,如果人名,则用内置cd检查(或填入数字也小于0),如果是人名和数字,则把数字当做出招cd(秒)。"
|
||||
TextWrapping="Wrap" />
|
||||
<ui:TextBox Grid.Row="0"
|
||||
Grid.RowSpan="2"
|
||||
Grid.Column="1"
|
||||
MinWidth="180"
|
||||
MaxWidth="800"
|
||||
Margin="0,0,36,0"
|
||||
Text="{Binding Config.AutoFightConfig.ActionSchedulerByCd, Mode=TwoWay}"
|
||||
TextWrapping="Wrap" />
|
||||
</Grid>
|
||||
<!--内嵌的设置-->
|
||||
<Separator Margin="-18,0" BorderThickness="0,1,0,0" />
|
||||
<Grid Margin="16,10,52,0">
|
||||
@@ -1011,14 +1038,14 @@
|
||||
<ui:TextBlock Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}"
|
||||
Text="可以选择要分解到圣遗物的最高星级"
|
||||
Text="需要分解圣遗物的最高星级"
|
||||
TextWrapping="Wrap" />
|
||||
<ComboBox Grid.Row="0"
|
||||
Grid.RowSpan="2"
|
||||
Grid.Column="1"
|
||||
Width="80"
|
||||
Margin="0,0,10,0"
|
||||
ItemsSource="{Binding ArtifactSalvageStarList, Mode=TwoWay}"
|
||||
ItemsSource="{Binding Source={x:Static pages:TaskSettingsPageViewModel.ArtifactSalvageStarList}}"
|
||||
SelectedItem="{Binding Config.AutoDomainConfig.MaxArtifactStar, Mode=TwoWay}">
|
||||
</ComboBox>
|
||||
<ui:ToggleSwitch Grid.Row="0"
|
||||
@@ -1260,7 +1287,7 @@
|
||||
</ui:TextBlock>
|
||||
</Grid>
|
||||
</ui:CardControl.Header>
|
||||
<controls:TwoStateButton Margin="0,0,36,0"
|
||||
<controls:TwoStateButton Margin="0,0,40,0"
|
||||
DisableCommand="{Binding StopSoloTaskCommand}"
|
||||
DisableContent="停止"
|
||||
EnableCommand="{Binding SwitchAutoMusicGameCommand}"
|
||||
@@ -1269,7 +1296,7 @@
|
||||
</ui:CardControl>
|
||||
|
||||
<!-- 自动音游专辑 -->
|
||||
<ui:CardExpander Margin="0,0,0,12">
|
||||
<ui:CardExpander Margin="0,0,0,12" ContentPadding="0">
|
||||
<ui:CardExpander.Icon>
|
||||
<ui:FontIcon Glyph="" Style="{StaticResource FaFontIconStyle}" />
|
||||
</ui:CardExpander.Icon>
|
||||
@@ -1323,12 +1350,37 @@
|
||||
<ui:TextBlock Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
FontTypography="Body"
|
||||
Text="自定义难度等级,使该级别下所有乐曲达成【大音天籁】"
|
||||
Text="自动演奏未达成【大音天籁】的乐曲"
|
||||
TextWrapping="Wrap" />
|
||||
<ui:TextBlock Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}"
|
||||
Text="默认为【传说】,【大师】即可获取所有奖励,【所有】即全部难度等级的所有乐曲达成【大音天籁】。"
|
||||
Text="关闭时,奖励已经领取就会跳过乐曲。开启时,达成了【大音天籁】才会跳过乐曲"
|
||||
TextWrapping="Wrap" />
|
||||
<ui:ToggleSwitch Grid.Row="0"
|
||||
Grid.RowSpan="2"
|
||||
Grid.Column="1"
|
||||
Margin="0,0,36,0"
|
||||
IsChecked="{Binding Config.AutoMusicGameConfig.MustCanorusLevel, Mode=TwoWay}" />
|
||||
</Grid>
|
||||
<Grid Margin="16">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ui:TextBlock Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
FontTypography="Body"
|
||||
Text="自动演奏的目标难度选择"
|
||||
TextWrapping="Wrap" />
|
||||
<ui:TextBlock Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}"
|
||||
Text="设置为【传说】,【大师】即可获取所有奖励,设置【所有】则会对乐曲的所有难度进行自动演奏"
|
||||
TextWrapping="Wrap" />
|
||||
<ComboBox Grid.Row="0"
|
||||
Grid.RowSpan="2"
|
||||
|
||||
@@ -778,7 +778,8 @@
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</ui:CardExpander>
|
||||
|
||||
|
||||
|
||||
<!-- 自动烹饪 -->
|
||||
<ui:CardControl Margin="0,0,0,12">
|
||||
<ui:CardControl.Icon>
|
||||
|
||||
@@ -282,6 +282,32 @@
|
||||
IsChecked="{Binding PathingConfig.SoloTaskUseFightEnabled, Mode=TwoWay}" />
|
||||
|
||||
</Grid>
|
||||
<Grid Margin="16">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ui:TextBlock Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
FontTypography="Body"
|
||||
Text="不在某时执行"
|
||||
TextWrapping="Wrap" />
|
||||
<ui:TextBlock Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}"
|
||||
Text="当执行完一个路线后,如果时间为当前配置的时间(范围:0-23),则此路径追踪任务后续都将都跳过,适用于连续执行的兜底任务,例如想通宵挂机,并且在4点后,开始执行新的任务。"
|
||||
TextWrapping="Wrap" />
|
||||
<ui:TextBox Grid.Row="0"
|
||||
Grid.RowSpan="2"
|
||||
Grid.Column="1"
|
||||
MinWidth="100"
|
||||
Text="{Binding PathingConfig.SkipDuring, Mode=TwoWay}"
|
||||
TextWrapping="NoWrap" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</ui:CardExpander>
|
||||
<ui:CardExpander Margin="0,0,0,12"
|
||||
@@ -370,6 +396,34 @@
|
||||
</b:Interaction.Triggers>
|
||||
</ComboBox>
|
||||
</Grid>
|
||||
<Grid Margin="16">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ui:TextBlock Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
FontTypography="Body"
|
||||
Text="根据技能CD优化出招人员"
|
||||
TextWrapping="Wrap" />
|
||||
<ui:TextBlock Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}"
|
||||
Text="根据填入人或人和cd,来决定当此人元素战技cd未结束时,跳过此人出招,来优化战斗流程,可填入人名或人名数字(用逗号分隔),多种用分号分隔,例如:白术;钟离,12;,如果人名,则用内置cd检查(或填入数字也小于0),如果是人名和数字,则把数字当做出招cd(秒)。"
|
||||
TextWrapping="Wrap" />
|
||||
<ui:TextBox Grid.Row="0"
|
||||
Grid.RowSpan="2"
|
||||
Grid.Column="1"
|
||||
MinWidth="180"
|
||||
MaxWidth="800"
|
||||
Margin="0,0,36,0"
|
||||
Text="{Binding PathingConfig.AutoFightConfig.ActionSchedulerByCd, Mode=TwoWay}"
|
||||
TextWrapping="Wrap" />
|
||||
</Grid>
|
||||
<Grid Margin="16">
|
||||
|
||||
<ui:CardExpander Margin="0,0,0,12"
|
||||
|
||||
@@ -66,12 +66,16 @@ public partial class MainWindowViewModel : ObservableObject, IViewModel
|
||||
[RelayCommand]
|
||||
private void OnSwitchBackdrop()
|
||||
{
|
||||
if (!OsVersionHelper.IsWindows11_22523_OrGreater)
|
||||
{
|
||||
return; // win10 不支持切换主题
|
||||
}
|
||||
|
||||
CurrentBackdropType = CurrentBackdropType switch
|
||||
{
|
||||
WindowBackdropType.Mica => WindowBackdropType.Acrylic,
|
||||
WindowBackdropType.Acrylic => WindowBackdropType.Tabbed,
|
||||
WindowBackdropType.Tabbed => WindowBackdropType.Mica,
|
||||
_ => WindowBackdropType.Mica
|
||||
WindowBackdropType.Acrylic => WindowBackdropType.Mica,
|
||||
_ => WindowBackdropType.Acrylic
|
||||
};
|
||||
|
||||
Config.CommonConfig.CurrentBackdropType = CurrentBackdropType;
|
||||
@@ -79,7 +83,6 @@ public partial class MainWindowViewModel : ObservableObject, IViewModel
|
||||
if (Application.Current.MainWindow is MainWindow mainWindow)
|
||||
{
|
||||
mainWindow.Background = new SolidColorBrush(Color.FromArgb(100, 0, 0, 0));
|
||||
;
|
||||
WindowBackdrop.ApplyBackdrop(mainWindow, CurrentBackdropType);
|
||||
}
|
||||
}
|
||||
@@ -97,14 +100,25 @@ public partial class MainWindowViewModel : ObservableObject, IViewModel
|
||||
[RelayCommand]
|
||||
private async Task OnLoaded()
|
||||
{
|
||||
// 预热OCR
|
||||
await OcrPreheating();
|
||||
|
||||
if (Environment.GetCommandLineArgs().Length > 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// 自动处理目录配置
|
||||
await Patch1();
|
||||
|
||||
// 预热OCR
|
||||
await OcrPreheating();
|
||||
|
||||
// 首次运行自动初始化绑定
|
||||
InitKeyBinding();
|
||||
// 首次运行
|
||||
if (Config.CommonConfig.IsFirstRun)
|
||||
{
|
||||
// 自动初始化键位绑定
|
||||
InitKeyBinding();
|
||||
Config.AutoFightConfig.TeamNames = ""; // 此配置以后无用
|
||||
Config.CommonConfig.IsFirstRun = false;
|
||||
}
|
||||
|
||||
// 检查更新
|
||||
await App.GetService<IUpdateService>()!.CheckUpdateAsync(new UpdateOption());
|
||||
@@ -119,28 +133,24 @@ public partial class MainWindowViewModel : ObservableObject, IViewModel
|
||||
ScriptRepoUpdater.Instance.AutoUpdate();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void InitKeyBinding()
|
||||
{
|
||||
if (Config.CommonConfig.IsFirstRun)
|
||||
try
|
||||
{
|
||||
try
|
||||
var kbVm = App.GetService<KeyBindingsSettingsPageViewModel>();
|
||||
if (kbVm != null)
|
||||
{
|
||||
var kbVm = App.GetService<KeyBindingsSettingsPageViewModel>();
|
||||
if (kbVm != null)
|
||||
{
|
||||
kbVm.FetchFromRegistryCommand.Execute(null);
|
||||
}
|
||||
kbVm.FetchFromRegistryCommand.Execute(null);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_logger.LogError("首次运行自动初始化按键绑定异常:" + e.Source + "\r\n--" + Environment.NewLine + e.StackTrace + "\r\n---" + Environment.NewLine + e.Message);
|
||||
|
||||
MessageBox.Error("读取原神键位并设置键位绑定数据时发生异常:" + e.Message + ",后续可以手动设置");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_logger.LogError("首次运行自动初始化按键绑定异常:" + e.Source + "\r\n--" + Environment.NewLine + e.StackTrace + "\r\n---" + Environment.NewLine + e.Message);
|
||||
|
||||
MessageBox.Error("读取原神键位并设置键位绑定数据时发生异常:" + e.Message + ",后续可以手动设置");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 不同的安装目录处理
|
||||
@@ -148,21 +158,29 @@ public partial class MainWindowViewModel : ObservableObject, IViewModel
|
||||
*/
|
||||
private async Task Patch1()
|
||||
{
|
||||
if (Directory.Exists(Global.Absolute("BetterGI"))
|
||||
// && File.Exists(Global.Absolute("BetterGI/BetterGI.exe"))
|
||||
&& Directory.Exists(Global.Absolute("BetterGI/User"))
|
||||
)
|
||||
var embeddedPath = Global.Absolute("BetterGI");
|
||||
var embeddedUserPath = Global.Absolute("BetterGI/User");
|
||||
var exePath = Global.Absolute("BetterGI/BetterGI.exe");
|
||||
if (Directory.Exists(embeddedPath)
|
||||
&& File.Exists(exePath)
|
||||
&& Directory.Exists(embeddedUserPath)
|
||||
)
|
||||
{
|
||||
var res = await MessageBox.ShowAsync("检测到旧的 BetterGI 配置,是否迁移配置并清理旧目录?", "BetterGI", System.Windows.MessageBoxButton.YesNo);
|
||||
if (res == System.Windows.MessageBoxResult.Yes)
|
||||
var fileVersionInfo = FileVersionInfo.GetVersionInfo(exePath);
|
||||
// 低版本才需要迁移
|
||||
if (fileVersionInfo.FileVersion != null && !Global.IsNewVersion(fileVersionInfo.FileVersion))
|
||||
{
|
||||
var dir = Global.Absolute("BetterGI/User");
|
||||
// 迁移配置,拷贝整个目录并覆盖
|
||||
DirectoryHelper.CopyDirectory(dir, Global.Absolute("User"));
|
||||
// 删除旧目录
|
||||
Directory.Delete(Global.Absolute("BetterGI"));
|
||||
var res = await MessageBox.ShowAsync("检测到旧的 BetterGI 配置,是否迁移配置并清理旧目录?", "BetterGI", System.Windows.MessageBoxButton.YesNo, MessageBoxImage.Question);
|
||||
if (res == System.Windows.MessageBoxResult.Yes)
|
||||
{
|
||||
// 迁移配置,拷贝整个目录并覆盖
|
||||
DirectoryHelper.CopyDirectory(embeddedUserPath, Global.Absolute("User"));
|
||||
// 删除旧目录
|
||||
DirectoryHelper.DeleteReadOnlyDirectory(embeddedPath);
|
||||
await MessageBox.InformationAsync("迁移配置成功, 软件将自动退出,请手动重新启动 BetterGI!");
|
||||
Application.Current.Shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -94,21 +94,26 @@ public partial class HomePageViewModel : ObservableObject, INavigationAware, IVi
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var args = Environment.GetCommandLineArgs();
|
||||
if (args.Length > 1)
|
||||
{
|
||||
if (args[1].Contains("start"))
|
||||
{
|
||||
_ = OnStartTriggerAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void OnLoaded()
|
||||
{
|
||||
// OnTest();
|
||||
|
||||
var args = Environment.GetCommandLineArgs();
|
||||
if (args.Length > 1)
|
||||
{
|
||||
if (args[1].Equals("start"))
|
||||
{
|
||||
_ = OnStartTriggerAsync();
|
||||
}
|
||||
else if (args[1].Equals("startOneDragon"))
|
||||
{
|
||||
var odVm = App.GetService<OneDragonFlowViewModel>();
|
||||
odVm?.OneKeyExecuteCommand.Execute(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnClosed()
|
||||
|
||||
@@ -62,6 +62,8 @@ public partial class OneDragonFlowViewModel : ObservableObject, INavigationAware
|
||||
|
||||
[ObservableProperty]
|
||||
private List<string> _domainNameList = ["", ..MapLazyAssets.Instance.DomainNameList];
|
||||
|
||||
public AllConfig Config { get; set; } = TaskContext.Instance().Config;
|
||||
|
||||
public OneDragonFlowViewModel()
|
||||
{
|
||||
@@ -83,6 +85,7 @@ public partial class OneDragonFlowViewModel : ObservableObject, INavigationAware
|
||||
}
|
||||
}
|
||||
};
|
||||
InitConfigList();
|
||||
}
|
||||
|
||||
public void OnNavigatedTo()
|
||||
|
||||
@@ -11,6 +11,7 @@ using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using BetterGenshinImpact.Core.Config;
|
||||
using BetterGenshinImpact.Core.Script;
|
||||
using BetterGenshinImpact.Core.Script.Group;
|
||||
@@ -174,6 +175,16 @@ public partial class ScriptControlViewModel : ObservableObject, INavigationAware
|
||||
dayRangeComboBox.SelectedValuePath = "Value"; // 绑定的值
|
||||
dayRangeComboBox.SelectedIndex = 0;
|
||||
stackPanel.Children.Add(dayRangeComboBox);
|
||||
|
||||
// 开关控件:ToggleButton 或 CheckBox
|
||||
CheckBox faultStatsSwitch = new CheckBox
|
||||
{
|
||||
Content = "异常情况统计",
|
||||
VerticalAlignment = VerticalAlignment.Center
|
||||
};
|
||||
stackPanel.Children.Add(faultStatsSwitch);
|
||||
|
||||
|
||||
|
||||
|
||||
// 开关控件:ToggleButton 或 CheckBox
|
||||
@@ -212,9 +223,39 @@ public partial class ScriptControlViewModel : ObservableObject, INavigationAware
|
||||
|
||||
secondRow.Children.Add(questionButton);
|
||||
|
||||
StackPanel threeRow = new StackPanel
|
||||
{
|
||||
Orientation = Orientation.Horizontal,
|
||||
Margin = new Thickness(0, 0, 0, 10)
|
||||
};
|
||||
|
||||
// 创建一个 TextBlock
|
||||
TextBlock hoeingDelayBlock = new TextBlock
|
||||
{
|
||||
Text = "锄地延时(秒):",
|
||||
VerticalAlignment = VerticalAlignment.Center,
|
||||
FontSize = 16,
|
||||
Margin = new Thickness(0, 0, 10, 0)
|
||||
};
|
||||
|
||||
|
||||
TextBox hoeingDelayTextBox = new TextBox
|
||||
{
|
||||
Width = 100,
|
||||
FontSize = 16,
|
||||
VerticalContentAlignment = VerticalAlignment.Center
|
||||
};
|
||||
|
||||
threeRow.Children.Add(hoeingDelayBlock);
|
||||
threeRow.Children.Add(hoeingDelayTextBox);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 将第二行添加到 StackPanel
|
||||
stackPanel.Children.Add(secondRow);
|
||||
|
||||
stackPanel.Children.Add(threeRow);
|
||||
//PrimaryButtonText
|
||||
var uiMessageBox = new Wpf.Ui.Controls.MessageBox
|
||||
{
|
||||
@@ -245,7 +286,8 @@ public partial class ScriptControlViewModel : ObservableObject, INavigationAware
|
||||
dayRangeComboBox.SelectedValue = sgpc.DayRangeValue;
|
||||
cookieTextBox.Text = config.Cookie;
|
||||
hoeingStatsSwitch.IsChecked = sgpc.HoeingStatsSwitch;
|
||||
|
||||
faultStatsSwitch.IsChecked = sgpc.FaultStatsSwitch;
|
||||
hoeingDelayTextBox.Text = sgpc.HoeingDelay;
|
||||
|
||||
MessageBoxResult result = await uiMessageBox.ShowDialogAsync();
|
||||
|
||||
@@ -259,6 +301,9 @@ public partial class ScriptControlViewModel : ObservableObject, INavigationAware
|
||||
sgpc.DayRangeValue=dayRangeValue;
|
||||
sgpc.RangeValue = rangeValue;
|
||||
sgpc.HoeingStatsSwitch = hoeingStatsSwitch.IsChecked ?? false;
|
||||
sgpc.FaultStatsSwitch = faultStatsSwitch.IsChecked ?? false;
|
||||
sgpc.HoeingDelay = hoeingDelayTextBox.Text;
|
||||
|
||||
config.Cookie = cookieValue;
|
||||
config.ScriptGroupLogDictionary[_selectedScriptGroup.Name]=sgpc;
|
||||
|
||||
@@ -343,7 +388,7 @@ public partial class ScriptControlViewModel : ObservableObject, INavigationAware
|
||||
configGroupEntities.Reverse();
|
||||
//realGameInfo
|
||||
//小怪摩拉统计
|
||||
win.NavigateToHtml(LogParse.LogParse.GenerHtmlByConfigGroupEntity(configGroupEntities,hoeingStats ? realGameInfo : null));
|
||||
win.NavigateToHtml(LogParse.LogParse.GenerHtmlByConfigGroupEntity(configGroupEntities,hoeingStats ? realGameInfo : null,sgpc));
|
||||
win.ShowDialog();
|
||||
}
|
||||
|
||||
@@ -416,7 +461,16 @@ public partial class ScriptControlViewModel : ObservableObject, INavigationAware
|
||||
WriteScriptGroup(SelectedScriptGroup);
|
||||
|
||||
}
|
||||
|
||||
|
||||
[RelayCommand]
|
||||
private void ReverseTaskOrder()
|
||||
{
|
||||
List<ScriptGroupProject> projects = new();
|
||||
projects.AddRange(SelectedScriptGroup?.Projects.Reverse());
|
||||
SelectedScriptGroup.Projects.Clear();
|
||||
projects.ForEach(item=>SelectedScriptGroup.Projects.Add(item));
|
||||
WriteScriptGroup(SelectedScriptGroup);
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
public void OnCopyScriptGroup(ScriptGroup? item)
|
||||
@@ -702,6 +756,7 @@ public partial class ScriptControlViewModel : ObservableObject, INavigationAware
|
||||
private List<ScriptProject> LoadAllJsScriptProjects()
|
||||
{
|
||||
var path = Global.ScriptPath();
|
||||
Directory.CreateDirectory(path);
|
||||
// 获取所有脚本项目
|
||||
var projects = Directory.GetDirectories(path)
|
||||
.Select(x => new ScriptProject(Path.GetFileName(x)))
|
||||
|
||||
@@ -98,9 +98,8 @@ public partial class TaskSettingsPageViewModel : ObservableObject, INavigationAw
|
||||
|
||||
[ObservableProperty]
|
||||
private List<string> _domainNameList;
|
||||
|
||||
[ObservableProperty]
|
||||
private List<string> _artifactSalvageStarList = ["4", "3", "2", "1"];
|
||||
|
||||
public static List<string> ArtifactSalvageStarList = ["4", "3", "2", "1"];
|
||||
|
||||
[ObservableProperty]
|
||||
private List<string> _autoMusicLevelList = ["传说", "大师", "困难", "普通", "所有"];
|
||||
|
||||
Reference in new issue
Block a user