From dffeef44976d544921f90faed67274ee134f8381 Mon Sep 17 00:00:00 2001 From: yoimiya-kokomi <592981798@qq.com> Date: Sun, 12 Jun 2022 05:54:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3`#=E5=96=B5=E5=96=B5=E5=B8=AE?= =?UTF-8?q?=E5=8A=A9`=E4=B8=AD=E7=9A=84=E6=96=87=E6=A1=88=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 5 ++-- apps/character.js | 41 ++++++++++++++++++++----------- components/Profile.js | 2 +- components/models/Reliquaries2.js | 2 -- 4 files changed, 31 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e7e2775..6f996f85 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,8 +5,9 @@ * `#角色面板` 圣遗物评分功能调整 * 修复小攻击、小防御、小生命有效词条未被正确高亮的问题 * 调整部分角色的评分词条权重值 -* `#更新角色面板` 功能恢复 - * 可对已有面板数据的角色手工输入面板属性,用于伤害测算 +* `#录入角色面板` 功能恢复 + * 可对已有面板数据的角色手工输入更改面板属性,用于伤害测算 + * 例如`#录入雷神面板 暴击80,爆伤250` * 暂不支持设置武器、圣遗物、命座、天赋。后续会增加支持 # 1.7.1 ~ 1.7.3 diff --git a/apps/character.js b/apps/character.js index bda2b8c5..246a671f 100644 --- a/apps/character.js +++ b/apps/character.js @@ -403,7 +403,7 @@ async function renderCard(e, avatar, render, renderType = "card") { }, { e, render, scale: 1.6 }); if (msgRes && msgRes.message_id) { // 如果消息发送成功,就将message_id和图片路径存起来,1小时过期 - await redis.set(`miao:original-picture:${msgRes.message_id}`, bg.img, {EX: 3600}); + await redis.set(`miao:original-picture:${msgRes.message_id}`, bg.img, { EX: 3600 }); } return msgRes; } @@ -676,20 +676,33 @@ async function getTargetUid(e) { return uidRet[0] } - let MysApi = await e.getMysApi({ - auth: "all", - targetType: "all", - cookieType: "all" - }); + let uid = false; - if (!MysApi || !e.targetUser) { - return false; - } + try { + let MysApi = await e.getMysApi({ + auth: "all", + targetType: "all", + cookieType: "all" + }); - let uid = e.targetUser.uid; - if (!uid || !uidReg.test(uid)) { - e.reply("请先发送【#绑定+你的UID】来绑定查询目标") - return false; + if (!MysApi || !e.targetUser) { + return false; + } + + uid = e.targetUser.uid; + if (!uid || !uidReg.test(uid)) { + e.reply("请先发送【#绑定+你的UID】来绑定查询目标") + return false; + } + } catch (e) { + let qq = e.user_id; + uid = await redis.get(`genshin:id-uid:${qq}`) || await Cache.get(`genshin:uid:${qq}`); + if (uid && uidReg.test(uid)) { + return uid; + } else { + e.reply("请先发送【#绑定+你的UID】来绑定查询目标"); + return false; + } } return uid; @@ -956,7 +969,7 @@ export async function getProfileAll(e) { let chars = []; lodash.forEach(profiles || [], (ds) => { - if (ds.dataSource !== "enka") { + if (!['enka', 'input2'].includes(ds.dataSource)) { return; } ds.name && chars.push(ds.name) diff --git a/components/Profile.js b/components/Profile.js index 82581e93..77963759 100644 --- a/components/Profile.js +++ b/components/Profile.js @@ -168,7 +168,7 @@ let Profile = { let { avatar, inputData } = e; let char = Character.get(avatar); let originalData = Profile.get(uid, char.id); - if (!originalData || originalData.dataSource !== "enka") { + if (!originalData || !['enka', 'input2'].includes(originalData.dataSource)) { return `请先获取${char.name}的面板数据后,再进行面板数据更新`; } inputData = inputData.replace("#", ""); diff --git a/components/models/Reliquaries2.js b/components/models/Reliquaries2.js index b83eb209..0a440199 100644 --- a/components/models/Reliquaries2.js +++ b/components/models/Reliquaries2.js @@ -39,11 +39,9 @@ let Reliquaries = { 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] = { weight: attrWeight, mark: attrMark,