识别体力与树脂数量 (#981)
* 识别体力与树脂数量 * 璃月6-奥藏山 * update repo.json * 地图追踪 星银矿石 (#1025) * Add files via upload * 自动修复 JSON 格式和版本号 [ci skip] * Delete repo/pathing/矿物/星银矿石/desktop.ini * Add files via upload --------- Co-authored-by: GitHub Actions Bot <actions@github.com> * Update main.js (#1024) 手动终止夹断 * update repo.json * 6.7 富Abpro (#1022) * Add files via upload * Add files via upload * Delete repo/js/AutoArtifactsPro/assets/ArtifactsPath/A路线/01普通/000【激活程序】稻妻大炮.json * Delete repo/js/AutoArtifactsPro/assets/ArtifactsPath/A路线/01普通/404须弥-天臂池七天神像4.json * Delete repo/js/AutoArtifactsPro/assets/ArtifactsPath/A路线/01普通/601纳塔-流泉之众4.json * Delete repo/js/AutoArtifactsPro/assets/ArtifactsPath/A路线/01普通/602纳塔-悬木人声望2.json * Delete repo/js/AutoArtifactsPro/assets/ArtifactsPath/A路线/01普通/603纳塔-花羽会西2.json * Add files via upload * update repo.json * `七圣召唤七日历练`: 修复牌币已满时卡在出战界面的问题 (#1017) * update repo.json * js:狗粮重置版1.2更新 (#1026) * update repo.json * fix: 修复部分情况下未找到图标直接结束 * temp * add: 璃月7 * feat: 新的数据结构 * add: 合并代码,功能待实现 --------- Co-authored-by: 寒烟 <2841974482@qq.com> Co-authored-by: physligl <181079228+physligl@users.noreply.github.com> Co-authored-by: Tooltingsu <143606015+Tooltingsu@users.noreply.github.com> Co-authored-by: GitHub Actions Bot <actions@github.com> Co-authored-by: JJMdzh <jjjjedyx@qq.com> Co-authored-by: 汐 <121607261+jiegedabaobei@users.noreply.github.com> Co-authored-by: Patrick-Ze <19711799+Patrick-Ze@users.noreply.github.com> Co-authored-by: mno <718135749@qq.com> Co-authored-by: 秋云 <physligl@gmail.com>
This commit is contained in:
@@ -179,13 +179,72 @@ async function executeMatchingStrategy() {
|
||||
async function loadNodeData() {
|
||||
try {
|
||||
const nodeDataText = await file.readText("LeyLineOutcropData.json");
|
||||
return JSON.parse(nodeDataText);
|
||||
const rawData = JSON.parse(nodeDataText);
|
||||
|
||||
// 适配数据结构:将原始数据转换为代码期望的格式
|
||||
return adaptNodeData(rawData);
|
||||
} catch (error) {
|
||||
log.error(`加载节点数据失败: ${error.message}`);
|
||||
throw new Error("无法加载 LeyLineOutcropData.json 文件");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 适配数据结构:将原始数据转换为代码期望的格式
|
||||
* @param {Object} rawData - 原始JSON数据
|
||||
* @returns {Object} 适配后的节点数据
|
||||
*/
|
||||
function adaptNodeData(rawData) {
|
||||
const adaptedData = {
|
||||
node: [],
|
||||
indexes: rawData.indexes
|
||||
};
|
||||
|
||||
// 添加传送点,设置type为"teleport"
|
||||
if (rawData.teleports) {
|
||||
for (const teleport of rawData.teleports) {
|
||||
adaptedData.node.push({
|
||||
...teleport,
|
||||
type: "teleport",
|
||||
next: [],
|
||||
prev: []
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 添加地脉花节点,设置type为"blossom"
|
||||
if (rawData.blossoms) {
|
||||
for (const blossom of rawData.blossoms) {
|
||||
adaptedData.node.push({
|
||||
...blossom,
|
||||
type: "blossom",
|
||||
next: [],
|
||||
prev: []
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 根据edges构建next和prev关系
|
||||
if (rawData.edges) {
|
||||
for (const edge of rawData.edges) {
|
||||
const sourceNode = adaptedData.node.find(node => node.id === edge.source);
|
||||
const targetNode = adaptedData.node.find(node => node.id === edge.target);
|
||||
|
||||
if (sourceNode && targetNode) {
|
||||
sourceNode.next.push({
|
||||
target: edge.target,
|
||||
route: edge.route
|
||||
});
|
||||
targetNode.prev.push(edge.source);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
log.debug(`适配数据完成:传送点 ${rawData.teleports ? rawData.teleports.length : 0} 个,地脉花 ${rawData.blossoms ? rawData.blossoms.length : 0} 个,边缘 ${rawData.edges ? rawData.edges.length : 0} 个`);
|
||||
|
||||
return adaptedData;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据位置找到对应的目标节点
|
||||
* @param {Object} nodeData - 节点数据
|
||||
@@ -654,7 +713,6 @@ async function adjustViewForReward(boxIconRo, token) {
|
||||
const screenCenterX = 960;
|
||||
const screenCenterY = 540;
|
||||
const maxAngle = 10; // 最大允许偏离角度(度)
|
||||
|
||||
for (let i = 0; i < 20; i++) {
|
||||
// 检查是否取消操作
|
||||
if (token && token.isCancellationRequested) {
|
||||
|
||||
Reference in New Issue
Block a user