mirror of
https://github.com/yoimiya-kokomi/miao-plugin.git
synced 2024-11-22 06:58:24 +00:00
#角色面板 功能的圣遗物评分目前会根据角色进行词条选择。
同时评价标准也会基于可用词条进行动态调整,会给出更精准的评分
This commit is contained in:
parent
fe4b92abde
commit
f3d274c1f0
@ -4,6 +4,7 @@ import { Character } from "../components/models.js"
|
||||
import { Cfg } from "../components/index.js";
|
||||
import Profile from "../components/Profile.js";
|
||||
import Format from "../components/Format.js"
|
||||
import Reliquaries from "../components/models/Reliquaries.js";
|
||||
import fs from "fs";
|
||||
import sizeOf from "image-size";
|
||||
|
||||
@ -575,7 +576,6 @@ export async function renderProfile(e, char, render) {
|
||||
let avatar = await getAvatar(e, char, MysApi);
|
||||
let talent = await getTalent(e, avatar);
|
||||
|
||||
let reliquaries = [], totalMark = 0;
|
||||
|
||||
let posIdx = {
|
||||
"生之花": {
|
||||
@ -595,15 +595,21 @@ export async function renderProfile(e, char, render) {
|
||||
}
|
||||
};
|
||||
|
||||
let reliquaries = [], totalMark = 0, totalMaxMark = 0;
|
||||
|
||||
const maxMark = Reliquaries.getMaxMark(char.name);
|
||||
let { titles: usefulTitles, mark: usefulMark } = Reliquaries.getUseful(avatar.name);
|
||||
|
||||
lodash.forEach(avatar.reliquaries, (ds) => {
|
||||
let pos = ds.pos_name;
|
||||
let arti = profile.artis[`arti${posIdx[pos].idx}`];
|
||||
if (arti) {
|
||||
let mark = Profile.getArtiMark(arti.attrs, ds.pos_name === "理之冠" ? arti.main : false);
|
||||
let mark = Reliquaries.getMark(avatar.name, arti.attrs);
|
||||
let maxMark = Reliquaries.getMaxMark(char.name, arti.main[0] || "");
|
||||
totalMark += mark;
|
||||
totalMaxMark += maxMark;
|
||||
ds.mark = c(mark, 1);
|
||||
ds.markType = mark > 45 ? (mark >= 50 ? "high" : "good") : "normal";
|
||||
ds.markType = Reliquaries.getMarkScore(mark, maxMark);
|
||||
ds.main = Profile.formatArti(arti.main);
|
||||
ds.attrs = Profile.formatArti(arti.attrs);
|
||||
}
|
||||
@ -617,6 +623,7 @@ export async function renderProfile(e, char, render) {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
let base64 = await render("character", "detail", {
|
||||
save_id: uid,
|
||||
uid: uid,
|
||||
@ -628,8 +635,12 @@ export async function renderProfile(e, char, render) {
|
||||
name: char.name,
|
||||
elem: char.elem,
|
||||
reliquaries,
|
||||
totalMark,
|
||||
totalMark: c(totalMark, 1),
|
||||
totalMaxMark,
|
||||
markScore: Reliquaries.getMarkScore(totalMark, totalMaxMark),
|
||||
weapon: avatar.weapon,
|
||||
usefulTitles,
|
||||
usefulMark,
|
||||
talentMap: { a: "普攻", e: "战技", q: "爆发" },
|
||||
cfgScale: Cfg.scale(1.5)
|
||||
}, "png");
|
||||
|
@ -3,6 +3,7 @@ import fetch from "node-fetch";
|
||||
import lodash from "lodash";
|
||||
import Format from "./Format.js";
|
||||
import Character from "./models/Character.js";
|
||||
import Reliquaries from "./models/Reliquaries.js";
|
||||
|
||||
const _path = process.cwd();
|
||||
const cfgPath = `${_path}/plugins/miao-plugin/config.js`;
|
||||
@ -67,6 +68,7 @@ const artifactMap = {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
let Data = {
|
||||
getData(uid, data) {
|
||||
let ret = {
|
||||
@ -293,19 +295,7 @@ let Profile = {
|
||||
return [title, val];
|
||||
},
|
||||
getArtiMark(data, ds) {
|
||||
let mark = {
|
||||
"暴击率": 2,
|
||||
"暴击伤害": 1,
|
||||
"元素精通": 0.25,
|
||||
"大攻击": 1,
|
||||
"大生命": 0.86,
|
||||
"大防御": 0.7,
|
||||
"小攻击": 0.12,
|
||||
"小生命": 0.014,
|
||||
"小防御": 0.18,
|
||||
"充能效率": 0.65
|
||||
};
|
||||
|
||||
Reliquaries.getMark(data)
|
||||
let total = 0;
|
||||
lodash.forEach(data, (ret) => {
|
||||
if (ret[0] && ret[1]) {
|
||||
|
82
components/models/Reliquaries.js
Normal file
82
components/models/Reliquaries.js
Normal file
@ -0,0 +1,82 @@
|
||||
import { attrMark, maxMark, attrMap, usefulAttr } from "../../resources/meta/reliquaries/reliquaries-mark.js";
|
||||
import lodash from "lodash";
|
||||
|
||||
let Reliquaries = {
|
||||
getUseful(char) {
|
||||
let attrKey = usefulAttr[char] || "";
|
||||
attrKey = attrKey.split(",");
|
||||
let attrTitles = [], retMap = {};
|
||||
lodash.forEach(attrKey, (key) => {
|
||||
let attr = attrMap[key];
|
||||
if (attr) {
|
||||
attrTitles.push(attr.title);
|
||||
lodash.forEach(attr.attr.split(","), (k) => {
|
||||
retMap[k] = attrMark[k];
|
||||
})
|
||||
}
|
||||
})
|
||||
return {
|
||||
titles: attrTitles,
|
||||
mark: retMap
|
||||
}
|
||||
},
|
||||
|
||||
getMaxMark(char, banTitle = "") {
|
||||
let markMap = Reliquaries.getUseful(char).mark;
|
||||
|
||||
let markList = [];
|
||||
|
||||
lodash.forEach(markMap, (m, title) => {
|
||||
if (title !== banTitle) {
|
||||
markList.push(maxMark[title]);
|
||||
}
|
||||
});
|
||||
|
||||
markList = markList.sort((a, b) => b - a);
|
||||
let retMaxMark = markList[0];
|
||||
lodash.forEach(markList, (mark, idx) => {
|
||||
if (idx > 0 && idx < 4) {
|
||||
retMaxMark += mark / 6;
|
||||
}
|
||||
});
|
||||
|
||||
return retMaxMark;
|
||||
|
||||
},
|
||||
|
||||
getMark(char = "", data = []) {
|
||||
let total = 0;
|
||||
let markMap = Reliquaries.getUseful(char).mark;
|
||||
lodash.forEach(data, (ret) => {
|
||||
let title = ret[0], val = ret[1];
|
||||
if (title && val) {
|
||||
if (markMap[title]) {
|
||||
total += markMap[title] * val;
|
||||
}
|
||||
}
|
||||
})
|
||||
return total;
|
||||
},
|
||||
|
||||
getMarkScore(mark, maxMark) {
|
||||
let pct = mark / maxMark;
|
||||
let scoreMap = [
|
||||
["D", 0.15],
|
||||
["C", 0.25],
|
||||
["B", 0.35],
|
||||
["A", 0.45],
|
||||
["S", 0.55],
|
||||
["SS", 0.65],
|
||||
["SSS", 0.75],
|
||||
["ACE", 0.85]
|
||||
];
|
||||
|
||||
for (let idx = 0; idx < scoreMap.length; idx++) {
|
||||
if (pct < scoreMap[idx][1]) {
|
||||
return scoreMap[idx][0];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default Reliquaries;
|
@ -1,12 +1,10 @@
|
||||
|
||||
body {
|
||||
width: 600px;
|
||||
height: 1000px;
|
||||
}
|
||||
|
||||
.container {
|
||||
width: 600px;
|
||||
height: 1030px;
|
||||
padding: 0;
|
||||
background-size: cover;
|
||||
overflow: hidden;
|
||||
@ -18,7 +16,7 @@ body {
|
||||
position: absolute;
|
||||
left: 8px;
|
||||
top: 115px;
|
||||
bottom: 470px;
|
||||
height: 410px;
|
||||
right: 8px;
|
||||
box-shadow: 0 0 2px 0 #fff;
|
||||
border-radius: 5px;
|
||||
@ -296,13 +294,14 @@ body {
|
||||
background-image: url(../common/bg/bg-pyro.jpg);
|
||||
}
|
||||
|
||||
|
||||
.artis {
|
||||
display: flex;
|
||||
width: 600px;
|
||||
flex-wrap: wrap;
|
||||
margin-top: 40px;
|
||||
margin-bottom: 5px;
|
||||
padding: 5px;
|
||||
margin-top: 40px;
|
||||
}
|
||||
|
||||
.artis .item {
|
||||
@ -365,12 +364,19 @@ body {
|
||||
font-family: Number, YS;
|
||||
}
|
||||
|
||||
.artis .head span.high-lvl {
|
||||
.mark-ACE {
|
||||
color: #e85656;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.mark-SSS,
|
||||
.mark-SS {
|
||||
color: #ffe699;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.artis .head span.good-lvl {
|
||||
.mark-S,
|
||||
.mark-A {
|
||||
color: #d699ff;
|
||||
font-weight: bold;
|
||||
}
|
||||
@ -396,6 +402,11 @@ body {
|
||||
display: table;
|
||||
}
|
||||
|
||||
|
||||
.artis ul.detail li.nouse span {
|
||||
color: #888;
|
||||
}
|
||||
|
||||
.artis ul.detail li.arti-main {
|
||||
font-size: 16px;
|
||||
padding: 8px 3px;
|
||||
@ -420,7 +431,6 @@ body {
|
||||
font-family: Number;
|
||||
}
|
||||
|
||||
|
||||
.artis .weapon .star {
|
||||
height: 20px;
|
||||
width: 100px;
|
||||
@ -450,14 +460,16 @@ body {
|
||||
|
||||
.artis .weapon {
|
||||
overflow: hidden;
|
||||
height: 100px;
|
||||
}
|
||||
|
||||
.artis .weapon img {
|
||||
width: 185px;
|
||||
height: 185px;
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
top: 0;
|
||||
left: 0;
|
||||
position: absolute;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.artis .weapon .head {
|
||||
@ -492,6 +504,7 @@ body {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
|
||||
.artis .weapon .affix-1 {
|
||||
box-shadow: 0 0 4px 0 #a3a3a3 inset;
|
||||
background: #ebebebaa;
|
||||
@ -517,6 +530,37 @@ body {
|
||||
background: #fff6dd;
|
||||
}
|
||||
|
||||
.artis .stat {
|
||||
height: 100px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.artis .stat {
|
||||
display: table-row;
|
||||
padding: 18px 10px;
|
||||
display: table;
|
||||
}
|
||||
|
||||
.artis .stat > div {
|
||||
display: table-cell;
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.artis .stat strong {
|
||||
display: block;
|
||||
height: 40px;
|
||||
font-size: 30px;
|
||||
font-family: Number;
|
||||
line-height: 40px;
|
||||
}
|
||||
|
||||
|
||||
.artis .stat span {
|
||||
font-size: 13px;
|
||||
line-height: 20px;
|
||||
color: #bbb;
|
||||
}
|
||||
|
||||
.char-优菈 .main-pic {
|
||||
margin-left: -175px;
|
||||
|
@ -20,7 +20,8 @@
|
||||
<div class="talent-icon
|
||||
{{talent[key].level_current > talent[key].level_original ? `talent-plus`:``}}
|
||||
{{talent[key].level_original == 10 ? `talent-crown`:``}}">
|
||||
<div class="talent-icon-img" style="background-image:url({{_res_path}}/meta/character/{{name}}/talent_{{key}}.png)"></div>
|
||||
<div class="talent-icon-img"
|
||||
style="background-image:url({{_res_path}}/meta/character/{{name}}/talent_{{key}}.png)"></div>
|
||||
<span>{{talent[key].level_current}}</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -47,14 +48,21 @@
|
||||
{{/each}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="artis">
|
||||
<div class="item weapon">
|
||||
<img src="{{_sys_res_path}}/genshin/logo/weapon/{{weapon.name}}.png"/>
|
||||
<div class="head">
|
||||
<strong>{{weapon.name}}</strong>
|
||||
<div class="star star-{{weapon.rarity}}"></div>
|
||||
<span>Lv.{{weapon.level}} <span
|
||||
class="affix affix-{{weapon.affix_level}}">精{{weapon.affix_level}}</span></span>
|
||||
<div>
|
||||
<div class="item weapon">
|
||||
<img src="{{_sys_res_path}}/genshin/logo/weapon/{{weapon.name}}.png"/>
|
||||
<div class="head">
|
||||
<strong>{{weapon.name}}</strong>
|
||||
<div class="star star-{{weapon.rarity}}"></div>
|
||||
<span>Lv.{{weapon.level}} <span
|
||||
class="affix affix-{{weapon.affix_level}}">精{{weapon.affix_level}}</span></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item stat">
|
||||
<div ><strong class="mark-{{markScore}}">{{markScore}}</strong><span>圣遗物评级</span></div>
|
||||
<div><strong>{{totalMark}}</strong><span>圣遗物总分</span></div>
|
||||
</div>
|
||||
</div>
|
||||
{{each reliquaries ds}}
|
||||
@ -66,13 +74,14 @@
|
||||
</div>
|
||||
<div class="head">
|
||||
<strong>{{ds.name}}</strong>
|
||||
<span>{{ds.pos_name}} - <span class="mark {{ds.markType}}-lvl">{{ds.mark}}分</span></span>
|
||||
<span class="mark mark-{{ds.markType}}"><span>{{ds.mark}}分</span> - {{ds.markType}}</span>
|
||||
</div>
|
||||
<ul class="detail">
|
||||
<li class="arti-main"><span class="title">{{ds.main[0]}}</span><span class="val">+{{ds.main[1]}}</span></li>
|
||||
{{each ds.attrs attr}}
|
||||
{{if attr[0]}}
|
||||
<li><span class="title">{{attr[0]}}</span><span class="val">+{{attr[1]}}</span></li>
|
||||
<li class="{{usefulMark[attr[0]] ? `useful`:`nouse`}}"><span class="title">{{attr[0]}}</span><span
|
||||
class="val">+{{attr[1]}}</span></li>
|
||||
{{/if}}
|
||||
{{/each}}
|
||||
</ul>
|
||||
|
108
resources/meta/reliquaries/reliquaries-mark.js
Normal file
108
resources/meta/reliquaries/reliquaries-mark.js
Normal file
@ -0,0 +1,108 @@
|
||||
export const attrMark = {
|
||||
"暴击率": 2,
|
||||
"暴击伤害": 1,
|
||||
"元素精通": 0.25,
|
||||
"大攻击": 1,
|
||||
"大生命": 0.86,
|
||||
"大防御": 0.7,
|
||||
"小攻击": 0.12,
|
||||
"小生命": 0.014,
|
||||
"小防御": 0.18,
|
||||
"充能效率": 0.65
|
||||
}
|
||||
|
||||
export const maxMark = {
|
||||
"暴击率": 46.6,
|
||||
"暴击伤害": 46.6,
|
||||
"元素精通": 35,
|
||||
"大攻击": 35,
|
||||
"大生命": 30.1,
|
||||
"大防御": 30.59,
|
||||
"小攻击": 14.04,
|
||||
"小生命": 25.1,
|
||||
"小防御": 25.02,
|
||||
"充能效率": 25.2
|
||||
}
|
||||
|
||||
|
||||
export const attrMap = {
|
||||
atk: {
|
||||
title: "攻击力",
|
||||
attr: "小攻击,大攻击"
|
||||
},
|
||||
def: {
|
||||
title: "防御力",
|
||||
attr: "小防御,大防御"
|
||||
},
|
||||
hp: {
|
||||
title: "生命值",
|
||||
attr: "小生命,大生命"
|
||||
},
|
||||
cRate: {
|
||||
title: "暴击率",
|
||||
attr: "暴击率"
|
||||
},
|
||||
cDmg: {
|
||||
title: "暴击伤害",
|
||||
attr: "暴击伤害"
|
||||
},
|
||||
mastery: {
|
||||
title: "元素精通",
|
||||
attr: "元素精通"
|
||||
},
|
||||
recharge: {
|
||||
title: "充能效率",
|
||||
attr: "充能效率"
|
||||
}
|
||||
}
|
||||
|
||||
export const usefulAttr = {
|
||||
"神里绫人": "atk,cRate,cDmg",
|
||||
"八重神子": "atk,cRate,cDmg,mastery,",
|
||||
"申鹤": "atk,recharge",
|
||||
"云堇": "def,recharge",
|
||||
"荒泷一斗": "def,cRate,cDmg",
|
||||
"五郎": "def,recharge",
|
||||
"班尼特": "hp,cRate,cDmg,recharge",
|
||||
"枫原万叶": "mastery,cRate,cDmg,recharge",
|
||||
"雷电将军": "atk,cRate,cDmg,recharge",
|
||||
"行秋": "atk,cRate,cDmg,recharge",
|
||||
"钟离": "hp,cRate,cDmg,recharge",
|
||||
"神里绫华": "atk,cRate,cDmg",
|
||||
"香菱": "atk,cRate,cDmg,recharge,mastery",
|
||||
"胡桃": "hp,cRate,cDmg,mastery",
|
||||
"甘雨": "atk,cRate,cDmg,mastery",
|
||||
"温迪": "mastery,cRate,cDmg,recharge",
|
||||
"珊瑚宫心海": "hp,recharge",
|
||||
"莫娜": "mastery,cRate,cDmg,recharge",
|
||||
"阿贝多": "def,cRate,cDmg",
|
||||
"迪奥娜": "hp,recharge",
|
||||
"优菈": "atk,cRate,cDmg",
|
||||
"达达利亚": "atk,cRate,cDmg,mastery",
|
||||
"魈": "atk,cRate,cDmg",
|
||||
"宵宫": "atk,cRate,cDmg,mastery",
|
||||
"九条裟罗": "atk,cRate,cDmg,recharge",
|
||||
"琴": "atk,cRate,cDmg,recharge",
|
||||
"菲谢尔": "atk,cRate,cDmg",
|
||||
"罗莎莉亚": "atk,cRate,cDmg",
|
||||
"可莉": "atk,cRate,cDmg",
|
||||
"凝光": "atk,cRate,cDmg",
|
||||
"北斗": "atk,cRate,cDmg",
|
||||
"刻晴": "atk,cRate,cDmg",
|
||||
"托马": "hp,recharge",
|
||||
"迪卢克": "atk,cRate,cDmg,mastery",
|
||||
"芭芭拉": "hp,recharge",
|
||||
"诺艾尔": "def,cRate,cDmg",
|
||||
"旅行者": "atk,cRate,cDmg",
|
||||
"重云": "atk,cRate,cDmg",
|
||||
"七七": "atk,cRate,cDmg,recharge",
|
||||
"凯亚": "atk,cRate,cDmg",
|
||||
"烟绯": "atk,cRate,cDmg,mastery",
|
||||
"早柚": "mastery,recharge",
|
||||
"安柏": "atk,cRate,cDmg,mastery",
|
||||
"丽莎": "atk,cRate,cDmg",
|
||||
"埃洛伊": "atk,cRate,cDmg",
|
||||
"辛焱": "atk,cRate,cDmg",
|
||||
"砂糖": "mastery,recharge",
|
||||
"雷泽": "atk,cRate,cDmg",
|
||||
}
|
Loading…
Reference in New Issue
Block a user