From 68a13300d19f33151b5891ddcd565142fcdb1b99 Mon Sep 17 00:00:00 2001 From: Haoyu Xu Date: Tue, 16 Jul 2024 14:55:06 +0800 Subject: [PATCH] fix(charwords): fixed adding charwords when multiple skins are presented --- libs/charword_table.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/libs/charword_table.js b/libs/charword_table.js index 9a4736b..10b300c 100644 --- a/libs/charword_table.js +++ b/libs/charword_table.js @@ -110,12 +110,14 @@ export default class CharwordTable { Object.values(data.charWords).forEach(item => { const operatorInfo = Object.values(this.#charwordTable.operators).filter(element => element.info[region][item.wordKey]) if (operatorInfo.length > 0) { - if (typeof operatorInfo[0].voice[region][item.wordKey] === 'undefined') { - operatorInfo[0].voice[region][item.wordKey] = {} - } - operatorInfo[0].voice[region][item.wordKey][item.voiceId] = { - title: item.voiceTitle, - text: item.voiceText.replace(/{@nickname}/g, NICKNAME[region]), + for (const operator of operatorInfo) { + if (typeof operator.voice[region][item.wordKey] === 'undefined') { + operator.voice[region][item.wordKey] = {} + } + operator.voice[region][item.wordKey][item.voiceId] = { + title: item.voiceTitle, + text: item.voiceText.replace(/{@nickname}/g, NICKNAME[region]), + } } } })