名将擂台:刷新对手

This commit is contained in:
luying
2022-07-19 17:14:11 +08:00
parent 4ee1f25876
commit 7394f14e9d
17 changed files with 48281 additions and 72 deletions
@@ -0,0 +1,59 @@
// 邮件内容
import {decodeArrayListStr, parseGoodStr, readFileAndParse} from '../util'
import { FILENAME } from '../../consts'
import { RewardInter } from '../interface';
export interface DicLadderDifficultRatio {
// id
readonly id: number;
// 排名
readonly rank: number;
// 强度倍率
readonly value: number;
// 次级属性
readonly secondAttrLevel: number;
// 等级
readonly level: number;
// 关卡id
readonly gkId: number;
// 头像
readonly head: number;
// 形象
readonly spine: number;
// 胜利奖励
readonly randomWinReward: { id: number, count: number, weight: number }[];
// 失败奖励
readonly randomFailReward: { id: number, count: number, weight: number }[];
// 突破奖励
readonly onceReward: RewardInter[];
// 战力
readonly ce: number;
}
export const dicLadderDifficultRatio = new Map<number, DicLadderDifficultRatio>();
export function loadLadderDifficultRatio() {
dicLadderDifficultRatio.clear();
let arr = readFileAndParse(FILENAME.DIC_LADDER_DIFFICULTRATIO);
arr.forEach(o => {
o.gkId = parseInt(o.gkId);
o.randomWinReward = parseRewardWithWeight(o.randomWinReward);
o.randomFailReward = parseRewardWithWeight(o.randomFailReward);
o.onceReward = parseGoodStr(o.onceReward)
dicLadderDifficultRatio.set(o.id, o);
});
arr = undefined;
}
function parseRewardWithWeight(str: string) {
let result = new Array<{ id: number, count: number, weight: number }>();
if (!str) return result;
let decodeArr = decodeArrayListStr(str);
for (let [id, count, weight] of decodeArr) {
if (isNaN(parseInt(id)) || isNaN(parseInt(count)) || isNaN(parseInt(weight))) {
throw new Error('data table format wrong');
}
result.push({ id: parseInt(id), count: parseInt(count), weight: parseInt(weight) });
}
return result
}
@@ -0,0 +1,41 @@
// 名将擂台匹配范围
import { parseNumberList, readFileAndParse} from '../util'
import { FILENAME } from '../../consts'
export interface DicLadderMatch {
// id
readonly id: number;
// 最低排名
readonly rankMin: number;
// 最高排名
readonly rankMax: number;
// 玩家随机范围往前数最多多少人
readonly rangeBeforeMax: number;
// 玩家随机范围往后数最多多少人
readonly rangeAfterMax: number;
// 玩家随机范围往前随多少人
readonly rangeBeforeNum: number;
// 玩家随机范围往后随多少人
readonly rangeAfterNum: number;
// 玩家随机间隔
readonly gap: { min: number, max: number };
// 是否可以挑战前十
readonly topChallenge: number;
}
export const dicLadderMatch: DicLadderMatch[] = [];
export function loadLadderMatch() {
dicLadderMatch.splice(0, dicLadderMatch.length);
let arr = readFileAndParse(FILENAME.DIC_LADDER_MATCH);
arr.forEach(o => {
o.gap = parseGap(o.interval);
dicLadderMatch.push(o);
});
arr = undefined;
}
function parseGap(str: string) {
let arr = parseNumberList(str);
return { min: arr[0], max: arr[1] }
}
@@ -0,0 +1,27 @@
// 名将擂台每天22点排名奖励
import {parseGoodStr, readFileAndParse} from '../util'
import { FILENAME } from '../../consts'
import { RewardInter } from '../interface';
export interface DicLadderRankReward {
// id
readonly id: number;
// 最低排名
readonly rankMin: number;
// 最高排名
readonly rankMax: number;
// 突破奖励
readonly reward: RewardInter[];
}
export const dicLadderRankReward: DicLadderRankReward[] = [];
export function loadLadderRankReward() {
dicLadderRankReward.splice(0, dicLadderRankReward.length);
let arr = readFileAndParse(FILENAME.DIC_LADDER_DIFFICULTRATIO);
arr.forEach(o => {
o.reward = parseGoodStr(o.reward)
dicLadderRankReward.push(o);
});
arr = undefined;
}