2022-06-25 23:45:43 +00:00
|
|
|
/*
|
|
|
|
* 角色圣遗物评分详情
|
|
|
|
*
|
|
|
|
* */
|
2022-07-30 21:06:00 +00:00
|
|
|
import lodash from 'lodash'
|
2023-03-07 17:52:11 +00:00
|
|
|
import { Cfg, Common } from '#miao'
|
2023-02-13 19:47:22 +00:00
|
|
|
import { getTargetUid, profileHelp, getProfileRefresh } from './ProfileCommon.js'
|
2023-03-07 17:52:11 +00:00
|
|
|
import { Artifact, Character, ProfileArtis, Player } from '#miao.models'
|
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
|
2023-02-13 19:47:22 +00:00
|
|
|
let profile = e._profile || await getProfileRefresh(e, avatar)
|
|
|
|
if (!profile) {
|
|
|
|
return true
|
2022-06-27 20:46:49 +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
|
|
|
}
|
2023-02-13 19:47:22 +00:00
|
|
|
let char = profile.char
|
2023-05-29 19:42:13 +00:00
|
|
|
let { game } = char
|
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,
|
2023-02-12 11:56:47 +00:00
|
|
|
splash: profile.costumeSplash,
|
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,
|
2022-11-26 08:12:32 +00:00
|
|
|
charCfg,
|
2023-05-29 19:42:13 +00:00
|
|
|
game,
|
2022-11-26 08:12:32 +00:00
|
|
|
changeProfile: e._profileMsg
|
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 = []
|
2023-02-08 20:55:54 +00:00
|
|
|
let player = Player.create(uid)
|
|
|
|
player.forEachAvatar((avatar) => {
|
|
|
|
let profile = avatar.getProfile()
|
|
|
|
if (!profile) {
|
|
|
|
return true
|
|
|
|
}
|
2022-08-18 10:13:42 +00:00
|
|
|
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()
|
2023-02-05 18:09:30 +00:00
|
|
|
let number = Cfg.get('artisNumber', 28)
|
|
|
|
artis = artis.slice(0, `${number}`)
|
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
|
|
|
}
|