* #更新角色面板 功能恢复

* 调整部分角色的评分词条权重值
* 修复小攻击、小防御、小生命有效词条未被正确高亮的问题
This commit is contained in:
yoimiya-kokomi 2022-06-11 22:10:53 +08:00
parent ac8e368d9b
commit 3267a68a3b
9 changed files with 74 additions and 52 deletions

View File

@ -1,3 +1,12 @@
# 1.7.4
* `#角色面板` 圣遗物评分功能调整
* 调整部分角色的评分词条权重值
* 修复小攻击、小防御、小生命有效词条未被正确高亮的问题
* `#更新角色面板` 功能恢复
* 可对已有面板数据的角色手工输入面板属性,用于伤害测算
* 暂不支持设置武器、圣遗物、命座、天赋。后续会增加支持
# 1.7.3 # 1.7.3
* `#角色面板`、`#圣遗物列表` 使用新的圣遗物评分逻辑计算评分 * `#角色面板`、`#圣遗物列表` 使用新的圣遗物评分逻辑计算评分

View File

@ -288,6 +288,7 @@ export async function wife(e, { render, User }) {
return true; return true;
} }
/* 接管戳一戳面板,尚未完成 */
async function pokeCharacter(e, { render }) { async function pokeCharacter(e, { render }) {
let MysApi = await e.getMysApi({ let MysApi = await e.getMysApi({
auth: "all", auth: "all",
@ -401,8 +402,6 @@ async function renderCard(e, avatar, render, renderType = "card") {
ds: char.getData("name,id,title,desc"), ds: char.getData("name,id,title,desc"),
}, { e, render, scale: 1.6 }); }, { e, render, scale: 1.6 });
} }
return true; return true;
} }
@ -458,7 +457,9 @@ async function getTalent(e, avatars) {
return skill; return skill;
} }
/*
* 自动更新面板数据
* */
async function autoRefresh(e) { async function autoRefresh(e) {
let uid = await getTargetUid(e); let uid = await getTargetUid(e);
@ -514,17 +515,21 @@ export async function getProfile(e, mode = "refresh") {
if (mode === "input") { if (mode === "input") {
if (e.inputData.trim().length < 5) { if (e.inputData.trim().length < 5) {
e.reply(`【输入示例】\n#录入夜兰面板 生命14450+25469, 攻击652+444, 防御548+144, 元素精通84, 暴击76.3, 爆伤194.2, 治疗0,充能112.3,元素伤害61.6,物伤0`) e.reply(`【输入示例】\n#录入夜兰面板 生命14450+25469, 攻击652+444, 防御548+144, 元素精通84, 暴击76.3, 爆伤194.2, 治疗0,充能112.3,元素伤害61.6,物伤0`)
return await profileHelp(e); return true;
//await profileHelp(e);
} }
let ret = Profile.inputProfile(e.selfUser.uid, e);
let ret = Profile.inputProfile(uid, e);
let char = Character.get(e.avatar); let char = Character.get(e.avatar);
if (ret) { if (lodash.isString(ret)) {
e.reply(ret);
return true;
} else if (ret) {
e.reply(`${char.name}信息手工录入完成,你可以使用 #角色名+面板 / #角色名+伤害 来查看详细角色面板属性了`) e.reply(`${char.name}信息手工录入完成,你可以使用 #角色名+面板 / #角色名+伤害 来查看详细角色面板属性了`)
} else { } else {
e.reply(`${char.name}信息手工录入失败,请检查录入格式。回复 #角色面板帮助 可查看录入提示`); e.reply(`${char.name}信息手工录入失败,请检查录入格式。回复 #角色面板帮助 可查看录入提示`);
e.reply(`【输入示例】\n#录入夜兰面板 生命14450+25469, 攻击652+444, 防御548+144, 元素精通84, 暴击76.3, 爆伤194.2, 治疗0,充能112.3,元素伤害61.6,物伤0 e.reply(`【输入示例】\n#录入夜兰面板 生命14450+25469, 攻击652+444, 防御548+144, 元素精通84, 暴击76.3, 爆伤194.2, 治疗0,充能112.3,元素伤害61.6,物伤0`)
`)
} }
return true; return true;
} }
@ -554,7 +559,9 @@ export async function getProfile(e, mode = "refresh") {
return true; return true;
} }
// 获取角色数据 /*
* 获取角色数据
* */
function getCharacterData(avatars) { function getCharacterData(avatars) {
let list = []; let list = [];
let set = {}; let set = {};
@ -719,7 +726,7 @@ export async function renderProfile(e, char, render, mode = "profile", params =
} }
await profileHelp(e); await profileHelp(e);
return true; return true;
} else if (profile.dataSource !== "enka") { } else if (!['enka', 'input2'].includes(profile.dataSource)) {
if (!await refresh()) { if (!await refresh()) {
e.reply(`由于数据格式升级,请重新获取面板信息后查看`); e.reply(`由于数据格式升级,请重新获取面板信息后查看`);
} }
@ -855,6 +862,9 @@ export async function enemyLv(e) {
} }
/*
* 圣遗物列表
* */
export async function getArtis(e, { render }) { export async function getArtis(e, { render }) {
let MysApi = await e.getMysApi({ let MysApi = await e.getMysApi({
auth: "all", auth: "all",
@ -927,6 +937,9 @@ export async function getArtis(e, { render }) {
}, { e, render, scale: 1.4 }); }, { e, render, scale: 1.4 });
} }
/*
* 获取面板列表
* */
export async function getProfileAll(e) { export async function getProfileAll(e) {
let uid = await getTargetUid(e); let uid = await getTargetUid(e);

View File

@ -144,7 +144,7 @@ let Calc = {
talent(profile, char) { talent(profile, char) {
let ret = {}; let ret = {};
let talentData = profile.talent; let talentData = profile.talent || {};
lodash.forEach(['a', 'e', 'q'], (key) => { lodash.forEach(['a', 'e', 'q'], (key) => {
let lv = talentData[key].level_current * 1 || 1, let lv = talentData[key].level_current * 1 || 1,

View File

@ -166,9 +166,14 @@ let Profile = {
inputProfile(uid, e) { inputProfile(uid, e) {
let { avatar, inputData } = e; let { avatar, inputData } = e;
let char = Character.get(avatar);
let originalData = Profile.get(uid, char.id);
if (!originalData || originalData.dataSource !== "enka") {
return `请先获取${char.name}的面板数据后,再进行面板数据更新`;
}
inputData = inputData.replace("#", ""); inputData = inputData.replace("#", "");
inputData = inputData.replace(/||、|\n|\t/g, ","); inputData = inputData.replace(/||、|\n|\t/g, ",");
let attr = {}; let attr = originalData.attr || {};
let attrMap = { let attrMap = {
hp: /生命/, hp: /生命/,
def: /防御/, def: /防御/,
@ -233,20 +238,16 @@ let Profile = {
return false; return false;
} }
let char = Character.get(avatar); originalData.dataSource = "input2";
let data = { originalData.attr = attr;
id: char.id,
name: char.name,
dataSource: "input",
attr
}
let userData = {}; let userData = {};
const userFile = `${userPath}/${uid}.json`; const userFile = `${userPath}/${uid}.json`;
if (fs.existsSync(userFile)) { if (fs.existsSync(userFile)) {
userData = JSON.parse(fs.readFileSync(userFile, "utf8")) || {}; userData = JSON.parse(fs.readFileSync(userFile, "utf8")) || {};
} }
userData.chars = userData.chars || {}; userData.chars = userData.chars || {};
userData.chars[avatar] = data; userData.chars[avatar] = originalData;
fs.writeFileSync(userFile, JSON.stringify(userData), "", " "); fs.writeFileSync(userFile, JSON.stringify(userData), "", " ");
return true; return true;
} }

View File

@ -1,11 +1,5 @@
import { import { attrValue, attrNameMap, attrMap, mainAttr, subAttr, usefulAttr }
attrValue, from "../../resources/meta/reliquaries/reliquaries-mark-new.js";
attrNameMap,
attrMap,
mainAttr,
subAttr,
usefulAttr
} from "../../resources/meta/reliquaries/reliquaries-mark-new.js";
import { Character } from "../models.js"; import { Character } from "../models.js";
import lodash from "lodash"; import lodash from "lodash";
@ -37,14 +31,19 @@ let Reliquaries = {
let maxMark = Reliquaries.getMaxMark(attrWeight); let maxMark = Reliquaries.getMaxMark(attrWeight);
let titleMark = {}, titleWeight = {}; let titleMark = {}, titleWeight = {};
lodash.forEach(attrMark, (mark, attr) => { lodash.forEach(attrMark, (mark, attr) => {
titleMark[attrMap[attr]] = mark; let aTitle = attrMap[attr];
titleWeight[attrMap[attr]] = attrWeight[attr] || 0; if (/小/.test(aTitle)) {
if (/大/.test(attrMap[attr])) { return;
let newAttr = attrMap[attr]; }
let newArr = newAttr.replace("大", "小"); titleMark[aTitle] = mark;
titleWeight[newArr] = attrWeight[attr] || 0; titleWeight[aTitle] = attrWeight[attr] || 0;
if (/大/.test(aTitle)) {
let sTitle = aTitle.replace("大", "小");
console.log(sTitle, aTitle, attrWeight[attr])
titleWeight[sTitle] = titleWeight[aTitle];
} }
}) })
console.log(titleWeight);
charCfg[name] = { charCfg[name] = {
weight: attrWeight, weight: attrWeight,
mark: attrMark, mark: attrMark,

View File

@ -6,7 +6,7 @@
{{set weapon = data.weapon}} {{set weapon = data.weapon}}
{{set talent = data.talent}} {{set talent = data.talent}}
{{set dataSrouce = data.dataSource}} {{set dataSource = data.dataSource}}
{{block 'main'}} {{block 'main'}}
@ -52,7 +52,7 @@
</div> </div>
</div> </div>
{{if mode === "profile" && dataSource !== "input"}} {{if mode === "profile" && dataSource !== "input2"}}
<div class="artis"> <div class="artis">
<div> <div>
<div class="item weapon"> <div class="item weapon">
@ -84,7 +84,8 @@
<li class="arti-main"><span class="title">{{ds.main[0]}}</span><span class="val">+{{ds.main[1]}}</span></li> <li class="arti-main"><span class="title">{{ds.main[0]}}</span><span class="val">+{{ds.main[1]}}</span></li>
{{each ds.attrs attr}} {{each ds.attrs attr}}
{{if attr[0]}} {{if attr[0]}}
<li class="{{usefulMark[attr[0]]*1 > 79.9 ?`great`:(usefulMark[attr[0]]*1>0 ? `useful`:`nouse`)}}"><span class="title">{{attr[0]}} </span><span <li class="{{usefulMark[attr[0]]*1 > 79.9 ?`great`:(usefulMark[attr[0]]*1>0 ? `useful`:`nouse`)}}"><span
class="title">{{attr[0]}} </span><span
class="val">+{{attr[1]}}</span></li> class="val">+{{attr[1]}}</span></li>
{{/if}} {{/if}}
{{/each}} {{/each}}
@ -95,21 +96,24 @@
</div> </div>
{{/if}} {{/if}}
{{if mode === "profile" && dataSource === "input"}} {{if dataSource === "input2"}}
<div class="cont"> <div class="cont">
<div class="cont-footer dmg-desc"> <div class="cont-footer dmg-desc">
面板信息来源于手工输入,面板信息及伤害计算可能不准确。通过<strong>#录入{{name}}面板</strong>可录入面板数据 面板信息来源于手工输入,面板信息及伤害计算可能不准确。通过<strong>#录入{{name}}面板</strong>可录入面板数据
</div> </div>
</div> </div>
{{/if}}
{{if mode === "profile" && dataSource === "input2"}}
<div class="artis input-mode"> <div class="artis input-mode">
<div class="item weapon"> <div class="item weapon">
<img src="{{_sys_res_path}}/genshin/logo/weapon/{{weapon.name}}.png"/> <img src="{{_sys_res_path}}/genshin/logo/weapon/{{weapon.name}}.png"/>
<div class="head"> <div class="head">
<strong>{{weapon.name}}</strong> <strong>{{weapon.name}}</strong>
<div class="star star-{{weapon.rarity}}"></div> <div class="star star-{{weapon.star}}"></div>
<span>Lv.{{weapon.level}} <span <span>Lv.{{weapon.leve || weapon.level}} <span
class="affix affix-{{weapon.affix_level}}">精{{weapon.affix_level}}</span></span> class="affix affix-{{weapon.affix}}">精{{weapon.affix}}</span></span>
</div> </div>
</div> </div>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 234 KiB

After

Width:  |  Height:  |  Size: 233 KiB

View File

@ -31,14 +31,7 @@ for (let attr in attrMap) {
} }
export const attrNameMap = anMap; export const attrNameMap = anMap;
/* 当前位置主词条不可能出现词缀*/
export const banAttr = {
1: "hpPlus,dmg,phy,heal".split(","),
2: "atkPlus,dmg,phy,heal".split(","),
3: "dmg,phy,heal".split(","),
4: "heal".split(","),
5: "dmg,phy".split(",")
};
export const mainAttr = { export const mainAttr = {
3: "atk,def,hp,mastery,recharge".split(","), 3: "atk,def,hp,mastery,recharge".split(","),
@ -60,10 +53,12 @@ export const usefulAttr = {
'雷电将军': { hp: 0, atk: 75, def: 0, cp: 100, cd: 100, mastery: 20, dmg: 75, phy: 0, recharge: 90, heal: 0 }, '雷电将军': { hp: 0, atk: 75, def: 0, cp: 100, cd: 100, mastery: 20, dmg: 75, phy: 0, recharge: 90, heal: 0 },
'行秋': { hp: 0, atk: 75, def: 0, cp: 100, cd: 100, mastery: 20, dmg: 100, phy: 0, recharge: 65, heal: 0 }, '行秋': { hp: 0, atk: 75, def: 0, cp: 100, cd: 100, mastery: 20, dmg: 100, phy: 0, recharge: 65, heal: 0 },
'钟离': { hp: 80, atk: 70, def: 0, cp: 100, cd: 100, mastery: 0, dmg: 100, phy: 50, recharge: 55, heal: 0 }, '钟离': { hp: 80, atk: 70, def: 0, cp: 100, cd: 100, mastery: 0, dmg: 100, phy: 50, recharge: 55, heal: 0 },
'钟离-血牛': { hp: 100, atk: 50, def: 0, cp: 75, cd: 75, mastery: 0, dmg: 75, phy: 0, recharge: 55, heal: 0 },
'神里绫华': { hp: 0, atk: 75, def: 0, cp: 100, cd: 100, mastery: 30, dmg: 100, phy: 0, recharge: 20, heal: 0 }, '神里绫华': { hp: 0, atk: 75, def: 0, cp: 100, cd: 100, mastery: 30, dmg: 100, phy: 0, recharge: 20, heal: 0 },
'香菱': { hp: 0, atk: 75, def: 0, cp: 100, cd: 100, mastery: 75, dmg: 100, phy: 0, recharge: 75, heal: 0 }, '香菱': { hp: 0, atk: 75, def: 0, cp: 100, cd: 100, mastery: 75, dmg: 100, phy: 0, recharge: 75, heal: 0 },
'胡桃': { hp: 80, atk: 30, def: 0, cp: 100, cd: 100, mastery: 75, dmg: 100, phy: 0, recharge: 35, heal: 0 }, '胡桃': { hp: 80, atk: 30, def: 0, cp: 100, cd: 100, mastery: 75, dmg: 100, phy: 0, recharge: 35, heal: 0 },
'甘雨': { hp: 0, atk: 90, def: 0, cp: 100, cd: 100, mastery: 50, dmg: 100, phy: 0, recharge: 40, heal: 0 }, '甘雨': { hp: 0, atk: 75, def: 0, cp: 100, cd: 100, mastery: 75, dmg: 100, phy: 0, recharge: 40, heal: 0 },
'甘雨-永冻': { hp: 0, atk: 75, def: 0, cp: 100, cd: 100, mastery: 0, dmg: 100, phy: 0, recharge: 75, heal: 0 },
'温迪': { hp: 0, atk: 75, def: 0, cp: 100, cd: 100, mastery: 60, dmg: 100, phy: 0, recharge: 80, heal: 0 }, '温迪': { hp: 0, atk: 75, def: 0, cp: 100, cd: 100, mastery: 60, dmg: 100, phy: 0, recharge: 80, heal: 0 },
'珊瑚宫心海': { hp: 100, atk: 50, def: 0, cp: 0, cd: 0, mastery: 0, dmg: 100, phy: 0, recharge: 65, heal: 100 }, '珊瑚宫心海': { hp: 100, atk: 50, def: 0, cp: 0, cd: 0, mastery: 0, dmg: 100, phy: 0, recharge: 65, heal: 100 },
'莫娜': { hp: 0, atk: 50, def: 0, cp: 100, cd: 100, mastery: 75, dmg: 100, phy: 0, recharge: 80, heal: 0 }, '莫娜': { hp: 0, atk: 50, def: 0, cp: 100, cd: 100, mastery: 75, dmg: 100, phy: 0, recharge: 80, heal: 0 },
@ -72,7 +67,7 @@ export const usefulAttr = {
'优菈': { hp: 0, atk: 75, def: 0, cp: 100, cd: 100, mastery: 0, dmg: 40, phy: 100, recharge: 45, heal: 0 }, '优菈': { hp: 0, atk: 75, def: 0, cp: 100, cd: 100, mastery: 0, dmg: 40, phy: 100, recharge: 45, heal: 0 },
'达达利亚': { hp: 0, atk: 75, def: 0, cp: 100, cd: 100, mastery: 50, dmg: 100, phy: 0, recharge: 45, heal: 0 }, '达达利亚': { hp: 0, atk: 75, def: 0, cp: 100, cd: 100, mastery: 50, dmg: 100, phy: 0, recharge: 45, heal: 0 },
'魈': { hp: 0, atk: 75, def: 0, cp: 100, cd: 100, mastery: 0, dmg: 100, phy: 0, recharge: 20, heal: 0 }, '魈': { hp: 0, atk: 75, def: 0, cp: 100, cd: 100, mastery: 0, dmg: 100, phy: 0, recharge: 20, heal: 0 },
'宵宫': { hp: 0, atk: 75, def: 0, cp: 100, cd: 100, mastery: 75, dmg: 100, phy: 0, recharge: 0, heal: 0 }, '宵宫': { hp: 0, atk: 75, def: 0, cp: 100, cd: 100, mastery: 60, dmg: 100, phy: 0, recharge: 0, heal: 0 },
'九条裟罗': { hp: 0, atk: 75, def: 0, cp: 100, cd: 100, mastery: 0, dmg: 100, phy: 0, recharge: 55, heal: 0 }, '九条裟罗': { hp: 0, atk: 75, def: 0, cp: 100, cd: 100, mastery: 0, dmg: 100, phy: 0, recharge: 55, heal: 0 },
'琴': { hp: 0, atk: 90, def: 0, cp: 100, cd: 100, mastery: 0, dmg: 100, phy: 100, recharge: 55, heal: 100 }, '琴': { hp: 0, atk: 90, def: 0, cp: 100, cd: 100, mastery: 0, dmg: 100, phy: 100, recharge: 55, heal: 100 },
'菲谢尔': { hp: 0, atk: 75, def: 0, cp: 100, cd: 100, mastery: 30, dmg: 100, phy: 60, recharge: 30, heal: 0 }, '菲谢尔': { hp: 0, atk: 75, def: 0, cp: 100, cd: 100, mastery: 30, dmg: 100, phy: 60, recharge: 30, heal: 0 },
@ -84,6 +79,7 @@ export const usefulAttr = {
'托马': { hp: 75, atk: 50, def: 0, cp: 50, cd: 50, mastery: 0, dmg: 75, phy: 0, recharge: 55, heal: 40 }, '托马': { hp: 75, atk: 50, def: 0, cp: 50, cd: 50, mastery: 0, dmg: 75, phy: 0, recharge: 55, heal: 40 },
'迪卢克': { hp: 0, atk: 75, def: 0, cp: 100, cd: 100, mastery: 50, dmg: 100, phy: 0, recharge: 40, heal: 0 }, '迪卢克': { hp: 0, atk: 75, def: 0, cp: 100, cd: 100, mastery: 50, dmg: 100, phy: 0, recharge: 40, heal: 0 },
'芭芭拉': { hp: 80, atk: 50, def: 0, cp: 50, cd: 50, mastery: 15, dmg: 80, phy: 0, recharge: 55, heal: 100 }, '芭芭拉': { hp: 80, atk: 50, def: 0, cp: 50, cd: 50, mastery: 15, dmg: 80, phy: 0, recharge: 55, heal: 100 },
'芭芭拉-暴力': { hp: 50, atk: 75, def: 0, cp: 100, cd: 100, mastery: 75, dmg: 100, phy: 0, recharge: 55, heal: 50 },
'诺艾尔': { hp: 0, atk: 75, def: 100, cp: 100, cd: 100, mastery: 0, dmg: 100, phy: 0, recharge: 70, heal: 0 }, '诺艾尔': { hp: 0, atk: 75, def: 100, cp: 100, cd: 100, mastery: 0, dmg: 100, phy: 0, recharge: 70, heal: 0 },
'旅行者': { hp: 0, atk: 75, def: 0, cp: 100, cd: 100, mastery: 0, dmg: 100, phy: 0, recharge: 55, heal: 0 }, '旅行者': { hp: 0, atk: 75, def: 0, cp: 100, cd: 100, mastery: 0, dmg: 100, phy: 0, recharge: 55, heal: 0 },
'重云': { hp: 0, atk: 75, def: 0, cp: 100, cd: 100, mastery: 0, dmg: 100, phy: 0, recharge: 70, heal: 0 }, '重云': { hp: 0, atk: 75, def: 0, cp: 100, cd: 100, mastery: 0, dmg: 100, phy: 0, recharge: 70, heal: 0 },

View File

@ -29,7 +29,7 @@ let polearm = {
}, },
"匣里灭辰": { "匣里灭辰": {
check: ({ element }) => ['水', '火'].includes(element), check: ({ element }) => ['水', '火'].includes(element),
title: "对于水或元素影响的敌人造成伤害提高[dmg]%", title: "对于水或元素影响的敌人造成伤害提高[dmg]%",
refine: { refine: {
dmg: step(20, 4), dmg: step(20, 4),
phy: step(20, 4), phy: step(20, 4),