Add locale
This commit is contained in:
@@ -16,11 +16,15 @@ const FormattedText = ({ children }: FormattedTextProps) => {
|
|||||||
function renderTokens(tokens: FormattedTextToken[]) {
|
function renderTokens(tokens: FormattedTextToken[]) {
|
||||||
return tokens.map((token, index) => {
|
return tokens.map((token, index) => {
|
||||||
if (token.type === 'element') {
|
if (token.type === 'element') {
|
||||||
return (
|
if (token.tagName === 'color') {
|
||||||
<Text key={index} style={{ color: adjustColor(token.attributes.color) }}>
|
return (
|
||||||
{renderTokens(token.children)}
|
<Text key={index} style={{ color: adjustColor(token.attributes.color) }}>
|
||||||
</Text>
|
{renderTokens(token.children)}
|
||||||
)
|
</Text>
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
return <Text key={index}>{renderTokens(token.children)}</Text>
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return token.text
|
return token.text
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { tokenize } from './tokenize'
|
import { tokenize } from './tokenize'
|
||||||
|
|
||||||
describe('tokenize', () => {
|
describe('tokenize', () => {
|
||||||
it('still tokenize even when a closing tag is missing', () => {
|
it('tokenizes malformed value', () => {
|
||||||
const rawString = '<color=#FFC741FF>분기'
|
const rawString = '<color=#FFC741FF>분기'
|
||||||
|
|
||||||
const result = tokenize(rawString)
|
const result = tokenize(rawString)
|
||||||
@@ -22,7 +22,7 @@ describe('tokenize', () => {
|
|||||||
}
|
}
|
||||||
])
|
])
|
||||||
})
|
})
|
||||||
it('tokenize', () => {
|
it('tokenizes nested tags', () => {
|
||||||
const rawString =
|
const rawString =
|
||||||
'기본 공격 또는 분기 공격이 적에게 연소 게이지를 <color=#FEDF4CFF><color=#23B2E3FF>4.0</color>pt 누적한다.</color> 발동 간격: <color=#23B2E3FF>6.0</color>초. 기본 공격과 분기 공격이 가하는 화염 원소 대미지가 <color=#23B2E3FF>30.0%</color> 증가한다.'
|
'기본 공격 또는 분기 공격이 적에게 연소 게이지를 <color=#FEDF4CFF><color=#23B2E3FF>4.0</color>pt 누적한다.</color> 발동 간격: <color=#23B2E3FF>6.0</color>초. 기본 공격과 분기 공격이 가하는 화염 원소 대미지가 <color=#23B2E3FF>30.0%</color> 증가한다.'
|
||||||
|
|
||||||
@@ -84,4 +84,26 @@ describe('tokenize', () => {
|
|||||||
}
|
}
|
||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('tokenizes size tag', () => {
|
||||||
|
const rawString = '<size=14>Hello</size>'
|
||||||
|
|
||||||
|
const result = tokenize(rawString)
|
||||||
|
|
||||||
|
expect(result).toEqual([
|
||||||
|
{
|
||||||
|
type: 'element',
|
||||||
|
tagName: 'size',
|
||||||
|
attributes: {
|
||||||
|
size: '14'
|
||||||
|
},
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
type: 'text',
|
||||||
|
text: 'Hello'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
])
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ export function tokenize(value: string) {
|
|||||||
let currentValue = value.replace(/{{/g, '').replace(/}}/g, '')
|
let currentValue = value.replace(/{{/g, '').replace(/}}/g, '')
|
||||||
|
|
||||||
while (currentValue.length > 0) {
|
while (currentValue.length > 0) {
|
||||||
const openingBracketStartIndex = currentValue.indexOf('<color')
|
const openingBracketStartIndex = currentValue.search(/<(color|size)/)
|
||||||
if (openingBracketStartIndex < 0) {
|
if (openingBracketStartIndex < 0) {
|
||||||
tokens.push({ type: 'text', text: currentValue })
|
tokens.push({ type: 'text', text: currentValue })
|
||||||
eat(openingBracketStartIndex)
|
eat(openingBracketStartIndex)
|
||||||
@@ -48,7 +48,7 @@ export function tokenize(value: string) {
|
|||||||
type: 'element',
|
type: 'element',
|
||||||
tagName,
|
tagName,
|
||||||
attributes: {
|
attributes: {
|
||||||
color: attr
|
[tagName]: attr
|
||||||
},
|
},
|
||||||
children
|
children
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { compileBattlesuitData } from './compileBattlesuitData'
|
|||||||
|
|
||||||
describe('compileBattlesuitData', () => {
|
describe('compileBattlesuitData', () => {
|
||||||
it('converts tags', () => {
|
it('converts tags', () => {
|
||||||
const list = compileBattlesuitData()
|
const list = compileBattlesuitData('en-US')
|
||||||
|
|
||||||
expect(list[0]).toMatchObject({
|
expect(list[0]).toMatchObject({
|
||||||
id: expect.any(String),
|
id: expect.any(String),
|
||||||
|
|||||||
@@ -12,9 +12,10 @@ import { getRawAvatarDataMap } from '../raw/avatarData'
|
|||||||
import { getRawAvatarSkillDataMap } from '../raw/avatarSkillData'
|
import { getRawAvatarSkillDataMap } from '../raw/avatarSkillData'
|
||||||
import { getRawAvatarSubSkillDataMap } from '../raw/avatarSubSkillData'
|
import { getRawAvatarSubSkillDataMap } from '../raw/avatarSubSkillData'
|
||||||
import { getRawAvatarTagUnLockDataMap } from '../raw/avatarTagUnLockData'
|
import { getRawAvatarTagUnLockDataMap } from '../raw/avatarTagUnLockData'
|
||||||
import { convertWeaponType as convertWeaponType, convertTagType, getText } from './utils'
|
import { convertWeaponType as convertWeaponType, convertTagType, createGetText } from './utils'
|
||||||
|
|
||||||
export function compileBattlesuitData(): Battlesuit[] {
|
export function compileBattlesuitData(locale: string): Battlesuit[] {
|
||||||
|
const getText = createGetText(locale)
|
||||||
const rawAvatarDataMap = getRawAvatarDataMap()
|
const rawAvatarDataMap = getRawAvatarDataMap()
|
||||||
const rawSkillDataMap = getRawAvatarSkillDataMap()
|
const rawSkillDataMap = getRawAvatarSkillDataMap()
|
||||||
const rawSubSkillDataMap = getRawAvatarSubSkillDataMap()
|
const rawSubSkillDataMap = getRawAvatarSubSkillDataMap()
|
||||||
@@ -63,7 +64,7 @@ export function compileBattlesuitData(): Battlesuit[] {
|
|||||||
paramAdd1: rawSubSkillData.ParamAdd_1,
|
paramAdd1: rawSubSkillData.ParamAdd_1,
|
||||||
paramAdd2: rawSubSkillData.ParamAdd_2,
|
paramAdd2: rawSubSkillData.ParamAdd_2,
|
||||||
paramAdd3: rawSubSkillData.ParamAdd_3,
|
paramAdd3: rawSubSkillData.ParamAdd_3,
|
||||||
tags: rawSubSkillData.TagList.map(convertRawSkillTag),
|
tags: rawSubSkillData.TagList.map(tag => convertRawSkillTag(tag, locale)),
|
||||||
toggle: rawSubSkillData.SkillToggle,
|
toggle: rawSubSkillData.SkillToggle,
|
||||||
unlockStar: convertStar(rawSubSkillData.UnlockStar, rawSubSkillData.UnlockSubStar)
|
unlockStar: convertStar(rawSubSkillData.UnlockStar, rawSubSkillData.UnlockSubStar)
|
||||||
})
|
})
|
||||||
@@ -78,7 +79,7 @@ export function compileBattlesuitData(): Battlesuit[] {
|
|||||||
info: getText(rawSkillData.Info),
|
info: getText(rawSkillData.Info),
|
||||||
icon: skillIcon || '',
|
icon: skillIcon || '',
|
||||||
skillType: convertShowOrderToSkillType(rawSkillData.ShowOrder),
|
skillType: convertShowOrderToSkillType(rawSkillData.ShowOrder),
|
||||||
tags: rawSkillData.TagList.map(convertRawSkillTag),
|
tags: rawSkillData.TagList.map(tag => convertRawSkillTag(tag, locale)),
|
||||||
paramSubId1: rawSkillData.ParamSubID_1,
|
paramSubId1: rawSkillData.ParamSubID_1,
|
||||||
paramSubId2: rawSkillData.ParamSubID_2,
|
paramSubId2: rawSkillData.ParamSubID_2,
|
||||||
paramSubId3: rawSkillData.ParamSubID_3,
|
paramSubId3: rawSkillData.ParamSubID_3,
|
||||||
@@ -246,7 +247,11 @@ function convertShowOrderToSkillType(rawShowOrder: number): SkillType {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function convertRawSkillTag(rawSkillTag: { Strength: number; TagID: number; TagComment: number }): SkillTagItem {
|
function convertRawSkillTag(
|
||||||
|
rawSkillTag: { Strength: number; TagID: number; TagComment: number },
|
||||||
|
locale: string
|
||||||
|
): SkillTagItem {
|
||||||
|
const getText = createGetText(locale)
|
||||||
const comment = getText(rawSkillTag.TagComment)
|
const comment = getText(rawSkillTag.TagComment)
|
||||||
return {
|
return {
|
||||||
type: convertRawStrengthToType(rawSkillTag.Strength),
|
type: convertRawStrengthToType(rawSkillTag.Strength),
|
||||||
|
|||||||
@@ -2,11 +2,12 @@ import { ListMap } from '../../../utils'
|
|||||||
import { Elf, ElfSkill } from '../../data/types'
|
import { Elf, ElfSkill } from '../../data/types'
|
||||||
import { getRawElfDataMap } from '../raw/elfData'
|
import { getRawElfDataMap } from '../raw/elfData'
|
||||||
import { getRawElfSkillDataMap } from '../raw/elfSkillData'
|
import { getRawElfSkillDataMap } from '../raw/elfSkillData'
|
||||||
import { convertTagType, getText } from './utils'
|
import { convertTagType, createGetText } from './utils'
|
||||||
|
|
||||||
export function compileElfData() {
|
export function compileElfData(locale: string) {
|
||||||
const rawElfDataMap = getRawElfDataMap()
|
const rawElfDataMap = getRawElfDataMap()
|
||||||
const rawElfSkillDataMap = getRawElfSkillDataMap()
|
const rawElfSkillDataMap = getRawElfSkillDataMap()
|
||||||
|
const getText = createGetText(locale)
|
||||||
|
|
||||||
const rawElfSkillMap = Object.entries(rawElfSkillDataMap).reduce<ListMap<string, ElfSkill>>(
|
const rawElfSkillMap = Object.entries(rawElfSkillDataMap).reduce<ListMap<string, ElfSkill>>(
|
||||||
(map, [id, rawSkillData]) => {
|
(map, [id, rawSkillData]) => {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { compileGodWarData } from './compileGodWarData'
|
|||||||
|
|
||||||
describe('compileGodWarData', () => {
|
describe('compileGodWarData', () => {
|
||||||
it('compiles main battlesuit abilities and signets', () => {
|
it('compiles main battlesuit abilities and signets', () => {
|
||||||
const { mainAvatarList } = compileGodWarData()
|
const { mainAvatarList } = compileGodWarData('en-US')
|
||||||
|
|
||||||
const targetItem = mainAvatarList[11]
|
const targetItem = mainAvatarList[11]
|
||||||
expect(targetItem).toMatchObject({
|
expect(targetItem).toMatchObject({
|
||||||
@@ -26,7 +26,7 @@ describe('compileGodWarData', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('compiles buff list per suit', () => {
|
it('compiles buff list per suit', () => {
|
||||||
const { buffSuitBuffListMap } = compileGodWarData()
|
const { buffSuitBuffListMap } = compileGodWarData('en-US')
|
||||||
|
|
||||||
const targetItem = buffSuitBuffListMap.get('3')
|
const targetItem = buffSuitBuffListMap.get('3')
|
||||||
|
|
||||||
|
|||||||
@@ -4,14 +4,15 @@ import { getRawGodWarBuffMap } from '../raw/godWarBuff'
|
|||||||
import { getRawGodWarExtraItemMap } from '../raw/godWarExxtraItem'
|
import { getRawGodWarExtraItemMap } from '../raw/godWarExxtraItem'
|
||||||
import { getRawGodWarMainAvatarMap } from '../raw/godWarMainAvatar'
|
import { getRawGodWarMainAvatarMap } from '../raw/godWarMainAvatar'
|
||||||
import { getRawGodWarSupportAvatarMap } from '../raw/godWarSupportAvatar'
|
import { getRawGodWarSupportAvatarMap } from '../raw/godWarSupportAvatar'
|
||||||
import { getText } from './utils'
|
import { createGetText } from './utils'
|
||||||
|
|
||||||
export function compileGodWarData() {
|
export function compileGodWarData(locale: string) {
|
||||||
const rawMainAvatarMap = getRawGodWarMainAvatarMap()['1']
|
const rawMainAvatarMap = getRawGodWarMainAvatarMap()['1']
|
||||||
const rawGodWarAvatarAbilityMap = getRawGodWarAvatarAbilityMap()
|
const rawGodWarAvatarAbilityMap = getRawGodWarAvatarAbilityMap()
|
||||||
const rawGodWarBuffMap = getRawGodWarBuffMap()
|
const rawGodWarBuffMap = getRawGodWarBuffMap()
|
||||||
const rawGodWarSupportAvatarMap = getRawGodWarSupportAvatarMap()['1']
|
const rawGodWarSupportAvatarMap = getRawGodWarSupportAvatarMap()['1']
|
||||||
const rawGodWarExtraItemMap = getRawGodWarExtraItemMap()
|
const rawGodWarExtraItemMap = getRawGodWarExtraItemMap()
|
||||||
|
const getText = createGetText(locale)
|
||||||
|
|
||||||
const battlesuitIdRawBuffListMap = new Map<string, ErSignet[]>()
|
const battlesuitIdRawBuffListMap = new Map<string, ErSignet[]>()
|
||||||
const buffSuitBuffListMap = new Map<string, ErSignet[]>()
|
const buffSuitBuffListMap = new Map<string, ErSignet[]>()
|
||||||
|
|||||||
@@ -2,14 +2,15 @@ import { EquipmentSkill, RootStigma, StigmataSet, StigmaType } from '../../data/
|
|||||||
import { getRawEquipmentSetDataMap } from '../raw/equipmentSetData'
|
import { getRawEquipmentSetDataMap } from '../raw/equipmentSetData'
|
||||||
import { getRawEquipmentSkillDataMap } from '../raw/equipmentSkillData'
|
import { getRawEquipmentSkillDataMap } from '../raw/equipmentSkillData'
|
||||||
import { getRawStigmataDataMap } from '../raw/stigmataData'
|
import { getRawStigmataDataMap } from '../raw/stigmataData'
|
||||||
import { convertEquipmentSkill, getText } from './utils'
|
import { convertEquipmentSkill, createGetText } from './utils'
|
||||||
|
|
||||||
export function compileStigmataData() {
|
export function compileStigmataData(locale: string) {
|
||||||
const rawStigmataDataMap = getRawStigmataDataMap()
|
const rawStigmataDataMap = getRawStigmataDataMap()
|
||||||
const rawStigmataDataMapEntries = Object.entries(rawStigmataDataMap)
|
const rawStigmataDataMapEntries = Object.entries(rawStigmataDataMap)
|
||||||
const rawEquipmentSkillDataMap = getRawEquipmentSkillDataMap()
|
const rawEquipmentSkillDataMap = getRawEquipmentSkillDataMap()
|
||||||
const rawEquipmentSetDataMap = getRawEquipmentSetDataMap()
|
const rawEquipmentSetDataMap = getRawEquipmentSetDataMap()
|
||||||
const stigmaSetIdMainIdListMap = new Map<string, string[]>()
|
const stigmaSetIdMainIdListMap = new Map<string, string[]>()
|
||||||
|
const getText = createGetText(locale)
|
||||||
|
|
||||||
const stigmataMainIdStigmataMap = rawStigmataDataMapEntries.reduce((map, [id, rawData]) => {
|
const stigmataMainIdStigmataMap = rawStigmataDataMapEntries.reduce((map, [id, rawData]) => {
|
||||||
// Bronya calorie has a dummy data
|
// Bronya calorie has a dummy data
|
||||||
@@ -46,7 +47,7 @@ export function compileStigmataData() {
|
|||||||
const rawSkill = rawEquipmentSkillDataMap[skillId]
|
const rawSkill = rawEquipmentSkillDataMap[skillId]
|
||||||
skills.push({
|
skills.push({
|
||||||
id: skillId,
|
id: skillId,
|
||||||
...convertEquipmentSkill(rawSkill),
|
...convertEquipmentSkill(rawSkill, locale),
|
||||||
param1: rawData.Prop1Param1,
|
param1: rawData.Prop1Param1,
|
||||||
param1Add: rawData.Prop1Param1Add,
|
param1Add: rawData.Prop1Param1Add,
|
||||||
param2: rawData.Prop1Param2,
|
param2: rawData.Prop1Param2,
|
||||||
@@ -60,7 +61,7 @@ export function compileStigmataData() {
|
|||||||
const rawSkill = rawEquipmentSkillDataMap[skillId]
|
const rawSkill = rawEquipmentSkillDataMap[skillId]
|
||||||
skills.push({
|
skills.push({
|
||||||
id: skillId,
|
id: skillId,
|
||||||
...convertEquipmentSkill(rawSkill),
|
...convertEquipmentSkill(rawSkill, locale),
|
||||||
param1: rawData.Prop2Param1,
|
param1: rawData.Prop2Param1,
|
||||||
param1Add: rawData.Prop2Param1Add,
|
param1Add: rawData.Prop2Param1Add,
|
||||||
param2: rawData.Prop2Param2,
|
param2: rawData.Prop2Param2,
|
||||||
@@ -74,7 +75,7 @@ export function compileStigmataData() {
|
|||||||
const rawSkill = rawEquipmentSkillDataMap[skillId]
|
const rawSkill = rawEquipmentSkillDataMap[skillId]
|
||||||
skills.push({
|
skills.push({
|
||||||
id: skillId,
|
id: skillId,
|
||||||
...convertEquipmentSkill(rawSkill),
|
...convertEquipmentSkill(rawSkill, locale),
|
||||||
param1: rawData.Prop3Param1,
|
param1: rawData.Prop3Param1,
|
||||||
param1Add: rawData.Prop3Param1Add,
|
param1Add: rawData.Prop3Param1Add,
|
||||||
param2: rawData.Prop3Param2,
|
param2: rawData.Prop3Param2,
|
||||||
@@ -126,7 +127,7 @@ export function compileStigmataData() {
|
|||||||
const rawSkill = rawEquipmentSkillDataMap[skillId]
|
const rawSkill = rawEquipmentSkillDataMap[skillId]
|
||||||
skills.push({
|
skills.push({
|
||||||
id: skillId,
|
id: skillId,
|
||||||
...convertEquipmentSkill(rawSkill),
|
...convertEquipmentSkill(rawSkill, locale),
|
||||||
param1: rawData.Prop1Param1,
|
param1: rawData.Prop1Param1,
|
||||||
param1Add: rawData.Prop1Param1Add,
|
param1Add: rawData.Prop1Param1Add,
|
||||||
param2: rawData.Prop1Param2,
|
param2: rawData.Prop1Param2,
|
||||||
@@ -140,7 +141,7 @@ export function compileStigmataData() {
|
|||||||
const rawSkill = rawEquipmentSkillDataMap[skillId]
|
const rawSkill = rawEquipmentSkillDataMap[skillId]
|
||||||
skills.push({
|
skills.push({
|
||||||
id: skillId,
|
id: skillId,
|
||||||
...convertEquipmentSkill(rawSkill),
|
...convertEquipmentSkill(rawSkill, locale),
|
||||||
param1: rawData.Prop2Param1,
|
param1: rawData.Prop2Param1,
|
||||||
param1Add: rawData.Prop2Param1Add,
|
param1Add: rawData.Prop2Param1Add,
|
||||||
param2: rawData.Prop2Param2,
|
param2: rawData.Prop2Param2,
|
||||||
@@ -154,7 +155,7 @@ export function compileStigmataData() {
|
|||||||
const rawSkill = rawEquipmentSkillDataMap[skillId]
|
const rawSkill = rawEquipmentSkillDataMap[skillId]
|
||||||
skills.push({
|
skills.push({
|
||||||
id: skillId,
|
id: skillId,
|
||||||
...convertEquipmentSkill(rawSkill),
|
...convertEquipmentSkill(rawSkill, locale),
|
||||||
param1: rawData.Prop3Param1,
|
param1: rawData.Prop3Param1,
|
||||||
param1Add: rawData.Prop3Param1Add,
|
param1Add: rawData.Prop3Param1Add,
|
||||||
param2: rawData.Prop3Param2,
|
param2: rawData.Prop3Param2,
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { compileWeaponData } from './compileWeaponData'
|
|||||||
|
|
||||||
describe('compileWeaponData', () => {
|
describe('compileWeaponData', () => {
|
||||||
it('compiles', () => {
|
it('compiles', () => {
|
||||||
const list = compileWeaponData()
|
const list = compileWeaponData('en-US')
|
||||||
|
|
||||||
const targetItem = list.find(weapon => weapon.id === '10277')
|
const targetItem = list.find(weapon => weapon.id === '10277')
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
import { RootWeaponData, WeaponData } from '../../data/types'
|
import { RootWeaponData, WeaponData } from '../../data/types'
|
||||||
import { getRawEquipmentSkillDataMap } from '../raw/equipmentSkillData'
|
import { getRawEquipmentSkillDataMap } from '../raw/equipmentSkillData'
|
||||||
import { getRawWeaponDataMap } from '../raw/weaponData'
|
import { getRawWeaponDataMap } from '../raw/weaponData'
|
||||||
import { convertEquipmentSkill, convertWeaponType, getText } from './utils'
|
import { convertEquipmentSkill, convertWeaponType, createGetText } from './utils'
|
||||||
|
|
||||||
export function compileWeaponData(): RootWeaponData[] {
|
export function compileWeaponData(locale: string): RootWeaponData[] {
|
||||||
const rawWeaponDataMap = getRawWeaponDataMap()
|
const rawWeaponDataMap = getRawWeaponDataMap()
|
||||||
const rawEquipmentSkillDataMap = getRawEquipmentSkillDataMap()
|
const rawEquipmentSkillDataMap = getRawEquipmentSkillDataMap()
|
||||||
|
const getText = createGetText(locale)
|
||||||
|
|
||||||
const rawWeaponMainIdWeaponDataMap = Object.entries(rawWeaponDataMap).reduce((map, [id, rawData]) => {
|
const rawWeaponMainIdWeaponDataMap = Object.entries(rawWeaponDataMap).reduce((map, [id, rawData]) => {
|
||||||
const rawWeaponMainId = rawData.WeaponMainID.toString()
|
const rawWeaponMainId = rawData.WeaponMainID.toString()
|
||||||
@@ -21,7 +22,7 @@ export function compileWeaponData(): RootWeaponData[] {
|
|||||||
const rawSkill = rawEquipmentSkillDataMap[skillId]
|
const rawSkill = rawEquipmentSkillDataMap[skillId]
|
||||||
skills.push({
|
skills.push({
|
||||||
id: skillId,
|
id: skillId,
|
||||||
...convertEquipmentSkill(rawSkill),
|
...convertEquipmentSkill(rawSkill, locale),
|
||||||
param1: rawData.Prop1Param1,
|
param1: rawData.Prop1Param1,
|
||||||
param1Add: rawData.Prop1Param1Add,
|
param1Add: rawData.Prop1Param1Add,
|
||||||
param2: rawData.Prop1Param2,
|
param2: rawData.Prop1Param2,
|
||||||
@@ -35,7 +36,7 @@ export function compileWeaponData(): RootWeaponData[] {
|
|||||||
const rawSkill = rawEquipmentSkillDataMap[skillId]
|
const rawSkill = rawEquipmentSkillDataMap[skillId]
|
||||||
skills.push({
|
skills.push({
|
||||||
id: skillId,
|
id: skillId,
|
||||||
...convertEquipmentSkill(rawSkill),
|
...convertEquipmentSkill(rawSkill, locale),
|
||||||
param1: rawData.Prop2Param1,
|
param1: rawData.Prop2Param1,
|
||||||
param1Add: rawData.Prop2Param1Add,
|
param1Add: rawData.Prop2Param1Add,
|
||||||
param2: rawData.Prop2Param2,
|
param2: rawData.Prop2Param2,
|
||||||
@@ -49,7 +50,7 @@ export function compileWeaponData(): RootWeaponData[] {
|
|||||||
const rawSkill = rawEquipmentSkillDataMap[skillId]
|
const rawSkill = rawEquipmentSkillDataMap[skillId]
|
||||||
skills.push({
|
skills.push({
|
||||||
id: skillId,
|
id: skillId,
|
||||||
...convertEquipmentSkill(rawSkill),
|
...convertEquipmentSkill(rawSkill, locale),
|
||||||
param1: rawData.Prop3Param1,
|
param1: rawData.Prop3Param1,
|
||||||
param1Add: rawData.Prop3Param1Add,
|
param1Add: rawData.Prop3Param1Add,
|
||||||
param2: rawData.Prop3Param2,
|
param2: rawData.Prop3Param2,
|
||||||
|
|||||||
@@ -2,9 +2,11 @@ import { TagType, WeaponType } from '../../data/types'
|
|||||||
import { RawEquipmentSkillData } from '../raw/equipmentSkillData'
|
import { RawEquipmentSkillData } from '../raw/equipmentSkillData'
|
||||||
import { getRawTextMap } from '../raw/textMap'
|
import { getRawTextMap } from '../raw/textMap'
|
||||||
|
|
||||||
export function getText(id: string | number) {
|
export function createGetText(locale?: string) {
|
||||||
const rawTextMap = getRawTextMap()
|
return function getText(id: string | number) {
|
||||||
return rawTextMap[id]?.Text || null
|
const rawTextMap = getRawTextMap(locale)
|
||||||
|
return rawTextMap[id]?.Text || null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function convertWeaponType(rawValue: number): WeaponType {
|
export function convertWeaponType(rawValue: number): WeaponType {
|
||||||
@@ -93,7 +95,8 @@ export function convertTagType(rawTagId: number): TagType {
|
|||||||
throw new Error(`Unsupported raw show order(Skill) (${rawTagId})`)
|
throw new Error(`Unsupported raw show order(Skill) (${rawTagId})`)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function convertEquipmentSkill(rawSkill: RawEquipmentSkillData) {
|
export function convertEquipmentSkill(rawSkill: RawEquipmentSkillData, locale: string) {
|
||||||
|
const getText = createGetText(locale)
|
||||||
const iconName = rawSkill.SkillIconPath.split('/').pop()
|
const iconName = rawSkill.SkillIconPath.split('/').pop()
|
||||||
return {
|
return {
|
||||||
name: getText(rawSkill.SkillName),
|
name: getText(rawSkill.SkillName),
|
||||||
|
|||||||
@@ -17,93 +17,129 @@ import {
|
|||||||
WeaponCatalogItem
|
WeaponCatalogItem
|
||||||
} from '../data/types'
|
} from '../data/types'
|
||||||
|
|
||||||
export const dataDir = path.join(process.cwd(), 'data/v2')
|
// export const dataDir = path.join(process.cwd(), 'data/ko-KR')
|
||||||
|
export function getDataDir(locale?: string) {
|
||||||
export const battlesuitsDir = path.join(dataDir, 'battlesuits')
|
if (locale == null) {
|
||||||
export const battlesuitCatalogPath = path.join(dataDir, 'battlesuit-catalog.yaml')
|
return path.join(process.cwd(), 'data', 'en-US')
|
||||||
|
}
|
||||||
export const weaponsDir = path.join(dataDir, 'weapons')
|
return path.join(process.cwd(), 'data', locale)
|
||||||
export const weaopnCatalogPath = path.join(dataDir, 'weapon-catalog.yaml')
|
|
||||||
|
|
||||||
export const stigmataDir = path.join(dataDir, 'stigmata')
|
|
||||||
export const stigmataCatalogPath = path.join(dataDir, 'stigmata-catalog.yaml')
|
|
||||||
|
|
||||||
export const stigmataSetsDir = path.join(dataDir, 'stigmata-sets')
|
|
||||||
export const stigmataSetCatalogPath = path.join(dataDir, 'stigmata-set-catalog.yaml')
|
|
||||||
|
|
||||||
export const erBattlesuitCatalogPath = path.join(dataDir, 'er-battlesuits-catalog.yaml')
|
|
||||||
export const erBattlesuitsDir = path.join(dataDir, 'er-battlesuits')
|
|
||||||
export const erSignetsDir = path.join(dataDir, 'er-signets')
|
|
||||||
export const erSupportsPath = path.join(dataDir, 'er-supports.yaml')
|
|
||||||
export const erSigilsPath = path.join(dataDir, 'er-sigils.yaml')
|
|
||||||
|
|
||||||
export const elfsDir = path.join(dataDir, 'elfs')
|
|
||||||
export const elfCatalogPath = path.join(dataDir, 'elf-catalog.yaml')
|
|
||||||
|
|
||||||
export function loadBattlesuitCatalog(): BattlesuitCatalogItem[] {
|
|
||||||
return readYamlFile(battlesuitCatalogPath)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function loadBattlesuitData(id: string) {
|
export function getBattlesuitsDir(locale?: string) {
|
||||||
const battlesuitDataPath = path.join(battlesuitsDir, `${id}.yaml`)
|
return path.join(getDataDir(locale), 'battlesuits')
|
||||||
|
}
|
||||||
|
export function getBattlesuitCatalogPath(locale?: string) {
|
||||||
|
return path.join(getDataDir(locale), 'battlesuit-catalog.yaml')
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getWeaponsDir(locale?: string) {
|
||||||
|
return path.join(getDataDir(locale), 'weapons')
|
||||||
|
}
|
||||||
|
export function getWeaopnCatalogPath(locale?: string) {
|
||||||
|
return path.join(getDataDir(locale), 'weapon-catalog.yaml')
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getStigmataDir(locale?: string) {
|
||||||
|
return path.join(getDataDir(locale), 'stigmata')
|
||||||
|
}
|
||||||
|
export function getStigmataCatalogPath(locale?: string) {
|
||||||
|
return path.join(getDataDir(locale), 'stigmata-catalog.yaml')
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getStigmataSetsDir(locale?: string) {
|
||||||
|
return path.join(getDataDir(locale), 'stigmata-sets')
|
||||||
|
}
|
||||||
|
export function getStigmataSetCatalogPath(locale?: string) {
|
||||||
|
return path.join(getDataDir(locale), 'stigmata-set-catalog.yaml')
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getErBattlesuitCatalogPath(locale?: string) {
|
||||||
|
return path.join(getDataDir(locale), 'er-battlesuits-catalog.yaml')
|
||||||
|
}
|
||||||
|
export function getErBattlesuitsDir(locale?: string) {
|
||||||
|
return path.join(getDataDir(locale), 'er-battlesuits')
|
||||||
|
}
|
||||||
|
export function getErSignetsDir(locale?: string) {
|
||||||
|
return path.join(getDataDir(locale), 'er-signets')
|
||||||
|
}
|
||||||
|
export function getErSupportsPath(locale?: string) {
|
||||||
|
return path.join(getDataDir(locale), 'er-supports.yaml')
|
||||||
|
}
|
||||||
|
export function getErSigilsPath(locale?: string) {
|
||||||
|
return path.join(getDataDir(locale), 'er-sigils.yaml')
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getElfsDir(locale?: string) {
|
||||||
|
return path.join(getDataDir(locale), 'elfs')
|
||||||
|
}
|
||||||
|
export function getElfCatalogPath(locale?: string) {
|
||||||
|
return path.join(getDataDir(locale), 'elf-catalog.yaml')
|
||||||
|
}
|
||||||
|
|
||||||
|
export function loadBattlesuitCatalog(locale?: string): BattlesuitCatalogItem[] {
|
||||||
|
return readYamlFile(getBattlesuitCatalogPath(locale))
|
||||||
|
}
|
||||||
|
|
||||||
|
export function loadBattlesuitData(id: string, locale?: string) {
|
||||||
|
const battlesuitDataPath = path.join(getBattlesuitsDir(locale), `${id}.yaml`)
|
||||||
return readYamlFile(battlesuitDataPath)
|
return readYamlFile(battlesuitDataPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function loadWeaponCatalog(): WeaponCatalogItem[] {
|
export function loadWeaponCatalog(locale?: string): WeaponCatalogItem[] {
|
||||||
return readYamlFile(weaopnCatalogPath)
|
return readYamlFile(getWeaopnCatalogPath(locale))
|
||||||
}
|
}
|
||||||
|
|
||||||
export function loadWeaponData(id: string) {
|
export function loadWeaponData(id: string, locale?: string) {
|
||||||
const weaponDataPath = path.join(weaponsDir, `${id}.yaml`)
|
const weaponDataPath = path.join(getWeaponsDir(locale), `${id}.yaml`)
|
||||||
return readYamlFile(weaponDataPath)
|
return readYamlFile(weaponDataPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function loadStigmataCatalog(): StigmataCatalogItem[] {
|
export function loadStigmataCatalog(locale?: string): StigmataCatalogItem[] {
|
||||||
return readYamlFile(stigmataCatalogPath)
|
return readYamlFile(getStigmataCatalogPath(locale))
|
||||||
}
|
}
|
||||||
|
|
||||||
export function loadStigmaData(id: string): RootStigma {
|
export function loadStigmaData(id: string, locale?: string): RootStigma {
|
||||||
const stigmaDataPath = path.join(stigmataDir, `${id}.yaml`)
|
const stigmaDataPath = path.join(getStigmataDir(locale), `${id}.yaml`)
|
||||||
return readYamlFile(stigmaDataPath)
|
return readYamlFile(stigmaDataPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function loadStigmataSetCatalog(): StigmataSetCatalogItem[] {
|
export function loadStigmataSetCatalog(locale?: string): StigmataSetCatalogItem[] {
|
||||||
return readYamlFile(stigmataSetCatalogPath)
|
return readYamlFile(getStigmataSetCatalogPath(locale))
|
||||||
}
|
}
|
||||||
|
|
||||||
export function loadStigmataSetData(id: string): StigmataSet {
|
export function loadStigmataSetData(id: string, locale?: string): StigmataSet {
|
||||||
const stigmataSetPath = path.join(stigmataSetsDir, `${id}.yaml`)
|
const stigmataSetPath = path.join(getStigmataSetsDir(locale), `${id}.yaml`)
|
||||||
return readYamlFile(stigmataSetPath)
|
return readYamlFile(stigmataSetPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function loadErBattlesuitCatalog(): ErBattlesuitCatalogItem[] {
|
export function loadErBattlesuitCatalog(locale?: string): ErBattlesuitCatalogItem[] {
|
||||||
return readYamlFile(erBattlesuitCatalogPath)
|
return readYamlFile(getErBattlesuitCatalogPath(locale))
|
||||||
}
|
}
|
||||||
|
|
||||||
export function loadErBattlesuit(id: string): ErBattlesuit {
|
export function loadErBattlesuit(id: string, locale?: string): ErBattlesuit {
|
||||||
const erBattlesuitPath = path.join(erBattlesuitsDir, `${id}.yaml`)
|
const erBattlesuitPath = path.join(getErBattlesuitsDir(locale), `${id}.yaml`)
|
||||||
return readYamlFile(erBattlesuitPath)
|
return readYamlFile(erBattlesuitPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function loadErSignets(id: string): ErSignet[] {
|
export function loadErSignets(id: string, locale?: string): ErSignet[] {
|
||||||
const erSignetsPath = path.join(erSignetsDir, `${id}.yaml`)
|
const erSignetsPath = path.join(getErSignetsDir(locale), `${id}.yaml`)
|
||||||
return readYamlFile(erSignetsPath)
|
return readYamlFile(erSignetsPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function loadErSupports(): ErSupportBattlesuit[] {
|
export function loadErSupports(locale?: string): ErSupportBattlesuit[] {
|
||||||
return readYamlFile(erSupportsPath)
|
return readYamlFile(getErSupportsPath(locale))
|
||||||
}
|
}
|
||||||
|
|
||||||
export function loadErSigils(): ErSigil[] {
|
export function loadErSigils(locale?: string): ErSigil[] {
|
||||||
return readYamlFile(erSigilsPath)
|
return readYamlFile(getErSigilsPath(locale))
|
||||||
}
|
}
|
||||||
|
|
||||||
export function loadElfCatalog(): ElfCatalogItem[] {
|
export function loadElfCatalog(locale?: string): ElfCatalogItem[] {
|
||||||
return readYamlFile(elfCatalogPath)
|
return readYamlFile(getElfCatalogPath(locale))
|
||||||
}
|
}
|
||||||
|
|
||||||
export function loadElfData(id: string): Elf {
|
export function loadElfData(id: string, locale?: string): Elf {
|
||||||
const elfDataPath = path.join(elfsDir, `${id}.yaml`)
|
const elfDataPath = path.join(getElfsDir(locale), `${id}.yaml`)
|
||||||
return readYamlFile(elfDataPath)
|
return readYamlFile(elfDataPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
import { loadRawData } from './loadRawData'
|
import { loadRawData } from './loadRawData'
|
||||||
|
|
||||||
export function getRawTextMap(): RawTextMap {
|
export function getRawTextMap(locale?: string): RawTextMap {
|
||||||
|
if (locale === 'en-US') {
|
||||||
|
return loadRawData('TextMap_en.json')
|
||||||
|
}
|
||||||
return loadRawData('TextMap.json')
|
return loadRawData('TextMap.json')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ const BattlesuitShowPage = ({ battlesuit }: BattlesuitShowPageProps) => {
|
|||||||
export default BattlesuitShowPage
|
export default BattlesuitShowPage
|
||||||
|
|
||||||
export async function getStaticProps({ locale, params }: NextPageContext & { params: { battlesuitId: string } }) {
|
export async function getStaticProps({ locale, params }: NextPageContext & { params: { battlesuitId: string } }) {
|
||||||
const battlesuit = loadBattlesuitData(params.battlesuitId)
|
const battlesuit = loadBattlesuitData(params.battlesuitId, locale)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
props: { battlesuit, ...(await getI18NProps(locale)) }
|
props: { battlesuit, ...(await getI18NProps(locale)) }
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import Head from '../../../../components/atoms/Head'
|
|||||||
import { useTranslation } from 'next-i18next'
|
import { useTranslation } from 'next-i18next'
|
||||||
import Breadcrumb from '../../../../components/organisms/Breadcrumb'
|
import Breadcrumb from '../../../../components/organisms/Breadcrumb'
|
||||||
import { generateI18NPaths, getI18NProps } from '../../../../server/i18n'
|
import { generateI18NPaths, getI18NProps } from '../../../../server/i18n'
|
||||||
|
import FormattedText from '../../../../components/v2/FormattedText'
|
||||||
|
|
||||||
interface BattlesuitShowPageProps {
|
interface BattlesuitShowPageProps {
|
||||||
battlesuit: Battlesuit
|
battlesuit: Battlesuit
|
||||||
@@ -90,7 +91,7 @@ const BattlesuitShowPage = ({ battlesuit, erBattlesuit }: BattlesuitShowPageProp
|
|||||||
</Heading>
|
</Heading>
|
||||||
</Box>
|
</Box>
|
||||||
<Box sx={{ p: 1, borderBottom: 'default', '&:last-child': { borderBottom: 'none' } }}>
|
<Box sx={{ p: 1, borderBottom: 'default', '&:last-child': { borderBottom: 'none' } }}>
|
||||||
{ability.desc}
|
<FormattedText>{ability.desc}</FormattedText>
|
||||||
</Box>
|
</Box>
|
||||||
</Fragment>
|
</Fragment>
|
||||||
)
|
)
|
||||||
@@ -117,7 +118,7 @@ const BattlesuitShowPage = ({ battlesuit, erBattlesuit }: BattlesuitShowPageProp
|
|||||||
</Heading>
|
</Heading>
|
||||||
</Flex>
|
</Flex>
|
||||||
<Box sx={{ p: 1, borderBottom: 'default', '&:last-child': { borderBottom: 'none' } }}>
|
<Box sx={{ p: 1, borderBottom: 'default', '&:last-child': { borderBottom: 'none' } }}>
|
||||||
{signet.desc}
|
<FormattedText>{signet.desc}</FormattedText>
|
||||||
</Box>
|
</Box>
|
||||||
</Fragment>
|
</Fragment>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -3,24 +3,6 @@ import { createDirIfNotExist } from '../lib/v2/server/fsUtils'
|
|||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
import YAML from 'yaml'
|
import YAML from 'yaml'
|
||||||
import { runScript } from './lib/utils'
|
import { runScript } from './lib/utils'
|
||||||
import {
|
|
||||||
battlesuitCatalogPath,
|
|
||||||
battlesuitsDir,
|
|
||||||
dataDir,
|
|
||||||
elfCatalogPath,
|
|
||||||
elfsDir,
|
|
||||||
erBattlesuitCatalogPath,
|
|
||||||
erBattlesuitsDir,
|
|
||||||
erSigilsPath,
|
|
||||||
erSignetsDir,
|
|
||||||
erSupportsPath,
|
|
||||||
stigmataCatalogPath,
|
|
||||||
stigmataDir,
|
|
||||||
stigmataSetCatalogPath,
|
|
||||||
stigmataSetsDir,
|
|
||||||
weaopnCatalogPath,
|
|
||||||
weaponsDir
|
|
||||||
} from '../lib/v2/server/loadData'
|
|
||||||
import {
|
import {
|
||||||
BattlesuitCatalogItem,
|
BattlesuitCatalogItem,
|
||||||
ElfCatalogItem,
|
ElfCatalogItem,
|
||||||
@@ -33,18 +15,41 @@ import { compileWeaponData } from '../lib/v2/server/compileData/compileWeaponDat
|
|||||||
import { compileStigmataData } from '../lib/v2/server/compileData/compileStigmataData'
|
import { compileStigmataData } from '../lib/v2/server/compileData/compileStigmataData'
|
||||||
import { compileGodWarData } from '../lib/v2/server/compileData/compileGodWarData'
|
import { compileGodWarData } from '../lib/v2/server/compileData/compileGodWarData'
|
||||||
import { compileElfData } from '../lib/v2/server/compileData/compileElfData'
|
import { compileElfData } from '../lib/v2/server/compileData/compileElfData'
|
||||||
|
import {
|
||||||
|
getBattlesuitCatalogPath,
|
||||||
|
getBattlesuitsDir,
|
||||||
|
getDataDir,
|
||||||
|
getElfCatalogPath,
|
||||||
|
getElfsDir,
|
||||||
|
getErBattlesuitCatalogPath,
|
||||||
|
getErBattlesuitsDir,
|
||||||
|
getErSigilsPath,
|
||||||
|
getErSignetsDir,
|
||||||
|
getErSupportsPath,
|
||||||
|
getStigmataCatalogPath,
|
||||||
|
getStigmataDir,
|
||||||
|
getStigmataSetCatalogPath,
|
||||||
|
getStigmataSetsDir,
|
||||||
|
getWeaopnCatalogPath,
|
||||||
|
getWeaponsDir
|
||||||
|
} from '../lib/v2/server/loadData'
|
||||||
|
|
||||||
runScript(async () => {
|
runScript(async () => {
|
||||||
createDirIfNotExist(dataDir)
|
writeDataFiles('ko-KR')
|
||||||
writeBattlesuitData()
|
writeDataFiles('en-US')
|
||||||
writeWeaponData()
|
|
||||||
writeStigmataData()
|
|
||||||
writeErData()
|
|
||||||
writeElfData()
|
|
||||||
})
|
})
|
||||||
|
|
||||||
function writeBattlesuitData() {
|
function writeDataFiles(locale: string) {
|
||||||
const battlesuitList = compileBattlesuitData()
|
createDirIfNotExist(getDataDir(locale))
|
||||||
|
writeBattlesuitData(locale)
|
||||||
|
writeWeaponData(locale)
|
||||||
|
writeStigmataData(locale)
|
||||||
|
writeErData(locale)
|
||||||
|
writeElfData(locale)
|
||||||
|
}
|
||||||
|
|
||||||
|
function writeBattlesuitData(locale: string) {
|
||||||
|
const battlesuitList = compileBattlesuitData(locale)
|
||||||
|
|
||||||
const catalogList: BattlesuitCatalogItem[] = battlesuitList.map(battlesuit => {
|
const catalogList: BattlesuitCatalogItem[] = battlesuitList.map(battlesuit => {
|
||||||
return {
|
return {
|
||||||
@@ -57,18 +62,18 @@ function writeBattlesuitData() {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
fs.writeFileSync(battlesuitCatalogPath, YAML.stringify(catalogList))
|
fs.writeFileSync(getBattlesuitCatalogPath(locale), YAML.stringify(catalogList))
|
||||||
|
|
||||||
createDirIfNotExist(battlesuitsDir)
|
createDirIfNotExist(getBattlesuitsDir(locale))
|
||||||
|
|
||||||
for (const battlesuit of battlesuitList) {
|
for (const battlesuit of battlesuitList) {
|
||||||
const battlesuitDataPath = path.join(battlesuitsDir, `${battlesuit.id}.yaml`)
|
const battlesuitDataPath = path.join(getBattlesuitsDir(locale), `${battlesuit.id}.yaml`)
|
||||||
fs.writeFileSync(battlesuitDataPath, YAML.stringify(battlesuit))
|
fs.writeFileSync(battlesuitDataPath, YAML.stringify(battlesuit))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function writeWeaponData() {
|
function writeWeaponData(locale: string) {
|
||||||
const weaponDataList = compileWeaponData()
|
const weaponDataList = compileWeaponData(locale)
|
||||||
|
|
||||||
const catalogList: WeaponCatalogItem[] = weaponDataList.map(rootWeapon => {
|
const catalogList: WeaponCatalogItem[] = weaponDataList.map(rootWeapon => {
|
||||||
const maxedWeapon = rootWeapon.weapons[rootWeapon.weapons.length - 1]
|
const maxedWeapon = rootWeapon.weapons[rootWeapon.weapons.length - 1]
|
||||||
@@ -81,18 +86,18 @@ function writeWeaponData() {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
fs.writeFileSync(weaopnCatalogPath, YAML.stringify(catalogList))
|
fs.writeFileSync(getWeaopnCatalogPath(locale), YAML.stringify(catalogList))
|
||||||
|
|
||||||
createDirIfNotExist(weaponsDir)
|
createDirIfNotExist(getWeaponsDir(locale))
|
||||||
|
|
||||||
for (const weaponData of weaponDataList) {
|
for (const weaponData of weaponDataList) {
|
||||||
const weaponDataPath = path.join(weaponsDir, `${weaponData.id}.yaml`)
|
const weaponDataPath = path.join(getWeaponsDir(locale), `${weaponData.id}.yaml`)
|
||||||
fs.writeFileSync(weaponDataPath, YAML.stringify(weaponData))
|
fs.writeFileSync(weaponDataPath, YAML.stringify(weaponData))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function writeStigmataData() {
|
function writeStigmataData(locale: string) {
|
||||||
const { stigmataSetList, stigmataMainIdStigmataMap } = compileStigmataData()
|
const { stigmataSetList, stigmataMainIdStigmataMap } = compileStigmataData(locale)
|
||||||
const stigmataList = [...stigmataMainIdStigmataMap.values()]
|
const stigmataList = [...stigmataMainIdStigmataMap.values()]
|
||||||
|
|
||||||
const catalogList: StigmataCatalogItem[] = stigmataList.map(rootStigma => {
|
const catalogList: StigmataCatalogItem[] = stigmataList.map(rootStigma => {
|
||||||
@@ -105,11 +110,11 @@ function writeStigmataData() {
|
|||||||
maxRarity: maxedStigma.maxRarity
|
maxRarity: maxedStigma.maxRarity
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
fs.writeFileSync(stigmataCatalogPath, YAML.stringify(catalogList))
|
fs.writeFileSync(getStigmataCatalogPath(locale), YAML.stringify(catalogList))
|
||||||
|
|
||||||
createDirIfNotExist(stigmataDir)
|
createDirIfNotExist(getStigmataDir(locale))
|
||||||
for (const stigmataData of stigmataList) {
|
for (const stigmataData of stigmataList) {
|
||||||
const stigmaDataPath = path.join(stigmataDir, `${stigmataData.id}.yaml`)
|
const stigmaDataPath = path.join(getStigmataDir(locale), `${stigmataData.id}.yaml`)
|
||||||
fs.writeFileSync(stigmaDataPath, YAML.stringify(stigmataData))
|
fs.writeFileSync(stigmaDataPath, YAML.stringify(stigmataData))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,8 +135,9 @@ function writeStigmataData() {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
fs.writeFileSync(stigmataSetCatalogPath, YAML.stringify(setCatalogList))
|
fs.writeFileSync(getStigmataSetCatalogPath(locale), YAML.stringify(setCatalogList))
|
||||||
|
|
||||||
|
const stigmataSetsDir = getStigmataSetsDir(locale)
|
||||||
createDirIfNotExist(stigmataSetsDir)
|
createDirIfNotExist(stigmataSetsDir)
|
||||||
for (const stigmataSet of stigmataSetList) {
|
for (const stigmataSet of stigmataSetList) {
|
||||||
const stigmaSetDataPath = path.join(stigmataSetsDir, `${stigmataSet.id}.yaml`)
|
const stigmaSetDataPath = path.join(stigmataSetsDir, `${stigmataSet.id}.yaml`)
|
||||||
@@ -139,33 +145,35 @@ function writeStigmataData() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function writeErData() {
|
function writeErData(locale: string) {
|
||||||
const { buffSuitBuffListMap, mainAvatarList, supportAvatarList, sigilList } = compileGodWarData()
|
const { buffSuitBuffListMap, mainAvatarList, supportAvatarList, sigilList } = compileGodWarData(locale)
|
||||||
|
|
||||||
const erBattlesuitCatalog = mainAvatarList.map(mainAvatar => {
|
const erBattlesuitCatalog = mainAvatarList.map(mainAvatar => {
|
||||||
return { battlesuit: mainAvatar.battlesuit }
|
return { battlesuit: mainAvatar.battlesuit }
|
||||||
})
|
})
|
||||||
|
|
||||||
fs.writeFileSync(erBattlesuitCatalogPath, YAML.stringify(erBattlesuitCatalog))
|
fs.writeFileSync(getErBattlesuitCatalogPath(locale), YAML.stringify(erBattlesuitCatalog))
|
||||||
|
|
||||||
|
const erBattlesuitsDir = getErBattlesuitsDir(locale)
|
||||||
createDirIfNotExist(erBattlesuitsDir)
|
createDirIfNotExist(erBattlesuitsDir)
|
||||||
for (const erBattlesuit of mainAvatarList) {
|
for (const erBattlesuit of mainAvatarList) {
|
||||||
const erBattlesuitPath = path.join(erBattlesuitsDir, `${erBattlesuit.battlesuit}.yaml`)
|
const erBattlesuitPath = path.join(erBattlesuitsDir, `${erBattlesuit.battlesuit}.yaml`)
|
||||||
fs.writeFileSync(erBattlesuitPath, YAML.stringify(erBattlesuit))
|
fs.writeFileSync(erBattlesuitPath, YAML.stringify(erBattlesuit))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const erSignetsDir = getErSignetsDir(locale)
|
||||||
createDirIfNotExist(erSignetsDir)
|
createDirIfNotExist(erSignetsDir)
|
||||||
for (const [buffSuit, list] of buffSuitBuffListMap) {
|
for (const [buffSuit, list] of buffSuitBuffListMap) {
|
||||||
const erSignetsPath = path.join(erSignetsDir, `${buffSuit}.yaml`)
|
const erSignetsPath = path.join(erSignetsDir, `${buffSuit}.yaml`)
|
||||||
fs.writeFileSync(erSignetsPath, YAML.stringify(list))
|
fs.writeFileSync(erSignetsPath, YAML.stringify(list))
|
||||||
}
|
}
|
||||||
|
|
||||||
fs.writeFileSync(erSupportsPath, YAML.stringify(supportAvatarList))
|
fs.writeFileSync(getErSupportsPath(locale), YAML.stringify(supportAvatarList))
|
||||||
fs.writeFileSync(erSigilsPath, YAML.stringify(sigilList))
|
fs.writeFileSync(getErSigilsPath(locale), YAML.stringify(sigilList))
|
||||||
}
|
}
|
||||||
|
|
||||||
function writeElfData() {
|
function writeElfData(locale: string) {
|
||||||
const elfs = compileElfData()
|
const elfs = compileElfData(locale)
|
||||||
|
|
||||||
const elfCatalogList = elfs.map<ElfCatalogItem>(elf => {
|
const elfCatalogList = elfs.map<ElfCatalogItem>(elf => {
|
||||||
return {
|
return {
|
||||||
@@ -178,8 +186,9 @@ function writeElfData() {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
fs.writeFileSync(elfCatalogPath, YAML.stringify(elfCatalogList))
|
fs.writeFileSync(getElfCatalogPath(locale), YAML.stringify(elfCatalogList))
|
||||||
|
|
||||||
|
const elfsDir = getElfsDir(locale)
|
||||||
createDirIfNotExist(elfsDir)
|
createDirIfNotExist(elfsDir)
|
||||||
for (const elf of elfs) {
|
for (const elf of elfs) {
|
||||||
const elfDataPath = path.join(elfsDir, `${elf.id}.yaml`)
|
const elfDataPath = path.join(elfsDir, `${elf.id}.yaml`)
|
||||||
|
|||||||
Reference in New Issue
Block a user