diff --git a/BetterGenshinImpact/Core/Config/HotKeyConfig.cs b/BetterGenshinImpact/Core/Config/HotKeyConfig.cs
index 99d0c6ef..a3a5d1fe 100644
--- a/BetterGenshinImpact/Core/Config/HotKeyConfig.cs
+++ b/BetterGenshinImpact/Core/Config/HotKeyConfig.cs
@@ -22,7 +22,7 @@ public partial class HotKeyConfig : ObservableObject
[ObservableProperty] private string _turnAroundHotkey = "F3";
- // [ObservableProperty] private string _enhanceArtifactHotkey = "F4";
+ [ObservableProperty] private string _enhanceArtifactHotkey = "F4";
[ObservableProperty] private string _quickBuyHotkey = "";
diff --git a/BetterGenshinImpact/GameTask/AutoSkip/OneKeyExpeditionTask.cs b/BetterGenshinImpact/GameTask/AutoSkip/OneKeyExpeditionTask.cs
index dd8e97d5..16a6751f 100644
--- a/BetterGenshinImpact/GameTask/AutoSkip/OneKeyExpeditionTask.cs
+++ b/BetterGenshinImpact/GameTask/AutoSkip/OneKeyExpeditionTask.cs
@@ -1,8 +1,12 @@
-using BetterGenshinImpact.GameTask.AutoSkip.Assets;
-using BetterGenshinImpact.GameTask.Common;
+using BetterGenshinImpact.Core.Simulator;
+using BetterGenshinImpact.GameTask.AutoGeniusInvokation.Exception;
+using BetterGenshinImpact.GameTask.AutoSkip.Assets;
+using BetterGenshinImpact.GameTask.AutoWood.Utils;
using BetterGenshinImpact.View.Drawable;
using Microsoft.Extensions.Logging;
-using OpenCvSharp;
+using System;
+using static BetterGenshinImpact.GameTask.Common.TaskControl;
+using static Vanara.PInvoke.User32;
namespace BetterGenshinImpact.GameTask.AutoSkip;
@@ -10,21 +14,45 @@ public class OneKeyExpeditionTask
{
public void Run(AutoSkipAssets assets)
{
- // 1.全部领取
- var content = TaskControl.CaptureToContent();
- content.CaptureRectArea.Find(assets.CollectRo, ra =>
+ try
{
- ra.ClickCenter();
- TaskControl.Logger.LogInformation("探索派遣:{Text}", "全部领取");
- TaskControl.Sleep(1100);
- // 2.重新派遣
- content = TaskControl.CaptureToContent();
- content.CaptureRectArea.Find(assets.ReRo, ra2 =>
+ // 1.全部领取
+ var content = CaptureToContent();
+ content.CaptureRectArea.Find(assets.CollectRo, ra =>
{
- ra2.ClickCenter();
- TaskControl.Logger.LogInformation("探索派遣:{Text}", "再次派遣");
+ ra.ClickCenter();
+ Logger.LogInformation("探索派遣:{Text}", "全部领取");
+ Sleep(1100);
+ // 2.重新派遣
+ NewRetry.Do(() =>
+ {
+ Sleep(1);
+ content = CaptureToContent();
+ var ra2 = content.CaptureRectArea.Find(assets.ReRo);
+ if (ra2.IsEmpty())
+ {
+ throw new RetryException("未检测到弹出菜单");
+ }
+ else
+ {
+ ra2.ClickCenter();
+ Logger.LogInformation("探索派遣:{Text}", "再次派遣");
+ }
+ }, TimeSpan.FromSeconds(1), 3);
+
+ // 3.退出派遣页面 ESC
+ Sleep(500);
+ Simulation.SendInputEx.Keyboard.KeyPress(VK.VK_ESCAPE);
+ Logger.LogInformation("探索派遣:{Text}", "完成");
});
- });
- VisionContext.Instance().DrawContent.ClearAll();
+ }
+ catch (Exception e)
+ {
+ Logger.LogInformation(e.Message);
+ }
+ finally
+ {
+ VisionContext.Instance().DrawContent.ClearAll();
+ }
}
}
\ No newline at end of file
diff --git a/BetterGenshinImpact/GameTask/Macro/QuickEnhanceArtifactMacro.cs b/BetterGenshinImpact/GameTask/Macro/QuickEnhanceArtifactMacro.cs
index 5e36fa9e..44663134 100644
--- a/BetterGenshinImpact/GameTask/Macro/QuickEnhanceArtifactMacro.cs
+++ b/BetterGenshinImpact/GameTask/Macro/QuickEnhanceArtifactMacro.cs
@@ -6,9 +6,8 @@ using System.Windows;
namespace BetterGenshinImpact.GameTask.Macro;
///
-/// 于 4.3 版本废弃
+/// 一键强化圣遗物
///
-[Obsolete]
public class QuickEnhanceArtifactMacro
{
diff --git a/BetterGenshinImpact/View/Pages/MacroSettingsPage.xaml b/BetterGenshinImpact/View/Pages/MacroSettingsPage.xaml
index a4ebb1b2..ea258177 100644
--- a/BetterGenshinImpact/View/Pages/MacroSettingsPage.xaml
+++ b/BetterGenshinImpact/View/Pages/MacroSettingsPage.xaml
@@ -98,7 +98,7 @@
-
+
diff --git a/BetterGenshinImpact/View/Pages/TriggerSettingsPage.xaml b/BetterGenshinImpact/View/Pages/TriggerSettingsPage.xaml
index 4a97c763..2159aa5f 100644
--- a/BetterGenshinImpact/View/Pages/TriggerSettingsPage.xaml
+++ b/BetterGenshinImpact/View/Pages/TriggerSettingsPage.xaml
@@ -342,7 +342,7 @@
Grid.Column="0"
FontTypography="Body"
TextWrapping="Wrap"
- Text="自动选择鱼饵并抛竿" />
+ Text="自动选择鱼饵并抛竿(实验功能)" />
{ QuickEnhanceArtifactMacro.Done(); }
- // );
- // HotKeySettingModels.Add(enhanceArtifactHotKeySettingModel);
+ var enhanceArtifactHotKeySettingModel = new HotKeySettingModel(
+ "按下快速强化圣遗物",
+ nameof(Config.HotKeyConfig.EnhanceArtifactHotkey),
+ Config.HotKeyConfig.EnhanceArtifactHotkey,
+ (_, _) => { QuickEnhanceArtifactMacro.Done(); }
+ );
+ HotKeySettingModels.Add(enhanceArtifactHotKeySettingModel);
HotKeySettingModels.Add(new HotKeySettingModel(
"按下快速购买商店物品",