✨ feat(养成): 九品天晶添加基础属性
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// 天晶石表
|
||||
import { readFileAndParse, parseGoodStr, parseNumberList } from '../util'
|
||||
import { readFileAndParse, parseGoodStr, parseNumberList, decodeArrayListStr } from '../util'
|
||||
import { FILENAME } from '../../consts';
|
||||
import { RewardInter } from '../interface';
|
||||
|
||||
@@ -22,6 +22,8 @@ export interface DicJewel {
|
||||
readonly randomEffect: number[];
|
||||
// 稀有属性
|
||||
readonly rareEffect: number[];
|
||||
// 基础属性
|
||||
readonly rareEffectBaseAttr: {id: number, num: number}[];
|
||||
// 对应藏宝图id
|
||||
readonly mapGoodId: number;
|
||||
// 淬炼消耗
|
||||
@@ -43,8 +45,10 @@ export function loadJewel() {
|
||||
arr.forEach(o => {
|
||||
o.randomEffect = parseNumberList(o.randomEffect);
|
||||
o.rareEffect = parseNumberList(o.rareEffect);
|
||||
o.rareEffectBaseAttr = parseAttr(o.rareEffectBaseAttr);
|
||||
o.quenchConsume = parseGoodStr(o.quenchConsume);
|
||||
o.inheritConsume = parseGoodStr(o.inheritConsume);
|
||||
|
||||
dicJewel.set(o.good_id, o);
|
||||
dicBlueprt.set(o.mapGoodId, o.good_id);
|
||||
if(!dicBlueprtByLv.has(o.lv)) {
|
||||
@@ -53,4 +57,17 @@ export function loadJewel() {
|
||||
dicBlueprtByLv.get(o.lv).push(o.mapGoodId);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
|
||||
function parseAttr(str: string) {
|
||||
let result = new Array<{id: number, num: number}>();
|
||||
if(!str) return result;
|
||||
let decodeArr = decodeArrayListStr(str);
|
||||
for(let [id, num] of decodeArr) {
|
||||
if(isNaN(parseInt(id)) || isNaN(parseInt(num))) {
|
||||
throw new Error('data table format wrong');
|
||||
}
|
||||
result.push({id: parseInt(id), num: parseInt(num)});
|
||||
}
|
||||
return result
|
||||
}
|
||||
Reference in New Issue
Block a user