伤害排名支持percent类型

This commit is contained in:
Aluxes 2024-03-01 22:09:34 +08:00
parent f7364ea736
commit 06ad9f5195
No known key found for this signature in database
GPG Key ID: 6696152F9C003087
6 changed files with 10 additions and 5 deletions

View File

@ -206,9 +206,11 @@ async function renderCharRankList({ e, uids, char, mode, groupId }) {
title = title.replace(/[ ·]*/g, '') title = title.replace(/[ ·]*/g, '')
} }
title = title.length > 10 ? title.replace(/伤害$/, '') : title title = title.length > 10 ? title.replace(/伤害$/, '') : title
let tmpAvg = dmg.type !== 'text' ? Format.comma(dmg.avg, 1) : dmg.avg
tmp.dmg = { tmp.dmg = {
title, title,
avg: Format.comma(dmg.avg, 1) avg: tmpAvg,
rank: data.dmg.rank
} }
} }
if (uid) { if (uid) {
@ -236,7 +238,7 @@ async function renderCharRankList({ e, uids, char, mode, groupId }) {
tmp._mark = mark?._mark || 0 tmp._mark = mark?._mark || 0
} }
tmp._formatmark = Format.comma(tmp._mark, 1) tmp._formatmark = Format.comma(tmp._mark, 1)
tmp._dmg = dmg?.avg || 0 tmp._dmg = (0 - tmp.dmg.rank) || 0
tmp._star = 5 - tmp.star tmp._star = 5 - tmp.star
list.push(tmp) list.push(tmp)
} }

View File

@ -337,7 +337,8 @@ export default class ProfileRank {
} }
} }
if (value && !lodash.isUndefined(value.score)) { if (value && !lodash.isUndefined(value.score)) {
await redis.zAdd(typeKey, { score: value.score, value: this.uid }) let tmpScore = value.score.toString().replaceAll('%', '')
await redis.zAdd(typeKey, { score: tmpScore, value: this.uid })
} }
if (!lodash.isNumber(rank)) { if (!lodash.isNumber(rank)) {
rank = await redis.zRevRank(typeKey, this.uid) rank = await redis.zRevRank(typeKey, this.uid)

View File

@ -19,7 +19,7 @@ export const details = [{
dmg: ({ talent }, dmg) => dmg(talent.q['威光落雷伤害'], 'q') dmg: ({ talent }, dmg) => dmg(talent.q['威光落雷伤害'], 'q')
}] }]
export const defDmgIdx = 2 export const defDmgIdx = 1
export const mainAttr = 'atk,cpct,cdmg' export const mainAttr = 'atk,cpct,cdmg'
export const buffs = [{ export const buffs = [{

View File

@ -55,7 +55,7 @@ export const details = [{
} }
}] }]
export const defDmgIdx = 2 export const defDmgIdx = 3
export const mainAttr = 'hp,atk,cpct,cdmg,speed' export const mainAttr = 'hp,atk,cpct,cdmg,speed'
export const buffs = [{ export const buffs = [{

View File

@ -29,6 +29,7 @@ export const details = [{
} }
}] }]
export const defDmgIdx = 3
export const mainAttr = 'atk,cpct,cdmg' export const mainAttr = 'atk,cpct,cdmg'
export const buffs = [{ export const buffs = [{

View File

@ -32,6 +32,7 @@ export const details = [{
} }
}] }]
export const defDmgIdx = 1
export const mainAttr = 'atk,cpct,cdmg' export const mainAttr = 'atk,cpct,cdmg'
export const buffs = [{ export const buffs = [{