feat: updated official_info structure

This commit is contained in:
Haoyu Xu
2025-05-06 14:51:13 +08:00
parent f3f84068da
commit 6644ab616e
7 changed files with 769 additions and 709 deletions

View File

@@ -145,8 +145,8 @@ const generateMapping = () => {
const type = operatorInfo.type
const name =
type === 'skin'
? operatorInfo.codename['zh-CN'].split(' · ')[0]
: operatorInfo.codename['en-US']
? operatorInfo.skinName['zh-CN']
: operatorInfo.skinName['en-US']
const skinEntry = findSkinEntry(skinTable, name, type)
operator.filename = skinEntry.dynIllustId.replace(/_2$/, '')
operator.fallback_name =

View File

@@ -31,8 +31,8 @@ export const init = (name: string, id: string) => {
try {
const entryName =
currentOpertor.type === 'skin'
? currentOpertor.codename['zh-CN'].split(' · ')[0]
: currentOpertor.codename['en-US']
? currentOpertor.skinName['zh-CN']
: currentOpertor.skinName['en-US']
const skinEntry = findSkinEntry(
skinTable,
entryName,
@@ -41,7 +41,16 @@ export const init = (name: string, id: string) => {
template.codename = findCodename(skinEntry, currentOpertor)
} catch (e: unknown) {
console.log(e as string)
template.codename = currentOpertor.codename
template.codename =
currentOpertor.type === 'skin'
? {
'zh-CN': `${currentOpertor.skinName['zh-CN']} · ${currentOpertor.operatorName}`,
'en-US': `${currentOpertor.skinName['en-US']} / ${currentOpertor.operatorName}`,
}
: {
'zh-CN': `${currentOpertor.operatorName}`,
'en-US': `${currentOpertor.skinName['en-US']}`,
}
}
file.writeSync(

View File

@@ -10,7 +10,7 @@ import {
SkinTableJsonCharSkinEntry,
Codename,
} from '../types.ts'
import type { OfficialInfoOperatorConfig } from '@aklive2d/official-info/types'
import type { OfficialInfoOperatorConfigV2 } from '@aklive2d/official-info/types'
export const getExtractedFolder = (name: string) => {
return path.join(OPERATOR_SOURCE_FOLDER, name, config.dir_name.extracted)
@@ -111,7 +111,7 @@ export const findSkinEntry = (
*/
export const findCodename = (
skinEntry: SkinTableJsonCharSkinEntry,
officialInfo: OfficialInfoOperatorConfig
officialInfo: OfficialInfoOperatorConfigV2
) => {
const UPPER_CASE_EXCEPTION_WORDS = [
'the',
@@ -144,7 +144,7 @@ export const findCodename = (
modelNameNormalized = modelNameNormalizedArray.join(' ')
}
if (skinEntry.displaySkin.skinName) {
let engSkinName = officialInfo.codename['en-US']
let engSkinName = officialInfo.skinName['en-US']
const engkinNameArray = engSkinName.split(' ')
engkinNameArray.forEach((word, index) => {
if (/^[a-zA-Z]+$/.test(word)) {
@@ -158,10 +158,11 @@ export const findCodename = (
}
})
engSkinName = engkinNameArray.join(' ')
codename['zh-CN'] = officialInfo.codename['zh-CN'].replace(/ +$/, '')
codename['zh-CN'] =
`${officialInfo.skinName['zh-CN']} · ${officialInfo.operatorName}`
codename['en-US'] = `${engSkinName} / ${modelNameNormalized}`
} else {
codename['zh-CN'] = officialInfo.codename['zh-CN'].replace(/ +$/, '')
codename['zh-CN'] = officialInfo.operatorName
codename['en-US'] = modelNameNormalized
}
return codename