Skip to content

Commit

Permalink
0.39.1 & fix some bug
Browse files Browse the repository at this point in the history
  • Loading branch information
huiyadanli committed Jan 2, 2025
1 parent c0fecd0 commit c80799c
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 21 deletions.
2 changes: 1 addition & 1 deletion BetterGenshinImpact/BetterGenshinImpact.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<ApplicationIcon>Assets\Images\logo.ico</ApplicationIcon>
<AssemblyName>BetterGI</AssemblyName>
<AssemblyVersion>0.39.0</AssemblyVersion>
<AssemblyVersion>0.39.1</AssemblyVersion>
<Platforms>x64</Platforms>
<DebugType>embedded</DebugType>
</PropertyGroup>
Expand Down
22 changes: 11 additions & 11 deletions BetterGenshinImpact/GameTask/AutoDomain/AutoDomainTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,13 @@ private async Task DoDomain()
var combatScenes = new CombatScenes().InitializeTeam(CaptureToRectArea());

// 前置进入秘境
EnterDomain();
await EnterDomain();

for (var i = 0; i < _taskParam.DomainRoundNum; i++)
{
// 0. 关闭秘境提示
Logger.LogDebug("0. 关闭秘境提示");
CloseDomainTip();
await CloseDomainTip();

// 队伍没初始化成功则重试
RetryTeamInit(combatScenes);
Expand Down Expand Up @@ -249,7 +249,7 @@ private async Task TpDomain()
Thread.Sleep(3000);
Simulation.SendInput.Keyboard.KeyUp(VK.VK_W);
}

await Delay(3000, _ct); // 站稳
}
else
Expand Down Expand Up @@ -277,7 +277,7 @@ private async Task<bool> SwitchParty(string? partyName)
return true;
}

private void EnterDomain()
private async Task EnterDomain()
{
var fightAssets = AutoFightContext.Instance.FightAssets;

Expand All @@ -288,7 +288,7 @@ private void EnterDomain()
Simulation.SendInput.Keyboard.KeyPress(VK.VK_F);
Logger.LogInformation("自动秘境:{Text}", "进入秘境");
// 秘境开门动画 5s
Sleep(5000, _ct);
await Delay(5000, _ct);
}

int retryTimes = 0, clickCount = 0;
Expand All @@ -302,14 +302,14 @@ private void EnterDomain()
clickCount++;
}

Sleep(1500, _ct);
await Delay(1500, _ct);
}

// 载入动画
Sleep(3000, _ct);
await Delay(3000, _ct);
}

private void CloseDomainTip()
private async Task CloseDomainTip()
{
// 2min的载入时间总够了吧
var retryTimes = 0;
Expand All @@ -319,16 +319,16 @@ private void CloseDomainTip()
using var cactRectArea = CaptureToRectArea().Find(AutoFightContext.Instance.FightAssets.ClickAnyCloseTipRa);
if (!cactRectArea.IsEmpty())
{
Sleep(1000, _ct);
await Delay(1000, _ct);
cactRectArea.Click();
break;
}

// todo 添加小地图角标位置检测 防止有人手点了
Sleep(1000, _ct);
await Delay(1000, _ct);
}

Sleep(1500, _ct);
await Delay(1500, _ct);
}

private List<CombatCommand> FindCombatScriptAndSwitchAvatar(CombatScenes combatScenes)
Expand Down
25 changes: 16 additions & 9 deletions BetterGenshinImpact/GameTask/AutoMusicGame/AutoAlbumTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,27 @@ public async Task Start(CancellationToken ct)

public async Task StartOneAlbum(CancellationToken ct)
{
using var iconRa = CaptureToRectArea().Find(AutoMusicAssets.Instance.UiLeftTopAlbumIcon);
if (!iconRa.IsExist())
{
throw new Exception("当前未处于专辑界面,请在专辑界面运行本任务");
}

// 12个音乐
for (int i = 0; i < 13; i++)
{
using var iconRa = CaptureToRectArea().Find(AutoMusicAssets.Instance.UiLeftTopAlbumIcon);
if (!iconRa.IsExist())
{
throw new Exception("当前未处于专辑界面,请在专辑界面运行本任务");
}


using var doneRa = CaptureToRectArea().Find(AutoMusicAssets.Instance.AlbumMusicComplate);
if (doneRa.IsExist())
{
Logger.LogInformation("当前音乐{Num}所有奖励已领取,切换下一首", i + 1);
Logger.LogInformation("当前乐曲{Num}所有奖励已领取,切换下一首", i + 1);
GameCaptureRegion.GameRegion1080PPosClick(310, 220);
await Delay(800, ct);
continue;
}

Logger.LogInformation("当前音乐{Num}存在未领取奖励,前往演奏", i + 1);
Logger.LogInformation("当前乐曲{Num}存在未领取奖励,前往演奏", i + 1);
Bv.ClickWhiteConfirmButton(CaptureToRectArea());
await Delay(800, ct);
// 点击传说
Expand Down Expand Up @@ -86,10 +88,15 @@ public async Task StartOneAlbum(CancellationToken ct)
// 等待任意一个任务完成
await Task.WhenAny(checkTask, musicTask);
await cts.CancelAsync();
Logger.LogInformation("当前音乐{Num}演奏结束", i + 1);
Logger.LogInformation("当前乐曲{Num}演奏结束", i + 1);
await Delay(2000, ct);

await Bv.WaitUntilFound(AutoMusicAssets.Instance.UiLeftTopAlbumIcon, ct);
Logger.LogInformation("切换下一首");
GameCaptureRegion.GameRegion1080PPosClick(310, 220);
await Delay(800, ct);
}

Logger.LogInformation("当前专辑所有音乐演奏结束");
Logger.LogInformation("当前专辑所有乐曲演奏结束");
}
}

0 comments on commit c80799c

Please sign in to comment.