build
This commit is contained in:
147
build/build.js
Normal file
147
build/build.js
Normal file
@@ -0,0 +1,147 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const crypto = require('crypto');
|
||||
|
||||
function calculateSHA1(filePath) {
|
||||
const fileBuffer = fs.readFileSync(filePath);
|
||||
const hashSum = crypto.createHash('sha1');
|
||||
hashSum.update(fileBuffer);
|
||||
return hashSum.digest('hex');
|
||||
}
|
||||
|
||||
function extractInfoFromCombatFile(filePath) {
|
||||
const content = fs.readFileSync(filePath, 'utf8');
|
||||
const authorMatch = content.match(/\/\/\s*作者:(.*)/);
|
||||
const descriptionMatch = content.match(/\/\/\s*描述:(.*)/);
|
||||
const characterMatches = content.match(/^(?!\/\/).*?(\S+)(?=\s|$)/gm);
|
||||
|
||||
const tags = [...new Set(characterMatches || [])]
|
||||
.map(char => char.trim())
|
||||
.filter(char => char.length > 0 && !char.match(/^[,.]$/)); // 过滤掉单个逗号或句号
|
||||
|
||||
return {
|
||||
author: authorMatch ? authorMatch[1].trim() : '',
|
||||
description: descriptionMatch ? descriptionMatch[1].trim() : '',
|
||||
tags: tags
|
||||
};
|
||||
}
|
||||
|
||||
function extractInfoFromJSFolder(folderPath) {
|
||||
const manifestPath = path.join(folderPath, 'manifest.json');
|
||||
if (fs.existsSync(manifestPath)) {
|
||||
try {
|
||||
const manifestContent = fs.readFileSync(manifestPath, 'utf8');
|
||||
const manifest = JSON.parse(manifestContent);
|
||||
return {
|
||||
version: manifest.version || '',
|
||||
description: manifest.description || '',
|
||||
author: manifest.authors && manifest.authors.length > 0 ? manifest.authors[0].name : '',
|
||||
tags: []
|
||||
};
|
||||
} catch (error) {
|
||||
console.error(`解析 ${manifestPath} 时出错:`, error);
|
||||
console.error('文件内容:', fs.readFileSync(manifestPath, 'utf8'));
|
||||
return { version: '', description: '', author: '', tags: [] };
|
||||
}
|
||||
}
|
||||
return { version: '', description: '', author: '', tags: [] };
|
||||
}
|
||||
|
||||
function extractInfoFromPathingFile(filePath, parentFolders) {
|
||||
const content = JSON.parse(fs.readFileSync(filePath, 'utf8'));
|
||||
return {
|
||||
author: content.info && content.info.author ? content.info.author : '',
|
||||
description: '',
|
||||
tags: parentFolders.slice(2) // 从第三个元素开始,跳过 'pathing' 和下一级目录
|
||||
};
|
||||
}
|
||||
|
||||
function extractInfoFromTCGFile(filePath, parentFolder) {
|
||||
const content = fs.readFileSync(filePath, 'utf8');
|
||||
const authorMatch = content.match(/\/\/\s*作者:(.*)/);
|
||||
const descriptionMatch = content.match(/\/\/\s*描述:(.*)/);
|
||||
const characterMatches = content.match(/角色\d+=([^|\r\n{]+)/g);
|
||||
|
||||
const tags = characterMatches
|
||||
? characterMatches.map(match => match.split('=')[1].trim())
|
||||
.filter(tag => tag && !tag.startsWith('角色'))
|
||||
: [];
|
||||
|
||||
if (parentFolder === '惊喜牌组') {
|
||||
tags.push('惊喜牌组');
|
||||
}
|
||||
|
||||
return {
|
||||
author: authorMatch ? authorMatch[1].trim() : '',
|
||||
description: descriptionMatch ? descriptionMatch[1].trim() : '',
|
||||
tags: [...new Set(tags)] // 去重
|
||||
};
|
||||
}
|
||||
|
||||
function generateDirectoryTree(dir, currentDepth = 0, parentFolders = []) {
|
||||
const stats = fs.statSync(dir);
|
||||
const info = {
|
||||
name: path.basename(dir),
|
||||
type: stats.isDirectory() ? 'directory' : 'file'
|
||||
};
|
||||
|
||||
if (stats.isDirectory()) {
|
||||
if (parentFolders[0] === 'js' && currentDepth === 1) {
|
||||
// 对于 js 文件夹下的直接子文件夹,不再递归
|
||||
const manifestPath = path.join(dir, 'manifest.json');
|
||||
if (fs.existsSync(manifestPath)) {
|
||||
const jsInfo = extractInfoFromJSFolder(dir);
|
||||
info.hash = calculateSHA1(manifestPath);
|
||||
info.version = jsInfo.version || info.hash.substring(0, 7);
|
||||
info.author = jsInfo.author;
|
||||
info.description = jsInfo.description;
|
||||
info.tags = jsInfo.tags;
|
||||
}
|
||||
} else {
|
||||
info.children = fs.readdirSync(dir).map(child => {
|
||||
const childPath = path.join(dir, child);
|
||||
return generateDirectoryTree(childPath, currentDepth + 1, [...parentFolders, info.name]);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
const hash = calculateSHA1(dir);
|
||||
info.hash = hash;
|
||||
info.version = hash.substring(0, 7);
|
||||
|
||||
const category = parentFolders[0];
|
||||
try {
|
||||
switch (category) {
|
||||
case 'combat':
|
||||
Object.assign(info, extractInfoFromCombatFile(dir));
|
||||
break;
|
||||
case 'pathing':
|
||||
Object.assign(info, extractInfoFromPathingFile(dir, parentFolders));
|
||||
info.tags = info.tags.filter(tag => tag !== 'pathing');
|
||||
break;
|
||||
case 'tcg':
|
||||
Object.assign(info, extractInfoFromTCGFile(dir, parentFolders[1]));
|
||||
break;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(`处理文件 ${dir} 时出错:`, error);
|
||||
info.error = error.message;
|
||||
}
|
||||
}
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
const repoPath = path.resolve(__dirname, '..', 'repo');
|
||||
|
||||
// 读取 repoPath 下的所有文件夹
|
||||
const topLevelFolders = fs.readdirSync(repoPath)
|
||||
.filter(item => fs.statSync(path.join(repoPath, item)).isDirectory());
|
||||
|
||||
// 对每个顶级文件夹调用 generateDirectoryTree
|
||||
const result = topLevelFolders.map(folder => {
|
||||
const folderPath = path.join(repoPath, folder);
|
||||
return generateDirectoryTree(folderPath, 0, [folder]);
|
||||
});
|
||||
|
||||
fs.writeFileSync('tree.json', JSON.stringify(result, null, 2));
|
||||
console.log('树状结构已保存到 tree.json 文件中。');
|
||||
3187
build/tree.json
Normal file
3187
build/tree.json
Normal file
File diff suppressed because it is too large
Load Diff
14
repo/combat/2.宵宫队[请看文件内说明].txt
Normal file
14
repo/combat/2.宵宫队[请看文件内说明].txt
Normal file
@@ -0,0 +1,14 @@
|
||||
// 作者:爱司基模人
|
||||
// 描述:推荐配队\n钟离 (夜/行/班/云/万)四选二 宵宫\n不推荐云堇万叶一起上\n钟离 芙宁娜 琴/早柚/班尼特 宵宫\n风奶带风套最好(金珀小鹿?金珀砂糖?金珀散兵?),其他奶凑合用/n
|
||||
|
||||
|
||||
钟离 s(0.1),e(hold),wait(0.3),w(0.1)
|
||||
芙宁娜 e,q
|
||||
行秋 e,q,e
|
||||
夜兰 e,e,wait(0.2),e,e,q
|
||||
云堇 e,q
|
||||
班尼特 e,q
|
||||
//琴 e,q 不识别
|
||||
早柚 e,e,q
|
||||
枫原万叶 e,attack(0.1),q
|
||||
宵宫 e,attack(5.5)
|
||||
@@ -1,3 +1,6 @@
|
||||
// 作者:佚名
|
||||
// 描述:
|
||||
|
||||
钟离 s(0.2),e(hold),wait(0.3),w(0.2),q
|
||||
纳西妲 e(hold),wait(0.3)
|
||||
芙宁娜 e,wait(0.3),q
|
||||
@@ -1,3 +1,6 @@
|
||||
// 作者:佚名
|
||||
// 描述:
|
||||
|
||||
仆人 e
|
||||
钟离 s(0.1),e(hold)
|
||||
班尼特 e,q
|
||||
@@ -1,3 +1,7 @@
|
||||
// 作者:佚名
|
||||
// 描述:北斗托马需要堆充能,自动轴为了更稳降低了输出,后置护盾容易被打断,不适用于开局就多动症的敌人(比如谐律本)
|
||||
|
||||
|
||||
仆人 e
|
||||
北斗 e
|
||||
托马 e,q
|
||||
@@ -10,4 +14,3 @@
|
||||
北斗 e,q
|
||||
仆人 charge(0.52),attack(2),dash,attack(2),dash,attack(2),e
|
||||
|
||||
//缺点:北斗托马需要堆充能,自动轴为了更稳降低了输出,后置护盾容易被打断,不适用于开局就多动症的敌人(比如谐律本)
|
||||
@@ -1,3 +1,7 @@
|
||||
// 作者:佚名
|
||||
// 描述:
|
||||
|
||||
|
||||
钟离 q,s(0.2),e(hold),wait(0.1),w(0.2),wait(0.2)
|
||||
雷电将军 e,wait(0.5),
|
||||
纳西妲 e(hold),wait(0.3),q,attack(0.5)
|
||||
@@ -1,3 +1,6 @@
|
||||
// 作者:爱司基模人
|
||||
// 描述:
|
||||
|
||||
雷电将军 e
|
||||
芙宁娜 e,wait(0.2),q
|
||||
夜兰 e,e,wait(0.8),e,e,wait(1.5),q
|
||||
@@ -1,3 +1,6 @@
|
||||
// 作者:爱司基模人
|
||||
// 描述:
|
||||
|
||||
白术 e,q
|
||||
纳西妲 e(hold),wait(0.3),q
|
||||
妮露 e,e,e,e,e,e,e,e
|
||||
@@ -1,3 +1,6 @@
|
||||
// 作者:爱司基模人
|
||||
// 描述:
|
||||
|
||||
钟离 q,s(0.1),e(hold),wait(0.3),w(0.1),attack(0.05),dash
|
||||
芙芙 e,q,attack(0.05),dash
|
||||
娜维娅 q,attack(0.05),dash,click(middle),wait(0.3),keydown(e),wait(0.2),keyup(e),click
|
||||
@@ -1,3 +1,6 @@
|
||||
// 作者:佚名
|
||||
// 描述:
|
||||
|
||||
芙宁娜 e,wait(0.2),q,wait(0.1)
|
||||
夜兰 e,wait(0.1),q,attack(0.5)
|
||||
白术 e,wait(0.1),q,attack(0.5)
|
||||
@@ -1,3 +1,7 @@
|
||||
// 作者:佚名
|
||||
// 描述:
|
||||
|
||||
|
||||
钟离 e(hold)
|
||||
夜兰 e,e,wait(0.2),q
|
||||
芙宁娜 e,wait(0.3),q
|
||||
@@ -1,3 +1,6 @@
|
||||
// 作者:爱司基模人
|
||||
// 描述:
|
||||
|
||||
钟离 s(0.2),e(hold),wait(0.3),w(0.2)
|
||||
纳西妲 e(hold),wait(0.3),d(0.2),q
|
||||
八重神子 q,s(0.2),e,wait(0.5),e,wait(0.6),w(0.2),e
|
||||
@@ -1,3 +1,6 @@
|
||||
// 作者:爱司基模人
|
||||
// 描述:
|
||||
|
||||
钟离 s(0.1),e(hold)
|
||||
纳西妲 e(hold)
|
||||
八重神子 s(0.1),e,wait(0.45),e,wait(0.55),w(0.2),e
|
||||
@@ -1,3 +1,6 @@
|
||||
// 作者:佚名
|
||||
// 描述:推荐配队:\n1钟离 夜班行云四选二 散兵\n2钟离 珐露珊 四琴 散兵 琴不识别,四琴用不了 可以试试加个q收尾\n3钟离 芙宁娜 四琴 散兵 琴不识别,四琴用不了\n4莱依拉北斗 行秋 云珐夜班 散兵
|
||||
|
||||
钟离 s(0.1),e(hold),wait(0.3),w(0.1)
|
||||
行秋 e,q,e
|
||||
夜兰 e,e,wait(0.2),e,e,q
|
||||
@@ -11,9 +14,3 @@
|
||||
//流浪者 e,attack(1.2),charge,attack(1),charge,attack(1),charge,e
|
||||
//散兵只重击
|
||||
//流浪者 e,charge,charge,charge,charge,charge,charge,charge,charge,charge,e
|
||||
//
|
||||
//推荐配队
|
||||
//钟离 夜班行云四选二 散兵
|
||||
//钟离 珐露珊 四琴 散兵 琴不识别,四琴用不了 可以试试加个q收尾
|
||||
//钟离 芙宁娜 四琴 散兵 琴不识别,四琴用不了
|
||||
//莱依拉北斗 行秋 云珐夜班 散兵
|
||||
@@ -1,3 +1,6 @@
|
||||
// 作者:爱司基模人
|
||||
// 描述:
|
||||
|
||||
钟离 s(0.1),e(hold),wait(0.3),w(0.1)
|
||||
芙宁娜 e,q
|
||||
行秋 attack(0.1),dash,e,q,e
|
||||
@@ -1,3 +1,6 @@
|
||||
// 作者:爱司基模人
|
||||
// 描述:
|
||||
|
||||
申鹤 e,q
|
||||
枫原万叶 e,attack(0.1)
|
||||
珊瑚宫心海 e
|
||||
@@ -1,3 +1,6 @@
|
||||
// 作者:爱司基模人
|
||||
// 描述:
|
||||
|
||||
钟离 s(0.2),e(hold),wait(0.3),w(0.2)
|
||||
行秋 e,q,e,wait(0.3)
|
||||
夜兰 e,e,wait(0.5),e,e,wait(1),q
|
||||
@@ -1,3 +1,6 @@
|
||||
// 作者:爱司基模人
|
||||
// 描述:草神瞎转点不了种子
|
||||
|
||||
钟离 q,w(1),s(0),e(hold),wait(0.3),w(0.1)
|
||||
纳西妲 e(hold),wait(0.3),q
|
||||
行秋 e,q,e
|
||||
@@ -1,7 +1,9 @@
|
||||
// 作者:佚名
|
||||
// 描述:缺点为无聚怪手段,双水角色需要堆一定的充能效率,优点是不画地为牢
|
||||
|
||||
|
||||
仆人 e
|
||||
钟离 s(0.2),e(hold),wait(0.1),w(0.2),wait(0.2)
|
||||
夜兰 e,attack(0.5),q
|
||||
坎蒂丝 e,q
|
||||
仆人 charge(0.52),attack(2),dash,attack(2),dash,attack(2),e
|
||||
|
||||
//缺点为无聚怪手段,双水角色需要堆一定的充能效率,优点是不画地为牢
|
||||
@@ -1,7 +1,9 @@
|
||||
// 作者:佚名
|
||||
// 描述:双c配置,三岩保障云堇有足够充能,缺点是伤害较低
|
||||
|
||||
仆人 e
|
||||
钟离 s(0.2),e(hold),wait(0.1),w(0.2),wait(0.2)
|
||||
娜维娅 e,q,e
|
||||
云堇 q,e
|
||||
仆人 charge(0.52),attack(2),dash,attack(2),dash,attack(2),e
|
||||
|
||||
//双c配置,三岩保障云堇有足够充能,缺点是伤害较低
|
||||
@@ -1,3 +1,6 @@
|
||||
// 作者:佚名
|
||||
// 描述:
|
||||
|
||||
钟离 s(0.2),e(hold)
|
||||
八重神子 e,wait(0.5),s(0.6),wait(0.2),e,wait(0.5),s(0.6),wait(0.2),w(0.2),wait(0.2),e
|
||||
枫原万叶 w(0.3),wait(0.1),e(hold),attack,q,e,attack
|
||||
@@ -1,3 +1,6 @@
|
||||
// 作者:拾荒者uihdve
|
||||
// 描述:
|
||||
|
||||
钟离 s(0.2),e(hold),wait(0.3),w(0.2),q
|
||||
纳西妲 e(hold),q
|
||||
夜兰 e,e,wait(0.2),e,e,q
|
||||
@@ -1,3 +1,6 @@
|
||||
// 作者:Dawn
|
||||
// 描述:
|
||||
|
||||
钟离 s(0.2),e(hold),wait(0.3),w(0.2),q
|
||||
芙宁娜 e,q
|
||||
琴 e,q
|
||||
@@ -1,3 +1,6 @@
|
||||
// 作者:上杉夏香
|
||||
// 描述:
|
||||
|
||||
钟离 s(0.2),e(hold),q
|
||||
芙宁娜 e,q
|
||||
鹿野苑平藏 e,q
|
||||
@@ -1,3 +1,6 @@
|
||||
// 作者:佚名
|
||||
// 描述:
|
||||
|
||||
钟离 s(0.2),e(hold),wait(0.3),w(0.2),q
|
||||
纳西妲 e(hold),q
|
||||
芙宁娜 e,wait(0.3),q
|
||||
@@ -1,3 +1,6 @@
|
||||
// 作者:爱司基模人
|
||||
// 描述:非满命
|
||||
|
||||
钟离 s(0.2),e(hold),wait(0.3),w(0.2),q
|
||||
那维莱特 e
|
||||
芙宁娜 e,q
|
||||
@@ -1,3 +1,6 @@
|
||||
// 作者:绘星痕
|
||||
// 描述:
|
||||
|
||||
钟离 s(0.2),e(hold),wait(0.3),w(0.2)
|
||||
芙宁娜 e,wait(0.3),q
|
||||
雷电将军 e
|
||||
@@ -1,3 +1,6 @@
|
||||
// 作者:爱司基模人
|
||||
// 描述:
|
||||
|
||||
钟离 s(0.2),e(hold),wait(0.3),w(0.2),q
|
||||
那维莱特 e
|
||||
枫原万叶 e,attack(0.1)
|
||||
@@ -1,3 +1,6 @@
|
||||
// 作者:爱司基模人
|
||||
// 描述:
|
||||
|
||||
将军 e,attack(0.1),dash
|
||||
芙芙 e,q
|
||||
行秋 e,q,e
|
||||
@@ -1,3 +1,6 @@
|
||||
// 作者:爱司基模人
|
||||
// 描述:
|
||||
|
||||
钟离 s(0.1),e(hold),wait(0.3),w(0.1),q,attack(0.05),dash
|
||||
行秋 e,q,e,attack(0.05),dash
|
||||
夜兰 e,e,wait(0.2),e,e,q
|
||||
@@ -1,14 +0,0 @@
|
||||
钟离 s(0.1),e(hold),wait(0.3),w(0.1)
|
||||
芙宁娜 e,q
|
||||
行秋 e,q,e
|
||||
夜兰 e,e,wait(0.2),e,e,q
|
||||
云堇 e,q
|
||||
班尼特 e,q
|
||||
//琴 e,q 不识别
|
||||
早柚 e,e,q
|
||||
枫原万叶 e,attack(0.1),q
|
||||
宵宫 e,attack(5.5)
|
||||
//
|
||||
//推荐配队
|
||||
//钟离 (夜/行/班/云/万)四选二 宵宫 不推荐云堇万叶一起上
|
||||
//钟离 芙宁娜 琴/早柚/班尼特 宵宫 风奶带风套最好(金珀小鹿?金珀砂糖?金珀散兵?),其他奶凑合用
|
||||
@@ -5,7 +5,7 @@
|
||||
"description": "自动调查离传送点较近的狗粮。请使用琳妮特前台,双风共鸣。并保证所有传送点都已经激活!",
|
||||
"authors": [
|
||||
{
|
||||
"name": "HZYgrandma",
|
||||
"name": "HZYgrandma"
|
||||
}
|
||||
],
|
||||
"main": "main.js"
|
||||
|
||||
Reference in New Issue
Block a user