feat(FullyAutoAndSemiAutoTools): 添加调试日志功能并优化队伍切换逻辑

- 添加了needRunMap的调试日志输出功能
- 修改switchTeamByIndex函数增加key参数支持
- 在路线切换时传入对应的元素名称作为标识
- 为草神路线切换添加了明确的调用参数
This commit is contained in:
yan
2026-01-18 16:48:27 +08:00
parent 0de698b62d
commit 84ae468a23

View File

@@ -639,7 +639,10 @@ async function initRun(config_run) {
});
})
await debugKey(
'log-needRunMap.json',
JSON.stringify([...needRunMap])
);
// needRunMap.set(as_name, {
// paths: matchedPaths,
// as_name: as_name,
@@ -1389,7 +1392,7 @@ async function runPath(path) {
* @param {number} index - 要切换的队伍在SevenElements数组中的索引
* @returns {Promise<void>}
*/
async function switchTeamByIndex(index) {
async function switchTeamByIndex(index,key) {
// 获取指定索引的队伍名称如果索引超出范围或小于0则返回undefined
const teamName = team.SevenElements.length > index && index >= 0 ? team.SevenElements[index] : undefined;
// 检查队伍名称是否有效
@@ -1426,7 +1429,7 @@ async function runPath(path) {
}
else if(path.includes("有草神")){
const idx = SevenElement.SevenElements.indexOf('草');
await switchTeamByIndex(idx);
await switchTeamByIndex(idx,"路线需要草神");
}
else {
const entry = [...SevenElement.SevenElementsMap.entries()].find(([key, val]) => {
@@ -1435,7 +1438,7 @@ async function runPath(path) {
if (entry) {
const [key, val] = entry;
const index = SevenElement.SevenElements.indexOf(key);
await switchTeamByIndex(index);
await switchTeamByIndex(index,key);
// const teamName = team.SevenElements.length > index && index >= 0 ?
// team.SevenElements[index] : undefined;
//