🐞 fix(节日活动): 划船免费次数计数

This commit is contained in:
luying
2023-05-23 16:48:58 +08:00
parent 9ee93df213
commit 48eb31d55b

View File

@@ -80,9 +80,18 @@ export class DragonBoatData extends ActivityBase {
this.buyCnt = playerData.buyCnt||0;
this.todayPlayCnt = 0;
this.playCnt = 0;
let recByDay = new Map<number, number>();
for(let { id, todayIndex, rewards } of (playerData.record||[])) {
if(todayIndex == this.todayIndex) this.todayPlayCnt ++;
this.playCnt ++;
if(todayIndex == this.todayIndex) {
this.todayPlayCnt ++;
this.playCnt ++;
} else {
let n = recByDay.get(todayIndex)||0;
if(n >= this.freeCnt) { // 不包含之前免费玩的次数
this.playCnt ++;
}
recByDay.set(todayIndex, n + 1);
}
let route = this.routes.find(cur => cur.id == id);
if(route) route.setPass(rewards);
}