diff --git a/src/lib/v2-pre/data/types.ts b/src/lib/v2-pre/data/types.ts index 8ebf9a9b..004d5c10 100644 --- a/src/lib/v2-pre/data/types.ts +++ b/src/lib/v2-pre/data/types.ts @@ -227,6 +227,7 @@ export interface Stigma { description: string shortName: string mainId: string + setId: string skills: EquipmentSkill[] rankUpMaterials: { id: string @@ -246,3 +247,17 @@ export interface StigmataCatalogItem { type: StigmaType 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 }[] +} diff --git a/src/lib/v2-pre/server/compileData/compileStigmataData.ts b/src/lib/v2-pre/server/compileData/compileStigmataData.ts index da5617c7..8a1744a4 100644 --- a/src/lib/v2-pre/server/compileData/compileStigmataData.ts +++ b/src/lib/v2-pre/server/compileData/compileStigmataData.ts @@ -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 { getRawStigmataDataMap } from '../raw/stigmataData' import { convertEquipmentSkill, getText } from './utils' @@ -7,8 +8,18 @@ export function compileStigmataData() { const rawStigmataDataMap = getRawStigmataDataMap() const rawStigmataDataMapEntries = Object.entries(rawStigmataDataMap) const rawEquipmentSkillDataMap = getRawEquipmentSkillDataMap() + const rawEquipmentSetDataMap = getRawEquipmentSetDataMap() + const stigmaSetIdMainIdListMap = new Map() 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() let rootStigma = map.get(mainId) if (rootStigma == null) { @@ -17,6 +28,14 @@ export function compileStigmataData() { stigmata: [] } 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 [, , smallIcon] = rawData.SmallIcon.split('/') @@ -92,13 +111,72 @@ export function compileStigmataData() { amount: Num } }), + setId: rawData.SetID.toString(), mainId }) return map }, new Map()) - return [...stigmataMainIdStigmataMap.values()] + const stigmataSetList = Object.entries(rawEquipmentSetDataMap).map(([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 { diff --git a/src/lib/v2-pre/server/loadData.ts b/src/lib/v2-pre/server/loadData.ts index ba369f2d..72ee0378 100644 --- a/src/lib/v2-pre/server/loadData.ts +++ b/src/lib/v2-pre/server/loadData.ts @@ -1,7 +1,7 @@ import fs from 'fs' import path from 'path' 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') @@ -14,6 +14,9 @@ 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 function loadBattlesuitCatalog(): BattlesuitCatalogItem[] { return readYamlFile(battlesuitCatalogPath) } @@ -36,11 +39,20 @@ export function loadStigmataCatalog(): WeaponCatalogItem[] { return readYamlFile(stigmataCatalogPath) } -export function loadStigmaData(id: string) { +export function loadStigmaData(id: string): Stigma { const stigmaDataPath = path.join(stigmataDir, `${id}.yaml`) 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) { return YAML.parse(fs.readFileSync(pathname).toString()) } diff --git a/src/lib/v2-pre/server/raw/equipmentSetData.ts b/src/lib/v2-pre/server/raw/equipmentSetData.ts new file mode 100644 index 00000000..be18aad7 --- /dev/null +++ b/src/lib/v2-pre/server/raw/equipmentSetData.ts @@ -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 +} diff --git a/src/pages/v2-pre/stigmata-sets/[stigmataSetId].tsx b/src/pages/v2-pre/stigmata-sets/[stigmataSetId].tsx new file mode 100644 index 00000000..b23691e3 --- /dev/null +++ b/src/pages/v2-pre/stigmata-sets/[stigmataSetId].tsx @@ -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 ( + + {stigmataSet.name} + + {stigmata.map(rootStigma => { + const stigma = rootStigma.stigmata[rootStigma.stigmata.length - 1] + return ( + <> + + + + + + + + {stigma.name} + + + + + + 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}) + + + {stigma.skills.map(skill => { + return ( + + + + {skill.name} + + + + + {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 + })} + + + + ) + })} + + + + ) + })} + + + + {stigmataSet.skills.map((skill, index) => { + return ( + + + + {skill.name} {index + 2}세트 + + + + + {formatSubSkillInfo({ + info: skill.info, + maxLv: 1, + paramBase1: skill.param1, + paramBase2: skill.param2, + paramBase3: skill.param3, + paramAdd1: skill.param1Add, + paramAdd2: skill.param2Add, + paramAdd3: skill.param3Add + })} + + + + ) + })} + + + Images + + {stigmata.map(rootStigma => { + const stigma = rootStigma.stigmata[rootStigma.stigmata.length - 1] + return + })} + + + {/*
{JSON.stringify(stigmataSet, null, 2)}
*/} +
+ ) +} + +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 +} diff --git a/src/pages/v2-pre/stigmata-sets/index.tsx b/src/pages/v2-pre/stigmata-sets/index.tsx new file mode 100644 index 00000000..d5b1cf17 --- /dev/null +++ b/src/pages/v2-pre/stigmata-sets/index.tsx @@ -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 ( + +

Stigmata (Set)

+ + {stigmataSetCatalog.map(stigmataSet => { + return ( + + + + + {stigmataSet.stigmataList.map(stigma => { + return + })} + + + {stigmataSet.name} + + {/* {stigma.id} */} + + + + ) + })} + +
+ ) +} + +export default StigmataSetListPage + +export async function getStaticProps({ locale }: NextPageContext) { + const stigmataSetCatalog = loadStigmataSetCatalog() + + return { + props: { stigmataSetCatalog } + } +} diff --git a/src/scripts/compileRawData.ts b/src/scripts/compileRawData.ts index 8f6e4378..bbd6b453 100644 --- a/src/scripts/compileRawData.ts +++ b/src/scripts/compileRawData.ts @@ -9,10 +9,17 @@ import { dataDir, stigmataCatalogPath, stigmataDir, + stigmataSetCatalogPath, + stigmataSetsDir, weaopnCatalogPath, weaponsDir } 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 { compileWeaponData } from '../lib/v2-pre/server/compileData/compileWeaponData' import { compileStigmataData } from '../lib/v2-pre/server/compileData/compileStigmataData' @@ -73,9 +80,10 @@ function writeWeaponData() { } 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] return { id: rootStigma.id, @@ -85,13 +93,36 @@ function writeStigmataData() { maxRarity: maxedStigma.maxRarity } }) - fs.writeFileSync(stigmataCatalogPath, YAML.stringify(catalogList)) createDirIfNotExist(stigmataDir) - - for (const stigmataData of stigmataDataList) { + for (const stigmataData of stigmataList) { const stigmaDataPath = path.join(stigmataDir, `${stigmataData.id}.yaml`) 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)) + } }