From 67bb400422c9d9088542a8973b2a3c340bc344cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=BE=89=E9=B8=AD=E8=9B=8B?= Date: Fri, 1 Nov 2024 23:41:51 +0800 Subject: [PATCH] add tag --- build/build.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/build/build.js b/build/build.js index 6d2e578d..445e634a 100644 --- a/build/build.js +++ b/build/build.js @@ -59,6 +59,30 @@ function extractInfoFromPathingFile(filePath, parentFolders) { .map(tag => tag.split('@')[0]) // 取@符号前面的数据 .filter((tag, index, self) => self.indexOf(tag) === index); // 去重 + // 检查positions数组中是否存在特定动作 + if (content.positions && Array.isArray(content.positions)) { + const hasNahidaCollect = content.positions.some(pos => pos.action === 'nahida_collect'); + const hasHydroCollect = content.positions.some(pos => pos.action === 'hydro_collect'); + const hasAnemoCollect = content.positions.some(pos => pos.action === 'anemo_collect'); + const hasElectroCollect = content.positions.some(pos => pos.action === 'electro_collect'); + const hasUpDownGrabLeaf = content.positions.some(pos => pos.action === 'up_down_grab_leaf'); + if (hasNahidaCollect) { + tags.push('纳西妲'); + } + if (hasHydroCollect) { + tags.push('水元素力收集'); + } + if (hasAnemoCollect) { + tags.push('风元素力收集'); + } + if (hasElectroCollect) { + tags.push('雷元素力收集'); + } + if (hasUpDownGrabLeaf) { + tags.push('四叶印'); + } + } + return { author: content.info && content.info.author ? content.info.author : '', description: convertNewlines(content.info && content.info.description ? content.info.description : ''),