Files
ZYZ/shared/pubUtils/dictionary/DicGachaContent.ts
2021-10-15 18:16:05 +08:00

31 lines
987 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { readFileAndParse, parseNumberList } from '../util'
import { FILENAME, GACHA_CONTENT_TYPE } from '../../consts'
export interface DicGachaContent {
// 内容id
readonly id: number;
// 道具类型 见sysConst 中的 GACHA_CONTENT_TYPE
readonly type: number;
// 对应参数 品质等级物品id 等
readonly param: number[];
// 道具数量
readonly count: number;
}
export const dicGachaContent = new Map<number, DicGachaContent>(); // id => dic
export const dicGachaContentHero = new Map<number, number>(); // quality => dic
export function loadGachaContent() {
dicGachaContent.clear();
dicGachaContentHero.clear();
let arr = readFileAndParse(FILENAME.DIC_GACHA_CONTENT);
arr.forEach(o => {
o.param = parseNumberList(o.param);
if(o.type == GACHA_CONTENT_TYPE.HERO) {
dicGachaContentHero.set(o.param[0], o.id);
}
dicGachaContent.set(o.id, o);
});
arr = undefined;
}