练兵场:注释掉ranks
This commit is contained in:
@@ -193,12 +193,12 @@ export class GuildTrainHandler {
|
||||
let goods = await addItems(roleId, roleName, sid, [{ id: CURRENCY_BY_TYPE.get(CURRENCY_TYPE.HONOUR), count: Math.floor((isSuccess ? trainSoloReward.winHonour : trainSoloReward.failHonour) * (soloRewardRatio + 100) / 100) }]);
|
||||
let { isComplete, ranks } = guildTrain;
|
||||
let reports = [];
|
||||
let index = findIndex(ranks, { roleId });
|
||||
if (index !== -1) {
|
||||
ranks[index].score += addScore;//更新原有的排名信息
|
||||
} else {
|
||||
ranks.push({ score: addScore, roleId });//新增排名
|
||||
}
|
||||
// let index = findIndex(ranks, { roleId });
|
||||
// if (index !== -1) {
|
||||
// ranks[index].score += addScore;//更新原有的排名信息
|
||||
// } else {
|
||||
// ranks.push({ score: addScore, roleId });//新增排名
|
||||
// }
|
||||
let needLockNext = false;
|
||||
let report = { roleName, trainId, hid, score: addScore, time: nowSeconds(), type: isSuccess ? 2 : 1, difficulty: battleRecord.record.difficulty };//type 1:失败, 2:成功,3:表示系统战报即:被成功压制
|
||||
reports.push(report);
|
||||
@@ -234,8 +234,8 @@ export class GuildTrainHandler {
|
||||
res.releaseCallback();//解锁
|
||||
}
|
||||
} else {
|
||||
//玩家结算前已经完成进度,修改玩家的排名
|
||||
guildTrain = await GuildTrainModel.updateGuildTrain(code, trainId, { ranks });
|
||||
// //玩家结算前已经完成进度,修改玩家的排名
|
||||
// guildTrain = await GuildTrainModel.updateGuildTrain(code, trainId, { ranks });
|
||||
res.releaseCallback();//解锁
|
||||
}
|
||||
if (isComplete) {//解锁下一关,弹出礼包 // 1 true true 6Sjkgp(trainId, isComplete, needLockNext, code)
|
||||
|
||||
@@ -83,15 +83,15 @@ export function getGuildTrainRewards (guildTrain) {
|
||||
export function getGuildTrainInfo (guildTrain: GuildTrainType, roleId: string, trainCount:number, trainRewards: Array<number>) {
|
||||
let { trainId, isComplete, trainInstances, ranks } = guildTrain;
|
||||
|
||||
ranks.sort(function(a, b) {
|
||||
return b.score - a.score;
|
||||
});
|
||||
let myRank = {};
|
||||
let resRanks = ranks.map(({roleId: rankRoleId, score}, index)=>{
|
||||
if (roleId == rankRoleId)
|
||||
myRank = {roleId: rankRoleId, score, rankLv: index+1};
|
||||
return {roleId: rankRoleId, score, rankLv: index+1};
|
||||
});
|
||||
// ranks.sort(function(a, b) {
|
||||
// return b.score - a.score;
|
||||
// });
|
||||
// let myRank = {};
|
||||
// let resRanks = ranks.map(({roleId: rankRoleId, score}, index)=>{
|
||||
// if (roleId == rankRoleId)
|
||||
// myRank = {roleId: rankRoleId, score, rankLv: index+1};
|
||||
// return {roleId: rankRoleId, score, rankLv: index+1};
|
||||
// });
|
||||
let { trainInstances: instances } = getArmyTrainJuDian(trainId);
|
||||
let resTrainInstances = trainInstances.map(({hid, progress, endTime})=>{
|
||||
let instance = findWhere(instances, { hid });
|
||||
@@ -100,7 +100,7 @@ export function getGuildTrainInfo (guildTrain: GuildTrainType, roleId: string,
|
||||
isComplete = true;
|
||||
return {hid, progress, endTime, isComplete};
|
||||
});
|
||||
let resGuildTrain = {trainId, isComplete, trainInstances: resTrainInstances, myRank, ranks: resRanks};
|
||||
let resGuildTrain = {trainId, isComplete, trainInstances: resTrainInstances, myRank: 0, ranks: [] };
|
||||
|
||||
return { guildTrain: resGuildTrain, trainCount, trainRewards};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user