✨ feat(宝物): 添加宝物系统
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
// 物品表
|
||||
import { readFileAndParse, parseGoodStr, } from '../util'
|
||||
import { FILENAME, } from '../../consts'
|
||||
import { RewardInter } from '../interface';
|
||||
const _ = require('lodash');
|
||||
|
||||
export interface DicArtifactQuality {
|
||||
// 唯一id,品质+品阶=唯一
|
||||
uniqId: number;
|
||||
// 品质,key1
|
||||
quality: number;
|
||||
// 品阶,key2
|
||||
qualityStage: number;
|
||||
// 这个品质下最大的等级
|
||||
maxLv: number;
|
||||
// 合成相关
|
||||
// 可以合成到他这个品质的uniqId,即原料的品质+品阶
|
||||
previousId: number;
|
||||
// 下一阶uniqId
|
||||
nextId: number;
|
||||
// 作为狗粮的宝物品质uniqId
|
||||
materialId: number;
|
||||
// 作为狗粮的宝物的数量
|
||||
materialCnt: number;
|
||||
// 作为狗粮的是否需要同名 1-是 0-不是
|
||||
materialGroup: number;
|
||||
// 是否可以分解 1-是 0-不是
|
||||
canDecompose: number;
|
||||
// 是否可以一键合成 1-是 0-不是
|
||||
canComposeAll: number;
|
||||
// 这个品质可以替换的通用道具,id&count。分解同样用这个字段,不可分解填&
|
||||
generalItem: RewardInter[];
|
||||
}
|
||||
|
||||
type KeysEnum<T> = { [P in keyof Required<T>]: true };
|
||||
const DicArtifactQualityKeys: KeysEnum<DicArtifactQuality> = {
|
||||
uniqId: true,
|
||||
quality: true,
|
||||
qualityStage: true,
|
||||
maxLv: true,
|
||||
previousId: true,
|
||||
nextId: true,
|
||||
materialId: true,
|
||||
materialCnt: true,
|
||||
materialGroup: true,
|
||||
canDecompose: true,
|
||||
canComposeAll: true,
|
||||
generalItem: true,
|
||||
}
|
||||
export const dicArtifactQuality = new Map<string, number>(); // quality+qualityStage
|
||||
export const dicArtifactQualityById = new Map<number, DicArtifactQuality>(); // uniqId
|
||||
|
||||
export function loadArtifactQuality() {
|
||||
dicArtifactQuality.clear();
|
||||
dicArtifactQualityById.clear();
|
||||
|
||||
let arr = readFileAndParse(FILENAME.DIC_ARTIFACT_QUALITY);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.generalItem = parseGoodStr(o.generalItem);
|
||||
dicArtifactQualityById.set(o.uniqId, _.pick(o, Object.keys(DicArtifactQualityKeys)));
|
||||
dicArtifactQuality.set(`${o.quality}_${o.qualityStage}`, o.uniqId);
|
||||
});
|
||||
|
||||
arr = undefined;
|
||||
}
|
||||
Reference in New Issue
Block a user