战报排序
This commit is contained in:
@@ -33,19 +33,22 @@ export class PvpHandler {
|
||||
async addRoleScore(msg: {heroScores: Array<{hid: number, score:number}>}, session: BackendSession) {
|
||||
let { heroScores: addHeroScores } = msg;
|
||||
let roleId = session.get('roleId');
|
||||
let {heroScores, hisScore, score} = await PvpDefenseModel.findByRoleId(roleId);
|
||||
for (let {hid, score: heroScore} of addHeroScores) {
|
||||
let {heroScores, hisScore} = await PvpDefenseModel.findByRoleId(roleId);
|
||||
let score = 0;
|
||||
for (let {hid, score: heroScore} of heroScores) {
|
||||
if (heroScore < 0) continue;
|
||||
let index = findIndex(heroScores, {hid});
|
||||
if (index!= -1) {
|
||||
let oldScore = heroScores[index].score;
|
||||
let index = findIndex(addHeroScores, {hid});
|
||||
if (index != -1) {
|
||||
heroScores[index].score = heroScore;
|
||||
score = score - oldScore + heroScore;
|
||||
} else {
|
||||
heroScores.push({hid, score :heroScore});
|
||||
score = score + heroScore;
|
||||
}
|
||||
}
|
||||
|
||||
for (let heroScore of heroScores) {
|
||||
score += heroScore.score;
|
||||
}
|
||||
|
||||
if (score < 0) {
|
||||
score = 0;
|
||||
}
|
||||
@@ -102,12 +105,12 @@ export class PvpHandler {
|
||||
if (!!pvpSeasonResult) {
|
||||
var { oldSeasonData, show, heroGoods, rankGoods} = pvpSeasonResult;
|
||||
if ( oldSeasonData.seasonEndTime > nowSeconds()) {//结算中锁定玩家信息
|
||||
seasonEndTime = oldSeasonData.seasonEndTime;
|
||||
heroScores = oldSeasonData.heroScores;
|
||||
score = oldSeasonData.score;
|
||||
refOppCnt = oldSeasonData.refOppCnt;
|
||||
challengeCnt = oldSeasonData.challengeCnt;
|
||||
challengeRefTime = oldSeasonData.challengeRefTime;
|
||||
// seasonEndTime = oldSeasonData.seasonEndTime;
|
||||
// heroScores = oldSeasonData.heroScores;
|
||||
// score = oldSeasonData.score;
|
||||
// refOppCnt = oldSeasonData.refOppCnt;
|
||||
// challengeCnt = oldSeasonData.challengeCnt;
|
||||
// challengeRefTime = oldSeasonData.challengeRefTime;
|
||||
} else if(show) {
|
||||
await PvpSeasonResultModel.updatePvpSeasonResult(roleId, {show: false});
|
||||
flag = true;
|
||||
|
||||
Reference in New Issue
Block a user