pvp:赛季奖励

This commit is contained in:
luying
2022-07-04 19:16:23 +08:00
parent 65d68d7db4
commit d307aa96f3
3 changed files with 53 additions and 21 deletions

View File

@@ -4,6 +4,7 @@ import { RewardInter } from '../interface';
export interface DicRankRewads {
readonly id: number;
readonly seasonNum: number;
readonly min: number;
readonly max: number;
readonly reward: Array<RewardInter>;
@@ -11,20 +12,24 @@ export interface DicRankRewads {
}
export const dicRankRewads = new Array<DicRankRewads>();
export const dicRankMax: { max: DicRankRewads } = { max: undefined };
export const dicRankRewads = new Map<number, DicRankRewads[]>();
export const dicRankMax = new Map<number, DicRankRewads>();
export function loadPvpRankReward() {
dicRankRewads.splice(0, dicRankRewads.length);
dicRankMax.max = undefined;
dicRankRewads.clear();
dicRankMax.clear();
let arr = readFileAndParse(FILENAME.DIC_PVP_RANK_REWARD);
arr.forEach(o => {
o.reward = parseGoodStr(o.reward);
if (!dicRankMax.max || o.min > dicRankMax.max.min) {
dicRankMax.max = o;
if(!dicRankRewads.has(o.seasonNum)) {
dicRankRewads.set(o.seasonNum, []);
}
dicRankRewads.get(o.seasonNum).push(o);
if (!dicRankMax.has(o.seasonNum) || o.min > dicRankMax.get(o.seasonNum).min) {
dicRankMax.set(o.seasonNum, o);
}
dicRankRewads.push(o);
});
arr = undefined;
}