mirror of
https://github.com/babalae/bettergi-scripts-list.git
synced 2026-05-20 22:25:50 +08:00
[自动地脉花]适配新的奖励领取界面及优化退出逻辑 (#2145)
* 适配新的奖励领取界面及优化退出逻辑 - 在各功能函数中添加奖励界面退出校验机制 - 增强奖励尝试及路径执行的错误处理与日志记录 - 适配新的奖励领取界面,基于当前状态优化树脂消耗决策 * Update version to 4.3 and add new contributor information in manifest.json * ”将检查是否关闭奖励界面“的逻辑从"未找到对应的地脉花策略"中移除
This commit is contained in:
@@ -42,6 +42,13 @@ const ocrRoThis = RecognitionObject.ocrThis;
|
||||
}
|
||||
}
|
||||
finally {
|
||||
// 确保退出奖励界面(如果在奖励界面)
|
||||
try {
|
||||
await ensureExitRewardPage();
|
||||
} catch (exitError) {
|
||||
log.warn(`退出奖励界面时出错: ${exitError.message}`);
|
||||
}
|
||||
|
||||
if (!marksStatus) {
|
||||
// 任何时候都确保自定义标记处于打开状态
|
||||
await openCustomMarks();
|
||||
@@ -106,6 +113,12 @@ function initialize() {
|
||||
*/
|
||||
async function prepareForLeyLineRun() {
|
||||
// 0. 回到主界面
|
||||
// 确保退出奖励界面
|
||||
try {
|
||||
await ensureExitRewardPage();
|
||||
} catch (exitError) {
|
||||
log.warn(`退出奖励界面时出错: ${exitError.message}`);
|
||||
}
|
||||
await genshin.returnMainUi(); // 回到主界面
|
||||
setGameMetrics(1920, 1080, 1); // 看起来没什么用
|
||||
// 1. 开局传送到七天神像
|
||||
@@ -404,7 +417,12 @@ async function executePath(path) {
|
||||
const routePath = path.routes[path.routes.length - 1];
|
||||
const targetPath = routePath.replace('assets/pathing/', 'assets/pathing/target/').replace('-rerun', '');
|
||||
await processLeyLineOutcrop(settings.timeout, targetPath);
|
||||
await attemptReward();
|
||||
|
||||
// 尝试领取奖励,如果失败则抛出异常停止执行
|
||||
const rewardSuccess = await attemptReward();
|
||||
if (!rewardSuccess) {
|
||||
throw new Error("无法领取奖励,树脂不足或其他原因");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -445,6 +463,14 @@ async function handleNoStrategyFound() {
|
||||
log.error("未找到对应的地脉花策略,请再次运行脚本");
|
||||
log.error("如果仍然不行,请截图{1}游戏界面,并反馈给作者!", "*完整的*");
|
||||
log.error("完整的游戏界面!完整的游戏界面!完整的游戏界面!");
|
||||
|
||||
// 确保退出奖励界面 TODO: 可能会影响debug,先不执行ensureExitRewardPage
|
||||
// try {
|
||||
// await ensureExitRewardPage();
|
||||
// } catch (exitError) {
|
||||
// log.warn(`退出奖励界面时出错: ${exitError.message}`);
|
||||
// }
|
||||
|
||||
if (isNotification) {
|
||||
notification.error("未找到对应的地脉花策略");
|
||||
await genshin.returnMainUi();
|
||||
|
||||
Reference in New Issue
Block a user