archive: 归档并进行脚本分类

This commit is contained in:
秋云
2025-05-23 09:53:56 +08:00
parent 8d6567e69a
commit f2892e5397
151 changed files with 88 additions and 59 deletions

View File

@@ -39,6 +39,6 @@
"move_mode": "walk",
"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)"
},
}
]
}

View File

@@ -147,6 +147,10 @@ function convertNewlines(text) {
// 过滤长标签的通用函数,一个汉字算两个字符
function filterLongTags(tags) {
return tags.filter(tag => {
// 特殊处理以bgi>=开头的版本标签,不论长度都保留
if (tag && tag.startsWith('bgi>=')) {
return true;
}
// 计算字符串的真实长度,一个汉字算两个字符
const realLength = [...tag].reduce((acc, c) => {
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) {
const content = fs.readFileSync(filePath, 'utf8');
const authorMatch = content.match(/\/\/\s*作者\s*:(.*)/);
const descriptionMatch = content.match(/\/\/\s*描述\s*:(.*)/);
const versionMatch = content.match(/\/\/\s*版本\s*:(.*)/);
const characterMatches = content.match(/^(?!\/\/).*?(\S+)(?=\s|$)/gm);
const tags = [...new Set(characterMatches || [])]
let tags = [...new Set(characterMatches || [])]
.map(char => char.trim())
.filter(char => char.length > 0 && !char.match(/^[,.]$/)); // 过滤掉单个逗号或句号
@@ -177,7 +204,7 @@ function extractInfoFromCombatFile(filePath) {
return {
author: authorMatch ? authorMatch[1].trim() : '',
description: descriptionMatch ? convertNewlines(descriptionMatch[1].trim()) : '',
tags: filterLongTags(tags),
tags: prioritizeVersionTag(filterLongTags(tags)),
version: version,
lastUpdated: lastUpdated
};
@@ -192,56 +219,31 @@ function extractInfoFromJSFolder(folderPath) {
const manifest = JSON.parse(manifestContent);
const combinedDescription = `${manifest.name || ''}~|~${manifest.description || ''}`;
// 查找文件夹中所有文件
let lastUpdatedTimestamp = null;
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);
}
}
}
}
// 获取manifest.json的修改时间仅处理这一个文件
const lastUpdatedTimestamp = getGitTimestamp(manifestPath);
// 格式化最后更新时间
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 || '',
description: convertNewlines(combinedDescription),
author: manifest.authors && manifest.authors.length > 0 ? manifest.authors[0].name : '',
tags: filterLongTags(manifest.tags || []),
tags: prioritizeVersionTag(filterLongTags(tags)),
lastUpdated: lastUpdated
};
} catch (error) { console.error(`解析 ${manifestPath} 时出错:`, error);
} catch (error) {
console.error(`解析 ${manifestPath} 时出错:`, error);
console.error('文件内容:', fs.readFileSync(manifestPath, 'utf8'));
return { version: '', description: '', author: '', tags: [], lastUpdated: null };
}
@@ -284,6 +286,14 @@ function extractInfoFromPathingFile(filePath, parentFolders) {
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)) {
const actions = contentObj.positions.map(pos => pos.action);
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('up_down_grab_leaf')) tags.push('四叶印');
if (actions.includes('fight')) tags.push('战斗');
} // 确保标签数组中没有重复项
}
// 确保标签数组中没有重复项
tags = [...new Set(tags)];
// 移除 "死亡笔记" 标签
// tags = tags.filter(tag => !tag.includes('死亡笔记'));
// 过滤掉超过10个字符的标签
tags = filterLongTags(tags);
// 过滤掉超过10个字符的标签,并确保版本标签优先
tags = prioritizeVersionTag(filterLongTags(tags));
return {
author: contentObj.info.author || '',
description: convertNewlines(contentObj.info.description || ''),
author: contentObj.info?.author || '',
description: convertNewlines(contentObj.info?.description || ''),
version: version,
tags: tags,
lastUpdated: lastUpdated
@@ -315,6 +323,7 @@ function extractInfoFromTCGFile(filePath, parentFolder) {
const authorMatch = content.match(/\/\/\s*作者:(.*)/);
const descriptionMatch = content.match(/\/\/\s*描述:(.*)/);
const versionMatch = content.match(/\/\/\s*版本:(.*)/);
// 移除最低版本提取TCG脚本无需最低版本要求
const characterMatches = content.match(/角色\d+\s?=([^|\r\n{]+)/g);
// 获取最后更新时间
@@ -337,10 +346,11 @@ function extractInfoFromTCGFile(filePath, parentFolder) {
const version = versionMatch ? versionMatch[1].trim() :
(gitTimestamp ? formatTime(gitTimestamp) :
calculateSHA1(filePath).substring(0, 7));
return {
return {
author: authorMatch ? authorMatch[1].trim() : '',
description: descriptionMatch ? convertNewlines(descriptionMatch[1].trim()) : '',
tags: filterLongTags([...new Set(tags)]), // 去重并过滤长标签
tags: prioritizeVersionTag(filterLongTags([...new Set(tags)])), // 去重并过滤长标签
version: version,
lastUpdated: lastUpdated
};
@@ -442,7 +452,23 @@ function generateDirectoryTree(dir, currentDepth = 0, parentFolders = []) {
}
} else {
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 => {
const childPath = path.join(dir, child);
return generateDirectoryTree(childPath, currentDepth + 1, [...parentFolders, info.name]);
@@ -454,6 +480,11 @@ function generateDirectoryTree(dir, currentDepth = 0, parentFolders = []) {
if (['desktop.ini', 'icon.ico'].includes(info.name)) {
return null;
}
// 对于pathing目录中的文件直接处理.json后缀的文件
if (parentFolders[0] === 'pathing' && !info.name.toLowerCase().endsWith('.json')) {
return null;
}
const hash = calculateSHA1(dir);
info.hash = hash;

View File

@@ -2,14 +2,12 @@
"manifest_version": 1,
"name": "一条龙不含自动副本+尘歌壶版",
"version": "1.0",
"description": "一条龙不含自动副本+尘歌壶版盾奶不要放到1号位 快捷道具要放满4个 设置原壶找壶灵 绘绮庭本人亲测其他搬运仓库大佬运行前右键配置尘歌壶默认绘绮庭为了防止操作失误设置有等待时间5秒左右可自行更改",
"description": "一条龙不含自动副本+尘歌壶版盾奶不要放到1号位 快捷道具要放满4个 设置原壶找壶灵 绘绮庭本人亲测其他搬运仓库大佬运行前右键配置尘歌壶默认绘绮庭为了防止操作失误设置有等待时间5秒左右可自行更改。感谢@辉鸭蛋作者@Yang-z@HZYgrandma @风埠@花火@鹤望兰 本人只是基于大佬们提交的js脚本进行优化整合实现奖励领取一条龙",
"authors": [
{
"name": "凉城"
}
],
//选择尘歌壶
"settings_ui": "settings.json",
"main": "main.js"
}
//感谢@辉鸭蛋作者@Yang-z@HZYgrandma @风埠@花火@鹤望兰 本人只是基于大佬们提交的js脚本进行优化整合实现奖励领取一条龙

Some files were not shown because too many files have changed in this diff Show More