2022-06-25 23:45:43 +00:00
|
|
|
/*
|
|
|
|
* 角色圣遗物评分详情
|
|
|
|
*
|
|
|
|
* */
|
2022-07-30 21:06:00 +00:00
|
|
|
import lodash from 'lodash'
|
2022-08-18 10:13:42 +00:00
|
|
|
import { Profile, Common } from '../../components/index.js'
|
2022-10-06 22:20:46 +00:00
|
|
|
import { getTargetUid, profileHelp, autoGetProfile } from './ProfileCommon.js'
|
2022-11-23 20:26:07 +00:00
|
|
|
import { Artifact, Character, ProfileArtis } from '../../models/index.js'
|
2022-06-25 23:45:43 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* 角色圣遗物面板
|
|
|
|
* */
|
2022-08-24 01:07:06 +00:00
|
|
|
export async function profileArtis (e) {
|
2022-07-30 21:06:00 +00:00
|
|
|
let { uid, avatar } = e
|
2022-06-25 23:45:43 +00:00
|
|
|
|
2022-06-27 20:46:49 +00:00
|
|
|
let { profile, char, err } = await autoGetProfile(e, uid, avatar, async () => {
|
2022-08-24 01:07:06 +00:00
|
|
|
await profileArtis(e)
|
2022-07-30 21:06:00 +00:00
|
|
|
})
|
2022-06-27 20:46:49 +00:00
|
|
|
|
|
|
|
if (err) {
|
2022-09-30 12:20:04 +00:00
|
|
|
return false
|
2022-06-27 20:46:49 +00:00
|
|
|
}
|
2022-06-25 23:45:43 +00:00
|
|
|
|
2022-08-18 10:13:42 +00:00
|
|
|
if (!profile.hasArtis()) {
|
2022-07-30 21:06:00 +00:00
|
|
|
e.reply('未能获得圣遗物详情,请重新获取面板信息后查看')
|
|
|
|
return true
|
2022-06-27 20:46:49 +00:00
|
|
|
}
|
|
|
|
|
2022-08-18 21:04:31 +00:00
|
|
|
let charCfg = profile.artis.getCharCfg()
|
2022-08-18 10:13:42 +00:00
|
|
|
|
2022-07-30 21:06:00 +00:00
|
|
|
let { attrMap } = Artifact.getMeta()
|
2022-06-25 23:45:43 +00:00
|
|
|
|
2022-11-23 20:26:07 +00:00
|
|
|
let artisDetail = profile.getArtisMark()
|
|
|
|
let artisKeyTitle = ProfileArtis.getArtisKeyTitle()
|
|
|
|
|
2022-07-30 21:06:00 +00:00
|
|
|
// 渲染图像
|
|
|
|
return await Common.render('character/artis-mark', {
|
2022-06-25 23:45:43 +00:00
|
|
|
uid,
|
|
|
|
elem: char.elem,
|
2022-09-03 21:08:57 +00:00
|
|
|
splash: char.getImgs(profile.costume).splash,
|
2022-06-25 23:45:43 +00:00
|
|
|
data: profile,
|
2022-08-31 18:26:36 +00:00
|
|
|
costume: profile.costume ? '2' : '',
|
2022-11-23 20:26:07 +00:00
|
|
|
artisDetail,
|
|
|
|
artisKeyTitle,
|
|
|
|
|
2022-06-25 23:45:43 +00:00
|
|
|
attrMap,
|
|
|
|
charCfg
|
2022-08-24 01:07:06 +00:00
|
|
|
}, { e, scale: 1.3 })
|
2022-06-25 23:45:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 圣遗物列表
|
|
|
|
* */
|
2022-08-24 01:07:06 +00:00
|
|
|
export async function profileArtisList (e) {
|
2022-07-30 21:06:00 +00:00
|
|
|
let uid = await getTargetUid(e)
|
2022-06-25 23:45:43 +00:00
|
|
|
if (!uid) {
|
2022-07-30 21:06:00 +00:00
|
|
|
return true
|
2022-06-25 23:45:43 +00:00
|
|
|
}
|
|
|
|
|
2022-07-30 21:06:00 +00:00
|
|
|
let artis = []
|
|
|
|
let profiles = Profile.getAll(uid) || {}
|
2022-06-25 23:45:43 +00:00
|
|
|
|
|
|
|
if (!profiles || profiles.length === 0) {
|
2022-07-30 21:06:00 +00:00
|
|
|
e.reply('暂无角色圣遗物详情')
|
|
|
|
return true
|
2022-06-25 23:45:43 +00:00
|
|
|
}
|
|
|
|
|
2022-08-18 10:13:42 +00:00
|
|
|
lodash.forEach(profiles || [], (profile) => {
|
|
|
|
let name = profile.name
|
2022-09-03 21:08:57 +00:00
|
|
|
let char = Character.get(name)
|
2022-08-18 10:13:42 +00:00
|
|
|
if (!profile.hasData || !profile.hasArtis()) {
|
2022-09-30 12:20:04 +00:00
|
|
|
return true
|
2022-06-25 23:45:43 +00:00
|
|
|
}
|
2022-08-18 10:13:42 +00:00
|
|
|
let profileArtis = profile.getArtisMark()
|
|
|
|
lodash.forEach(profileArtis.artis, (arti, idx) => {
|
2022-11-23 20:26:07 +00:00
|
|
|
arti.charWeight = profileArtis.charWeight
|
2022-08-18 10:13:42 +00:00
|
|
|
arti.avatar = name
|
2022-09-03 21:08:57 +00:00
|
|
|
arti.side = char.side
|
2022-08-18 10:13:42 +00:00
|
|
|
artis.push(arti)
|
|
|
|
})
|
2022-07-30 21:06:00 +00:00
|
|
|
})
|
2022-06-25 23:45:43 +00:00
|
|
|
|
|
|
|
if (artis.length === 0) {
|
2022-07-30 21:06:00 +00:00
|
|
|
e.reply('请先获取角色面板数据后再查看圣遗物列表...')
|
|
|
|
await profileHelp(e)
|
|
|
|
return true
|
2022-06-25 23:45:43 +00:00
|
|
|
}
|
2022-07-30 21:06:00 +00:00
|
|
|
artis = lodash.sortBy(artis, '_mark')
|
|
|
|
artis = artis.reverse()
|
|
|
|
artis = artis.slice(0, 28)
|
2022-11-23 20:26:07 +00:00
|
|
|
let artisKeyTitle = ProfileArtis.getArtisKeyTitle()
|
2022-06-25 23:45:43 +00:00
|
|
|
|
2022-07-30 21:06:00 +00:00
|
|
|
// 渲染图像
|
2022-08-24 01:07:06 +00:00
|
|
|
return await Common.render('character/artis-list', {
|
2022-06-25 23:45:43 +00:00
|
|
|
save_id: uid,
|
2022-07-30 21:06:00 +00:00
|
|
|
uid,
|
2022-11-23 20:26:07 +00:00
|
|
|
artis,
|
|
|
|
artisKeyTitle
|
2022-08-24 01:07:06 +00:00
|
|
|
}, { e, scale: 1.4 })
|
2022-06-25 23:45:43 +00:00
|
|
|
}
|