Import weapon data
This commit is contained in:
@@ -142,3 +142,53 @@ export interface BattlesuitSubSkill {
|
||||
unlockStar: StarRank
|
||||
toggle: boolean
|
||||
}
|
||||
|
||||
export interface WeaponCatalogItem {
|
||||
id: string
|
||||
name: string
|
||||
type: WeaponType
|
||||
maxRarity: 1 | 2 | 3 | 4 | 5
|
||||
}
|
||||
|
||||
export interface WeaponData {
|
||||
id: string
|
||||
weapons: {
|
||||
id: string
|
||||
rarity: number
|
||||
maxLv: number
|
||||
type: WeaponType
|
||||
title: string
|
||||
description: string
|
||||
icon: string
|
||||
hpBase: number
|
||||
hpAdd: number
|
||||
spBase: number
|
||||
spAdd: number
|
||||
attackBase: number
|
||||
attackAdd: number
|
||||
defenceBase: number
|
||||
defenceAdd: number
|
||||
criticalBase: number
|
||||
criticalAdd: number
|
||||
resistanceBase: number
|
||||
resistanceAdd: number
|
||||
skills: WeaponSkill[]
|
||||
rankUpMaterials: {
|
||||
id: string
|
||||
amount: number
|
||||
}[]
|
||||
}
|
||||
}
|
||||
export interface WeaponSkill {
|
||||
id: string
|
||||
name: string
|
||||
info: string
|
||||
icon?: string
|
||||
skillCd: number
|
||||
skillSpCost: number
|
||||
skillSpNeed: number
|
||||
tags: {
|
||||
type: TagType
|
||||
comment: string
|
||||
}[]
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ import { compileBattlesuitData } from './compileBattlesuitData'
|
||||
describe('compileBattlesuitData', () => {
|
||||
it('converts tags', () => {
|
||||
const list = compileBattlesuitData()
|
||||
|
||||
expect(list[0]).toMatchObject({
|
||||
id: expect.any(String),
|
||||
tags: ['physical-dmg', 'stun', 'burst', 'time-mastery']
|
||||
|
||||
@@ -6,19 +6,13 @@ import {
|
||||
CharacterType,
|
||||
SkillTagItem,
|
||||
SkillType,
|
||||
TagType,
|
||||
WeaponType
|
||||
TagType
|
||||
} from '../../data/types'
|
||||
import { getRawAvatarDataMap } from '../raw/avatarData'
|
||||
import { getRawAvatarSkillDataMap } from '../raw/avatarSkillData'
|
||||
import { getRawAvatarSubSkillDataMap } from '../raw/avatarSubSkillData'
|
||||
import { getRawAvatarTagUnLockDataMap } from '../raw/avatarTagUnLockData'
|
||||
import { getRawTextMap } from '../raw/textMap'
|
||||
|
||||
export function getText(id: string | number) {
|
||||
const rawTextMap = getRawTextMap()
|
||||
return rawTextMap[id]?.Text || null
|
||||
}
|
||||
import { convertWeaponType as convertWeaponType, convertTagType, getText } from './utils'
|
||||
|
||||
export function compileBattlesuitData(): Battlesuit[] {
|
||||
const rawAvatarDataMap = getRawAvatarDataMap()
|
||||
@@ -42,13 +36,13 @@ export function compileBattlesuitData(): Battlesuit[] {
|
||||
enLastName: getText(rawAvatarData.EnLastName),
|
||||
attributeType: convertAttributeToAttributeType(rawAvatarData.Attribute),
|
||||
isEasterner: rawAvatarData.IsEasterner,
|
||||
weapon: convertClassIdToWeaponType(rawAvatarData.ClassID),
|
||||
weapon: convertWeaponType(rawAvatarData.ClassID),
|
||||
character: convertRoleIdToCharacterType(rawAvatarData.RoleID),
|
||||
initialStar: convertStar(rawAvatarData.UnlockStar, 0),
|
||||
tags: rawAvatarData.TagUnlockList.map(rawTagId => {
|
||||
const rawAvatarTagUnLock = rawAvatarTagUnLockDataMap[rawTagId]
|
||||
|
||||
return convertRawTagIdToTagType(rawAvatarTagUnLock.TagID)
|
||||
return convertTagType(rawAvatarTagUnLock.TagID)
|
||||
}),
|
||||
skills: rawAvatarData.SkillList.map<BattlesuitSkill>(rawSkillId => {
|
||||
const rawSkillData = rawSkillDataMap[rawSkillId]
|
||||
@@ -154,35 +148,6 @@ function convertAttributeToAttributeType(rawValue: number): AttributeType {
|
||||
}
|
||||
}
|
||||
|
||||
function convertClassIdToWeaponType(rawValue: number): WeaponType {
|
||||
switch (rawValue) {
|
||||
case 1:
|
||||
return 'pistols'
|
||||
case 2:
|
||||
return 'katana'
|
||||
case 3:
|
||||
return 'cannon'
|
||||
case 4:
|
||||
return '2-handed'
|
||||
case 5:
|
||||
return 'cross'
|
||||
case 6:
|
||||
return 'fists'
|
||||
case 7:
|
||||
return 'scythe'
|
||||
case 8:
|
||||
return 'lance'
|
||||
case 9:
|
||||
return 'bow'
|
||||
case 10:
|
||||
return 'chakram'
|
||||
case 11:
|
||||
return 'javelin'
|
||||
default:
|
||||
throw new Error(`Unsupported raw classId(weapon type) (${rawValue})`)
|
||||
}
|
||||
}
|
||||
|
||||
function convertRoleIdToCharacterType(rawValue: number): CharacterType {
|
||||
switch (rawValue) {
|
||||
case 1:
|
||||
@@ -281,63 +246,6 @@ function convertShowOrderToSkillType(rawShowOrder: number): SkillType {
|
||||
}
|
||||
}
|
||||
|
||||
function convertRawTagIdToTagType(rawTagId: number): TagType {
|
||||
switch (rawTagId) {
|
||||
case 1001:
|
||||
return 'branch'
|
||||
case 1002:
|
||||
return 'charge'
|
||||
case 1003:
|
||||
return 'physical-dmg'
|
||||
case 1004:
|
||||
return 'fire-dmg'
|
||||
case 1005:
|
||||
return 'ice-dmg'
|
||||
case 1006:
|
||||
return 'lightning-dmg'
|
||||
case 1007:
|
||||
return 'freeze'
|
||||
case 1008:
|
||||
return 'paralyze'
|
||||
case 1009:
|
||||
return 'stun'
|
||||
case 1010:
|
||||
return 'ignite'
|
||||
case 1011:
|
||||
return 'bleed'
|
||||
case 1012:
|
||||
return 'heavy-atk'
|
||||
case 1013:
|
||||
return 'weaken'
|
||||
case 1014:
|
||||
return 'impair'
|
||||
case 1015:
|
||||
return 'float'
|
||||
case 1016:
|
||||
return 'slow-down'
|
||||
case 1017:
|
||||
return 'time-mastery'
|
||||
case 1018:
|
||||
return 'gather'
|
||||
case 1019:
|
||||
return 'heal'
|
||||
case 1020:
|
||||
return 'fast-atk'
|
||||
case 1021:
|
||||
return 'burst'
|
||||
case 1022:
|
||||
return 'shield'
|
||||
case 1023:
|
||||
return 'aerial'
|
||||
case 1024:
|
||||
return 'ranged'
|
||||
case 1025:
|
||||
return 'meele'
|
||||
}
|
||||
|
||||
throw new Error(`Unsupported raw show order(Skill) (${rawTagId})`)
|
||||
}
|
||||
|
||||
function convertRawSkillTag(rawSkillTag: { Strength: number; TagID: number; TagComment: number }): SkillTagItem {
|
||||
const comment = getText(rawSkillTag.TagComment)
|
||||
return {
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
import { compileWeaponData } from './compileWeaponData'
|
||||
|
||||
describe('compileWeaponData', () => {
|
||||
it('compiles', () => {
|
||||
const list = compileWeaponData()
|
||||
|
||||
const targetItem = list.find(weapon => weapon.id === '10277')
|
||||
|
||||
expect(targetItem).toMatchObject({
|
||||
id: expect.any(String),
|
||||
weapons: expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
id: expect.any(String)
|
||||
})
|
||||
])
|
||||
})
|
||||
|
||||
expect(targetItem!.weapons[3]).toMatchObject({
|
||||
skills: [
|
||||
{
|
||||
id: '1221'
|
||||
},
|
||||
{
|
||||
id: '2297'
|
||||
}
|
||||
]
|
||||
})
|
||||
// console.log(targetItem!.weapons[3])
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,102 @@
|
||||
import { getRawEquipmentSkillDataMap, RawEquipmentSkillData } from '../raw/equipmentSkillData'
|
||||
import { getRawWeaponDataMap } from '../raw/weaponData'
|
||||
import { convertTagType, convertWeaponType, getText } from './utils'
|
||||
|
||||
export function compileWeaponData() {
|
||||
const rawWeaponDataMap = getRawWeaponDataMap()
|
||||
const rawEquipmentSkillDataMap = getRawEquipmentSkillDataMap()
|
||||
|
||||
const rawWeaponMainIdWeaponDataMap = Object.entries(rawWeaponDataMap).reduce((map, [id, rawData]) => {
|
||||
const rawWeaponMainId = rawData.WeaponMainID.toString()
|
||||
let weaponList = map.get(rawWeaponMainId)
|
||||
if (weaponList == null) {
|
||||
weaponList = []
|
||||
map.set(rawWeaponMainId, weaponList)
|
||||
}
|
||||
|
||||
const skills = []
|
||||
if (rawData.Prop1ID !== 0) {
|
||||
const skillId = rawData.Prop1ID.toString()
|
||||
const rawSkill = rawEquipmentSkillDataMap[skillId]
|
||||
skills.push({
|
||||
id: skillId,
|
||||
...convertWeaponSkill(rawSkill)
|
||||
})
|
||||
}
|
||||
if (rawData.Prop2ID !== 0) {
|
||||
const skillId = rawData.Prop2ID.toString()
|
||||
const rawSkill = rawEquipmentSkillDataMap[skillId]
|
||||
skills.push({
|
||||
id: skillId,
|
||||
...convertWeaponSkill(rawSkill)
|
||||
})
|
||||
}
|
||||
if (rawData.Prop3ID !== 0) {
|
||||
const skillId = rawData.Prop3ID.toString()
|
||||
const rawSkill = rawEquipmentSkillDataMap[skillId]
|
||||
skills.push({
|
||||
id: skillId,
|
||||
...convertWeaponSkill(rawSkill)
|
||||
})
|
||||
}
|
||||
const icon = rawData.IconPath.split('/').pop()
|
||||
weaponList.push({
|
||||
id,
|
||||
rarity: rawData.Rarity,
|
||||
maxLv: rawData.MaxLv,
|
||||
type: convertWeaponType(rawData.BaseType),
|
||||
title: getText(rawData.DisplayTitle),
|
||||
description: getText(rawData.DisplayDescription),
|
||||
icon,
|
||||
hpBase: rawData.HPBase,
|
||||
hpAdd: rawData.HPAdd,
|
||||
spBase: rawData.SPBase,
|
||||
spAdd: rawData.SPAdd,
|
||||
attackBase: rawData.AttackBase,
|
||||
attackAdd: rawData.AttackAdd,
|
||||
defenceBase: rawData.DefenceBase,
|
||||
defenceAdd: rawData.DefenceAdd,
|
||||
criticalBase: rawData.CriticalBase,
|
||||
criticalAdd: rawData.CriticalAdd,
|
||||
resistanceBase: rawData.ResistanceBase,
|
||||
resistanceAdd: rawData.ResistanceAdd,
|
||||
skills,
|
||||
|
||||
rankUpMaterials: rawData.EvoMaterial.map(rawMaterial => {
|
||||
return {
|
||||
id: rawMaterial.ID.toString(),
|
||||
amount: rawMaterial.Num
|
||||
}
|
||||
}),
|
||||
powerType: rawData.PowerType
|
||||
})
|
||||
return map
|
||||
}, new Map())
|
||||
|
||||
const weaponIdList = [...rawWeaponMainIdWeaponDataMap.keys()]
|
||||
|
||||
return weaponIdList.map(weaponId => {
|
||||
return {
|
||||
id: weaponId,
|
||||
weapons: rawWeaponMainIdWeaponDataMap.get(weaponId)
|
||||
}
|
||||
})
|
||||
|
||||
function convertWeaponSkill(rawSkill: RawEquipmentSkillData) {
|
||||
const iconName = rawSkill.SkillIconPath.split('/').pop()
|
||||
return {
|
||||
name: getText(rawSkill.SkillName),
|
||||
info: getText(rawSkill.SkillDisplay),
|
||||
icon: iconName != null && iconName.length > 0 ? iconName : undefined,
|
||||
skillCd: rawSkill.SkillCD,
|
||||
skillSpCost: rawSkill.SPCost,
|
||||
skillSpNeed: rawSkill.SPNeed,
|
||||
tags: rawSkill.TagList.map(rawEquipmentSkillTag => {
|
||||
return {
|
||||
type: convertTagType(rawEquipmentSkillTag.TagID),
|
||||
comment: getText(rawEquipmentSkillTag.TagComment)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
import { TagType, WeaponType } from '../../data/types'
|
||||
import { getRawTextMap } from '../raw/textMap'
|
||||
|
||||
export function getText(id: string | number) {
|
||||
const rawTextMap = getRawTextMap()
|
||||
return rawTextMap[id]?.Text || null
|
||||
}
|
||||
|
||||
export function convertWeaponType(rawValue: number): WeaponType {
|
||||
switch (rawValue) {
|
||||
case 1:
|
||||
return 'pistols'
|
||||
case 2:
|
||||
return 'katana'
|
||||
case 3:
|
||||
return 'cannon'
|
||||
case 4:
|
||||
return '2-handed'
|
||||
case 5:
|
||||
return 'cross'
|
||||
case 6:
|
||||
return 'fists'
|
||||
case 7:
|
||||
return 'scythe'
|
||||
case 8:
|
||||
return 'lance'
|
||||
case 9:
|
||||
return 'bow'
|
||||
case 10:
|
||||
return 'chakram'
|
||||
case 11:
|
||||
return 'javelin'
|
||||
default:
|
||||
throw new Error(`Unsupported raw classId(weapon type) (${rawValue})`)
|
||||
}
|
||||
}
|
||||
|
||||
export function convertTagType(rawTagId: number): TagType {
|
||||
switch (rawTagId) {
|
||||
case 1001:
|
||||
return 'branch'
|
||||
case 1002:
|
||||
return 'charge'
|
||||
case 1003:
|
||||
return 'physical-dmg'
|
||||
case 1004:
|
||||
return 'fire-dmg'
|
||||
case 1005:
|
||||
return 'ice-dmg'
|
||||
case 1006:
|
||||
return 'lightning-dmg'
|
||||
case 1007:
|
||||
return 'freeze'
|
||||
case 1008:
|
||||
return 'paralyze'
|
||||
case 1009:
|
||||
return 'stun'
|
||||
case 1010:
|
||||
return 'ignite'
|
||||
case 1011:
|
||||
return 'bleed'
|
||||
case 1012:
|
||||
return 'heavy-atk'
|
||||
case 1013:
|
||||
return 'weaken'
|
||||
case 1014:
|
||||
return 'impair'
|
||||
case 1015:
|
||||
return 'float'
|
||||
case 1016:
|
||||
return 'slow-down'
|
||||
case 1017:
|
||||
return 'time-mastery'
|
||||
case 1018:
|
||||
return 'gather'
|
||||
case 1019:
|
||||
return 'heal'
|
||||
case 1020:
|
||||
return 'fast-atk'
|
||||
case 1021:
|
||||
return 'burst'
|
||||
case 1022:
|
||||
return 'shield'
|
||||
case 1023:
|
||||
return 'aerial'
|
||||
case 1024:
|
||||
return 'ranged'
|
||||
case 1025:
|
||||
return 'meele'
|
||||
}
|
||||
|
||||
throw new Error(`Unsupported raw show order(Skill) (${rawTagId})`)
|
||||
}
|
||||
@@ -1,13 +1,16 @@
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
import YAML from 'yaml'
|
||||
import { BattlesuitCatalogItem } from '../data/types'
|
||||
import { BattlesuitCatalogItem, WeaponCatalogItem } from '../data/types'
|
||||
|
||||
export const dataDir = path.join(process.cwd(), 'data/v2-pre')
|
||||
export const battlesuitsDir = path.join(dataDir, 'battlesuits')
|
||||
|
||||
export const battlesuitsDir = path.join(dataDir, 'battlesuits')
|
||||
export const battlesuitCatalogPath = path.join(dataDir, 'battlesuit-catalog.yaml')
|
||||
|
||||
export const weaponsDir = path.join(dataDir, 'weapons')
|
||||
export const weaopnCatalogPath = path.join(dataDir, 'weapon-catalog.yaml')
|
||||
|
||||
export function loadBattlesuitCatalog(): BattlesuitCatalogItem[] {
|
||||
return readYamlFile(battlesuitCatalogPath)
|
||||
}
|
||||
@@ -17,6 +20,15 @@ export function loadBattlesuitData(id: string) {
|
||||
return readYamlFile(battlesuitDataPath)
|
||||
}
|
||||
|
||||
export function loadWeaponCatalog(): WeaponCatalogItem[] {
|
||||
return readYamlFile(weaopnCatalogPath)
|
||||
}
|
||||
|
||||
export function loadWeaponData(id: string) {
|
||||
const weaponDataPath = path.join(weaponsDir, `${id}.yaml`)
|
||||
return readYamlFile(weaponDataPath)
|
||||
}
|
||||
|
||||
function readYamlFile(pathname: string) {
|
||||
return YAML.parse(fs.readFileSync(pathname).toString())
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
import { loadRawData } from './loadRawData'
|
||||
|
||||
export function getRawEquipmentSkillDataMap(): RawEquipmentSkillDataMap {
|
||||
return loadRawData('EquipmentSkillData.json')
|
||||
}
|
||||
|
||||
export type RawEquipmentSkillDataMap = {
|
||||
[key: string]: RawEquipmentSkillData
|
||||
}
|
||||
|
||||
export interface RawEquipmentSkillData {
|
||||
SkillName: number
|
||||
SkillDisplay: number
|
||||
SkillIconPath: string
|
||||
SkillCD: number
|
||||
SPCost: number
|
||||
SPNeed: number
|
||||
MaxChargesCount: number
|
||||
TagList: {
|
||||
TagID: number
|
||||
TagComment: number
|
||||
}[]
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
import { loadRawData } from './loadRawData'
|
||||
|
||||
export function getRawWeaponDataMap(): RawWeaponDataMap {
|
||||
return loadRawData('WeaponData.json')
|
||||
}
|
||||
|
||||
export type RawWeaponDataMap = {
|
||||
[key: string]: RawWeaponData
|
||||
}
|
||||
|
||||
export interface RawWeaponData {
|
||||
Rarity: number
|
||||
MaxRarity: number
|
||||
SubRarity: number
|
||||
SubMaxRarity: number
|
||||
Cost: number
|
||||
PowerType: number
|
||||
MaxLv: number
|
||||
ExpType: number
|
||||
SellPriceBase: number
|
||||
SellPriceAdd: number
|
||||
GearExpProvideBase: number
|
||||
GearExpPorvideAdd: number
|
||||
BaseType: number
|
||||
BodyMod: string
|
||||
DisplayTitle: number
|
||||
DisplayDescription: number
|
||||
IconPath: string
|
||||
ImagePath: '0'
|
||||
HPBase: number
|
||||
HPAdd: number
|
||||
SPBase: number
|
||||
SPAdd: number
|
||||
AttackBase: number
|
||||
AttackAdd: number
|
||||
DefenceBase: number
|
||||
DefenceAdd: number
|
||||
CriticalBase: number
|
||||
CriticalAdd: number
|
||||
ResistanceBase: number
|
||||
ResistanceAdd: number
|
||||
EvoMaterial: {
|
||||
ID: number
|
||||
Num: number
|
||||
}[]
|
||||
EvoPlayerLevel: number
|
||||
EvoID: number
|
||||
Prop1ID: number
|
||||
Prop1Param1: number
|
||||
Prop1Param2: number
|
||||
Prop1Param3: number
|
||||
Prop1Param1Add: number
|
||||
Prop1Param2Add: number
|
||||
Prop1Param3Add: number
|
||||
Prop2ID: number
|
||||
Prop2Param1: number
|
||||
Prop2Param2: number
|
||||
Prop2Param3: number
|
||||
Prop2Param1Add: number
|
||||
Prop2Param2Add: number
|
||||
Prop2Param3Add: number
|
||||
Prop3ID: number
|
||||
Prop3Param1: number
|
||||
Prop3Param2: number
|
||||
Prop3Param3: number
|
||||
Prop3Param1Add: number
|
||||
Prop3Param2Add: number
|
||||
Prop3Param3Add: number
|
||||
Protect: boolean
|
||||
ExDisjoinCurrencyCost: number
|
||||
ExDisjoinAddMaterial: []
|
||||
DisjoinScoinCost: number
|
||||
DisjoinAddMaterial: []
|
||||
WeaponMainID: number
|
||||
LinkIDList: []
|
||||
WeaponQuality: number
|
||||
SellPriceID: number
|
||||
Transcendent: false
|
||||
Target: number
|
||||
GachaMainDropDisplayConfig: number[]
|
||||
GachaGiftDropDisplayConfig: []
|
||||
PreloadEffectFolderPath: string
|
||||
WeaponFilterList: number[]
|
||||
SoundBanks: []
|
||||
CollaborationWeaponID: number
|
||||
AvatarCustomDisplayID: number
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { loadRawData } from './loadRawData'
|
||||
|
||||
export function getRawWeaponMainIdDataMap(): RawWeaponMainIdDataMap {
|
||||
return loadRawData('WeaponMainIDData.json')
|
||||
}
|
||||
|
||||
export type RawWeaponMainIdDataMap = {
|
||||
[key: string]: RawWeaponMainIdData
|
||||
}
|
||||
|
||||
export interface RawWeaponMainIdData {
|
||||
ReforgeTargetIDList: number[]
|
||||
}
|
||||
@@ -3,19 +3,27 @@ import { createDirIfNotExist } from '../lib/v2-pre/server/fsUtils'
|
||||
import fs from 'fs'
|
||||
import YAML from 'yaml'
|
||||
import { runScript } from './lib/utils'
|
||||
import { battlesuitCatalogPath, battlesuitsDir, dataDir } from '../lib/v2-pre/server/loadData'
|
||||
import { BattlesuitCatalogItem } from '../lib/v2-pre/data/types'
|
||||
import { compileBattlesuitData } from '../lib/v2-pre/server/migration/compileBattlesuitData'
|
||||
import {
|
||||
battlesuitCatalogPath,
|
||||
battlesuitsDir,
|
||||
dataDir,
|
||||
weaopnCatalogPath,
|
||||
weaponsDir
|
||||
} from '../lib/v2-pre/server/loadData'
|
||||
import { BattlesuitCatalogItem, 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'
|
||||
|
||||
runScript(async () => {
|
||||
createDirIfNotExist(dataDir)
|
||||
writeBattlesuitData()
|
||||
writeWeaponData()
|
||||
})
|
||||
|
||||
function writeBattlesuitData() {
|
||||
const battlesuitList = compileBattlesuitData()
|
||||
|
||||
const simplifiedList: BattlesuitCatalogItem[] = battlesuitList.map(battlesuit => {
|
||||
const catalogList: BattlesuitCatalogItem[] = battlesuitList.map(battlesuit => {
|
||||
return {
|
||||
id: battlesuit.id,
|
||||
fullName: battlesuit.fullName,
|
||||
@@ -26,7 +34,7 @@ function writeBattlesuitData() {
|
||||
}
|
||||
})
|
||||
|
||||
fs.writeFileSync(battlesuitCatalogPath, YAML.stringify(simplifiedList))
|
||||
fs.writeFileSync(battlesuitCatalogPath, YAML.stringify(catalogList))
|
||||
|
||||
createDirIfNotExist(battlesuitsDir)
|
||||
|
||||
@@ -35,3 +43,26 @@ function writeBattlesuitData() {
|
||||
fs.writeFileSync(battlesuitDataPath, YAML.stringify(battlesuit))
|
||||
}
|
||||
}
|
||||
|
||||
function writeWeaponData() {
|
||||
const weaponDataList = compileWeaponData()
|
||||
|
||||
const catalogList: WeaponCatalogItem[] = weaponDataList.map(weapon => {
|
||||
const maxedWeapon = weapon.weapons[weapon.weapons.length - 1]
|
||||
return {
|
||||
id: weapon.id,
|
||||
name: maxedWeapon.name,
|
||||
type: maxedWeapon.type,
|
||||
maxRarity: maxedWeapon.rarity
|
||||
}
|
||||
})
|
||||
|
||||
fs.writeFileSync(weaopnCatalogPath, YAML.stringify(catalogList))
|
||||
|
||||
createDirIfNotExist(weaponsDir)
|
||||
|
||||
for (const weaponData of weaponDataList) {
|
||||
const weaponDataPath = path.join(weaponsDir, `${weaponData.id}.yaml`)
|
||||
fs.writeFileSync(weaponDataPath, YAML.stringify(weaponData))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user