Skip to content

Commit b6e4fe3

Browse files
kaedelcbhuiyadanli
andauthored
尘歌壶领取好感角色为空时不领好感 (#2092)
Co-authored-by: 辉鸭蛋 <huiyadanli@gmail.com>
1 parent bbe0b9f commit b6e4fe3

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

BetterGenshinImpact/GameTask/Common/Job/GoToSereniteaPotTask.cs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
using System.Collections.ObjectModel;
1919
using System.Globalization;
2020
using System.IO;
21+
using Newtonsoft.Json;
22+
using BetterGenshinImpact.GameTask.QuickSereniteaPot;
23+
using BetterGenshinImpact.Core.Recognition.OCR;
2124
using System.Linq;
2225
using System.Threading;
2326
using System.Threading.Tasks;
@@ -418,7 +421,28 @@ private async Task GetReward(CancellationToken ct)
418421
{
419422
Logger.LogInformation("领取尘歌壶奖励:{text}", "领取好感和宝钱");
420423
await Delay(1000, ct);
421-
CaptureToRectArea().Find(ElementAssets.Instance.SereniteaPotLoveRo, a => a.Click());
424+
425+
var getAare = CaptureToRectArea();
426+
var count = OcrFactory.Paddle.OcrWithoutDetector(getAare.DeriveCrop(getAare.Width* 1801 / 1920,
427+
getAare.Height* 609 / 1080,getAare.Width * 75 / 1920,getAare.Width * 46 / 1920).SrcMat);
428+
429+
var match = System.Text.RegularExpressions.Regex.Match(count, @"(\d+)\s*[/17]\s*(8)");
430+
var shouldClick = true;
431+
if (match.Success)
432+
{
433+
var numericPart = StringUtils.TryParseInt(match.Groups[1].Value);
434+
if (numericPart == 0)
435+
{
436+
Logger.LogWarning("领取尘歌壶奖励:{text}", "没有角色可领取好感"); //存好感
437+
shouldClick = false;
438+
}
439+
}
440+
441+
if (shouldClick)
442+
{
443+
getAare.Find(ElementAssets.Instance.SereniteaPotLoveRo, a => a.Click());
444+
}
445+
422446
await Delay(500, ct);
423447
var ra = CaptureToRectArea();
424448
var list = ra.FindMulti(new RecognitionObject

0 commit comments

Comments
 (0)