Compare commits

..
12 Commits
4 changed files with 69 additions and 62 deletions

No files matched your search

+2 -2
View File
@@ -16,7 +16,6 @@ jobs:
fileName: "*"
- name: 📥 Download kachina-builder release
if: ${{ github.event.inputs.kachina-channel == 'release' }}
uses: robinraju/[email protected]
with:
repository: "YuehaiTeam/kachina-installer"
@@ -57,6 +56,7 @@ jobs:
- name: Determine version number
id: get-version
shell: bash
run: |
if [ "${{ github.event_name }}" = "release" ]; then
echo "version=${{ github.event.release.tag_name }}" >> $GITHUB_OUTPUT
@@ -72,7 +72,7 @@ jobs:
with:
filetype: local
mirrorchyan_rid: BGI
filename: "downloads/BetterGI_7z/BetterGI.zip"
filename: "BetterGI.zip"
version_name: ${{ steps.get-version.outputs.version }}
upload_token: ${{ secrets.MirrorChyanUploadToken }}
os: win
@@ -2,7 +2,7 @@
<PropertyGroup>
<AssemblyName>BetterGI</AssemblyName>
<Version>0.46.0</Version>
<Version>0.46.2</Version>
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
@@ -398,84 +398,58 @@ public class AutoDomainTask : ISoloTask
Logger.LogInformation("周日未设置秘境奖励序号,不进行奖励选择");
}
}
else
{
Logger.LogWarning("周日设置秘境奖励序号错误,请检查配置页面");
}
}
else
{
Logger.LogWarning("周日奖励选择:圣遗物副本无需选择奖励");
Logger.LogDebug("周日奖励选择:圣遗物副本无需选择奖励");
}
await Delay(300, _ct);
//await Delay(100000, _ct);//调试延时=========
}
// 点击单人挑战,增加容错,点击失败则继续尝试
// 点击单人挑战
int retryTimes = 0;
while (retryTimes < 40)
while (retryTimes < 20)
{
retryTimes++;
using var confirmRectArea = CaptureToRectArea().Find(fightAssets.ConfirmRa);
if (!confirmRectArea.IsEmpty())
{
await Delay(500, _ct);
confirmRectArea.Click();
await Delay(500, _ct);
var ra = CaptureToRectArea();
var matchingChallengeArea = ra.FindMulti(RecognitionObject.Ocr(ra.Width * 0.64, ra.Height * 0.91,
ra.Width * 0.13, ra.Height * 0.06));
var done = matchingChallengeArea.LastOrDefault(t =>
Regex.IsMatch(t.Text, this.matchingChallengeString));
if (done != null)
{
continue;
}
else
{
break;
}
}
await Delay(500, _ct);
}
//如果卡顿,可能会错过"是否仍要挑战该秘境"判断弹框,改为判断"快速编队"后进行点击进入
retryTimes = 0;
while (retryTimes < 30)
{
await Delay(600, _ct);
var ra = CaptureToRectArea();
var rapidformationStringArea = ra.FindMulti(RecognitionObject.Ocr(ra.Width * 0.64, ra.Height * 0.91,
ra.Width * 0.13, ra.Height * 0.06));
var done = rapidformationStringArea.LastOrDefault(t =>
Regex.IsMatch(t.Text, this.rapidformationString));
if (done != null)
{
using var confirmRectArea = CaptureToRectArea().Find(fightAssets.ConfirmRa);
if (!confirmRectArea.IsEmpty())
{
confirmRectArea.Click();
await Delay(500, _ct);
}
}
else
{
break;
}
using var confirmRectArea2 = ra.Find(RecognitionObject.Ocr(ra.Width * 0.263, ra.Height * 0.32,
ra.Width - ra.Width * 0.263 * 2, ra.Height - ra.Height * 0.32 - ra.Height * 0.353));
if (confirmRectArea2.IsExist() && confirmRectArea2.Text.Contains("是否仍要挑战该秘境"))
await Delay(1500, _ct);
}
// 判断弹框
await Delay(600, _ct);
var ra = CaptureToRectArea();
using var confirmRectArea2 = ra.Find(RecognitionObject.Ocr(ra.Width * 0.263, ra.Height * 0.32,
ra.Width - ra.Width * 0.263 * 2, ra.Height - ra.Height * 0.32 - ra.Height * 0.353));
if (confirmRectArea2.IsExist() && confirmRectArea2.Text.Contains("是否仍要挑战该秘境"))
{
Logger.LogWarning("自动秘境:检测到树脂不足提示:{Text}", confirmRectArea2.Text);
throw new Exception("当前树脂不足,自动秘境停止运行。");
}
// 点击进入
retryTimes = 0;
while (retryTimes < 20)
{
retryTimes++;
using var confirmRectArea = CaptureToRectArea().Find(fightAssets.ConfirmRa);
if (!confirmRectArea.IsEmpty())
{
Logger.LogWarning("自动秘境:检测到树脂不足提示:{Text}", confirmRectArea2.Text);
throw new Exception("当前树脂不足,自动秘境停止运行。");
confirmRectArea.Click();
break;
}
retryTimes++;
await Delay(1200, _ct);
}
// 载入动画
await Delay(3000, _ct);
}
@@ -1034,7 +1008,7 @@ public class AutoDomainTask : ISoloTask
// 再 OCR 一次,弹出框,确认当前是否有原粹树脂
using var ra2 = CaptureToRectArea();
var textListInPrompt = ra2.FindMulti(RecognitionObject.Ocr(ra2.Width * 0.25, ra2.Height * 0.2, ra2.Width * 0.5, ra2.Height * 0.6));
if (textListInPrompt.Any(t => t.Text.Contains("数量不足") || t.Text.Contains("补充")))
if (textListInPrompt.Any(t => t.Text.Contains("数量不足") || t.Text.Contains("补充原粹树脂")))
{
// 没有原粹树脂,直接退出秘境
Logger.LogInformation("自动秘境:原粹树脂已用尽,退出秘境");
@@ -1053,16 +1027,31 @@ public class AutoDomainTask : ISoloTask
var resinStatus = ResinStatus.RecogniseFromRegion(ra3);
resinStatus.Print(Logger);
if (resinStatus is { CondensedResinCount: <= 0, OriginalResinCount: < 20 })
{
Logger.LogWarning("树脂不足");
await ExitDomain();
return false;
}
bool resinUsed = false;
if (resinStatus.CondensedResinCount > 0)
{
PressUseResin(ra3, "浓缩树脂");
resinUsed = PressUseResin(ra3, "浓缩树脂");
resinStatus.CondensedResinCount -= 1;
}
else if (resinStatus.OriginalResinCount >= 20)
{
PressUseResin(ra3, "原粹树脂");
resinUsed = PressUseResin(ra3, "原粹树脂");
resinStatus.OriginalResinCount -= 20;
}
if (!resinUsed)
{
Logger.LogWarning("自动秘境:未找到可用的树脂,可能是{Msg1} 或者 {Msg2}。", "树脂不足", "OCR 识别失败");
await ExitDomain();
return false;
}
if (resinStatus is { CondensedResinCount: <= 0, OriginalResinCount: < 20 })
{
@@ -1140,6 +1129,24 @@ public class AutoDomainTask : ISoloTask
// 有体力继续
confirmRectArea.Click();
await Delay(60, _ct); // 双击
confirmRectArea.Click();
if (!chooseResinPrompt)
{
// 真没树脂了还有提示兜底
await Delay(900, _ct);
var textListInNoResinPrompt = CaptureToRectArea().FindMulti(RecognitionObject.Ocr(ra2.Width * 0.25, ra2.Height * 0.2, ra2.Width * 0.5, ra2.Height * 0.6));
if (textListInNoResinPrompt.Any(t => t.Text.Contains("是否仍要") && t.Text.Contains("挑战") && t.Text.Contains("秘境")))
{
var cancelBtn = textListInNoResinPrompt.FirstOrDefault(t => t.Text.Contains("取消"));
if (cancelBtn != null)
{
cancelBtn.Click();
return false;
}
}
}
return true;
}
}
@@ -1175,7 +1182,7 @@ public class AutoDomainTask : ISoloTask
if (useList.Count != 0)
{
// 找到使用按键
var useKey = useList.FirstOrDefault(t => t.X > TaskContext.Instance().SystemInfo.CaptureAreaRect.Width / 2
var useKey = useList.FirstOrDefault(t => t.X > TaskContext.Instance().SystemInfo.ScaleMax1080PCaptureRect.Width / 2
&& IsHeightOverlap(t, resinKey));
if (useKey != null)
{
@@ -81,7 +81,7 @@ public partial class ScriptRepoWindow
}
catch (Exception ex)
{
Toast.Error($"更新失败,可尝试重置仓库后重新更新。失败原因:: {ex.Message}");
await MessageBox.ErrorAsync($"更新失败,可尝试重置仓库后重新更新。失败原因:: {ex.Message}");
}
}