修复#角色详情 天赋图标及未装备圣遗物的展示异常

This commit is contained in:
yoimiya-kokomi 2022-04-17 03:39:45 +08:00
parent c8a0887c66
commit 664186696c
5 changed files with 46 additions and 12 deletions

View File

@ -62,11 +62,11 @@ export async function character(e, { render, User }) {
} }
let mode = 'card'; let mode = 'card';
if (/详情$/.test(msg)) { if (/(详情|详细|面板|面版)$/.test(msg)) {
mode = 'profile'; mode = 'profile';
} }
let name = msg.replace(/#|老婆|老公|详情|[1|2|5][0-9]{8}/g, "").trim(); let name = msg.replace(/#|老婆|老公|详情|详细|面板|面版|[1|2|5][0-9]{8}/g, "").trim();
let char = Character.get(name); let char = Character.get(name);
if (!char) { if (!char) {
return false; return false;
@ -416,7 +416,7 @@ export async function getProfile(e) {
return true; return true;
} }
let data = await Profile.request(selfUser.uid, e); let data = await Profile.request(selfUser.uid, e);
if(!data){ if (!data) {
return true; return true;
} }
if (!data.chars) { if (!data.chars) {
@ -577,8 +577,28 @@ export async function renderProfile(e, char, render) {
let reliquaries = [], totalMark = 0; let reliquaries = [], totalMark = 0;
lodash.forEach(avatar.reliquaries, (ds, idx) => { let posIdx = {
let arti = profile.artis[`arti${idx + 1}`]; "生之花": {
idx: 1
},
"死之羽": {
idx: 2
},
"时之沙": {
idx: 3
},
"空之杯": {
idx: 4
},
"理之冠": {
idx: 5
}
};
lodash.forEach(avatar.reliquaries, (ds) => {
let pos = ds.pos_name;
let arti = profile.artis[`arti${posIdx[pos].idx}`];
if (arti) { if (arti) {
let mark = Profile.getArtiMark(arti.attrs, ds.pos_name === "理之冠" ? arti.main : false); let mark = Profile.getArtiMark(arti.attrs, ds.pos_name === "理之冠" ? arti.main : false);
totalMark += mark; totalMark += mark;
@ -587,8 +607,15 @@ export async function renderProfile(e, char, render) {
ds.main = Profile.formatArti(arti.main); ds.main = Profile.formatArti(arti.main);
ds.attrs = Profile.formatArti(arti.attrs); ds.attrs = Profile.formatArti(arti.attrs);
} }
reliquaries.push(ds); posIdx[pos].data = ds;
}) })
lodash.forEach(posIdx, (ds) => {
if (ds && ds.data) {
reliquaries.push(ds.data);
} else {
reliquaries.push({});
}
});
let base64 = await render("character", "detail", { let base64 = await render("character", "detail", {
save_id: uid, save_id: uid,

View File

@ -273,6 +273,9 @@ let Profile = {
return ret; return ret;
} }
let title = ds[0], val = ds[1]; let title = ds[0], val = ds[1];
if (!title || title === "undefined") {
return [];
}
if (/伤害加成/.test(title) && val < 1) { if (/伤害加成/.test(title) && val < 1) {
val = Format.pct(val * 100); val = Format.pct(val * 100);
} else if (/伤害加成|大|暴|充能|治疗/.test(title)) { } else if (/伤害加成|大|暴|充能|治疗/.test(title)) {

View File

@ -11,7 +11,7 @@ export { character, wife, consStat, abyssPct, wiki, updateRes, sysCfg, help, get
let rule = { let rule = {
character: { character: {
reg: "^#(喵喵)?(.*)(详情)?$", reg: "^#(喵喵)?(.*)(详情|详细|面板|面版)?$",
describe: "【#角色】角色详情", describe: "【#角色】角色详情",
}, },
wife: { wife: {
@ -35,7 +35,7 @@ let rule = {
describe: "【#帮助】 #喵喵帮助", describe: "【#帮助】 #喵喵帮助",
}, },
getProfile: { getProfile: {
reg: "^#\s*获取游戏角色详情\s*$", reg: "^#\s*(获取|更新)(游戏|角色)*(详情|详细|面板|面版)\s*$",
describe: "【#角色】 获取游戏橱窗详情数据", describe: "【#角色】 获取游戏橱窗详情数据",
}, },
...adminRule ...adminRule

View File

@ -160,13 +160,17 @@ body {
z-index: 90; z-index: 90;
} }
.talent-icon img { .talent-icon img,
.talent-icon .talent-icon-img {
width: 46%; width: 46%;
height: 46%; height: 46%;
position: absolute; position: absolute;
top: 50%; top: 50%;
left: 50%; left: 50%;
margin: -22% 0 0 -23%; margin: -22% 0 0 -23%;
background-size: contain;
background-repeat: no-repeat;
background-position: center;
} }
.talent-icon span { .talent-icon span {

View File

@ -20,7 +20,7 @@
<div class="talent-icon <div class="talent-icon
{{talent[key].level_current > talent[key].level_original ? `talent-plus`:``}} {{talent[key].level_current > talent[key].level_original ? `talent-plus`:``}}
{{talent[key].level_original == 10 ? `talent-crown`:``}}"> {{talent[key].level_original == 10 ? `talent-crown`:``}}">
<img src="{{_res_path}}/meta/character/{{name}}/talent_{{key}}.png"/> <div class="talent-icon-img" style="background-image:url({{_res_path}}/meta/character/{{name}}/talent_{{key}}.png)"></div>
<span>{{talent[key].level_current}}</span> <span>{{talent[key].level_current}}</span>
</div> </div>
</div> </div>
@ -40,7 +40,7 @@
<div class="char-cons"> <div class="char-cons">
{{each cons con idx}} {{each cons con idx}}
<div class="cons-item"> <div class="cons-item">
<div class="talent-icon {{idx*1>avatar.actived_constellation_num*1 ? 'off':''}}"> <div class="talent-icon {{idx * 1 > avatar.actived_constellation_num * 1 ? 'off' : '' }}">
<img src="{{_res_path}}/meta/character/{{name}}/cons_{{idx}}.png"/> <img src="{{_res_path}}/meta/character/{{name}}/cons_{{idx}}.png"/>
</div> </div>
</div> </div>
@ -59,7 +59,7 @@
</div> </div>
{{each reliquaries ds}} {{each reliquaries ds}}
<div class="item arti"> <div class="item arti">
{{if ds.name}} {{if ds.name && ds.main && ds.main[0] && ds.main[0]!="undefined"}}
<div class="arti-icon"> <div class="arti-icon">
<img src="{{_sys_res_path}}/genshin/logo/reliquaries/{{ds.name}}.png"/> <img src="{{_sys_res_path}}/genshin/logo/reliquaries/{{ds.name}}.png"/>
<span>+{{ds.level}}</span> <span>+{{ds.level}}</span>