From d71ff068683c08966c16669c7a265a19cbb0b549 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=BE=89=E9=B8=AD=E8=9B=8B?= Date: Sun, 29 Dec 2024 20:54:31 +0800 Subject: [PATCH] fix domain and map retry --- .../GameTask/AutoDomain/AutoDomainTask.cs | 8 ++++++-- .../GameTask/AutoTrackPath/TpTask.cs | 15 +++++++++++---- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/BetterGenshinImpact/GameTask/AutoDomain/AutoDomainTask.cs b/BetterGenshinImpact/GameTask/AutoDomain/AutoDomainTask.cs index e205442f..647c7b26 100644 --- a/BetterGenshinImpact/GameTask/AutoDomain/AutoDomainTask.cs +++ b/BetterGenshinImpact/GameTask/AutoDomain/AutoDomainTask.cs @@ -81,6 +81,8 @@ public class AutoDomainTask : ISoloTask try { await DoDomain(); + // 其他场景不重试 + break; } catch (Exception e) { @@ -90,9 +92,11 @@ public class AutoDomainTask : ISoloTask await Delay(2000, ct); continue; } + else + { + throw; + } } - // 其他场景不重试 - break; } diff --git a/BetterGenshinImpact/GameTask/AutoTrackPath/TpTask.cs b/BetterGenshinImpact/GameTask/AutoTrackPath/TpTask.cs index ea25e3ad..515eb8f0 100644 --- a/BetterGenshinImpact/GameTask/AutoTrackPath/TpTask.cs +++ b/BetterGenshinImpact/GameTask/AutoTrackPath/TpTask.cs @@ -41,6 +41,7 @@ public class TpTask(CancellationToken ct) /// /// /// 强制以当前的tpX,tpY坐标进行自动传送 + /// 地图缩放等级 public async Task<(double, double)> TpOnce(double tpX, double tpY, bool force = false, int initialZoomLevel = 4) { var (x, y) = (tpX, tpY); @@ -62,7 +63,7 @@ public class TpTask(CancellationToken ct) { await AdjustMapZoomLevel(true); currentZoomLevel--; - Logger.LogInformation($"缩放等级过大,调整为{currentZoomLevel}。"); + Logger.LogInformation("当前缩放等级过大,调整为{currentZoomLevel}。", currentZoomLevel); } while (!IsPointInBigMapWindow(bigMapInAllMapRect, x, y) || currentZoomLevel > 2.5) // 左上角 350x400也属于禁止点击区域 { @@ -159,10 +160,16 @@ public class TpTask(CancellationToken ct) Simulation.SendInput.Keyboard.KeyPress(User32.VK.VK_M); await Delay(1000, ct); ra1 = CaptureToRectArea(); + for (int i = 0; i < 3; i++) + { + if (!Bv.IsInBigMapUi(ra1)) + { + await Delay(500, ct); + ra1 = CaptureToRectArea(); + } + } } - currentZoomLevel = GetBigMapZoomLevel(ra1); - Logger.LogInformation($"当前缩放等级为{currentZoomLevel:F},地图移动过程中不要操作鼠标中键。"); - + for (var i = 0; i < 3; i++) { try