43 lines
1.3 KiB
TypeScript
43 lines
1.3 KiB
TypeScript
// 武将技能表
|
|
import {decodeArrayListStr, readFileAndParse} 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}>;
|
|
|
|
}
|
|
|
|
export const dicHeroSkill = new Map<number, DicHeroSkill>();
|
|
export function loadHeroSkill() {
|
|
dicHeroSkill.clear();
|
|
|
|
let arr = readFileAndParse(FILENAME.DIC_HERO_SKILL);
|
|
arr.forEach(o => {
|
|
o.starSeidArr = parseSeid(o.starSeid);
|
|
o.colorStarSeidArr = parseSeid(o.colorStarSeid);
|
|
dicHeroSkill.set(o.skillid, o);
|
|
});
|
|
arr = undefined;
|
|
}
|
|
|
|
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;
|
|
} |