archive: 归档并进行脚本分类
This commit is contained in:
@@ -39,6 +39,6 @@
|
|||||||
"move_mode": "walk",
|
"move_mode": "walk",
|
||||||
"action": "combat_script",
|
"action": "combat_script",
|
||||||
"action_params": "keydown(f),wait(0.3),keyup(f),wait(1),keydown(w),wait(2),keydown(a),wait(3.8),keyup(w),keyup(a),wait(1),keypress(VK_Shift),keydown(w),wait(10),wait(10),wait(10),wait(3),keyup(w),keydown(w),wait(0.5),keydown(d),wait(3),keyup(d),wait(2),keyup(w),wait(2),keydown(Space),wait(2),keyup(Space),keydown(a),keydown(w),wait(0.35),keyup(a),keyup(w)"
|
"action_params": "keydown(f),wait(0.3),keyup(f),wait(1),keydown(w),wait(2),keydown(a),wait(3.8),keyup(w),keyup(a),wait(1),keypress(VK_Shift),keydown(w),wait(10),wait(10),wait(10),wait(3),keyup(w),keydown(w),wait(0.5),keydown(d),wait(3),keyup(d),wait(2),keyup(w),wait(2),keydown(Space),wait(2),keyup(Space),keydown(a),keydown(w),wait(0.35),keyup(a),keyup(w)"
|
||||||
},
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
141
build/build.js
141
build/build.js
@@ -147,6 +147,10 @@ function convertNewlines(text) {
|
|||||||
// 过滤长标签的通用函数,一个汉字算两个字符
|
// 过滤长标签的通用函数,一个汉字算两个字符
|
||||||
function filterLongTags(tags) {
|
function filterLongTags(tags) {
|
||||||
return tags.filter(tag => {
|
return tags.filter(tag => {
|
||||||
|
// 特殊处理以bgi>=开头的版本标签,不论长度都保留
|
||||||
|
if (tag && tag.startsWith('bgi>=')) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
// 计算字符串的真实长度,一个汉字算两个字符
|
// 计算字符串的真实长度,一个汉字算两个字符
|
||||||
const realLength = [...tag].reduce((acc, c) => {
|
const realLength = [...tag].reduce((acc, c) => {
|
||||||
return acc + (c.charCodeAt(0) > 127 ? 2 : 1);
|
return acc + (c.charCodeAt(0) > 127 ? 2 : 1);
|
||||||
@@ -155,13 +159,36 @@ function filterLongTags(tags) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 提取最低版本要求并格式化为标签
|
||||||
|
function formatMinVersionTag(minVersion) {
|
||||||
|
if (!minVersion) return null;
|
||||||
|
// 统一格式化为 bgi>=x.xx.xx
|
||||||
|
return `bgi>=${minVersion.trim()}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将版本标签置于标签列表首位
|
||||||
|
function prioritizeVersionTag(tags) {
|
||||||
|
if (!tags || !Array.isArray(tags)) return [];
|
||||||
|
|
||||||
|
// 查找 bgi>= 开头的标签
|
||||||
|
const versionTags = tags.filter(tag => tag && tag.startsWith('bgi>='));
|
||||||
|
const otherTags = tags.filter(tag => !tag || !tag.startsWith('bgi>='));
|
||||||
|
|
||||||
|
// 如果有多个版本标签,只保留第一个
|
||||||
|
if (versionTags.length > 0) {
|
||||||
|
return [versionTags[0], ...otherTags];
|
||||||
|
}
|
||||||
|
|
||||||
|
return otherTags;
|
||||||
|
}
|
||||||
|
|
||||||
function extractInfoFromCombatFile(filePath) {
|
function extractInfoFromCombatFile(filePath) {
|
||||||
const content = fs.readFileSync(filePath, 'utf8');
|
const content = fs.readFileSync(filePath, 'utf8');
|
||||||
const authorMatch = content.match(/\/\/\s*作者\s*:(.*)/);
|
const authorMatch = content.match(/\/\/\s*作者\s*:(.*)/);
|
||||||
const descriptionMatch = content.match(/\/\/\s*描述\s*:(.*)/);
|
const descriptionMatch = content.match(/\/\/\s*描述\s*:(.*)/);
|
||||||
const versionMatch = content.match(/\/\/\s*版本\s*:(.*)/);
|
const versionMatch = content.match(/\/\/\s*版本\s*:(.*)/);
|
||||||
const characterMatches = content.match(/^(?!\/\/).*?(\S+)(?=\s|$)/gm);
|
const characterMatches = content.match(/^(?!\/\/).*?(\S+)(?=\s|$)/gm);
|
||||||
const tags = [...new Set(characterMatches || [])]
|
let tags = [...new Set(characterMatches || [])]
|
||||||
.map(char => char.trim())
|
.map(char => char.trim())
|
||||||
.filter(char => char.length > 0 && !char.match(/^[,.]$/)); // 过滤掉单个逗号或句号
|
.filter(char => char.length > 0 && !char.match(/^[,.]$/)); // 过滤掉单个逗号或句号
|
||||||
|
|
||||||
@@ -177,7 +204,7 @@ function extractInfoFromCombatFile(filePath) {
|
|||||||
return {
|
return {
|
||||||
author: authorMatch ? authorMatch[1].trim() : '',
|
author: authorMatch ? authorMatch[1].trim() : '',
|
||||||
description: descriptionMatch ? convertNewlines(descriptionMatch[1].trim()) : '',
|
description: descriptionMatch ? convertNewlines(descriptionMatch[1].trim()) : '',
|
||||||
tags: filterLongTags(tags),
|
tags: prioritizeVersionTag(filterLongTags(tags)),
|
||||||
version: version,
|
version: version,
|
||||||
lastUpdated: lastUpdated
|
lastUpdated: lastUpdated
|
||||||
};
|
};
|
||||||
@@ -192,56 +219,31 @@ function extractInfoFromJSFolder(folderPath) {
|
|||||||
const manifest = JSON.parse(manifestContent);
|
const manifest = JSON.parse(manifestContent);
|
||||||
const combinedDescription = `${manifest.name || ''}~|~${manifest.description || ''}`;
|
const combinedDescription = `${manifest.name || ''}~|~${manifest.description || ''}`;
|
||||||
|
|
||||||
// 查找文件夹中所有文件
|
// 获取manifest.json的修改时间,仅处理这一个文件
|
||||||
let lastUpdatedTimestamp = null;
|
const lastUpdatedTimestamp = getGitTimestamp(manifestPath);
|
||||||
let allFiles = [];
|
|
||||||
|
|
||||||
// 递归获取所有文件
|
|
||||||
function getAllFiles(dir) {
|
|
||||||
const files = fs.readdirSync(dir);
|
|
||||||
files.forEach(file => {
|
|
||||||
const filePath = path.join(dir, file);
|
|
||||||
if (fs.statSync(filePath).isDirectory()) {
|
|
||||||
getAllFiles(filePath);
|
|
||||||
} else {
|
|
||||||
allFiles.push(filePath);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
getAllFiles(folderPath);
|
|
||||||
|
|
||||||
// 获取每个文件的时间戳,找出最新的
|
|
||||||
for (const file of allFiles) {
|
|
||||||
const timestamp = getGitTimestamp(file);
|
|
||||||
if (timestamp) {
|
|
||||||
if (!lastUpdatedTimestamp) {
|
|
||||||
lastUpdatedTimestamp = timestamp;
|
|
||||||
} else {
|
|
||||||
// 比较时间戳,保留较新的
|
|
||||||
try {
|
|
||||||
const date1 = new Date(timestamp);
|
|
||||||
const date2 = new Date(lastUpdatedTimestamp);
|
|
||||||
if (date1 > date2) {
|
|
||||||
lastUpdatedTimestamp = timestamp;
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
console.warn(`比较时间戳出错: ${timestamp} vs ${lastUpdatedTimestamp}`, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 格式化最后更新时间
|
// 格式化最后更新时间
|
||||||
const lastUpdated = formatLastUpdated(lastUpdatedTimestamp);
|
const lastUpdated = formatLastUpdated(lastUpdatedTimestamp);
|
||||||
return {
|
|
||||||
|
// 提取最低版本要求
|
||||||
|
let tags = manifest.tags || [];
|
||||||
|
// 从 bgi_version 字段获取
|
||||||
|
if (manifest.bgi_version) {
|
||||||
|
const minVersionTag = formatMinVersionTag(manifest.bgi_version);
|
||||||
|
if (minVersionTag) {
|
||||||
|
tags.unshift(minVersionTag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
version: manifest.version || '',
|
version: manifest.version || '',
|
||||||
description: convertNewlines(combinedDescription),
|
description: convertNewlines(combinedDescription),
|
||||||
author: manifest.authors && manifest.authors.length > 0 ? manifest.authors[0].name : '',
|
author: manifest.authors && manifest.authors.length > 0 ? manifest.authors[0].name : '',
|
||||||
tags: filterLongTags(manifest.tags || []),
|
tags: prioritizeVersionTag(filterLongTags(tags)),
|
||||||
lastUpdated: lastUpdated
|
lastUpdated: lastUpdated
|
||||||
};
|
};
|
||||||
} catch (error) { console.error(`解析 ${manifestPath} 时出错:`, error);
|
} catch (error) {
|
||||||
|
console.error(`解析 ${manifestPath} 时出错:`, error);
|
||||||
console.error('文件内容:', fs.readFileSync(manifestPath, 'utf8'));
|
console.error('文件内容:', fs.readFileSync(manifestPath, 'utf8'));
|
||||||
return { version: '', description: '', author: '', tags: [], lastUpdated: null };
|
return { version: '', description: '', author: '', tags: [], lastUpdated: null };
|
||||||
}
|
}
|
||||||
@@ -284,6 +286,14 @@ function extractInfoFromPathingFile(filePath, parentFolders) {
|
|||||||
tags = [...tags, ...contentObj.info.tags];
|
tags = [...tags, ...contentObj.info.tags];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 提取最低版本要求,使用 bgi_version 字段
|
||||||
|
if (contentObj.info && contentObj.info.bgi_version) {
|
||||||
|
const minVersionTag = formatMinVersionTag(contentObj.info.bgi_version);
|
||||||
|
if (minVersionTag) {
|
||||||
|
tags.unshift(minVersionTag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (contentObj.positions && Array.isArray(contentObj.positions)) {
|
if (contentObj.positions && Array.isArray(contentObj.positions)) {
|
||||||
const actions = contentObj.positions.map(pos => pos.action);
|
const actions = contentObj.positions.map(pos => pos.action);
|
||||||
if (actions.includes('nahida_collect')) tags.push('纳西妲');
|
if (actions.includes('nahida_collect')) tags.push('纳西妲');
|
||||||
@@ -292,18 +302,16 @@ function extractInfoFromPathingFile(filePath, parentFolders) {
|
|||||||
if (actions.includes('electro_collect')) tags.push('雷元素力收集');
|
if (actions.includes('electro_collect')) tags.push('雷元素力收集');
|
||||||
if (actions.includes('up_down_grab_leaf')) tags.push('四叶印');
|
if (actions.includes('up_down_grab_leaf')) tags.push('四叶印');
|
||||||
if (actions.includes('fight')) tags.push('战斗');
|
if (actions.includes('fight')) tags.push('战斗');
|
||||||
} // 确保标签数组中没有重复项
|
}
|
||||||
|
// 确保标签数组中没有重复项
|
||||||
tags = [...new Set(tags)];
|
tags = [...new Set(tags)];
|
||||||
|
|
||||||
// 移除 "死亡笔记" 标签
|
// 过滤掉超过10个字符的标签,并确保版本标签优先
|
||||||
// tags = tags.filter(tag => !tag.includes('死亡笔记'));
|
tags = prioritizeVersionTag(filterLongTags(tags));
|
||||||
|
|
||||||
// 过滤掉超过10个字符的标签
|
|
||||||
tags = filterLongTags(tags);
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
author: contentObj.info.author || '',
|
author: contentObj.info?.author || '',
|
||||||
description: convertNewlines(contentObj.info.description || ''),
|
description: convertNewlines(contentObj.info?.description || ''),
|
||||||
version: version,
|
version: version,
|
||||||
tags: tags,
|
tags: tags,
|
||||||
lastUpdated: lastUpdated
|
lastUpdated: lastUpdated
|
||||||
@@ -315,6 +323,7 @@ function extractInfoFromTCGFile(filePath, parentFolder) {
|
|||||||
const authorMatch = content.match(/\/\/\s*作者:(.*)/);
|
const authorMatch = content.match(/\/\/\s*作者:(.*)/);
|
||||||
const descriptionMatch = content.match(/\/\/\s*描述:(.*)/);
|
const descriptionMatch = content.match(/\/\/\s*描述:(.*)/);
|
||||||
const versionMatch = content.match(/\/\/\s*版本:(.*)/);
|
const versionMatch = content.match(/\/\/\s*版本:(.*)/);
|
||||||
|
// 移除最低版本提取,TCG脚本无需最低版本要求
|
||||||
const characterMatches = content.match(/角色\d+\s?=([^|\r\n{]+)/g);
|
const characterMatches = content.match(/角色\d+\s?=([^|\r\n{]+)/g);
|
||||||
|
|
||||||
// 获取最后更新时间
|
// 获取最后更新时间
|
||||||
@@ -337,10 +346,11 @@ function extractInfoFromTCGFile(filePath, parentFolder) {
|
|||||||
const version = versionMatch ? versionMatch[1].trim() :
|
const version = versionMatch ? versionMatch[1].trim() :
|
||||||
(gitTimestamp ? formatTime(gitTimestamp) :
|
(gitTimestamp ? formatTime(gitTimestamp) :
|
||||||
calculateSHA1(filePath).substring(0, 7));
|
calculateSHA1(filePath).substring(0, 7));
|
||||||
return {
|
|
||||||
|
return {
|
||||||
author: authorMatch ? authorMatch[1].trim() : '',
|
author: authorMatch ? authorMatch[1].trim() : '',
|
||||||
description: descriptionMatch ? convertNewlines(descriptionMatch[1].trim()) : '',
|
description: descriptionMatch ? convertNewlines(descriptionMatch[1].trim()) : '',
|
||||||
tags: filterLongTags([...new Set(tags)]), // 去重并过滤长标签
|
tags: prioritizeVersionTag(filterLongTags([...new Set(tags)])), // 去重并过滤长标签
|
||||||
version: version,
|
version: version,
|
||||||
lastUpdated: lastUpdated
|
lastUpdated: lastUpdated
|
||||||
};
|
};
|
||||||
@@ -442,7 +452,23 @@ function generateDirectoryTree(dir, currentDepth = 0, parentFolders = []) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
info.children = fs.readdirSync(dir)
|
info.children = fs.readdirSync(dir)
|
||||||
.filter(child => !['desktop.ini', 'icon.ico'].includes(child)) // 过滤掉 desktop.ini 和 icon.ico
|
.filter(child => {
|
||||||
|
// 过滤掉 desktop.ini 和 icon.ico
|
||||||
|
if (['desktop.ini', 'icon.ico'].includes(child)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 对于pathing目录,只保留.json文件和目录
|
||||||
|
if (parentFolders[0] === 'pathing') {
|
||||||
|
const childPath = path.join(dir, child);
|
||||||
|
const isDir = fs.statSync(childPath).isDirectory();
|
||||||
|
if (!isDir && !child.toLowerCase().endsWith('.json')) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
})
|
||||||
.map(child => {
|
.map(child => {
|
||||||
const childPath = path.join(dir, child);
|
const childPath = path.join(dir, child);
|
||||||
return generateDirectoryTree(childPath, currentDepth + 1, [...parentFolders, info.name]);
|
return generateDirectoryTree(childPath, currentDepth + 1, [...parentFolders, info.name]);
|
||||||
@@ -455,6 +481,11 @@ function generateDirectoryTree(dir, currentDepth = 0, parentFolders = []) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 对于pathing目录中的文件,直接处理.json后缀的文件
|
||||||
|
if (parentFolders[0] === 'pathing' && !info.name.toLowerCase().endsWith('.json')) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
const hash = calculateSHA1(dir);
|
const hash = calculateSHA1(dir);
|
||||||
info.hash = hash;
|
info.hash = hash;
|
||||||
info.version = hash.substring(0, 7);
|
info.version = hash.substring(0, 7);
|
||||||
|
|||||||
@@ -2,14 +2,12 @@
|
|||||||
"manifest_version": 1,
|
"manifest_version": 1,
|
||||||
"name": "一条龙不含自动副本+尘歌壶版",
|
"name": "一条龙不含自动副本+尘歌壶版",
|
||||||
"version": "1.0",
|
"version": "1.0",
|
||||||
"description": "一条龙不含自动副本+尘歌壶版,盾奶不要放到1号位 快捷道具要放满4个 设置原壶找壶灵 绘绮庭本人亲测,其他搬运仓库大佬,运行前右键配置尘歌壶,默认绘绮庭为了防止操作失误,设置有等待时间5秒左右可自行更改",
|
"description": "一条龙不含自动副本+尘歌壶版,盾奶不要放到1号位 快捷道具要放满4个 设置原壶找壶灵 绘绮庭本人亲测,其他搬运仓库大佬,运行前右键配置尘歌壶,默认绘绮庭为了防止操作失误,设置有等待时间5秒左右可自行更改。感谢@辉鸭蛋作者@Yang-z@HZYgrandma @风埠@花火@鹤望兰 本人只是基于大佬们提交的js脚本进行优化整合实现奖励领取一条龙",
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "凉城"
|
"name": "凉城"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
//选择尘歌壶
|
|
||||||
"settings_ui": "settings.json",
|
"settings_ui": "settings.json",
|
||||||
"main": "main.js"
|
"main": "main.js"
|
||||||
}
|
}
|
||||||
//感谢@辉鸭蛋作者@Yang-z@HZYgrandma @风埠@花火@鹤望兰 本人只是基于大佬们提交的js脚本进行优化整合实现奖励领取一条龙
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user