装备:获得天晶石&合成装备
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
// 装备套装表
|
||||
import { readFileAndParse, parseNumberList, decodeArrayListStr } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicEquipSuit {
|
||||
// id
|
||||
readonly id: number;
|
||||
// 匹配的武将的职业的大类
|
||||
readonly jobClass: number;
|
||||
// 套装内含的装备编号
|
||||
readonly equips: number[];
|
||||
// 按星级可解锁的属性
|
||||
readonly effect: { star: number, seid: number }[];
|
||||
// 解锁条件索引
|
||||
readonly effectCondition: Map<number, number>
|
||||
}
|
||||
|
||||
export const dicEquipSuit = new Map<number, DicEquipSuit>();
|
||||
export function loadEquipSuit() {
|
||||
dicEquipSuit.clear();
|
||||
let arr = readFileAndParse(FILENAME.DIC_EQUIP);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.equips = parseNumberList(o.equips);
|
||||
parseRandomEffect(o, o.effect);
|
||||
dicEquipSuit.set(o.jobClass, o);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
|
||||
function parseRandomEffect(o: any, str: string) {
|
||||
if (!str) return null;
|
||||
let decodeArr = decodeArrayListStr(str);
|
||||
let effect: number[] = [], effectCondition = new Map<number, number>();
|
||||
for (let [star, seid] of decodeArr) {
|
||||
if (isNaN(parseInt(star)) || isNaN(parseFloat(seid))) {
|
||||
throw new Error('data table format wrong');
|
||||
}
|
||||
effect.push(parseInt(seid));
|
||||
effectCondition.set(parseInt(seid), parseInt(star));
|
||||
}
|
||||
o.effect = effect;
|
||||
o.effectCondition = effectCondition;
|
||||
}
|
||||
Reference in New Issue
Block a user