From d51139025b2d0ae14b8ccdff3a489f340d34bebb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=BE=89=E9=B8=AD=E8=9B=8B?= Date: Mon, 23 Sep 2024 22:21:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BE=BF=E6=90=BA=E8=90=A5=E5=85=BB=E8=A2=8B?= =?UTF-8?q?=20=E7=9A=84=E5=88=A4=E6=96=AD=E8=BF=9B=E8=A1=8C=E5=89=8D?= =?UTF-8?q?=E7=BD=AE=EF=BC=8C=E5=87=8F=E5=B0=91=E6=97=A0=E6=84=8F=E4=B9=89?= =?UTF-8?q?=E7=9A=84=E6=80=A7=E8=83=BD=E6=8D=9F=E8=80=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../GameTask/AutoDomain/AutoDomainTask.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/BetterGenshinImpact/GameTask/AutoDomain/AutoDomainTask.cs b/BetterGenshinImpact/GameTask/AutoDomain/AutoDomainTask.cs index 6bbb52fa..f4d58af8 100644 --- a/BetterGenshinImpact/GameTask/AutoDomain/AutoDomainTask.cs +++ b/BetterGenshinImpact/GameTask/AutoDomain/AutoDomainTask.cs @@ -386,12 +386,17 @@ public class AutoDomainTask : ISoloTask { return; } + if (!IsTakeFood()) + { + Logger.LogInformation("未装备 “{Tool}”,不启用红血自动吃药功能", "便携营养袋"); + return; + } try { while (!_cts.Token.IsCancellationRequested) { - if (IsLowHealth() && IsTakeFood()) + if (IsLowHealth()) { // 模拟按键 "Z" Simulation.SendInput.Keyboard.KeyPress(User32.VK.VK_Z); @@ -427,7 +432,7 @@ public class AutoDomainTask : ISoloTask // 识别道具图标下是否是数字 var countArea = ra.DeriveCrop(1800, 845, 40, 20); var count = OcrFactory.Paddle.OcrWithoutDetector(countArea.SrcGreyMat); - return StringUtils.TryParseInt(count) != 0; + return int.TryParse(count, out _); } ///