每日:扫荡次数忘记考虑月卡
This commit is contained in:
@@ -182,7 +182,7 @@ export class NormalBattleHandler {
|
|||||||
let dungeonNum = {};
|
let dungeonNum = {};
|
||||||
|
|
||||||
if (warInfo.warType == WAR_TYPE.DAILY) {
|
if (warInfo.warType == WAR_TYPE.DAILY) {
|
||||||
let checkResult = await checkDailyAndIncrease(roleId, warStar, battleId, isSuccess?1:0, false, stars);
|
let checkResult = await checkDailyAndIncrease(roleId, warStar, battleId, isSuccess?1:0, false, stars, role);
|
||||||
if (checkResult.status == -1) {
|
if (checkResult.status == -1) {
|
||||||
return checkResult.resResult;
|
return checkResult.resResult;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ export async function checkDaily(roleId: string, battleId: number, inc: number)
|
|||||||
* @param isRef 在计算之前是否检查每日的刷新
|
* @param isRef 在计算之前是否检查每日的刷新
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export async function checkDailyAndIncrease(roleId: string, warStar: WarStar[], battleId: number, inc: number, isRef: boolean, stars = []) {
|
export async function checkDailyAndIncrease(roleId: string, warStar: WarStar[], battleId: number, inc: number, isRef: boolean, stars = [], role?: RoleType) {
|
||||||
let { newWarStars } = calculateWarStar(warStar, battleId, stars);
|
let { newWarStars } = calculateWarStar(warStar, battleId, stars);
|
||||||
|
|
||||||
let dailyWar = gameData.war.get(battleId);
|
let dailyWar = gameData.war.get(battleId);
|
||||||
@@ -96,17 +96,15 @@ export async function checkDailyAndIncrease(roleId: string, warStar: WarStar[],
|
|||||||
let type = dailyWar.dailyType;
|
let type = dailyWar.dailyType;
|
||||||
let war = getDailyWarStatus(dailyWar, newWarStars);
|
let war = getDailyWarStatus(dailyWar, newWarStars);
|
||||||
|
|
||||||
let curDaily = gameData.daily.find(cur => cur.dailyType == type);
|
|
||||||
if(!curDaily) return { status: -1, resResult: resResult(STATUS.DAILY_TYPE_NOT_FOUND) };
|
|
||||||
|
|
||||||
let dailyRecord: any;
|
let dailyRecord: any;
|
||||||
if(isRef) {
|
if(isRef) {
|
||||||
dailyRecord = await DailyRecordModel.refreshRecord(roleId, type);
|
dailyRecord = await DailyRecordModel.refreshRecord(roleId, type);
|
||||||
} else { // 如果是手动挑战,由于在进入时已经检查过了,所以即使结算时过去了一天也还是累计在上一天
|
} else { // 如果是手动挑战,由于在进入时已经检查过了,所以即使结算时过去了一天也还是累计在上一天
|
||||||
dailyRecord = await DailyRecordModel.getDailyRecordById(roleId, type);
|
dailyRecord = await DailyRecordModel.getDailyRecordById(roleId, type);
|
||||||
}
|
}
|
||||||
let { count = 0, buyCount = 0 } = dailyRecord;
|
|
||||||
if(count + inc > curDaily.timesPerDay + buyCount ) {
|
let { count } = await getDailyNum(dailyRecord, role);
|
||||||
|
if(count < inc) {
|
||||||
return { status: -1, resResult: resResult(STATUS.DAILY_TIMES_LACK) }
|
return { status: -1, resResult: resResult(STATUS.DAILY_TIMES_LACK) }
|
||||||
}
|
}
|
||||||
let result = await DailyRecordModel.increseDailyCount(roleId, type, inc);
|
let result = await DailyRecordModel.increseDailyCount(roleId, type, inc);
|
||||||
@@ -123,7 +121,7 @@ export async function getDailyNum(dailyRecord: DailyRecord, role?: RoleType) {
|
|||||||
role = await RoleModel.findByRoleId(roleId, 'vipStartTime');
|
role = await RoleModel.findByRoleId(roleId, 'vipStartTime');
|
||||||
}
|
}
|
||||||
timesPerDay = getVipDailyCnt(timesPerDay, role);
|
timesPerDay = getVipDailyCnt(timesPerDay, role);
|
||||||
|
console.log('###### getDailyNum', timesPerDay, count, buyCount, timesCanBuy)
|
||||||
return {count: timesPerDay - count + buyCount, buyCount: timesCanBuy - buyCount}
|
return {count: timesPerDay - count + buyCount, buyCount: timesCanBuy - buyCount}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user