feat(gift): 修改宝箱保底机制

This commit is contained in:
liangtongchuan
2023-02-18 18:15:34 +08:00
committed by luying
parent 321d9d15ba
commit 199677e2a4
9 changed files with 1863 additions and 1688 deletions

View File

@@ -16,10 +16,8 @@ export interface DicGiftPackagePlan {
readonly count: number;
// 权重
readonly weight: number;
// 保底 每floor必出floorCount个提前获取到次数就重置
readonly floorFrequency: number;
// 保底数量
readonly floorCount: number;
// 保底表id
readonly floorId: number;
}
type KeysEnum<T> = { [P in keyof Required<T>]: true };
@@ -30,8 +28,7 @@ const DicGiftPackagePlanKeys: KeysEnum<DicGiftPackagePlan> = {
content: true,
count: true,
weight: true,
floorFrequency: true,
floorCount: true
floorId: true,
}
export const dicGiftPackagePlan = new Map<number, DicGiftPackagePlan[]>(); // packageId => [plan]
@@ -40,14 +37,7 @@ export function loadGiftPackagePlan() {
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]);
}
o.floorId = o.floor;
if(!dicGiftPackagePlan.has(o.giftPackageId)) {
dicGiftPackagePlan.set(o.giftPackageId, []);
}