装备:镶嵌天晶石

This commit is contained in:
luying
2022-02-16 16:51:23 +08:00
parent 862c3f4d65
commit 29e66fc844
17 changed files with 277 additions and 144 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
// 天晶石表
import { decodeArrayListStr, readFileAndParse, parseGoodStr, parseNumberList } from '../util'
import { readFileAndParse, parseGoodStr, parseNumberList } from '../util'
import { FILENAME } from '../../consts';
import { RewardInter } from '../interface';
@@ -0,0 +1,29 @@
// 天晶石表
import { readFileAndParse, parseGoodStr, parseNumberList } from '../util'
import { FILENAME } from '../../consts';
export interface DicJewelCondition {
// id
readonly id: number;
// 天晶石品质
readonly jewelLv: number;
// 属性词条id
readonly randSeId: number;
// 需要的地玉石的数量
readonly stoneCnt: number;
// 需要的地玉石的品质之和
readonly stoneLv: number;
}
export const dicJewelCondition = new Map<string, DicJewelCondition>();
export function loadJewelCondition() {
dicJewelCondition.clear();
let arr = readFileAndParse(FILENAME.DIC_JEWEL_CONDITION);
arr.forEach(o => {
dicJewelCondition.set(`${o.jewelLv}_${o.randSeId}`, o);
});
arr = undefined;
}
+51
View File
@@ -0,0 +1,51 @@
// 地玉石表
import { readFileAndParse, parseGoodStr, decodeArrayListStr } from '../util'
import { FILENAME } from '../../consts';
import { RewardInter } from '../interface';
export interface DicStone {
// 物品id
readonly good_id: number;
// 地玉石名
readonly name: string;
// 装备栏id
readonly eplaceId: number;
// itid
readonly itid: number;
// 地玉石阶
readonly lv: number;
// 地玉石品质
readonly quality: number;
// 合成消耗
readonly composeMaterial: RewardInter[];
// 属性提升
readonly attribute: {id: number, num: number}[];
}
export const dicStone = new Map<number, DicStone>();
export function loadStone() {
dicStone.clear();
let arr = readFileAndParse(FILENAME.DIC_STONE);
arr.forEach(o => {
o.composeMaterial = parseGoodStr(o.composeMaterial);
o.attribute = parseAttr(o.attribute);
dicStone.set(o.good_id, o);
});
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
}