pvp:修复赛季结束
This commit is contained in:
@@ -66,11 +66,6 @@ export class PvpHandler {
|
||||
}
|
||||
update = { ...update, ...refOppObj }
|
||||
}
|
||||
|
||||
if (pvpDefense.isFirstEntry) {
|
||||
update.isFirstEntry = false;
|
||||
result.setIsFirstEntry(true);
|
||||
}
|
||||
|
||||
if(Object.keys(update).length > 0) {
|
||||
pvpDefense = await PvpDefenseModel.updateInfoAndInclude(roleId, update);
|
||||
@@ -83,8 +78,10 @@ export class PvpHandler {
|
||||
result.setOppPlayers(oppPlayersReturn);
|
||||
// 赛季结算
|
||||
let pvpSeasonResult = await PvpSeasonResultModel.getPvpSeasonResult(roleId);
|
||||
if (!!pvpSeasonResult && !!pvpSeasonResult.show) {
|
||||
if (!!pvpSeasonResult && !!pvpSeasonResult.show && pvpDefense.seasonNum == seasonNum) {
|
||||
result.setPvpSeasonResult(pvpSeasonResult);
|
||||
result.setIsFirstEntry(true);
|
||||
update.isFirstEntry = false;
|
||||
await PvpSeasonResultModel.setShow(roleId);
|
||||
}
|
||||
// 拍卖
|
||||
@@ -577,8 +574,8 @@ export class PvpHandler {
|
||||
}
|
||||
|
||||
async debugPvpSeasonResetTime(msg: { day: number }, session: BackendSession) {
|
||||
let { day: hour } = msg;
|
||||
let { seasonNum, seasonEndTime } = await pinus.app.rpc.systimer.systimerRemote.resetPvpSeasonTime.toServer('systimer-server-1', hour);
|
||||
let { day: minute } = msg;
|
||||
let { seasonNum, seasonEndTime } = await pinus.app.rpc.systimer.systimerRemote.resetPvpSeasonTime.toServer('systimer-server-1', minute);
|
||||
return resResult(STATUS.SUCCESS, { seasonNum, seasonEndTime });
|
||||
}
|
||||
|
||||
|
||||
@@ -569,7 +569,7 @@ async function resetPvpScores(pvpDefense: PvpDefenseType, seasonNum: number, pvp
|
||||
|
||||
pvpDefense = await PvpDefenseModel.updateInfoAndInclude(roleId, {
|
||||
heroScores: newHeroScores, score: newScore, attack: newAttack, defense: newDefense,
|
||||
seasonNum, challengeCnt: PVP.PVP_CHALLENGE_COUNTS, challengeRefTime: 0, winStreakNum: 0
|
||||
seasonNum, challengeCnt: PVP.PVP_CHALLENGE_COUNTS, challengeRefTime: 0, winStreakNum: 0, isFirstEntry: true
|
||||
});
|
||||
return pvpDefense;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@ import { PVP } from '../pubUtils/dicParam';
|
||||
const PER_SECOND = 1 * 1000;
|
||||
const PER_DAY = 24 * 60 * 60;
|
||||
const PER_HOUR = 1 * 60 * 60;
|
||||
const SETTLE_DIFF_SECONDS = 29 * 60;
|
||||
const PER_MINUTE = 1 * 60;
|
||||
var seasonMakeRewardTimJobId: Job;
|
||||
var warJobId: Job;
|
||||
@@ -94,10 +93,10 @@ async function setPvpSeasonJob() {
|
||||
await setPvpSeason();
|
||||
}
|
||||
|
||||
async function setPvpSeason(isForce?: boolean, hour?: number) {
|
||||
console.log(`******** setPvpSeason1: isForce-${isForce}, hour-${hour}`)
|
||||
async function setPvpSeason(isForce?: boolean, minute?: number) {
|
||||
console.log(`******** setPvpSeason1: isForce-${isForce}, minute-${minute}`)
|
||||
|
||||
let during = hour? hour * PER_HOUR: null; // 下一次重置赛季天数
|
||||
let during = minute? minute * PER_MINUTE: null; // 下一次重置赛季天数
|
||||
let oldPvpConfig = await PVPConfigModel.findCurPVPConfig();
|
||||
let pvpConfig = oldPvpConfig;
|
||||
console.log(`******** setPvpSeason2: during-${during}, seasonEndTime-${pvpConfig?.seasonEndTime}, now-${nowSeconds()}`)
|
||||
@@ -112,7 +111,7 @@ async function setPvpSeason(isForce?: boolean, hour?: number) {
|
||||
|
||||
let newSeasonStartTime = lastSeasonEndTime + PER_MINUTE;
|
||||
if(!during) during = getSeasonContinueDay(lastSeasonNum + 1) * PER_DAY;
|
||||
let rewardTime = SETTLE_DIFF_SECONDS;
|
||||
let rewardTime = PVP.PVP_SEASON_REWARD_TIME_BEFORE * PER_MINUTE;
|
||||
if(nowSeconds() - newSeasonStartTime > during) {
|
||||
newSeasonStartTime = <number>getTimeFun().getDayZeroPoint(0);
|
||||
}
|
||||
@@ -131,7 +130,7 @@ async function setPvpSeason(isForce?: boolean, hour?: number) {
|
||||
let newSeasonNum = await CounterModel.getNewCounter(COUNTER.PVP_SEASON_NUM);
|
||||
pvpConfig = await PVPConfigModel.createPVPConfig(newSeasonNum, newSeasonStartTime, newSeasonStartTime + during - rewardTime, newSeasonStartTime + during - PER_MINUTE);
|
||||
}
|
||||
await setPvpSeasonMakeRewardJob(oldPvpConfig);
|
||||
await setPvpSeasonMakeRewardJob(pvpConfig);
|
||||
await setNextSeasonJob(pvpConfig);
|
||||
setPvpSeasonNum(pvpConfig);
|
||||
return pvpConfig;
|
||||
@@ -155,7 +154,8 @@ async function setPvpSeasonMakeRewardJob(pvpConfig: PVPConfigType) {
|
||||
if(pvpConfig.seasonRewardTime < nowSeconds() && !pvpConfig.hasSettleReward) { // 未发奖励
|
||||
await pvpSeasonEnd(pvpConfig.seasonNum);
|
||||
} else {
|
||||
seasonMakeRewardTimJobId = scheduleJob('seasonMakeRewardTimJobId', pvpConfig.seasonRewardTime, async () => {
|
||||
seasonMakeRewardTimJobId = scheduleJob('seasonMakeRewardTimJobId', pvpConfig.seasonRewardTime * 1000, async () => {
|
||||
console.log('************ seasonMakeRewardTimJobId *********');
|
||||
await pvpSeasonEnd(pvpConfig.seasonNum);
|
||||
});
|
||||
}
|
||||
@@ -166,15 +166,15 @@ async function setNextSeasonJob(pvpConfig: PVPConfigType) {
|
||||
seasonRefreshTimeJobId.cancel();
|
||||
}
|
||||
//定时开启新赛季,比seasonEndTime多定一分钟,保证定时器时间没错
|
||||
seasonRefreshTimeJobId = scheduleJob('seasonRefreshTimeJobId', pvpConfig.seasonEndTime + PER_MINUTE, setPvpSeasonJob);
|
||||
seasonRefreshTimeJobId = scheduleJob('seasonRefreshTimeJobId', (pvpConfig.seasonEndTime + PER_MINUTE) * 1000, setPvpSeasonJob);
|
||||
}
|
||||
|
||||
/**
|
||||
* debug接口
|
||||
* @param hour
|
||||
*/
|
||||
export async function resetPvpSeasonTime(hour: number) {
|
||||
return await setPvpSeason(true, hour);
|
||||
export async function resetPvpSeasonTime(minute: number) {
|
||||
return await setPvpSeason(true, minute);
|
||||
}
|
||||
|
||||
export async function reportOnlineSchedule() {
|
||||
|
||||
@@ -301,7 +301,7 @@ describe('pvp测试', function () {
|
||||
})
|
||||
}
|
||||
|
||||
it('领取巅峰之路奖励', function(done) {
|
||||
it.skip('领取巅峰之路奖励', function(done) {
|
||||
let id = Math.floor(Math.random() * 10);
|
||||
if(receivedBox.includes(id) || hisScore < 5000) {
|
||||
debugResetBox(() => {
|
||||
|
||||
Reference in New Issue
Block a user