✨ feat(活动): 新将擢迁保底显示
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { ActivityModelType } from '../../db/Activity';
|
||||
import { UserGachaType } from '../../db/UserGacha';
|
||||
import { DicGacha } from '../../pubUtils/dictionary/DicGacha';
|
||||
import { getGachaRemainFloor } from '../../pubUtils/util';
|
||||
import { ActivityBase } from './activityField';
|
||||
|
||||
interface NewHeroGachaItemInDb {
|
||||
@@ -29,6 +30,7 @@ export class NewHeroGachaData extends ActivityBase {
|
||||
pickHero: number = 0;
|
||||
count: number = 0;
|
||||
isFree: boolean = false; // 免费次数
|
||||
remainFloor: number = 0;
|
||||
|
||||
constructor(activityData: ActivityModelType, createTime: number, serverTime: number) {
|
||||
super(activityData, createTime, serverTime)
|
||||
@@ -59,6 +61,7 @@ export class NewHeroGachaData extends ActivityBase {
|
||||
this.pickHero = data.pickHero;
|
||||
this.count = data.count;
|
||||
this.isFree = data.freeCount < dic?.free.count;
|
||||
this.remainFloor = getGachaRemainFloor(data.gachaId, data.floor||[])
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -839,7 +839,7 @@ export function arrToMap<T>(arr: T[], getKey: (obj: T) => number|string): Map<nu
|
||||
|
||||
export function getGachaRemainFloor(gachaId: number, userFloor: Floor[]) {
|
||||
let dicGacha = gameData.gacha.get(gachaId);
|
||||
if(dicGacha.gachaType != GACHA_TYPE.NORMAL) return 0;
|
||||
if(dicGacha.gachaType != GACHA_TYPE.NORMAL && dicGacha.gachaType != GACHA_TYPE.ACTIVITY) return 0;
|
||||
|
||||
for(let floorId of dicGacha.floor) {
|
||||
let dicGachaFloor = gameData.gachaFloor.get(floorId);
|
||||
|
||||
Reference in New Issue
Block a user