diff --git a/BetterGenshinImpact/Core/Config/Global.cs b/BetterGenshinImpact/Core/Config/Global.cs
index a1af26e8..247807e9 100644
--- a/BetterGenshinImpact/Core/Config/Global.cs
+++ b/BetterGenshinImpact/Core/Config/Global.cs
@@ -5,7 +5,7 @@ namespace BetterGenshinImpact.Core.Config;
public class Global
{
- public static string Version = "0.12.0";
+ public static string Version = "0.13.0";
public static string StartUpPath { get; private set; } = AppContext.BaseDirectory;
diff --git a/BetterGenshinImpact/GameTask/AutoSkip/Assets/AutoSkipAssets.cs b/BetterGenshinImpact/GameTask/AutoSkip/Assets/AutoSkipAssets.cs
index b65db9d3..ff60c317 100644
--- a/BetterGenshinImpact/GameTask/AutoSkip/Assets/AutoSkipAssets.cs
+++ b/BetterGenshinImpact/GameTask/AutoSkip/Assets/AutoSkipAssets.cs
@@ -50,7 +50,7 @@ public class AutoSkipAssets
RecognitionType = RecognitionTypes.TemplateMatch,
TemplateImageMat = GameTaskManager.LoadAssetImage("AutoSkip", "icon_daily_reward.png"),
RegionOfInterest = new Rect(info.CaptureAreaRect.Width / 2, 0, info.CaptureAreaRect.Width - info.CaptureAreaRect.Width / 2, info.CaptureAreaRect.Height),
- DrawOnWindow = true
+ DrawOnWindow = false
}.InitTemplate();
ExploreIconRo = new RecognitionObject
{
@@ -58,7 +58,7 @@ public class AutoSkipAssets
RecognitionType = RecognitionTypes.TemplateMatch,
TemplateImageMat = GameTaskManager.LoadAssetImage("AutoSkip", "icon_explore.png"),
RegionOfInterest = new Rect(info.CaptureAreaRect.Width / 2, 0, info.CaptureAreaRect.Width - info.CaptureAreaRect.Width / 2, info.CaptureAreaRect.Height),
- DrawOnWindow = true
+ DrawOnWindow = false
}.InitTemplate();
MenuRo = new RecognitionObject
diff --git a/BetterGenshinImpact/GameTask/AutoSkip/AutoSkipConfig.cs b/BetterGenshinImpact/GameTask/AutoSkip/AutoSkipConfig.cs
index f7547e44..198853b9 100644
--- a/BetterGenshinImpact/GameTask/AutoSkip/AutoSkipConfig.cs
+++ b/BetterGenshinImpact/GameTask/AutoSkip/AutoSkipConfig.cs
@@ -30,5 +30,16 @@ namespace BetterGenshinImpact.GameTask.AutoSkip
public int ChatOptionTextWidth { get; set; }= 280;
public int ExpeditionOptionTextWidth { get; set; } = 130;
+
+
+ ///
+ /// 自动领取每日委托奖励
+ ///
+ [ObservableProperty] private bool _autoGetDailyRewardsEnabled = true;
+
+ ///
+ /// 自动重新派遣
+ ///
+ [ObservableProperty] private bool _autoReExploreEnabled = false;
}
}
diff --git a/BetterGenshinImpact/GameTask/AutoSkip/AutoSkipTrigger.cs b/BetterGenshinImpact/GameTask/AutoSkip/AutoSkipTrigger.cs
index 5551644a..e6f1de21 100644
--- a/BetterGenshinImpact/GameTask/AutoSkip/AutoSkipTrigger.cs
+++ b/BetterGenshinImpact/GameTask/AutoSkip/AutoSkipTrigger.cs
@@ -64,51 +64,57 @@ public class AutoSkipTrigger : ITaskTrigger
}
// 领取每日委托奖励
- var dailyRewardIconRa = content.CaptureRectArea.Find(_autoSkipAssets.DailyRewardIconRo);
- if (!dailyRewardIconRa.IsEmpty())
+ if (config.AutoGetDailyRewardsEnabled)
{
- var text = GetOrangeOptionText(content.CaptureRectArea.SrcMat, dailyRewardIconRa, (int)(config.ChatOptionTextWidth * assetScale));
-
- if (text.Contains("每日委托"))
+ var dailyRewardIconRa = content.CaptureRectArea.Find(_autoSkipAssets.DailyRewardIconRo);
+ if (!dailyRewardIconRa.IsEmpty())
{
- if (Math.Abs(content.FrameIndex - _prevOtherClickFrameIndex) >= 8)
+ var text = GetOrangeOptionText(content.CaptureRectArea.SrcMat, dailyRewardIconRa, (int)(config.ChatOptionTextWidth * assetScale));
+
+ if (text.Contains("每日委托"))
{
- _logger.LogInformation("自动选择:{Text}", text);
+ if (Math.Abs(content.FrameIndex - _prevOtherClickFrameIndex) >= 8)
+ {
+ _logger.LogInformation("自动选择:{Text}", text);
+ }
+
+ dailyRewardIconRa.ClickCenter();
+ dailyRewardIconRa.Dispose();
+ return;
}
- dailyRewardIconRa.ClickCenter();
+ _prevOtherClickFrameIndex = content.FrameIndex;
dailyRewardIconRa.Dispose();
- return;
}
-
- _prevOtherClickFrameIndex = content.FrameIndex;
- dailyRewardIconRa.Dispose();
}
// 领取探索派遣奖励
- var exploreIconRa = content.CaptureRectArea.Find(_autoSkipAssets.ExploreIconRo);
- if (!exploreIconRa.IsEmpty())
+ if (config.AutoReExploreEnabled)
{
- var text = GetOrangeOptionText(content.CaptureRectArea.SrcMat, exploreIconRa, (int)(config.ExpeditionOptionTextWidth * assetScale));
- if (text.Contains("探索派遣"))
+ var exploreIconRa = content.CaptureRectArea.Find(_autoSkipAssets.ExploreIconRo);
+ if (!exploreIconRa.IsEmpty())
{
- if (Math.Abs(content.FrameIndex - _prevOtherClickFrameIndex) >= 8)
+ var text = GetOrangeOptionText(content.CaptureRectArea.SrcMat, exploreIconRa, (int)(config.ExpeditionOptionTextWidth * assetScale));
+ if (text.Contains("探索派遣"))
{
- _logger.LogInformation("自动选择:{Text}", text);
+ if (Math.Abs(content.FrameIndex - _prevOtherClickFrameIndex) >= 8)
+ {
+ _logger.LogInformation("自动选择:{Text}", text);
+ }
+
+ exploreIconRa.ClickCenter();
+
+ // 等待探索派遣界面打开
+ Thread.Sleep(1000);
+ new ExpeditionTask().Run(content);
+ exploreIconRa.Dispose();
+ return;
}
- exploreIconRa.ClickCenter();
-
- // 等待探索派遣界面打开
- Thread.Sleep(1000);
- new ExpeditionTask().Run(content);
+ _prevOtherClickFrameIndex = content.FrameIndex;
exploreIconRa.Dispose();
return;
}
-
- _prevOtherClickFrameIndex = content.FrameIndex;
- exploreIconRa.Dispose();
- return;
}
// 找右下的对话选项按钮
diff --git a/BetterGenshinImpact/GameTask/AutoSkip/ExpeditionTask.cs b/BetterGenshinImpact/GameTask/AutoSkip/ExpeditionTask.cs
index 5e221833..9034484e 100644
--- a/BetterGenshinImpact/GameTask/AutoSkip/ExpeditionTask.cs
+++ b/BetterGenshinImpact/GameTask/AutoSkip/ExpeditionTask.cs
@@ -27,7 +27,7 @@ namespace BetterGenshinImpact.GameTask.AutoSkip;
///
public class ExpeditionTask
{
- private static readonly List ExpeditionCharacterList = new() { "菲谢尔", "班尼特" };
+ private static readonly List ExpeditionCharacterList = new() { "菲谢尔", "班尼特", "夜兰", "申鹤", "久岐忍" };
//private static readonly List GameAreaNames = new() { "蒙德", "璃月", "稻妻", "须弥", "枫丹" };
@@ -50,7 +50,7 @@ public class ExpeditionTask
}
else
{
- TaskControl.Sleep(500);
+ TaskControl.Sleep(800);
content.CaptureRectArea
.Derive(new Rect((int)(110 * assetScale), (int)((145 + 70 * i) * assetScale),
(int)(60 * assetScale), (int)(33 * assetScale)))
@@ -58,7 +58,7 @@ public class ExpeditionTask
ReExplorationGameArea(content);
}
}
-
+ TaskControl.Logger.LogInformation("探索派遣:{Text}", "重新派遣完成");
VisionContext.Instance().DrawContent.ClearAll();
}
@@ -71,10 +71,12 @@ public class ExpeditionTask
{
var result = CaptureAndOcr(content, new Rect(0, 0, captureRect.Width - (int)(480 * assetScale), captureRect.Height));
var rect = result.FindRectByText("探险完成");
+ // TODO i>1 的时候,可以通过关键词“探索派遣限制 4 / 5 ”判断是否已经派遣完成?
if (rect != Rect.Empty)
{
- // 点击探险完成
+ // 点击探险完成下方的人物头像
content.CaptureRectArea.Derive(new Rect(rect.X, rect.Y + (int)(50 * assetScale), rect.Width, (int)(80 * assetScale))).ClickCenter();
+ TaskControl.Sleep(500);
// 重新截图 找领取
result = CaptureAndOcr(content);
rect = result.FindRectByText("领取");
@@ -116,13 +118,18 @@ public class ExpeditionTask
private bool SelectCharacter(CaptureContent content)
{
- var result = CaptureAndOcr(content);
+ var captureRect = TaskContext.Instance().SystemInfo.CaptureAreaRect;
+ var result = CaptureAndOcr(content, new Rect(0, 0, captureRect.Width / 2, captureRect.Height));
if (result.RegionHasText("角色选择"))
{
var cards = GetCharacterCards(result);
if (cards.Count > 0)
{
- var card = cards.First(c => c.Idle);
+ var card = cards.FirstOrDefault(c => c.Idle && c.Name != null && ExpeditionCharacterList.Contains(c.Name));
+ if (card == null)
+ {
+ card = cards.First(c => c.Idle);
+ }
var rect = card.Rects.First();
using var ra = content.CaptureRectArea.Derive(rect);
@@ -163,7 +170,7 @@ public class ExpeditionTask
foreach (var ocrResultRect2 in ocrResultRects)
{
if (ocrResultRect2.Rect.Y > ocrResultRect.Rect.Y - 50 * assetScale
- && ocrResultRect2.Rect.Y + ocrResultRect2.Rect.Height > ocrResultRect.Rect.Y)
+ && ocrResultRect2.Rect.Y + ocrResultRect2.Rect.Height < ocrResultRect.Rect.Y + ocrResultRect.Rect.Height)
{
if (ocrResultRect2.Text.Contains("探险完成"))
{
@@ -174,16 +181,23 @@ public class ExpeditionTask
card.Name = name;
}
}
- else
+ else if (!ocrResultRect2.Text.Contains("时间缩短") && !ocrResultRect2.Text.Contains("奖励增加") && !ocrResultRect2.Text.Contains("暂无加成"))
{
card.Name = ocrResultRect2.Text;
}
- card.Rects.Add(ocrResultRect.Rect);
+ card.Rects.Add(ocrResultRect2.Rect);
}
}
- cards.Add(card);
+ if (!string.IsNullOrEmpty(card.Name))
+ {
+ cards.Add(card);
+ }
+ else
+ {
+ TaskControl.Logger.LogWarning("探索派遣:存在未找到角色命的识别内容");
+ }
}
}
@@ -198,7 +212,7 @@ public class ExpeditionTask
using var mat = bitmap.ToMat();
Cv2.CvtColor(mat, mat, ColorConversionCodes.BGR2GRAY);
var result = OcrFactory.Paddle.OcrResult(mat);
- VisionContext.Instance().DrawContent.PutOrRemoveRectList("OcrResultRects", result.ToRectDrawableList());
+ //VisionContext.Instance().DrawContent.PutOrRemoveRectList("OcrResultRects", result.ToRectDrawableList());
return result;
}
@@ -209,7 +223,7 @@ public class ExpeditionTask
using var mat = new Mat(bitmap.ToMat(), rect);
Cv2.CvtColor(mat, mat, ColorConversionCodes.BGR2GRAY);
var result = OcrFactory.Paddle.OcrResult(mat);
- VisionContext.Instance().DrawContent.PutOrRemoveRectList("OcrResultRects", result.ToRectDrawableList(_pen));
+ //VisionContext.Instance().DrawContent.PutOrRemoveRectList("OcrResultRects", result.ToRectDrawableList(_pen));
return result;
}
}
\ No newline at end of file
diff --git a/BetterGenshinImpact/View/Pages/TriggerSettingsPage.xaml b/BetterGenshinImpact/View/Pages/TriggerSettingsPage.xaml
index 667b1efc..9d000a1b 100644
--- a/BetterGenshinImpact/View/Pages/TriggerSettingsPage.xaml
+++ b/BetterGenshinImpact/View/Pages/TriggerSettingsPage.xaml
@@ -200,6 +200,62 @@
Margin="0,0,36,0"
IsChecked="{Binding Config.AutoSkipConfig.QuicklySkipConversationsEnabled, Mode=TwoWay}" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BetterGenshinImpact/ViewModel/Pages/HomePageViewModel.cs b/BetterGenshinImpact/ViewModel/Pages/HomePageViewModel.cs
index 801bd444..19b810b1 100644
--- a/BetterGenshinImpact/ViewModel/Pages/HomePageViewModel.cs
+++ b/BetterGenshinImpact/ViewModel/Pages/HomePageViewModel.cs
@@ -146,7 +146,7 @@ public partial class HomePageViewModel : ObservableObject, INavigationAware
[RelayCommand]
private void OnTest()
{
- var result = OcrFactory.Paddle.OcrResult(new Mat("E:\\HuiTask\\更好的原神\\自动派遣\\Clip_20231030_235235.png", ImreadModes.Grayscale));
+ var result = OcrFactory.Paddle.OcrResult(new Mat(@"E:\HuiTask\更好的原神\七圣召唤\Clip_20231105_143729.png", ImreadModes.Grayscale));
foreach (var region in result.Regions)
{
Debug.WriteLine($"{region.Text}");