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