Implement Stigmata Set pages
This commit is contained in:
@@ -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())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user