✨ feat(宝物): 添加宝物系统
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
// 物品表
|
||||
import { readFileAndParse, parseNumberList, } from '../util'
|
||||
import { FILENAME, } from '../../consts'
|
||||
const _ = require('lodash');
|
||||
|
||||
export interface DicArtifact {
|
||||
// 宝物idt,其中形态1和goodId必须一致
|
||||
readonly artifactId: number;
|
||||
// 宝物名
|
||||
readonly name: string;
|
||||
// 物品表id,不同品质&品阶的同名宝物的物品id不同
|
||||
readonly goodId: number;
|
||||
// 同名宝物,比如史记,可以直接写shiji,不过要当心多音词,注意唯一性
|
||||
readonly group: string;
|
||||
// 形态
|
||||
readonly type: number;
|
||||
// 是否是初始形态,用于服务器获取
|
||||
readonly isDefaultType: boolean;
|
||||
// 品质,每个宝物id直接对应一种品质
|
||||
readonly quality: number;
|
||||
// 品阶,每个宝物id直接对应一种品阶
|
||||
readonly qualityStage: number;
|
||||
// 专属职业
|
||||
readonly jobClass: number;
|
||||
// 专属武将
|
||||
readonly hid: number;
|
||||
// 词条:seid&seid
|
||||
readonly seids: number[];
|
||||
// 等级配置方案
|
||||
readonly lvAttrPlan: number;
|
||||
// 升品配置方案
|
||||
readonly qualityAttrPlan: number;
|
||||
}
|
||||
|
||||
type KeysEnum<T> = { [P in keyof Required<T>]: true };
|
||||
const DicArtifactKeys: KeysEnum<DicArtifact> = {
|
||||
artifactId: true,
|
||||
name: true,
|
||||
goodId: true,
|
||||
group: true,
|
||||
type: true,
|
||||
isDefaultType: true,
|
||||
quality: true,
|
||||
qualityStage: true,
|
||||
jobClass: true,
|
||||
hid: true,
|
||||
seids: true,
|
||||
lvAttrPlan: true,
|
||||
qualityAttrPlan: true,
|
||||
}
|
||||
export const dicArtifact = new Map<number, DicArtifact>();
|
||||
export const dicArtifactByGid = new Map<number, number>();
|
||||
export const dicArtifactByGidAndType = new Map<string, number>();
|
||||
export const dicArtifactsByGroup = new Map<string, DicArtifact>();
|
||||
|
||||
export function loadArtifact() {
|
||||
dicArtifact.clear();
|
||||
dicArtifactByGid.clear();
|
||||
dicArtifactByGidAndType.clear();
|
||||
dicArtifactsByGroup.clear();
|
||||
|
||||
let arr = readFileAndParse(FILENAME.DIC_ARTIFACT);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.seids = parseNumberList(o.seids);
|
||||
if(o.isDefaultType) dicArtifactByGid.set(o.goodId, o.artifactId);
|
||||
dicArtifactByGidAndType.set(`${o.goodId}_${o.type}`, o.artifactId);
|
||||
dicArtifact.set(o.artifactId, _.pick(o, Object.keys(DicArtifactKeys)));
|
||||
dicArtifactsByGroup.set(`${o.group}_${o.type}_${o.quality}_${o.qualityStage}`, o);
|
||||
});
|
||||
|
||||
arr = undefined;
|
||||
}
|
||||
Reference in New Issue
Block a user