装备:随机属性
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// 武将特技表
|
||||
import { readFileAndParse, decodeArrayListStr, parseNumberList } from '../util'
|
||||
import { readFileAndParse, parseNumberList } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicRandomEffectPool {
|
||||
@@ -19,7 +19,7 @@ export interface DicRandomEffectPool {
|
||||
// 分割
|
||||
readonly gap: number;
|
||||
// 分割
|
||||
readonly rate: {min: number, max: number, weight: number}[];
|
||||
readonly planId: number;
|
||||
// 组别
|
||||
readonly group: number;
|
||||
// 等级
|
||||
@@ -35,24 +35,10 @@ export function loadRandomEffectPool() {
|
||||
let arr = readFileAndParse(FILENAME.DIC_RANDOM_EFFECT_POOL);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.rate = parseRate(o.count);
|
||||
if(o.planId == '&') o.planId = 0;
|
||||
o.gainValueArr = parseNumberList(o.gainValue);
|
||||
dicRandomEffectPool.set(o.id, o);
|
||||
dicRandomEffectPoolByGroupAndLv.set(`${o.group}_${o.level}`, o.id);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
|
||||
function parseRate(str: string) {
|
||||
|
||||
let result: {min: number, max: number, weight: number}[] = [];
|
||||
if(!str) return result;
|
||||
let decodeArr = decodeArrayListStr(str);
|
||||
for(let [min, max, weight] of decodeArr) {
|
||||
if(isNaN(parseFloat(min)) || isNaN(parseFloat(max)) || isNaN(parseFloat(weight))) {
|
||||
throw new Error('data table format wrong');
|
||||
}
|
||||
result.push({min: parseFloat(min), max: parseFloat(max), weight: parseFloat(weight) });
|
||||
}
|
||||
return result
|
||||
}
|
||||
Reference in New Issue
Block a user