[自动地脉花]适配新的奖励领取界面及优化退出逻辑 (#2145)

* 适配新的奖励领取界面及优化退出逻辑

- 在各功能函数中添加奖励界面退出校验机制
- 增强奖励尝试及路径执行的错误处理与日志记录
- 适配新的奖励领取界面,基于当前状态优化树脂消耗决策

* Update version to 4.3 and add new contributor information in manifest.json

* ”将检查是否关闭奖励界面“的逻辑从"未找到对应的地脉花策略"中移除
This commit is contained in:
Colin Xu
2025-10-15 09:15:01 +08:00
committed by GitHub
parent 661b8dbc55
commit ea5d51bc55
11 changed files with 568 additions and 85 deletions

View File

@@ -11,6 +11,7 @@ this.executePathsUsingNodeData = async function (position) {
if (!targetNode) {
log.error(`未找到与坐标(${currentNodePosition.x}, ${currentNodePosition.y})匹配的目标节点`);
await ensureExitRewardPage();
return;
}
log.debug(`找到目标节点: ID ${targetNode.id}, 位置(${targetNode.position.x}, ${targetNode.position.y})`);
@@ -18,6 +19,7 @@ this.executePathsUsingNodeData = async function (position) {
if (paths.length === 0) {
log.error(`未找到通向目标节点(ID: ${targetNode.id})的路径`);
await ensureExitRewardPage();
return;
}
@@ -45,6 +47,7 @@ this.executePathsUsingNodeData = async function (position) {
const nextNode = nodeData.node.find(node => node.id === nextNodeId);
if (!nextNode) {
await ensureExitRewardPage();
return;
}
const pathObject = {
@@ -81,6 +84,7 @@ this.executePathsUsingNodeData = async function (position) {
if (!found) {
log.warn("无法在分支点找到下一个地脉花,退出本次循环");
await ensureExitRewardPage();
return;
}
log.info(`找到下一个地脉花,位置: (${leyLineX}, ${leyLineY})`);
@@ -114,6 +118,7 @@ this.executePathsUsingNodeData = async function (position) {
// 恢复原始坐标
leyLineX = currentLeyLineX;
leyLineY = currentLeyLineY;
await ensureExitRewardPage();
return;
}
const nextNode = nodeData.node.find(node => node.id === selectedNodeId);
@@ -122,6 +127,7 @@ this.executePathsUsingNodeData = async function (position) {
// 恢复原始坐标
leyLineX = currentLeyLineX;
leyLineY = currentLeyLineY;
await ensureExitRewardPage();
return;
}
@@ -149,10 +155,12 @@ this.executePathsUsingNodeData = async function (position) {
catch (error) {
if(error.message.includes("战斗失败")) {
log.error("战斗失败,重新寻找地脉花后重试");
await ensureExitRewardPage();
return;
}
// 其他错误需要向上传播
log.error(`执行路径时出错: ${error.message}`);
await ensureExitRewardPage();
throw error;
}
}