Files
ZYZ/shared/pubUtils/dictionary/DicRougeRandomEventPlan.ts
2023-08-30 11:02:52 +08:00

28 lines
828 B
TypeScript

/**
* 随机关卡配置表
*/
import { readFileAndParse } from '../util'
import { FILENAME } from '../../consts'
export interface DicRougeRandomEventPlan {
readonly id: number;
readonly planId: number;
readonly randomEventId: number; // 随机关卡的id dicRougeEventOption中的randomEventId
readonly weight: number; // 权重
}
export const dicRougeRandomEventPlan = new Map<number, DicRougeRandomEventPlan[]>();
export function loadRougeRandomEventPlan() {
dicRougeRandomEventPlan.clear();
let arr = readFileAndParse(FILENAME.DIC_ROUGE_RANDOM_EVENT_PLAN);
arr.forEach(o => {
if (!dicRougeRandomEventPlan.has(o.planId)) {
dicRougeRandomEventPlan.set(o.planId, []);
}
dicRougeRandomEventPlan.get(o.planId).push(o);
});
arr = undefined;
}