From 23f14b028fd6501ecb54bb65bd4efeb5e84873fa Mon Sep 17 00:00:00 2001 From: yoimiya-kokomi <592981798@qq.com> Date: Fri, 29 Apr 2022 04:50:58 +0800 Subject: [PATCH] =?UTF-8?q?*=20=E5=A2=9E=E5=8A=A0=20`#=E5=9C=A3=E9=81=97?= =?UTF-8?q?=E7=89=A9=E5=88=97=E8=A1=A8`=20=E5=91=BD=E4=BB=A4=EF=BC=8C?= =?UTF-8?q?=E5=AF=B9=E5=B7=B2=E7=BB=8F=E8=8E=B7=E5=8F=96=E9=9D=A2=E6=9D=BF?= =?UTF-8?q?=E7=9A=84=E6=89=80=E6=9C=89=E8=A7=92=E8=89=B2=E5=9C=A3=E9=81=97?= =?UTF-8?q?=E7=89=A9=E8=BF=9B=E8=A1=8C=E8=AF=84=E5=88=86=EF=BC=8C=E5=B9=B6?= =?UTF-8?q?=E5=B1=95=E7=A4=BA=E9=AB=98=E8=AF=84=E5=88=86=E7=9A=84=E5=9C=A3?= =?UTF-8?q?=E9=81=97=E7=89=A9=E5=88=97=E8=A1=A8=20*=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=20`#=E9=9D=A2=E6=9D=BF=E8=A7=92=E8=89=B2=E5=88=97=E8=A1=A8`=20?= =?UTF-8?q?=E5=91=BD=E4=BB=A4=EF=BC=8C=E6=9F=A5=E7=9C=8B=E5=B7=B2=E7=BB=8F?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E9=9D=A2=E6=9D=BF=E7=9A=84=E8=A7=92=E8=89=B2?= =?UTF-8?q?=E5=88=97=E8=A1=A8=20*=20=E5=85=AC=E5=AD=90=E9=9D=A2=E6=9D=BF?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0EQ=E8=92=B8=E5=8F=91=E4=BC=A4=E5=AE=B3?= =?UTF-8?q?=E8=AE=A1=E7=AE=97=20*=20=E4=B8=80=E4=BA=9Bbugfix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 4 +- apps/character.js | 97 ++++++++++++++++++- components/Calc.js | 3 +- index.js | 14 ++- resources/character/artis.css | 33 +++++++ resources/character/artis.html | 43 ++++++++ resources/character/detail.css | 2 +- resources/meta/character/达达利亚/calc.js | 8 +- 8 files changed, 195 insertions(+), 9 deletions(-) create mode 100644 resources/character/artis.css create mode 100644 resources/character/artis.html diff --git a/CHANGELOG.md b/CHANGELOG.md index e0e3da3d..120b76b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,9 @@ * `#角色面板` 功能升级 * 优化无角色面板数据时的引导 * 优化返回的图像格式及分辨率,平衡响应速度及显示效果 -* 添加 `#胡桃面板更新` 命令,获取单个角色面板数据,每天可更新5次 +* 增加 `#圣遗物列表` 命令,对已经获取面板的所有角色圣遗物进行评分,并展示高评分的圣遗物列表 +* 增加 `#面板角色列表` 命令,查看已经获取面板的角色列表 +* 增加 `#胡桃面板更新` 命令,获取单个角色面板数据,每天可更新5次 * 更改 `#全部面板更新` 命令,获取角色展柜全部8个角色,每天可更新3次 diff --git a/apps/character.js b/apps/character.js index b95a4f9e..11066411 100644 --- a/apps/character.js +++ b/apps/character.js @@ -63,13 +63,15 @@ export async function character(e, { render, User }) { } let mode = 'card'; + let name = msg.replace(/#|老婆|老公|[1|2|5][0-9]{8}/g, "").trim(); + if (/(详情|详细|面板|面版)$/.test(msg)) { mode = 'profile'; - } else if (/(详情|详细|面板|面版)更新$/.test(msg)) { + name = name.replace(/(详情|详细|面板|面版)/, "").trim(); + } else if (/(详情|详细|面板|面版)更新/.test(msg)) { mode = "refresh"; + name = name.replace(/(详情|详细|面板|面版)更新/, "").trim(); } - - let name = msg.replace(/#|老婆|老公|详情|详细|面板|面版|更新|[1|2|5][0-9]{8}/g, "").trim(); let char = Character.get(name); if (!char) { @@ -713,4 +715,93 @@ export async function enemyLv(e) { } return true; +} + +export async function getArtis(e, { render }) { + let MysApi = await e.getMysApi({ + auth: "cookie", + targetType: "self", + cookieType: "self", + actionName: "查询角色天赋命座等信息" + }); + if (!MysApi) { + return true; + } + + let selfUser = e.selfUser, + uid = selfUser.uid; + + let artis = [], + profiles = Profile.getAll(uid) || {}; + + if (!profiles || profiles.length === 0) { + e.reply("暂无角色圣遗物详情"); + return true; + } + + + lodash.forEach(profiles || [], (ds) => { + let name = ds.name; + if (!name) { + return; + } + let { mark: usefulMark } = Reliquaries.getUseful(name); + /* 处理圣遗物 */ + if (ds.artis) { + lodash.forEach(ds.artis, (arti) => { + let mark = Reliquaries.getMark(name, arti.attrs); + let maxMark = Reliquaries.getMaxMark(name, arti.main[0] || ""); + arti.mark = Format.comma(mark, 1); + arti._mark = mark; + arti.markType = Reliquaries.getMarkScore(mark, maxMark); + arti.main = Profile.formatArti(arti.main); + arti.attrs = Profile.formatArti(arti.attrs); + arti.usefulMark = usefulMark; + arti.avatar = name; + artis.push(arti); + }) + } + }); + + artis = lodash.sortBy(artis, "_mark"); + artis = artis.reverse(); + artis = artis.slice(0, 20); + + + let base64 = await render("character", "artis", { + save_id: uid, + uid: uid, + artis, + cfgScale: Cfg.scale(1.4) + }); + if (base64) { + e.reply(segment.image(`base64://${base64}`)); + } + return true; +} + +export async function getProfileAll(e) { + let MysApi = await e.getMysApi({ + auth: "cookie", + targetType: "self", + cookieType: "self", + actionName: "查询角色天赋命座等信息" + }); + if (!MysApi) { + return true; + } + let uid = MysApi.selfUser.uid; + + let profiles = Profile.getAll(uid) || {}; + if (profiles.length === 0) { + e.reply("尚未获取任何角色数据"); + } else { + let chars = []; + lodash.forEach(profiles, (ds) => { + ds.name && chars.push(ds.name) + }); + e.reply("当前已获取面板角色: " + chars.join(", ")); + } + return true; + } \ No newline at end of file diff --git a/components/Calc.js b/components/Calc.js index dd82d848..92e27701 100644 --- a/components/Calc.js +++ b/components/Calc.js @@ -381,7 +381,8 @@ let Calc = { // 反应区 let eleNum = 1; if (ele) { - eleNum = { zf: 1.5, rh: 2 }[ele] || 1; + // todo 更详细 + eleNum = (attr.element === "水" ? { zf: 2 } : { zf: 1.5, rh: 2 })[ele] || 1; if (attr[ele]) { eleNum = eleNum * (1 + attr[ele] / 100); } diff --git a/index.js b/index.js index a926375b..3306c9da 100644 --- a/index.js +++ b/index.js @@ -1,4 +1,4 @@ -import { character, getProfile, wife, wifeReg, enemyLv } from "./apps/character.js"; +import { character, getProfile, wife, wifeReg, enemyLv, getArtis, getProfileAll } from "./apps/character.js"; import { consStat, abyssPct } from "./apps/stat.js"; import { wiki } from "./apps/wiki.js"; import { help, versionInfo } from "./apps/help.js"; @@ -19,7 +19,9 @@ export { help, versionInfo, getProfile, - enemyLv + enemyLv, + getArtis, + getProfileAll }; @@ -28,6 +30,14 @@ let rule = { reg: "^#(喵喵)?(.*)(详情|详细|面板|面版)?(更新)?$", describe: "【#角色】角色详情", }, + getArtis: { + reg: "#圣遗物列表", + describe: "【#角色】圣遗物列表", + }, + getProfileAll: { + reg: "#面板角色列表", + describe: "【#角色】查看当前已获取面板数据的角色列表", + }, wife: { reg: wifeReg, describe: "【#角色】#老公 #老婆 查询", diff --git a/resources/character/artis.css b/resources/character/artis.css new file mode 100644 index 00000000..01f7778f --- /dev/null +++ b/resources/character/artis.css @@ -0,0 +1,33 @@ +.container { + width: 790px; +} + +.artis { + width: 790px; +} + +.artis .item { + height: 205px; + overflow: hidden; +} + +.artis .item .avatar { + position: absolute; + left: 32px; + top: 26px; + width: 38px; + height: 38px; + border-radius: 50%; + overflow: hidden; + z-index: 3; +} + +.artis .item .arti-icon img { + width: 52px; + height: 52px; +} + +.artis .item .avatar img { + max-width: 100%; + max-height: 100%; +} \ No newline at end of file diff --git a/resources/character/artis.html b/resources/character/artis.html new file mode 100644 index 00000000..93f40027 --- /dev/null +++ b/resources/character/artis.html @@ -0,0 +1,43 @@ + + + + + + + + + + +
+
+ {{each artis ds}} +
+ {{if ds.name && ds.main && ds.main[0] && ds.main[0]!="undefined"}} +
+ +
+
+ +
+
+ {{ds.name}} + {{ds.mark}}分 - {{ds.markType}} +
+
    +
  • {{ds.main[0]}}+{{ds.main[1]}}
  • + {{each ds.attrs attr}} + {{if attr[0]}} +
  • {{attr[0]}}+{{attr[1]}}
  • + {{/if}} + {{/each}} +
+ {{/if}} +
+ {{/each}} +
+ +
+ + + diff --git a/resources/character/detail.css b/resources/character/detail.css index 893a2200..a1f70131 100644 --- a/resources/character/detail.css +++ b/resources/character/detail.css @@ -420,7 +420,7 @@ body { display: block; } -.artis .item img { +.artis .item .arti-icon img { width: 60px; height: 60px; } diff --git a/resources/meta/character/达达利亚/calc.js b/resources/meta/character/达达利亚/calc.js index 5937417d..5f83a79b 100644 --- a/resources/meta/character/达达利亚/calc.js +++ b/resources/meta/character/达达利亚/calc.js @@ -7,6 +7,12 @@ export const details = [{ },{ title: "开E后Q伤害", dmg: ({ talent }, dmg) => dmg(talent.q['技能伤害·近战'], 'q') +},{ + title: "开E后Q蒸发", + dmg: ({ talent }, dmg) => dmg(talent.q['技能伤害·近战'], 'q','zf') }]; -export const buffs = []; \ No newline at end of file +export const buffs = [{ + title: "元素精通:蒸发伤害提高[zf]%", + mastery: "zf" +}]; \ No newline at end of file