便携营养袋 的判断进行前置,减少无意义的性能损耗

This commit is contained in:
辉鸭蛋
2024-09-23 22:21:12 +08:00
parent e7148f827d
commit d51139025b

View File

@@ -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 _);
}
/// <summary>