mirror of
https://github.com/yoimiya-kokomi/miao-plugin.git
synced 2024-11-25 09:27:34 +00:00
为#最强排行
、#最高分排行
增加uid排序逻辑
This commit is contained in:
parent
ead88813f0
commit
a96c45eb11
@ -1,6 +1,7 @@
|
||||
import { Character, ProfileRank, ProfileDmg, Avatar } from '../../models/index.js'
|
||||
import { renderProfile } from './ProfileDetail.js'
|
||||
import { Data, Profile, Common, Format } from '../../components/index.js'
|
||||
import lodash from 'lodash'
|
||||
|
||||
export async function groupRank (e) {
|
||||
let groupId = e.group_id
|
||||
@ -137,10 +138,11 @@ async function renderCharRankList ({ e, uids, char, mode, groupId }) {
|
||||
let avatar = new Avatar(profile, uid)
|
||||
let tmp = {
|
||||
uid,
|
||||
isMax: true,
|
||||
isMax: !char,
|
||||
...avatar.getData('id,star,name,sName,level,fetter,cons,weapon,elem,talent,artisSet,imgs'),
|
||||
artisMark: Data.getData(mark, 'mark,markClass')
|
||||
}
|
||||
tmp._mark = mark._mark
|
||||
let dmg = data?.dmg?.data
|
||||
if (dmg && dmg.avg) {
|
||||
let title = dmg.title
|
||||
@ -153,6 +155,7 @@ async function renderCharRankList ({ e, uids, char, mode, groupId }) {
|
||||
title: title,
|
||||
avg: Format.comma(dmg.avg, 1)
|
||||
}
|
||||
tmp._dmg = dmg.avg
|
||||
}
|
||||
if (uid) {
|
||||
let userInfo = await ProfileRank.getUidInfo(uid)
|
||||
@ -170,9 +173,12 @@ async function renderCharRankList ({ e, uids, char, mode, groupId }) {
|
||||
let title
|
||||
if (char) {
|
||||
title = `#${char.name}${mode === 'mark' ? '圣遗物' : ''}排行`
|
||||
list = lodash.sortBy(list, mode === 'mark' ? '_mark' : '_dmg').reverse()
|
||||
} else {
|
||||
title = `#${mode === 'mark' ? '最高分' : '最强'}排行`
|
||||
list = lodash.sortBy(list, 'uid')
|
||||
}
|
||||
|
||||
const rankCfg = await ProfileRank.getGroupCfg(groupId)
|
||||
// 渲染图像
|
||||
return await Common.render('character/rank-profile-list', {
|
||||
|
@ -178,18 +178,19 @@ class Character extends Base {
|
||||
|
||||
// 获取角色插画
|
||||
getImgs (costume = '') {
|
||||
let costumeId = this.checkCostume(costume) ? '2' : ''
|
||||
if (costume === 'super') {
|
||||
costumeId = '0'
|
||||
if (!lodash.isArray(costume)) {
|
||||
costume = [costume, false]
|
||||
}
|
||||
let cacheId = `costume${costumeId}`
|
||||
let costumeCfg = [this.checkCostume(costume[0]) ? '2' : '', costume[1] || 'normal']
|
||||
|
||||
let cacheId = `costume${costumeCfg.join('')}`
|
||||
if (!this._imgs) {
|
||||
this._imgs = {}
|
||||
}
|
||||
if (this._imgs[cacheId]) {
|
||||
return this._imgs[cacheId]
|
||||
}
|
||||
this._imgs[cacheId] = CharImg.getImgs(this.name, costumeId, this.isTraveler ? this.elem : '', this.source === 'amber' ? 'png' : 'webp')
|
||||
this._imgs[cacheId] = CharImg.getImgs(this.name, costumeCfg, this.isTraveler ? this.elem : '', this.source === 'amber' ? 'png' : 'webp')
|
||||
return this._imgs[cacheId]
|
||||
}
|
||||
|
||||
|
@ -94,9 +94,9 @@ export default class ProfileData extends Base {
|
||||
get costume () {
|
||||
let talent = this.talent ? lodash.map(this.talent, (ds) => ds.original).join('') : ''
|
||||
if (this.cons === 6 || ['ACE', 'ACE²'].includes(this.artis?.markClass) || talent === '101010') {
|
||||
return 'super'
|
||||
return [this._costume, 'super']
|
||||
}
|
||||
return this._costume
|
||||
return [this._costume, 'normal']
|
||||
}
|
||||
|
||||
// toJSON 供保存使用
|
||||
|
@ -54,7 +54,10 @@ const CharImg = {
|
||||
},
|
||||
|
||||
// 获取角色的图像资源数据
|
||||
getImgs (name, costumeId = '', travelerElem = '', fileType = 'webp') {
|
||||
getImgs (name, costumeCfg = '', travelerElem = '', fileType = 'webp') {
|
||||
if (!lodash.isArray(costumeCfg)) {
|
||||
costumeCfg = [costumeCfg, 'normal']
|
||||
}
|
||||
let imgs = {}
|
||||
if (!['空', '荧', '旅行者'].includes(name)) {
|
||||
travelerElem = ''
|
||||
@ -72,13 +75,15 @@ const CharImg = {
|
||||
let tAdd = (key, path) => {
|
||||
imgs[key] = `${travelerElem ? tPath : nPath}${path}.${fileType}`
|
||||
}
|
||||
add('face', 'imgs/face', `imgs/face${costumeId}`)
|
||||
add('side', 'imgs/side', `imgs/side${costumeId}`)
|
||||
add('face', 'imgs/face', `imgs/face${costumeCfg[0]}`)
|
||||
add('side', 'imgs/side', `imgs/side${costumeCfg[0]}`)
|
||||
add('gacha', 'imgs/gacha')
|
||||
if (costumeId === '0' && fs.existsSync(`${rPath}/profile/super-character/${name}.webp`)) {
|
||||
if (costumeCfg[1] === 'super' && fs.existsSync(`${rPath}/profile/super-character/${name}.webp`)) {
|
||||
imgs.splash = `profile/super-character/${name}.webp`
|
||||
} else if (costumeCfg[1] === 'super' && fs.existsSync(`${rPath}/${nPath}/imgs/splash0.webp`)) {
|
||||
imgs.splash = `${nPath}imgs/splash0.webp`
|
||||
} else {
|
||||
add('splash', 'imgs/splash', `imgs/splash${costumeId}`)
|
||||
add('splash', 'imgs/splash', `imgs/splash${costumeCfg[0]}`)
|
||||
}
|
||||
tAdd('card', 'imgs/card')
|
||||
tAdd('banner', 'imgs/banner')
|
||||
|
@ -59,7 +59,7 @@
|
||||
<div class="info"> {{ds.uid}}</div>
|
||||
</div>
|
||||
|
||||
<div class="char-talent">
|
||||
<div class="char-talent elem-{{ds.elem}}">
|
||||
{{set talent = ds.talent }}
|
||||
{{set keys = ['a','e','q'] }}
|
||||
{{each keys key}}
|
||||
|
Loading…
Reference in New Issue
Block a user