Add support battlesuits page
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
import { readFileSync } from '../fs'
|
||||
import { readFileSync, readJsonFileSync } from '../fs'
|
||||
import {
|
||||
PopulatedSignetGroup,
|
||||
SignetData,
|
||||
signetGroups,
|
||||
SignetSet,
|
||||
SupportBattlesuit,
|
||||
supportBattlesuitIds,
|
||||
} from '../../../lib/honkai3rd/elysianRealm'
|
||||
import { getBattlesuitById } from './battlesuits'
|
||||
|
||||
@@ -106,6 +108,46 @@ export function getSignetGroupById(id: string, locale = 'en-US') {
|
||||
return signetGroupMap[id]
|
||||
}
|
||||
|
||||
export function getSupportBattlesuits(locale?: string) {
|
||||
return supportBattlesuitIds.map<SupportBattlesuit>((battlesuitId) => {
|
||||
const battlesuit = getBattlesuitById(battlesuitId)!
|
||||
const {
|
||||
skillName,
|
||||
description,
|
||||
cooldown,
|
||||
}: { skillName: string; description: string; cooldown: number } =
|
||||
readJsonFileSync(
|
||||
`honkai3rd/elysianRealm/supportBattlesuits/${battlesuitId}.json`
|
||||
)
|
||||
|
||||
let localizedName = battlesuit.name
|
||||
let localizedSkillName = skillName
|
||||
let localizedDescription = description
|
||||
|
||||
if (locale === 'ko-KR') {
|
||||
const [krSkillName, ...krDescriptionLines] = readFileSync(
|
||||
`honkai3rd/ko-KR/elysianRealm/supportBattlesuits/${battlesuitId}.md`
|
||||
)
|
||||
.toString()
|
||||
.trim()
|
||||
.slice(2)
|
||||
.split('\n\n')
|
||||
|
||||
localizedName = battlesuit.krName!
|
||||
localizedSkillName = krSkillName
|
||||
localizedDescription = krDescriptionLines.join('\n').trim()
|
||||
}
|
||||
|
||||
return {
|
||||
id: battlesuitId,
|
||||
name: localizedName,
|
||||
skillName: localizedSkillName,
|
||||
description: localizedDescription,
|
||||
cooldown,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function parseNormalSignetsRawData(setId: string, data: string) {
|
||||
const signetSections = data.replace(/\\\*/g, '*').slice(2).split('\n# ')
|
||||
const signets: SignetData[] = []
|
||||
|
||||
Reference in New Issue
Block a user