🐞 fix(活动): 宴请百家免费次数累计
This commit is contained in:
@@ -78,9 +78,10 @@ class HeroData {
|
|||||||
export class EntertainData extends ActivityBase {
|
export class EntertainData extends ActivityBase {
|
||||||
buyCost: string; // 购买一次划船次数的消耗,type&id&count
|
buyCost: string; // 购买一次划船次数的消耗,type&id&count
|
||||||
dailyBuyCnt: number; // 每天可以购买的次数
|
dailyBuyCnt: number; // 每天可以购买的次数
|
||||||
freeCnt: number; // 每天可以免费划船的次数
|
freeCntDaily: number; // 每天可以免费划船的次数
|
||||||
heroes: HeroData[] = []; // 宴请武将
|
heroes: HeroData[] = []; // 宴请武将
|
||||||
|
|
||||||
|
freeCnt: number = 0; // 累积到现在可以免费的次数
|
||||||
maxBuyCnt: number = 0; // 累积到现在可以购买的次数
|
maxBuyCnt: number = 0; // 累积到现在可以购买的次数
|
||||||
buyCnt: number = 0; // 累积到现在已经购买了的次数
|
buyCnt: number = 0; // 累积到现在已经购买了的次数
|
||||||
todayPlayCnt: number = 0; // 今天玩的次数
|
todayPlayCnt: number = 0; // 今天玩的次数
|
||||||
@@ -100,7 +101,8 @@ export class EntertainData extends ActivityBase {
|
|||||||
|
|
||||||
this.buyCost = dataObj.buyCost || '&';
|
this.buyCost = dataObj.buyCost || '&';
|
||||||
this.dailyBuyCnt = dataObj.dailyBuyCnt || 0;
|
this.dailyBuyCnt = dataObj.dailyBuyCnt || 0;
|
||||||
this.freeCnt = dataObj.freeCnt || 0;
|
this.freeCntDaily = dataObj.freeCnt || 0;
|
||||||
|
this.freeCnt = this.freeCntDaily * this.todayIndex;
|
||||||
this.maxBuyCnt = this.todayIndex * this.dailyBuyCnt;
|
this.maxBuyCnt = this.todayIndex * this.dailyBuyCnt;
|
||||||
for (let data of (dataObj.heroes || [])) {
|
for (let data of (dataObj.heroes || [])) {
|
||||||
this.heroes.push(new HeroData(data));
|
this.heroes.push(new HeroData(data));
|
||||||
@@ -124,8 +126,10 @@ export class EntertainData extends ActivityBase {
|
|||||||
this.playCnt++;
|
this.playCnt++;
|
||||||
} else {
|
} else {
|
||||||
let n = recByDay.get(todayIndex) || 0;
|
let n = recByDay.get(todayIndex) || 0;
|
||||||
if (n >= this.freeCnt) { // 不包含之前免费玩的次数
|
if (n >= this.freeCntDaily) { // 不包含之前免费玩的次数
|
||||||
this.playCnt++;
|
this.playCnt++;
|
||||||
|
} else {
|
||||||
|
this.freeCnt--;
|
||||||
}
|
}
|
||||||
recByDay.set(todayIndex, n + 1);
|
recByDay.set(todayIndex, n + 1);
|
||||||
}
|
}
|
||||||
@@ -137,6 +141,7 @@ export class EntertainData extends ActivityBase {
|
|||||||
this.invitedHeroNum++;
|
this.invitedHeroNum++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public updateBuyCnt(playerData: ActivityEntertainRecModelType) {
|
public updateBuyCnt(playerData: ActivityEntertainRecModelType) {
|
||||||
|
|||||||
Reference in New Issue
Block a user