From 2edb2cde77ec944797dd49b18794c6d30745ede7 Mon Sep 17 00:00:00 2001 From: Sakura Knoll Date: Thu, 13 Jul 2023 19:55:43 +0900 Subject: [PATCH] Add signet pages --- src/components/v2-pre/SquareImage.tsx | 43 +++++++ src/lib/v2-pre/data/er.ts | 16 +++ src/lib/v2-pre/data/formatText.spec.ts | 1 - src/lib/v2-pre/data/text.ts | 15 +++ src/lib/v2-pre/data/types.ts | 30 +++++ .../compileData/compileGodWarData.spec.ts | 45 +++++++ .../server/compileData/compileGodWarData.ts | 83 +++++++++++++ src/lib/v2-pre/server/loadData.ts | 35 +++++- .../v2-pre/server/raw/godWarAvatarAbility.ts | 17 +++ src/lib/v2-pre/server/raw/godWarBuff.ts | 26 ++++ src/lib/v2-pre/server/raw/godWarBuffSuit.ts | 18 +++ src/lib/v2-pre/server/raw/godWarMainAvatar.ts | 24 ++++ .../v2-pre/er/battlesuits/[battlesuitId].tsx | 115 ++++++++++++++++++ src/pages/v2-pre/er/index.tsx | 75 ++++++++++++ src/pages/v2-pre/er/signets/[groupId].tsx | 89 ++++++++++++++ src/scripts/compileRawData.ts | 27 ++++ 16 files changed, 655 insertions(+), 4 deletions(-) create mode 100644 src/components/v2-pre/SquareImage.tsx create mode 100644 src/lib/v2-pre/data/er.ts create mode 100644 src/lib/v2-pre/server/compileData/compileGodWarData.spec.ts create mode 100644 src/lib/v2-pre/server/compileData/compileGodWarData.ts create mode 100644 src/lib/v2-pre/server/raw/godWarAvatarAbility.ts create mode 100644 src/lib/v2-pre/server/raw/godWarBuff.ts create mode 100644 src/lib/v2-pre/server/raw/godWarBuffSuit.ts create mode 100644 src/lib/v2-pre/server/raw/godWarMainAvatar.ts create mode 100644 src/pages/v2-pre/er/battlesuits/[battlesuitId].tsx create mode 100644 src/pages/v2-pre/er/index.tsx create mode 100644 src/pages/v2-pre/er/signets/[groupId].tsx diff --git a/src/components/v2-pre/SquareImage.tsx b/src/components/v2-pre/SquareImage.tsx new file mode 100644 index 00000000..214e0284 --- /dev/null +++ b/src/components/v2-pre/SquareImage.tsx @@ -0,0 +1,43 @@ +import { Box, Flex, Image } from 'theme-ui' + +interface SquareImageProps { + src: string + originalSize: number + size?: number + alt?: string +} + +const SquareImage = ({ src, originalSize, size, alt }: SquareImageProps) => { + if (size == null) { + size = originalSize + } + + const ratio = size / originalSize + return ( + + + + {alt} + + + + ) +} + +export default SquareImage diff --git a/src/lib/v2-pre/data/er.ts b/src/lib/v2-pre/data/er.ts new file mode 100644 index 00000000..2a975f0a --- /dev/null +++ b/src/lib/v2-pre/data/er.ts @@ -0,0 +1,16 @@ +export const signetGroups = [ + { id: '1', name: '[구원]의 각인', icon: 'Kevin' }, + { id: '2', name: '[황금]의 각인', icon: 'Eden' }, + { id: '3', name: '[오멸]의 각인', icon: 'Kalpas' }, + { id: '4', name: '[천혜]의 각인', icon: 'Su' }, + { id: '5', name: '[찰나]의 각인', icon: 'Sakura' }, + { id: '6', name: '[무한]의 각인', icon: 'Mobius' }, + { id: '7', name: '[부생]의 각인', icon: 'Hua' }, + // { id: '8', name: '[■■]의 각인', icon: 'Elysia' }, + // { id: '9', name: '[■■]의 각인', icon: 'Elysia' }, + { id: '10', name: '[계율]의 각인', icon: 'Aponia' }, + { id: '11', name: '[나선]의 각인', icon: 'Verve' }, + { id: '12', name: '[욱광]의 각인', icon: 'Kosma' }, + { id: '13', name: '[번성]의 각인', icon: 'Griseo' }, + { id: '14', name: '[환몽]의 각인', icon: 'Pardofelis' } +] diff --git a/src/lib/v2-pre/data/formatText.spec.ts b/src/lib/v2-pre/data/formatText.spec.ts index 3481c3f3..380865c6 100644 --- a/src/lib/v2-pre/data/formatText.spec.ts +++ b/src/lib/v2-pre/data/formatText.spec.ts @@ -23,7 +23,6 @@ describe('formatSubSkillInfo', () => { it('appends 0, based on precision, if the calculated value does not have decimals', () => { const params = { info: '전투 중 초기 SP가 #1[f1] 증가하며, 오픈월드에서는 10분에 1회 발동한다.', - maxLv: 11, paramBase1: 20, paramBase2: 0, diff --git a/src/lib/v2-pre/data/text.ts b/src/lib/v2-pre/data/text.ts index e760b383..07ac486e 100644 --- a/src/lib/v2-pre/data/text.ts +++ b/src/lib/v2-pre/data/text.ts @@ -223,3 +223,18 @@ export function getTagTypeLabel(type: TagType) { return `Unknown Tag Type (${type})` } } + +export function getErSignetTypeLabel(quality: number) { + switch (quality) { + case 1: + return '일반 각인' + case 2: + return '증폭 각인' + case 3: + return '코어 각인' + case 4: + return '전용 각인' + default: + return `Unknown (${quality})` + } +} diff --git a/src/lib/v2-pre/data/types.ts b/src/lib/v2-pre/data/types.ts index 004d5c10..f38772b8 100644 --- a/src/lib/v2-pre/data/types.ts +++ b/src/lib/v2-pre/data/types.ts @@ -261,3 +261,33 @@ export interface StigmataSetCatalogItem { name: string stigmataList: { id: string; icon: string; maxRarity: number }[] } + +export interface ErSignet { + id: string + name: string + desc: string + buffSuit: string + quality: number +} + +export interface ErBattlesuit { + battlesuit: string + abilities: ErBattlesuitAbility[] + signets: ErSignet[] +} +export interface ErBattlesuitCatalogItem { + battlesuit: string +} + +export interface ErBattlesuitAbility { + id: string + type: number + name: string + desc: string +} + +export interface ErSignetGroup { + id: string + name: string + icon: string +} diff --git a/src/lib/v2-pre/server/compileData/compileGodWarData.spec.ts b/src/lib/v2-pre/server/compileData/compileGodWarData.spec.ts new file mode 100644 index 00000000..db2bf770 --- /dev/null +++ b/src/lib/v2-pre/server/compileData/compileGodWarData.spec.ts @@ -0,0 +1,45 @@ +import { compileGodWarData } from './compileGodWarData' + +describe('compileGodWarData', () => { + it('compiles main battlesuit abilities and signets', () => { + const { mainAvatarList } = compileGodWarData() + + const targetItem = mainAvatarList[11] + expect(targetItem).toMatchObject({ + battlesuit: expect.any(String), + abilities: expect.arrayContaining([ + expect.objectContaining({ + name: expect.any(String), + desc: expect.any(String) + }) + ]), + signets: expect.arrayContaining([ + { + id: expect.any(String), + buffSuit: expect.any(String), + name: expect.any(String), + desc: expect.any(String), + quality: expect.any(Number) + } + ]) + }) + }) + + it('compiles buff list per suit', () => { + const { buffSuitBuffListMap } = compileGodWarData() + + const targetItem = buffSuitBuffListMap.get('3') + + expect(targetItem).toEqual( + expect.arrayContaining([ + expect.objectContaining({ + id: expect.any(String), + buffSuit: expect.any(String), + name: expect.any(String), + desc: expect.any(String), + quality: expect.any(Number) + }) + ]) + ) + }) +}) diff --git a/src/lib/v2-pre/server/compileData/compileGodWarData.ts b/src/lib/v2-pre/server/compileData/compileGodWarData.ts new file mode 100644 index 00000000..024e720f --- /dev/null +++ b/src/lib/v2-pre/server/compileData/compileGodWarData.ts @@ -0,0 +1,83 @@ +import { ErBattlesuit, ErBattlesuitAbility, ErSignet, ErSignetGroup } from '../../data/types' +import { getRawGodWarAvatarAbilityMap } from '../raw/godWarAvatarAbility' +import { getRawGodWarBuffMap } from '../raw/godWarBuff' +import { getRawGodWarBuffSuitMap } from '../raw/godWarBuffSuit' +import { getRawGodWarMainAvatarMap } from '../raw/godWarMainAvatar' +import { getText } from './utils' + +export function compileGodWarData() { + const rawMainAvatarMap = getRawGodWarMainAvatarMap()['1'] + const rawGodWarAvatarAbilityMap = getRawGodWarAvatarAbilityMap() + const rawGodWarBuffMap = getRawGodWarBuffMap() + const rawGodWarBuffSuitMap = getRawGodWarBuffSuitMap() + const battlesuitIdRawBuffListMap = new Map() + const buffSuitBuffListMap = new Map() + + Object.entries(rawGodWarBuffMap).forEach(([id1, rawbuffMap]) => { + const rawBuffList = Object.entries(rawbuffMap) + rawBuffList.forEach(([id2, rawBuff]) => { + const buffSuit = rawBuff.BuffSuit.toString() + // No data + if (buffSuit === '0') { + return + } + if (buffSuit === '8') { + const buffGroupId = rawBuff.BuffGroup.toString() + let buffList = battlesuitIdRawBuffListMap.get(buffGroupId) + if (buffList == null) { + buffList = [] + battlesuitIdRawBuffListMap.set(buffGroupId, buffList) + } + buffList.push({ + id: `${id1}-${id2}`, + name: getText(rawBuff.BuffName), + desc: getText(rawBuff.BuffDesc), + buffSuit, + quality: rawBuff.BuffQuality + }) + } else { + if (rawBuff.BuffSuit < 10 && id1.length > 4) { + return + } + let buffList = buffSuitBuffListMap.get(buffSuit) + if (buffList == null) { + buffList = [] + buffSuitBuffListMap.set(buffSuit, buffList) + } + buffList.push({ + id: `${id1}-${id2}`, + name: getText(rawBuff.BuffName), + desc: getText(rawBuff.BuffDesc), + buffSuit, + quality: rawBuff.BuffQuality + }) + } + }) + }) + + const mainAvatarList = Object.entries(rawMainAvatarMap).map(([id, rawData]) => { + const abilities = rawData.AvatarAbilityID.map(id => { + const stringId = id.toString() + const rawAbility = rawGodWarAvatarAbilityMap[stringId] + + return { + id: stringId, + type: rawAbility.AbilityType, + name: getText(rawAbility.AbilityTitle), + desc: getText(rawAbility.AbilityDes) + } + }) + const signets = battlesuitIdRawBuffListMap.get(id)! + + return { + battlesuit: id, + abilities, + signets + } + }) + + return { + buffSuitBuffListMap, + mainAvatarList + } +} diff --git a/src/lib/v2-pre/server/loadData.ts b/src/lib/v2-pre/server/loadData.ts index c6e7be71..e5239ebd 100644 --- a/src/lib/v2-pre/server/loadData.ts +++ b/src/lib/v2-pre/server/loadData.ts @@ -1,7 +1,17 @@ import fs from 'fs' import path from 'path' import YAML from 'yaml' -import { BattlesuitCatalogItem, RootStigma, StigmataSet, WeaponCatalogItem } from '../data/types' +import { + BattlesuitCatalogItem, + ErBattlesuit, + ErBattlesuitCatalogItem, + ErSignet, + RootStigma, + StigmataCatalogItem, + StigmataSet, + StigmataSetCatalogItem, + WeaponCatalogItem +} from '../data/types' export const dataDir = path.join(process.cwd(), 'data/v2-pre') @@ -17,6 +27,11 @@ 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 erSignetGroupsPath = path.join(dataDir, 'er-signet-groups.yaml') + export function loadBattlesuitCatalog(): BattlesuitCatalogItem[] { return readYamlFile(battlesuitCatalogPath) } @@ -35,7 +50,7 @@ export function loadWeaponData(id: string) { return readYamlFile(weaponDataPath) } -export function loadStigmataCatalog(): WeaponCatalogItem[] { +export function loadStigmataCatalog(): StigmataCatalogItem[] { return readYamlFile(stigmataCatalogPath) } @@ -44,7 +59,7 @@ export function loadStigmaData(id: string): RootStigma { return readYamlFile(stigmaDataPath) } -export function loadStigmataSetCatalog(): WeaponCatalogItem[] { +export function loadStigmataSetCatalog(): StigmataSetCatalogItem[] { return readYamlFile(stigmataSetCatalogPath) } @@ -53,6 +68,20 @@ export function loadStigmataSetData(id: string): StigmataSet { return readYamlFile(stigmataSetPath) } +export function loadErBattlesuitCatalog(): ErBattlesuitCatalogItem[] { + return readYamlFile(erBattlesuitCatalogPath) +} + +export function loadErBattlesuit(id: string): ErBattlesuit { + const erBattlesuitPath = path.join(erBattlesuitsDir, `${id}.yaml`) + return readYamlFile(erBattlesuitPath) +} + +export function loadErSignets(id: string): ErSignet[] { + const erSignetsPath = path.join(erSignetsDir, `${id}.yaml`) + return readYamlFile(erSignetsPath) +} + function readYamlFile(pathname: string) { return YAML.parse(fs.readFileSync(pathname).toString()) } diff --git a/src/lib/v2-pre/server/raw/godWarAvatarAbility.ts b/src/lib/v2-pre/server/raw/godWarAvatarAbility.ts new file mode 100644 index 00000000..37ecd357 --- /dev/null +++ b/src/lib/v2-pre/server/raw/godWarAvatarAbility.ts @@ -0,0 +1,17 @@ +import { loadRawData } from './loadRawData' + +export function getRawGodWarAvatarAbilityMap(): RawGodWarAvatarAbilityMap { + return loadRawData('GodWarAvatarAbility.json') +} + +export type RawGodWarAvatarAbilityMap = { + [key: string]: RawGodWarAvatarAbility +} + +export interface RawGodWarAvatarAbility { + AbilityType: number + AbilityTitle: number + AbilityDes: number + AbilityIcon: string + IsShowInAvatarChallenge: boolean +} diff --git a/src/lib/v2-pre/server/raw/godWarBuff.ts b/src/lib/v2-pre/server/raw/godWarBuff.ts new file mode 100644 index 00000000..2b4fbb7a --- /dev/null +++ b/src/lib/v2-pre/server/raw/godWarBuff.ts @@ -0,0 +1,26 @@ +import { loadRawData } from './loadRawData' + +export function getRawGodWarBuffMap(): RawGodWarBuffMap { + return loadRawData('GodWarBuff.json') +} + +export type RawGodWarBuffMap = { + [key: string]: { + [key: string]: RawGodWarBuff + } +} + +export interface RawGodWarBuff { + BuffSuit: number + BuffQuality: number + AbilityName: string + ParamList: string[] + BuffIcon: string // 'SpriteOutput/Rogue/BuffIcon/RogueGodIcon_1' + BuffName: number + BuffDesc: number + BuffUpDesc: number + SimpleBuffDesc: number + BuffTagList: unknown[] + ShowBuffIconEffect: boolean + BuffGroup: number +} diff --git a/src/lib/v2-pre/server/raw/godWarBuffSuit.ts b/src/lib/v2-pre/server/raw/godWarBuffSuit.ts new file mode 100644 index 00000000..8653704c --- /dev/null +++ b/src/lib/v2-pre/server/raw/godWarBuffSuit.ts @@ -0,0 +1,18 @@ +import { loadRawData } from './loadRawData' + +export function getRawGodWarBuffSuitMap(): RawGodWarBuffSuitMap { + return loadRawData('GodWarBuffSuit.json') +} + +export type RawGodWarBuffSuitMap = { + [key: string]: RawGodWarBuffSuit +} + +export interface RawGodWarBuffSuit { + SuitIcon: string + SuitName: number + SuitDesc: number + SuitImage: string + ShowSuitIconEffect: boolean + ShowFilterOption: boolean +} diff --git a/src/lib/v2-pre/server/raw/godWarMainAvatar.ts b/src/lib/v2-pre/server/raw/godWarMainAvatar.ts new file mode 100644 index 00000000..bd0b3e23 --- /dev/null +++ b/src/lib/v2-pre/server/raw/godWarMainAvatar.ts @@ -0,0 +1,24 @@ +import { loadRawData } from './loadRawData' + +export function getRawGodWarMainAvatarMap(): RawGodWarMainAvataMap { + return loadRawData('GodWarMainAvatar.json') +} + +export type RawGodWarMainAvataMap = { + [key: string]: { + [key: string]: RawGodWarAvatarData + } +} + +export interface RawGodWarAvatarData { + AbilityName: string + ParamList: string[] + StepUnlockMissionMap: { + MissionID: number + StepID: number + }[] + AvatarAbilityID: number[] + AvatarMissionList: number[] + RecommendLink: string + AvatarChallengeStageIDList: number[] +} diff --git a/src/pages/v2-pre/er/battlesuits/[battlesuitId].tsx b/src/pages/v2-pre/er/battlesuits/[battlesuitId].tsx new file mode 100644 index 00000000..0f05d0ac --- /dev/null +++ b/src/pages/v2-pre/er/battlesuits/[battlesuitId].tsx @@ -0,0 +1,115 @@ +import { NextPageContext } from 'next' +import { Box, Card, Flex, Heading, Image } from 'theme-ui' +import AvatarFigureImage from '../../../../components/v2-pre/AvatarFigureImage' +import { loadBattlesuitData, loadErBattlesuit, loadErBattlesuitCatalog } from '../../../../lib/v2-pre/server/loadData' +import { Battlesuit, ErBattlesuit, ErSignet } from '../../../../lib/v2-pre/data/types' +import { Fragment, useMemo } from 'react' +import { assetsBucketBaseUrl } from '../../../../lib/consts' + +interface BattlesuitShowPageProps { + battlesuit: Battlesuit + erBattlesuit: ErBattlesuit +} + +const BattlesuitShowPage = ({ battlesuit, erBattlesuit }: BattlesuitShowPageProps) => { + const signetSets = useMemo(() => { + const signetSetMap = erBattlesuit.signets + .slice() + .sort((a, b) => { + return a.id.localeCompare(b.id) + }) + .reduce>((map, signet) => { + const result = signet.id.match(/([12])([0-9]+)([1-5])-[0-9]/) + if (result != null) { + const [, _lv, _battlesuit, signetOrder] = result + let set = map.get(signetOrder) + if (set == null) { + set = [] + map.set(signetOrder, set) + } + set.push(signet) + } + return map + }, new Map()) + + return [...signetSetMap.values()] + }, [erBattlesuit.signets]) + + return ( + + {battlesuit.fullName} + + + + ER Adjustments + + + {erBattlesuit.abilities.map(ability => { + return ( + + + + {ability.name} + + + {ability.desc} + + ) + })} + + + Exclusive Signets + + {signetSets.map((set, index) => { + return ( + + {set.map(signet => { + return ( + + + {'Elysia'} + + {signet.name} + + + + {signet.desc} + + + ) + })} + + ) + })} + + ) +} + +export default BattlesuitShowPage + +export async function getStaticProps({ locale, params }: NextPageContext & { params: { battlesuitId: string } }) { + const battlesuit = loadBattlesuitData(params.battlesuitId) + const erBattlesuit = loadErBattlesuit(params.battlesuitId) + + return { + props: { battlesuit, erBattlesuit } + } +} + +export async function getStaticPaths() { + const battlesuitCatalog = loadErBattlesuitCatalog() + + return { + paths: battlesuitCatalog.map(catalogItem => { + return { + params: { battlesuitId: catalogItem.battlesuit } + } + }), + fallback: false + } +} diff --git a/src/pages/v2-pre/er/index.tsx b/src/pages/v2-pre/er/index.tsx new file mode 100644 index 00000000..310843e8 --- /dev/null +++ b/src/pages/v2-pre/er/index.tsx @@ -0,0 +1,75 @@ +/** @jsxImportSource theme-ui */ +import { Box, Heading, Flex, Link, Card } from '@theme-ui/components' +import { NextPageContext } from 'next' +import { loadBattlesuitCatalog, loadErBattlesuitCatalog } from '../../../lib/v2-pre/server/loadData' +import { BattlesuitCatalogItem, ErBattlesuitCatalogItem } from '../../../lib/v2-pre/data/types' +import { useMemo } from 'react' +import BattlesuitCatalogItemCard from '../../../components/v2-pre/BattlesuitCatalogItemCard' +import { assetsBucketBaseUrl } from '../../../lib/consts' +import SquareImage from '../../../components/v2-pre/SquareImage' +import { signetGroups } from '../../../lib/v2-pre/data/er' + +interface ErPageProps { + erBattlesuitCatalog: ErBattlesuitCatalogItem[] + battlesuitCatalog: BattlesuitCatalogItem[] +} + +const ErPage = ({ erBattlesuitCatalog, battlesuitCatalog }: ErPageProps) => { + const battlesuitCatalogMap = useMemo(() => { + return battlesuitCatalog.reduce((map, item) => { + map.set(item.id, item) + return map + }, new Map()) + }, [battlesuitCatalog]) + return ( + +

Elysian Realm

+ Signets + + {signetGroups.map(signetGroup => { + return ( + + + + + {signetGroup.name} + + + + ) + })} + + + Battlesuits + + {erBattlesuitCatalog.map(erBattlesuit => { + const battlesuit = battlesuitCatalogMap.get(erBattlesuit.battlesuit)! + return ( + + + + + + ) + })} + + + Supports +
+ ) +} + +export default ErPage + +export async function getStaticProps({ locale }: NextPageContext) { + const erBattlesuitCatalog = loadErBattlesuitCatalog() + const battlesuitCatalog = loadBattlesuitCatalog() + + return { + props: { erBattlesuitCatalog, battlesuitCatalog } + } +} diff --git a/src/pages/v2-pre/er/signets/[groupId].tsx b/src/pages/v2-pre/er/signets/[groupId].tsx new file mode 100644 index 00000000..097d44de --- /dev/null +++ b/src/pages/v2-pre/er/signets/[groupId].tsx @@ -0,0 +1,89 @@ +import { NextPageContext } from 'next' +import { Box, Card, Flex, Heading } from 'theme-ui' +import { loadErSignets } from '../../../../lib/v2-pre/server/loadData' +import { ErSignet, ErSignetGroup } from '../../../../lib/v2-pre/data/types' +import { Fragment, useMemo } from 'react' +import { assetsBucketBaseUrl } from '../../../../lib/consts' +import { signetGroups } from '../../../../lib/v2-pre/data/er' +import SquareImage from '../../../../components/v2-pre/SquareImage' +import { getErSignetTypeLabel } from '../../../../lib/v2-pre/data/text' + +interface BattlesuitShowPageProps { + group: ErSignetGroup + signets: ErSignet[] +} + +const BattlesuitShowPage = ({ signets, group }: BattlesuitShowPageProps) => { + const signetSets = useMemo(() => { + const signetSetMap = signets.reduce>((map, signet) => { + const [id1, _id2] = signet.id.split('-') + let set = map.get(id1) + if (set == null) { + set = [] + map.set(id1, set) + } + set.push(signet) + return map + }, new Map()) + + return [...signetSetMap.values()] + }, [signets]) + return ( + + {group.name} + + {signetSets.map((set, index) => { + return ( + + {set.map(signet => { + return ( + + + + + {signet.name} + + {getErSignetTypeLabel(signet.quality)} + + + {signet.desc} + + + ) + })} + + ) + })} + {/* +
+        {JSON.stringify(signets, null, 2)}
+      
*/} +
+ ) +} + +export default BattlesuitShowPage + +export async function getStaticProps({ locale, params }: NextPageContext & { params: { groupId: string } }) { + const signets = loadErSignets(params.groupId) + const group = signetGroups.find(group => group.id === params.groupId) + + return { + props: { signets, group } + } +} + +export async function getStaticPaths() { + return { + paths: signetGroups.map(group => { + return { + params: { groupId: group.id } + } + }), + fallback: false + } +} diff --git a/src/scripts/compileRawData.ts b/src/scripts/compileRawData.ts index bbd6b453..c3b2984c 100644 --- a/src/scripts/compileRawData.ts +++ b/src/scripts/compileRawData.ts @@ -7,6 +7,9 @@ import { battlesuitCatalogPath, battlesuitsDir, dataDir, + erBattlesuitCatalogPath, + erBattlesuitsDir, + erSignetsDir, stigmataCatalogPath, stigmataDir, stigmataSetCatalogPath, @@ -23,12 +26,14 @@ import { import { compileBattlesuitData } from '../lib/v2-pre/server/compileData/compileBattlesuitData' import { compileWeaponData } from '../lib/v2-pre/server/compileData/compileWeaponData' import { compileStigmataData } from '../lib/v2-pre/server/compileData/compileStigmataData' +import { compileGodWarData } from '../lib/v2-pre/server/compileData/compileGodWarData' runScript(async () => { createDirIfNotExist(dataDir) writeBattlesuitData() writeWeaponData() writeStigmataData() + writeErData() }) function writeBattlesuitData() { @@ -126,3 +131,25 @@ function writeStigmataData() { fs.writeFileSync(stigmaSetDataPath, YAML.stringify(stigmataSet)) } } + +function writeErData() { + const { buffSuitBuffListMap, mainAvatarList } = compileGodWarData() + + const erBattlesuitCatalog = mainAvatarList.map(mainAvatar => { + return { battlesuit: mainAvatar.battlesuit } + }) + + fs.writeFileSync(erBattlesuitCatalogPath, YAML.stringify(erBattlesuitCatalog)) + + createDirIfNotExist(erBattlesuitsDir) + for (const erBattlesuit of mainAvatarList) { + const erBattlesuitPath = path.join(erBattlesuitsDir, `${erBattlesuit.battlesuit}.yaml`) + fs.writeFileSync(erBattlesuitPath, YAML.stringify(erBattlesuit)) + } + + createDirIfNotExist(erSignetsDir) + for (const [buffSuit, list] of buffSuitBuffListMap) { + const erSignetsPath = path.join(erSignetsDir, `${buffSuit}.yaml`) + fs.writeFileSync(erSignetsPath, YAML.stringify(list)) + } +}