Skip to content

Commit

Permalink
fix domain and map retry
Browse files Browse the repository at this point in the history
  • Loading branch information
huiyadanli committed Dec 29, 2024
1 parent 741da4e commit d71ff06
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
8 changes: 6 additions & 2 deletions BetterGenshinImpact/GameTask/AutoDomain/AutoDomainTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ public async Task Start(CancellationToken ct)
try
{
await DoDomain();
// 其他场景不重试
break;
}
catch (Exception e)
{
Expand All @@ -90,9 +92,11 @@ public async Task Start(CancellationToken ct)
await Delay(2000, ct);
continue;
}
else
{
throw;
}
}
// 其他场景不重试
break;
}


Expand Down
15 changes: 11 additions & 4 deletions BetterGenshinImpact/GameTask/AutoTrackPath/TpTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public class TpTask(CancellationToken ct)
/// <param name="tpX"></param>
/// <param name="tpY"></param>
/// <param name="force">强制以当前的tpX,tpY坐标进行自动传送</param>
/// <param name="initialZoomLevel">地图缩放等级</param>
public async Task<(double, double)> TpOnce(double tpX, double tpY, bool force = false, int initialZoomLevel = 4)
{
var (x, y) = (tpX, tpY);
Expand All @@ -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也属于禁止点击区域
{
Expand Down Expand Up @@ -159,10 +160,16 @@ private bool IsPointInBigMapWindow(Rect bigMapInAllMapRect, double x, double y)
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
Expand Down

0 comments on commit d71ff06

Please sign in to comment.