Implement Stigmata Set pages
This commit is contained in:
@@ -227,6 +227,7 @@ export interface Stigma {
|
|||||||
description: string
|
description: string
|
||||||
shortName: string
|
shortName: string
|
||||||
mainId: string
|
mainId: string
|
||||||
|
setId: string
|
||||||
skills: EquipmentSkill[]
|
skills: EquipmentSkill[]
|
||||||
rankUpMaterials: {
|
rankUpMaterials: {
|
||||||
id: string
|
id: string
|
||||||
@@ -246,3 +247,17 @@ export interface StigmataCatalogItem {
|
|||||||
type: StigmaType
|
type: StigmaType
|
||||||
maxRarity: 1 | 2 | 3 | 4 | 5
|
maxRarity: 1 | 2 | 3 | 4 | 5
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface StigmataSet {
|
||||||
|
id: string
|
||||||
|
name: string
|
||||||
|
desc: string
|
||||||
|
skills: EquipmentSkill[]
|
||||||
|
stigmaIdList: string[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface StigmataSetCatalogItem {
|
||||||
|
id: string
|
||||||
|
name: string
|
||||||
|
stigmataList: { id: string; icon: string; maxRarity: number }[]
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { RootStigma, StigmaType } from '../../data/types'
|
import { EquipmentSkill, RootStigma, StigmataSet, StigmaType } from '../../data/types'
|
||||||
|
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, getText } from './utils'
|
||||||
@@ -7,8 +8,18 @@ export function compileStigmataData() {
|
|||||||
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 stigmaSetIdMainIdListMap = new Map<string, string[]>()
|
||||||
|
|
||||||
const stigmataMainIdStigmataMap = rawStigmataDataMapEntries.reduce((map, [id, rawData]) => {
|
const stigmataMainIdStigmataMap = rawStigmataDataMapEntries.reduce((map, [id, rawData]) => {
|
||||||
|
// Bronya calorie has a dummy data
|
||||||
|
if (id === '32274') {
|
||||||
|
return map
|
||||||
|
}
|
||||||
|
// Mei Chrismas does not exist in the game
|
||||||
|
if (rawData.StigmataMainID === 120443) {
|
||||||
|
return map
|
||||||
|
}
|
||||||
const mainId = rawData.StigmataMainID.toString()
|
const mainId = rawData.StigmataMainID.toString()
|
||||||
let rootStigma = map.get(mainId)
|
let rootStigma = map.get(mainId)
|
||||||
if (rootStigma == null) {
|
if (rootStigma == null) {
|
||||||
@@ -17,6 +28,14 @@ export function compileStigmataData() {
|
|||||||
stigmata: []
|
stigmata: []
|
||||||
}
|
}
|
||||||
map.set(mainId, rootStigma)
|
map.set(mainId, rootStigma)
|
||||||
|
|
||||||
|
const setId = rawData.SetID.toString()
|
||||||
|
let mainIdList = stigmaSetIdMainIdListMap.get(setId)
|
||||||
|
if (mainIdList == null) {
|
||||||
|
mainIdList = []
|
||||||
|
stigmaSetIdMainIdListMap.set(setId, mainIdList)
|
||||||
|
}
|
||||||
|
mainIdList.push(mainId)
|
||||||
}
|
}
|
||||||
const [, , icon] = rawData.IconPath.split('/')
|
const [, , icon] = rawData.IconPath.split('/')
|
||||||
const [, , smallIcon] = rawData.SmallIcon.split('/')
|
const [, , smallIcon] = rawData.SmallIcon.split('/')
|
||||||
@@ -92,13 +111,72 @@ export function compileStigmataData() {
|
|||||||
amount: Num
|
amount: Num
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
setId: rawData.SetID.toString(),
|
||||||
mainId
|
mainId
|
||||||
})
|
})
|
||||||
|
|
||||||
return map
|
return map
|
||||||
}, new Map<string, RootStigma>())
|
}, new Map<string, RootStigma>())
|
||||||
|
|
||||||
return [...stigmataMainIdStigmataMap.values()]
|
const stigmataSetList = Object.entries(rawEquipmentSetDataMap).map<StigmataSet>(([id, rawData]) => {
|
||||||
|
const skills: EquipmentSkill[] = []
|
||||||
|
|
||||||
|
if (rawData.Prop1ID !== 0) {
|
||||||
|
const skillId = rawData.Prop1ID.toString()
|
||||||
|
const rawSkill = rawEquipmentSkillDataMap[skillId]
|
||||||
|
skills.push({
|
||||||
|
id: skillId,
|
||||||
|
...convertEquipmentSkill(rawSkill),
|
||||||
|
param1: rawData.Prop1Param1,
|
||||||
|
param1Add: rawData.Prop1Param1Add,
|
||||||
|
param2: rawData.Prop1Param2,
|
||||||
|
param2Add: rawData.Prop1Param2Add,
|
||||||
|
param3: rawData.Prop1Param3,
|
||||||
|
param3Add: rawData.Prop1Param3Add
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (rawData.Prop2ID !== 0) {
|
||||||
|
const skillId = rawData.Prop2ID.toString()
|
||||||
|
const rawSkill = rawEquipmentSkillDataMap[skillId]
|
||||||
|
skills.push({
|
||||||
|
id: skillId,
|
||||||
|
...convertEquipmentSkill(rawSkill),
|
||||||
|
param1: rawData.Prop2Param1,
|
||||||
|
param1Add: rawData.Prop2Param1Add,
|
||||||
|
param2: rawData.Prop2Param2,
|
||||||
|
param2Add: rawData.Prop2Param2Add,
|
||||||
|
param3: rawData.Prop2Param3,
|
||||||
|
param3Add: rawData.Prop2Param3Add
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (rawData.Prop3ID !== 0) {
|
||||||
|
const skillId = rawData.Prop3ID.toString()
|
||||||
|
const rawSkill = rawEquipmentSkillDataMap[skillId]
|
||||||
|
skills.push({
|
||||||
|
id: skillId,
|
||||||
|
...convertEquipmentSkill(rawSkill),
|
||||||
|
param1: rawData.Prop3Param1,
|
||||||
|
param1Add: rawData.Prop3Param1Add,
|
||||||
|
param2: rawData.Prop3Param2,
|
||||||
|
param2Add: rawData.Prop3Param2Add,
|
||||||
|
param3: rawData.Prop3Param3,
|
||||||
|
param3Add: rawData.Prop3Param3Add
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
id,
|
||||||
|
name: getText(rawData.SetName),
|
||||||
|
desc: getText(rawData.SetDesc),
|
||||||
|
skills,
|
||||||
|
stigmaIdList: stigmaSetIdMainIdListMap.get(id) || []
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
return {
|
||||||
|
stigmataSetList,
|
||||||
|
stigmataMainIdStigmataMap
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function convertStigmataType(rawType: number): StigmaType {
|
function convertStigmataType(rawType: number): StigmaType {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import YAML from 'yaml'
|
import YAML from 'yaml'
|
||||||
import { BattlesuitCatalogItem, WeaponCatalogItem } from '../data/types'
|
import { BattlesuitCatalogItem, Stigma, StigmataSet, WeaponCatalogItem } from '../data/types'
|
||||||
|
|
||||||
export const dataDir = path.join(process.cwd(), 'data/v2-pre')
|
export const dataDir = path.join(process.cwd(), 'data/v2-pre')
|
||||||
|
|
||||||
@@ -14,6 +14,9 @@ export const weaopnCatalogPath = path.join(dataDir, 'weapon-catalog.yaml')
|
|||||||
export const stigmataDir = path.join(dataDir, 'stigmata')
|
export const stigmataDir = path.join(dataDir, 'stigmata')
|
||||||
export const stigmataCatalogPath = path.join(dataDir, 'stigmata-catalog.yaml')
|
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 function loadBattlesuitCatalog(): BattlesuitCatalogItem[] {
|
export function loadBattlesuitCatalog(): BattlesuitCatalogItem[] {
|
||||||
return readYamlFile(battlesuitCatalogPath)
|
return readYamlFile(battlesuitCatalogPath)
|
||||||
}
|
}
|
||||||
@@ -36,11 +39,20 @@ export function loadStigmataCatalog(): WeaponCatalogItem[] {
|
|||||||
return readYamlFile(stigmataCatalogPath)
|
return readYamlFile(stigmataCatalogPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function loadStigmaData(id: string) {
|
export function loadStigmaData(id: string): Stigma {
|
||||||
const stigmaDataPath = path.join(stigmataDir, `${id}.yaml`)
|
const stigmaDataPath = path.join(stigmataDir, `${id}.yaml`)
|
||||||
return readYamlFile(stigmaDataPath)
|
return readYamlFile(stigmaDataPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function loadStigmataSetCatalog(): WeaponCatalogItem[] {
|
||||||
|
return readYamlFile(stigmataSetCatalogPath)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function loadStigmataSetData(id: string): StigmataSet {
|
||||||
|
const stigmataSetPath = path.join(stigmataSetsDir, `${id}.yaml`)
|
||||||
|
return readYamlFile(stigmataSetPath)
|
||||||
|
}
|
||||||
|
|
||||||
function readYamlFile(pathname: string) {
|
function readYamlFile(pathname: string) {
|
||||||
return YAML.parse(fs.readFileSync(pathname).toString())
|
return YAML.parse(fs.readFileSync(pathname).toString())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
import { loadRawData } from './loadRawData'
|
||||||
|
|
||||||
|
export function getRawEquipmentSetDataMap(): RawEquipmentSetDataMap {
|
||||||
|
return loadRawData('EquipmentSetData.json')
|
||||||
|
}
|
||||||
|
|
||||||
|
export type RawEquipmentSetDataMap = {
|
||||||
|
[key: string]: RawEquipmentSetData
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface RawEquipmentSetData {
|
||||||
|
SetName: number
|
||||||
|
SetDesc: number
|
||||||
|
Prop1ID: number
|
||||||
|
SpellEffectNum1: number
|
||||||
|
Prop1Param1: number
|
||||||
|
Prop1Param2: number
|
||||||
|
Prop1Param3: number
|
||||||
|
Prop1Param1Add: number
|
||||||
|
Prop1Param2Add: number
|
||||||
|
Prop1Param3Add: number
|
||||||
|
Prop2ID: number
|
||||||
|
SpellEffectNum2: number
|
||||||
|
Prop2Param1: number
|
||||||
|
Prop2Param2: number
|
||||||
|
Prop2Param3: number
|
||||||
|
Prop2Param1Add: number
|
||||||
|
Prop2Param2Add: number
|
||||||
|
Prop2Param3Add: number
|
||||||
|
Prop3ID: number
|
||||||
|
SpellEffectNum3: number
|
||||||
|
Prop3Param1: number
|
||||||
|
Prop3Param2: number
|
||||||
|
Prop3Param3: number
|
||||||
|
Prop3Param1Add: number
|
||||||
|
Prop3Param2Add: number
|
||||||
|
Prop3Param3Add: number
|
||||||
|
}
|
||||||
@@ -0,0 +1,187 @@
|
|||||||
|
import { NextPageContext } from 'next'
|
||||||
|
import { Box, Card, Flex, Heading, Link } from 'theme-ui'
|
||||||
|
import FormattedText from '../../../components/v2-pre/FormattedText'
|
||||||
|
import { formatSubSkillInfo } from '../../../lib/v2-pre/data/formatText'
|
||||||
|
import { loadStigmaData, loadStigmataSetCatalog, loadStigmataSetData } from '../../../lib/v2-pre/server/loadData'
|
||||||
|
import { RootStigma, SkillTagItem, StigmataSet } from '../../../lib/v2-pre/data/types'
|
||||||
|
import { Fragment } from 'react'
|
||||||
|
import TagIcon from '../../../components/v2-pre/TagIcon'
|
||||||
|
import StigmaIcon from '../../../components/v2-pre/StigmaIcon'
|
||||||
|
import StigmaFigureImage from '../../../components/v2-pre/StigmaFigureImage'
|
||||||
|
|
||||||
|
interface StigmataSetShowPage {
|
||||||
|
stigmataSet: StigmataSet
|
||||||
|
stigmata: RootStigma[]
|
||||||
|
}
|
||||||
|
|
||||||
|
const StigmataSetShowPage = ({ stigmataSet, stigmata }: StigmataSetShowPage) => {
|
||||||
|
return (
|
||||||
|
<Box>
|
||||||
|
<Heading as="h1">{stigmataSet.name}</Heading>
|
||||||
|
<Card mb={3}>
|
||||||
|
{stigmata.map(rootStigma => {
|
||||||
|
const stigma = rootStigma.stigmata[rootStigma.stigmata.length - 1]
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Flex sx={{ borderBottom: 'default', '&:last-child': { borderBottom: 'none' } }}>
|
||||||
|
<Box sx={{ flexShrink: 0, borderRight: 'default', p: 1 }}>
|
||||||
|
<StigmaIcon key={stigma.id} icon={stigma.icon} rarity={stigma.rarity} />
|
||||||
|
</Box>
|
||||||
|
<Box sx={{ flexGrow: 1 }}>
|
||||||
|
<Flex sx={{ borderBottom: 'default', alignItems: 'center', p: 1 }}>
|
||||||
|
<Heading
|
||||||
|
as="h3"
|
||||||
|
sx={{
|
||||||
|
my: 1
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Link href={`/v2-pre/stigmata/${rootStigma.id}`}>{stigma.name}</Link>
|
||||||
|
</Heading>
|
||||||
|
</Flex>
|
||||||
|
|
||||||
|
<Flex sx={{ alignItems: 'center', p: 1, borderBottom: 'default' }}>
|
||||||
|
<Box>
|
||||||
|
HP : {Math.floor(stigma.hpBase + stigma.hpAdd * (stigma.maxLv - 1))} / ATK :{' '}
|
||||||
|
{Math.floor(stigma.attackBase + stigma.attackAdd * (stigma.maxLv - 1))} / DEF :{' '}
|
||||||
|
{Math.floor(stigma.defenceBase + stigma.defenceAdd * (stigma.maxLv - 1))} / CRT :{' '}
|
||||||
|
{Math.floor(stigma.criticalBase + stigma.criticalAdd * (stigma.maxLv - 1))} (at Max Lv{' '}
|
||||||
|
{stigma.maxLv})
|
||||||
|
</Box>
|
||||||
|
</Flex>
|
||||||
|
{stigma.skills.map(skill => {
|
||||||
|
return (
|
||||||
|
<Fragment key={skill.id}>
|
||||||
|
<Box sx={{ borderBottom: 'default', p: 1 }}>
|
||||||
|
<Heading
|
||||||
|
as="h3"
|
||||||
|
sx={{
|
||||||
|
mx: 0,
|
||||||
|
my: 1
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{skill.name}
|
||||||
|
</Heading>
|
||||||
|
</Box>
|
||||||
|
<Box
|
||||||
|
sx={{
|
||||||
|
p: 1,
|
||||||
|
borderBottom: 'default',
|
||||||
|
'&:last-child': {
|
||||||
|
borderBottom: 'none'
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<FormattedText>
|
||||||
|
{formatSubSkillInfo({
|
||||||
|
info: skill.info,
|
||||||
|
maxLv: stigma.maxLv,
|
||||||
|
paramBase1: skill.param1,
|
||||||
|
paramBase2: skill.param2,
|
||||||
|
paramBase3: skill.param3,
|
||||||
|
paramAdd1: skill.param1Add,
|
||||||
|
paramAdd2: skill.param2Add,
|
||||||
|
paramAdd3: skill.param3Add
|
||||||
|
})}
|
||||||
|
</FormattedText>
|
||||||
|
</Box>
|
||||||
|
</Fragment>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</Box>
|
||||||
|
</Flex>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</Card>
|
||||||
|
|
||||||
|
<Card mb={3}>
|
||||||
|
{stigmataSet.skills.map((skill, index) => {
|
||||||
|
return (
|
||||||
|
<Fragment key={skill.id}>
|
||||||
|
<Box sx={{ borderBottom: 'default' }}>
|
||||||
|
<Heading
|
||||||
|
as="h3"
|
||||||
|
sx={{
|
||||||
|
p: 1,
|
||||||
|
m: 1
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{skill.name} <small>{index + 2}세트</small>
|
||||||
|
</Heading>
|
||||||
|
</Box>
|
||||||
|
<Box
|
||||||
|
sx={{
|
||||||
|
p: 1,
|
||||||
|
borderBottom: 'default',
|
||||||
|
'&:last-child': {
|
||||||
|
borderBottom: 'none'
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<FormattedText>
|
||||||
|
{formatSubSkillInfo({
|
||||||
|
info: skill.info,
|
||||||
|
maxLv: 1,
|
||||||
|
paramBase1: skill.param1,
|
||||||
|
paramBase2: skill.param2,
|
||||||
|
paramBase3: skill.param3,
|
||||||
|
paramAdd1: skill.param1Add,
|
||||||
|
paramAdd2: skill.param2Add,
|
||||||
|
paramAdd3: skill.param3Add
|
||||||
|
})}
|
||||||
|
</FormattedText>
|
||||||
|
</Box>
|
||||||
|
</Fragment>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</Card>
|
||||||
|
|
||||||
|
<Heading>Images</Heading>
|
||||||
|
<Box mb={3}>
|
||||||
|
{stigmata.map(rootStigma => {
|
||||||
|
const stigma = rootStigma.stigmata[rootStigma.stigmata.length - 1]
|
||||||
|
return <StigmaFigureImage key={stigma.id} stigma={stigma} size={480} />
|
||||||
|
})}
|
||||||
|
</Box>
|
||||||
|
|
||||||
|
{/* <pre>{JSON.stringify(stigmataSet, null, 2)}</pre> */}
|
||||||
|
</Box>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default StigmataSetShowPage
|
||||||
|
|
||||||
|
export async function getStaticProps({ locale, params }: NextPageContext & { params: { stigmataSetId: string } }) {
|
||||||
|
const stigmataSet = loadStigmataSetData(params.stigmataSetId)
|
||||||
|
const stigmata = stigmataSet.stigmaIdList.map(id => {
|
||||||
|
return loadStigmaData(id)
|
||||||
|
})
|
||||||
|
|
||||||
|
return {
|
||||||
|
props: {
|
||||||
|
stigmataSet,
|
||||||
|
stigmata
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function getStaticPaths() {
|
||||||
|
const stigmataSetCatalog = loadStigmataSetCatalog()
|
||||||
|
|
||||||
|
return {
|
||||||
|
paths: stigmataSetCatalog.map(catalogItem => {
|
||||||
|
return {
|
||||||
|
params: { stigmataSetId: catalogItem.id }
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
fallback: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
interface SkillTagBoxProps {
|
||||||
|
tag: SkillTagItem
|
||||||
|
}
|
||||||
|
|
||||||
|
const SkillTagItem = ({ tag }: SkillTagBoxProps) => {
|
||||||
|
return <TagIcon type={tag.type} strength={tag.strength} comment={tag.comment} size="sm" />
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
/** @jsxImportSource theme-ui */
|
||||||
|
import { Box, Card } from '@theme-ui/components'
|
||||||
|
import { NextPageContext } from 'next'
|
||||||
|
import { Flex, Link } from 'theme-ui'
|
||||||
|
|
||||||
|
import { StigmataCatalogItem, StigmataSetCatalogItem } from '../../../lib/v2-pre/data/types'
|
||||||
|
import { loadStigmataCatalog, loadStigmataSetCatalog } from '../../../lib/v2-pre/server/loadData'
|
||||||
|
import StigmaIcon from '../../../components/v2-pre/StigmaIcon'
|
||||||
|
|
||||||
|
interface StigmataSetListPageProps {
|
||||||
|
stigmataSetCatalog: StigmataSetCatalogItem[]
|
||||||
|
}
|
||||||
|
|
||||||
|
const StigmataSetListPage = ({ stigmataSetCatalog }: StigmataSetListPageProps) => {
|
||||||
|
return (
|
||||||
|
<Box>
|
||||||
|
<h1>Stigmata (Set)</h1>
|
||||||
|
<Flex sx={{ flexWrap: 'wrap' }}>
|
||||||
|
{stigmataSetCatalog.map(stigmataSet => {
|
||||||
|
return (
|
||||||
|
<Box key={stigmataSet.id} m={2}>
|
||||||
|
<Link href={`/v2-pre/stigmata-sets/${stigmataSet.id}`}>
|
||||||
|
<Card p={1}>
|
||||||
|
<Flex sx={{ justifyContent: 'center' }}>
|
||||||
|
{stigmataSet.stigmataList.map(stigma => {
|
||||||
|
return <StigmaIcon key={stigma.id} icon={stigma.icon} rarity={stigma.maxRarity} />
|
||||||
|
})}
|
||||||
|
</Flex>
|
||||||
|
<Box
|
||||||
|
sx={{
|
||||||
|
overflow: 'hidden',
|
||||||
|
textOverflow: 'ellipsis',
|
||||||
|
whiteSpace: 'nowrap',
|
||||||
|
px: 1,
|
||||||
|
textAlign: 'center'
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{stigmataSet.name}
|
||||||
|
</Box>
|
||||||
|
{/* {stigma.id} */}
|
||||||
|
</Card>
|
||||||
|
</Link>
|
||||||
|
</Box>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</Flex>
|
||||||
|
</Box>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default StigmataSetListPage
|
||||||
|
|
||||||
|
export async function getStaticProps({ locale }: NextPageContext) {
|
||||||
|
const stigmataSetCatalog = loadStigmataSetCatalog()
|
||||||
|
|
||||||
|
return {
|
||||||
|
props: { stigmataSetCatalog }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,10 +9,17 @@ import {
|
|||||||
dataDir,
|
dataDir,
|
||||||
stigmataCatalogPath,
|
stigmataCatalogPath,
|
||||||
stigmataDir,
|
stigmataDir,
|
||||||
|
stigmataSetCatalogPath,
|
||||||
|
stigmataSetsDir,
|
||||||
weaopnCatalogPath,
|
weaopnCatalogPath,
|
||||||
weaponsDir
|
weaponsDir
|
||||||
} from '../lib/v2-pre/server/loadData'
|
} from '../lib/v2-pre/server/loadData'
|
||||||
import { BattlesuitCatalogItem, StigmataCatalogItem, WeaponCatalogItem } from '../lib/v2-pre/data/types'
|
import {
|
||||||
|
BattlesuitCatalogItem,
|
||||||
|
StigmataCatalogItem,
|
||||||
|
StigmataSetCatalogItem,
|
||||||
|
WeaponCatalogItem
|
||||||
|
} from '../lib/v2-pre/data/types'
|
||||||
import { compileBattlesuitData } from '../lib/v2-pre/server/compileData/compileBattlesuitData'
|
import { compileBattlesuitData } from '../lib/v2-pre/server/compileData/compileBattlesuitData'
|
||||||
import { compileWeaponData } from '../lib/v2-pre/server/compileData/compileWeaponData'
|
import { compileWeaponData } from '../lib/v2-pre/server/compileData/compileWeaponData'
|
||||||
import { compileStigmataData } from '../lib/v2-pre/server/compileData/compileStigmataData'
|
import { compileStigmataData } from '../lib/v2-pre/server/compileData/compileStigmataData'
|
||||||
@@ -73,9 +80,10 @@ function writeWeaponData() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function writeStigmataData() {
|
function writeStigmataData() {
|
||||||
const stigmataDataList = compileStigmataData()
|
const { stigmataSetList, stigmataMainIdStigmataMap } = compileStigmataData()
|
||||||
|
const stigmataList = [...stigmataMainIdStigmataMap.values()]
|
||||||
|
|
||||||
const catalogList: StigmataCatalogItem[] = stigmataDataList.map(rootStigma => {
|
const catalogList: StigmataCatalogItem[] = stigmataList.map(rootStigma => {
|
||||||
const maxedStigma = rootStigma.stigmata[rootStigma.stigmata.length - 1]
|
const maxedStigma = rootStigma.stigmata[rootStigma.stigmata.length - 1]
|
||||||
return {
|
return {
|
||||||
id: rootStigma.id,
|
id: rootStigma.id,
|
||||||
@@ -85,13 +93,36 @@ function writeStigmataData() {
|
|||||||
maxRarity: maxedStigma.maxRarity
|
maxRarity: maxedStigma.maxRarity
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
fs.writeFileSync(stigmataCatalogPath, YAML.stringify(catalogList))
|
fs.writeFileSync(stigmataCatalogPath, YAML.stringify(catalogList))
|
||||||
|
|
||||||
createDirIfNotExist(stigmataDir)
|
createDirIfNotExist(stigmataDir)
|
||||||
|
for (const stigmataData of stigmataList) {
|
||||||
for (const stigmataData of stigmataDataList) {
|
|
||||||
const stigmaDataPath = path.join(stigmataDir, `${stigmataData.id}.yaml`)
|
const stigmaDataPath = path.join(stigmataDir, `${stigmataData.id}.yaml`)
|
||||||
fs.writeFileSync(stigmaDataPath, YAML.stringify(stigmataData))
|
fs.writeFileSync(stigmaDataPath, YAML.stringify(stigmataData))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const setCatalogList: StigmataSetCatalogItem[] = stigmataSetList.map(stigmataSet => {
|
||||||
|
return {
|
||||||
|
id: stigmataSet.id,
|
||||||
|
name: stigmataSet.name,
|
||||||
|
stigmataList: stigmataSet.stigmaIdList.map(stigmaId => {
|
||||||
|
const rootStigma = stigmataMainIdStigmataMap.get(stigmaId)!
|
||||||
|
const maxedStigma = rootStigma.stigmata[rootStigma.stigmata.length - 1]
|
||||||
|
|
||||||
|
return {
|
||||||
|
id: stigmaId,
|
||||||
|
icon: maxedStigma.icon,
|
||||||
|
maxRarity: maxedStigma.maxRarity
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
fs.writeFileSync(stigmataSetCatalogPath, YAML.stringify(setCatalogList))
|
||||||
|
|
||||||
|
createDirIfNotExist(stigmataSetsDir)
|
||||||
|
for (const stigmataSet of stigmataSetList) {
|
||||||
|
const stigmaSetDataPath = path.join(stigmataSetsDir, `${stigmataSet.id}.yaml`)
|
||||||
|
fs.writeFileSync(stigmaSetDataPath, YAML.stringify(stigmataSet))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user