新增*遗器列表

This commit is contained in:
Aluxes 2024-04-04 00:35:06 +08:00
parent b72dfe187e
commit 3ac9ef6aaf
No known key found for this signature in database
GPG Key ID: 6696152F9C003087
4 changed files with 25 additions and 12 deletions

View File

@ -66,7 +66,7 @@ app.reg({
artisList: { artisList: {
name: '面板圣遗物列表', name: '面板圣遗物列表',
fn: profileArtisList, fn: profileArtisList,
rule: /^#圣遗物列表\s*(\d{9,10})?$/ rule: /^#(星铁|原神)?(圣遗物|遗器)列表\s*(\d{9,10})?$/
}, },
profileStat: { profileStat: {

View File

@ -51,20 +51,23 @@ export async function profileArtis (e) {
* 圣遗物列表 * 圣遗物列表
* */ * */
export async function profileArtisList (e) { export async function profileArtisList (e) {
let game = /星铁|遗器/.test(e.msg) ? 'sr' : 'gs'
e.isSr = game
let uid = await getTargetUid(e) let uid = await getTargetUid(e)
if (!uid) { if (!uid) {
return true return true
} }
let artis = [] let artis = []
let player = Player.create(uid) let player = Player.create(uid, game)
player.forEachAvatar((avatar) => { player.forEachAvatar((avatar) => {
let profile = avatar.getProfile() let profile = avatar.getProfile()
if (!profile) { if (!profile) {
return true return true
} }
let name = profile.name let name = profile.name
let char = Character.get(name) let char = Character.get(name, game)
if (!profile.hasData || !profile.hasArtis()) { if (!profile.hasData || !profile.hasArtis()) {
return true return true
} }
@ -78,7 +81,8 @@ export async function profileArtisList (e) {
}) })
if (artis.length === 0) { if (artis.length === 0) {
e.reply('请先获取角色面板数据后再查看圣遗物列表...') let artisName = game === 'gs' ? '圣遗物' : '遗器'
e.reply(`请先获取角色面板数据后再查看${artisName}列表...`)
await profileHelp(e) await profileHelp(e)
return true return true
} }
@ -86,7 +90,7 @@ export async function profileArtisList (e) {
artis = artis.reverse() artis = artis.reverse()
let number = Cfg.get('artisNumber', 28) let number = Cfg.get('artisNumber', 28)
artis = artis.slice(0, `${number}`) artis = artis.slice(0, `${number}`)
let artisKeyTitle = Artifact.getArtisKeyTitle() let artisKeyTitle = Artifact.getArtisKeyTitle(game)
// 渲染图像 // 渲染图像
return await Common.render('character/artis-list', { return await Common.render('character/artis-list', {

View File

@ -1,20 +1,24 @@
.container { .container {
width: 790px; width: 790px;
} }
.uid { .uid {
margin: 20px 10px 10px; margin: 20px 10px 10px;
text-shadow: 0 0 3px #000, 2px 2px 4px rgba(0, 0, 0, 0.7); text-shadow: 0 0 3px #000, 2px 2px 4px rgba(0, 0, 0, 0.7);
text-align: right; text-align: right;
color: #fff; color: #fff;
} }
.artis { .artis {
width: 790px; width: 790px;
} }
.artis .item { .artis .item {
height: 190px; height: 190px;
margin-bottom: 10px; margin-bottom: 10px;
overflow: hidden; overflow: hidden;
} }
.artis .item .avatar { .artis .item .avatar {
position: absolute; position: absolute;
right: 0; right: 0;
@ -25,13 +29,16 @@
overflow: hidden; overflow: hidden;
z-index: 3; z-index: 3;
} }
.artis .item.arti .arti-icon { .artis .item.arti .arti-icon {
right: 10px; right: 10px;
width: 75px; width: 75px;
height: 75px; height: 75px;
} }
.artis .item .avatar img { .artis .item .avatar img {
max-width: 100%; max-width: 100%;
max-height: 100%; max-height: 100%;
} }
/*# sourceMappingURL=artis-list.css.map */ /*# sourceMappingURL=artis-list.css.map */

View File

@ -1,8 +1,8 @@
{{extend elemLayout}} {{extend elemLayout}}
{{block 'css'}} {{block 'css'}}
<link rel="stylesheet" type="text/css" href="{{_res_path}}/character/profile-detail.css"/> <link rel="stylesheet" type="text/css" href="{{_res_path}}/character/profile-detail.css" />
<link rel="stylesheet" type="text/css" href="{{_res_path}}/character/artis-list.css"/> <link rel="stylesheet" type="text/css" href="{{_res_path}}/character/artis-list.css" />
{{/block}} {{/block}}
{{block 'main'}} {{block 'main'}}
@ -14,7 +14,7 @@
<div class="item arti"> <div class="item arti">
{{if ds && ds.name && ds.main && ds.main.key && ds.main.key!="undefined"}} {{if ds && ds.name && ds.main && ds.main.key && ds.main.key!="undefined"}}
<div class="avatar"> <div class="avatar">
<img src="{{_res_path}}{{ds.side}}" onerror="whenError(this)"/> <img src="{{_res_path}}{{ds.side}}" onerror="whenError(this)" />
</div> </div>
<div class="arti-icon"> <div class="arti-icon">
<div class="img" style="background-image:url({{_res_path}}{{ds.img}})"></div> <div class="img" style="background-image:url({{_res_path}}{{ds.img}})"></div>
@ -24,14 +24,16 @@
<span class="mark mark-{{ds.markClass}}"><span>{{ds.mark}}分</span> - {{ds.markClass}}</span> <span class="mark mark-{{ds.markClass}}"><span>{{ds.mark}}分</span> - {{ds.markClass}}</span>
</div> </div>
<ul class="detail attr"> <ul class="detail attr">
<li class="arti-main"><span class="title">{{artisKeyTitle[ds.main?.key]}}</span><span class="val">+{{ds.main?.value}}</span> <li class="arti-main"><span class="title">{{artisKeyTitle[ds.main?.key]}}</span><span
class="val">+{{ds.main?.value}}</span>
</li> </li>
{{each ds.attrs attr}} {{each ds.attrs attr}}
{{if attr && attr.key}} {{if attr && attr.key}}
<li class="{{ds.charWeight[attr.key]*1 > 79.9 ?`great`:(ds.charWeight[attr.key]*1>0 ? `useful`:`nouse`)}}"> <li class="{{ds.charWeight[attr.key]*1 > 79.9 ?`great`:(ds.charWeight[attr.key]*1>0 ? `useful`:`nouse`)}}">
<span class="title">{{if attr.eff}}<i class="eff">{{attr.eff || ''}}</i>{{/if}}{{if attr.upNum}}<i <span class="title">{{if attr.eff}}<i class="eff">{{attr.eff || ''}}</i>{{/if}}{{if attr.upNum}}<i
class="up-num up-{{attr.upNum}}"></i>{{/if}}{{artisKeyTitle[attr.key]}}</span> class="up-num up-{{attr.upNum}}"></i>{{/if}}{{artisKeyTitle[attr.key]}}</span>
<span class="val">+{{attr.value}}</span></li> <span class="val">+{{attr.value}}</span>
</li>
{{/if}} {{/if}}
{{/each}} {{/each}}
</ul> </ul>
@ -40,4 +42,4 @@
{{/each}} {{/each}}
</div> </div>
</div> </div>
{{/block}} {{/block}}