Files
ZYZ/shared/pubUtils/dictionary/DicHeroSkill.ts

40 lines
1.2 KiB
TypeScript

// 武将技能表
import {decodeArrayListStr, readJsonFile} from '../util'
import { FILENAME } from '../../consts'
export interface DicHeroSkill {
// 技能id
readonly skillid: number;
// 技能名
readonly name: string;
// 星级解锁
readonly starSeidArr: Array<{star: number, value: number, type: number}>;
// 觉醒解锁
readonly colorStarSeidArr: Array<{star: number, value: number, type: number}>;
}
const str = readJsonFile(FILENAME.DIC_HERO_SKILL);
let arr = JSON.parse(str);
export const dicHeroSkill = new Map<number, DicHeroSkill>();
arr.forEach(o => {
o.starSeidArr = parseSeid(o.starSeid);
o.colorStarSeidArr = parseSeid(o.colorStarSeid);
dicHeroSkill.set(o.skillid, o);
});
function parseSeid(str: string) {
let arr = new Array<{star: number, value: number, type: number}>();
if(!str) return arr;
let decodeArr = decodeArrayListStr(str);
for(let [star, value, type] of decodeArr) {
if(isNaN(parseInt(star)) || isNaN(parseInt(value)) || isNaN(parseInt(type))) {
continue;
}
arr.push({ star: parseInt(star), value: parseInt(value), type: parseInt(type)});
}
return arr;
}