mirror of
https://github.com/yoimiya-kokomi/miao-plugin.git
synced 2024-11-16 04:35:42 +00:00
add basic support for rank of star rail (#640)
This commit is contained in:
parent
d6ee87bb6f
commit
b890097a59
@ -21,7 +21,7 @@ export async function groupRank (e) {
|
||||
let mode = /(分|圣遗物|评分|ACE)/.test(msg) ? 'mark' : 'dmg'
|
||||
mode = /(词条)/.test(msg) ? 'valid' : mode
|
||||
mode = /(双爆)/.test(msg) ? 'crit' : mode
|
||||
let name = msg.replace(/(#|最强|最高分|第一|词条|双爆|极限|最高|最多|最牛|圣遗物|评分|群内|群|排名|排行|面板|面版|详情|榜)/g, '')
|
||||
let name = msg.replace(/(#|星铁|最强|最高分|第一|词条|双爆|极限|最高|最多|最牛|圣遗物|评分|群内|群|排名|排行|面板|面版|详情|榜)/g, '')
|
||||
let char = Character.get(name)
|
||||
if (!char) {
|
||||
// 名字不存在或不为列表模式,则返回false
|
||||
@ -29,6 +29,9 @@ export async function groupRank (e) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
if (/星铁/.test(msg) || char.isSr) {
|
||||
e.isSr = true
|
||||
}
|
||||
// 对鲸泽佬的极限角色文件增加支持
|
||||
if (type === 'super') {
|
||||
let player = Player.create(100000000)
|
||||
@ -74,7 +77,11 @@ export async function groupRank (e) {
|
||||
if (uids.length > 0) {
|
||||
return renderCharRankList({ e, uids, char, mode, groupId })
|
||||
} else {
|
||||
e.reply('暂无排名:请通过【#面板】查看角色面板以更新排名信息...')
|
||||
if (e.isSr){
|
||||
e.reply('暂无排名:请通过【*面板】查看角色面板以更新排名信息...')
|
||||
} else {
|
||||
e.reply('暂无排名:请通过【#面板】查看角色面板以更新排名信息...')
|
||||
}
|
||||
}
|
||||
}
|
||||
return true
|
||||
@ -169,7 +176,7 @@ async function renderCharRankList ({ e, uids, char, mode, groupId }) {
|
||||
let list = []
|
||||
for (let ds of uids) {
|
||||
let uid = ds.uid || ds.value
|
||||
let player = Player.create(uid)
|
||||
let player = Player.create(uid, e.isSr ? 'sr' : 'gs')
|
||||
let avatar = player.getAvatar(ds.charId || char.id)
|
||||
if (!avatar) {
|
||||
continue
|
||||
@ -231,16 +238,26 @@ async function renderCharRankList ({ e, uids, char, mode, groupId }) {
|
||||
}
|
||||
let title
|
||||
if (char) {
|
||||
let modeTitleMap = {
|
||||
dmg: '',
|
||||
mark: '圣遗物评分',
|
||||
crit: '双爆副词条',
|
||||
valid: '加权有效词条'
|
||||
let modeTitleMap = {}
|
||||
if (e.isSr) {
|
||||
modeTitleMap = {
|
||||
dmg: '',
|
||||
mark: '遗器评分',
|
||||
crit: '双爆副词条',
|
||||
valid: '加权有效词条'
|
||||
}
|
||||
} else {
|
||||
modeTitleMap = {
|
||||
dmg: '',
|
||||
mark: '圣遗物评分',
|
||||
crit: '双爆副词条',
|
||||
valid: '加权有效词条'
|
||||
}
|
||||
}
|
||||
title = `#${char.name}${modeTitleMap[mode]}排行`
|
||||
title = `${e.isSr ? '*' : '#'}${char.name}${modeTitleMap[mode]}排行`
|
||||
list = lodash.sortBy(list, mode === 'dmg' ? '_dmg' : '_mark').reverse()
|
||||
} else {
|
||||
title = `#${mode === 'mark' ? '最高分' : '最强'}排行`
|
||||
title = `${e.isSr ? '*' : '#'}${mode === 'mark' ? '最高分' : '最强'}排行`
|
||||
list = lodash.sortBy(list, ['uid', '_star', 'id'])
|
||||
}
|
||||
|
||||
@ -248,6 +265,7 @@ async function renderCharRankList ({ e, uids, char, mode, groupId }) {
|
||||
// 渲染图像
|
||||
return await Common.render('character/rank-profile-list', {
|
||||
save_id: char.id,
|
||||
game: e.isSr ? 'sr' : 'gs',
|
||||
list,
|
||||
title,
|
||||
elem: char.elem,
|
||||
|
@ -4,6 +4,8 @@
|
||||
<link rel="stylesheet" type="text/css" href="{{_res_path}}/character/rank-profile-list.css"/>
|
||||
{{/block}}
|
||||
|
||||
{{set talentMap = game === 'sr' ? {a: '普攻', e: '战技', t:'天赋', q: '爆发'} : {a: '普攻', e: '战技', q: '爆发'} }}
|
||||
{{set gameHash = game === 'gs' ? '#':'*' }}
|
||||
|
||||
{{block 'main'}}
|
||||
<div class="head-box">
|
||||
@ -35,7 +37,7 @@
|
||||
</li>
|
||||
<li>
|
||||
<strong>排名范围:</strong>
|
||||
本群内 / 时间点:{{rankCfg.time}} 后 / 在群内主动通过 #面板 命令查看过的面板数据
|
||||
本群内 / 时间点:{{rankCfg.time}} 后 / 在群内主动通过 {{gameHash}}面板 命令查看过的面板数据
|
||||
</li>
|
||||
{{if rankCfg?.limitTxt !== '无限制'}}
|
||||
<li>
|
||||
@ -79,16 +81,15 @@
|
||||
</div>
|
||||
|
||||
<div class="char-talent elem-{{ds.elem}}">
|
||||
{{set talent = ds.talent }}
|
||||
{{set keys = ['a','e','q'] }}
|
||||
{{each keys key}}
|
||||
{{each talentMap tName key}}
|
||||
{{set talent = ds.talent[key] || {} }}
|
||||
<div class="talent-item">
|
||||
<div class="talent-icon
|
||||
{{talent[key]?.level > talent[key]?.original ? `talent-plus`:``}}
|
||||
{{talent[key]?.original >= 10 ? `talent-crown`:``}}">
|
||||
{{talent.level > talent.original ? `talent-plus`:``}}
|
||||
{{talent.original >= 10 ? `talent-crown`:``}}">
|
||||
<div class="talent-icon-img"
|
||||
style="background-image:url({{_res_path}}{{ds.imgs[key]}})"></div>
|
||||
<span>{{talent[key]?.level}}</span>
|
||||
<span>{{talent.level}}</span>
|
||||
</div>
|
||||
</div>
|
||||
{{/each}}
|
||||
|
Loading…
Reference in New Issue
Block a user