排行榜:配置空排名
This commit is contained in:
@@ -370,6 +370,22 @@ export function completeLadderRanks(ranks: RoleAndGuildRankInfo[]) {
|
||||
return result;
|
||||
}
|
||||
|
||||
export function completeRanks(ranks: RoleAndGuildRankInfo[]) {
|
||||
let max = Math.max(...ranks.map(cur => cur.rank), 0);
|
||||
if(max > 200) max = 200;
|
||||
let result: RoleAndGuildRankInfo[] = [];
|
||||
for(let i = 1; i <= max; i++) {
|
||||
let rank = ranks.find(cur => cur.rank == i);
|
||||
if(rank) {
|
||||
result.push(rank);
|
||||
} else {
|
||||
let rank = new RoleAndGuildRankInfo(i, 0);
|
||||
result.push(rank);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
export async function sendLadderDailyReward(serverId: number) {
|
||||
let ranks = await getLadderMatchByRank(serverId, '+inf', '-inf');
|
||||
for(let { rank, roleId } of ranks) {
|
||||
|
||||
Reference in New Issue
Block a user