feat(礼包): 礼包添加保底

This commit is contained in:
luying
2023-01-13 18:40:46 +08:00
parent c8190bae61
commit 634d75e21d
6 changed files with 21610 additions and 31 deletions
+3
View File
@@ -117,6 +117,7 @@ import { dicArtifactQualityPlan, loadArtifactQualityPlan } from "./dictionary/Di
import { dicArtifactSeid, loadArtifactSeid } from "./dictionary/DicArtifactSeid";
import { DicArtifact } from "./dictionary/DicArtifact";
import { DicArtifactQuality } from "./dictionary/DicArtifactQuality";
import { dicGiftPackagePlan, loadGiftPackagePlan } from "./dictionary/DicGiftPackagePlan";
export const gameData = {
daily: dicDaily,
@@ -228,6 +229,7 @@ export const gameData = {
gachaPickHeroCnt: new Map<number, number>(),
heroTransPiece: new Map<number, number>(),
giftPackage: dicGiftPackage,
giftPackagePlan: dicGiftPackagePlan,
comBtlLvRange: new Map<number, {min: number, max: number}>(),
recruit: dicRecruit,
rmb: dicRMB,
@@ -1215,6 +1217,7 @@ function loadDatas() {
loadGachaPlan();
loadGachaFloor();
loadGiftPackage();
loadGiftPackagePlan();
loadRecruit();
loadRMB();
loadActivityType();
@@ -0,0 +1,57 @@
// 礼包奖励表
import { readFileAndParse } from '../util';
import { FILENAME } from '../../consts';
const _ = require('lodash');
export interface DicGiftPackagePlan {
// 唯一id
readonly id: number;
// 礼包类型 dic_zyz_giftPackage的id
readonly giftPackageId: number;
// addReward中的type
readonly contentType: number;
// 物品id或武将id
readonly content: number;
// 数量
readonly count: number;
// 权重
readonly weight: number;
// 保底, 每floor必出floorCount个,提前获取到次数就重置
readonly floorFrequency: number;
// 保底数量
readonly floorCount: number;
}
type KeysEnum<T> = { [P in keyof Required<T>]: true };
const DicGiftPackagePlanKeys: KeysEnum<DicGiftPackagePlan> = {
id: true,
giftPackageId: true,
contentType: true,
content: true,
count: true,
weight: true,
floorFrequency: true,
floorCount: true
}
export const dicGiftPackagePlan = new Map<number, DicGiftPackagePlan[]>(); // packageId => [plan]
export function loadGiftPackagePlan() {
dicGiftPackagePlan.clear();
let arr = readFileAndParse(FILENAME.DIC_GIFT_PACKAGE_PLAN);
arr.forEach(o => {
if(o.floor == '&') {
o.floorFrequency = 0;
o.floorCount = 0;
} else {
let arr = o.floor.split('&');
o.floorFrequency = isNaN(parseInt(arr[0]))? 0: parseInt(arr[0]);
o.floorCount = isNaN(parseInt(arr[1]))? 0: parseInt(arr[1]);
}
if(!dicGiftPackagePlan.has(o.giftPackageId)) {
dicGiftPackagePlan.set(o.giftPackageId, []);
}
dicGiftPackagePlan.get(o.giftPackageId)?.push(_.pick(o, Object.keys(DicGiftPackagePlanKeys)));
});
arr = undefined;
}