From 9bea49cc961334cf90eb495bd9c1eb2ac901cb3d Mon Sep 17 00:00:00 2001 From: yoimiya-kokomi <592981798@qq.com> Date: Wed, 29 Jun 2022 04:30:34 +0800 Subject: [PATCH] =?UTF-8?q?`#=E5=96=B5=E5=96=B5=E5=B8=AE=E5=8A=A9`?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AF=B9=E8=87=AA=E5=AE=9A=E4=B9=89=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E6=96=87=E4=BB=B6=E7=9A=84=E6=94=AF=E6=8C=81=20*=20?= =?UTF-8?q?=E5=B7=B2=E6=9C=89=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6=E5=8F=AF?= =?UTF-8?q?=E6=9B=B4=E5=90=8D=E4=B8=BAhelp-cfg.js=EF=BC=8C=E9=98=B2?= =?UTF-8?q?=E6=AD=A2=E5=90=8E=E7=BB=AD=E6=9B=B4=E6=96=B0=E5=86=B2=E7=AA=81?= =?UTF-8?q?=EF=BC=8C=E5=90=8E=E7=BB=AD=E4=BC=9A=E6=94=AF=E6=8C=81=E6=9B=B4?= =?UTF-8?q?=E5=A4=9A=E9=85=8D=E7=BD=AE=E9=A1=B9=20*=20=E5=9C=A8=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E9=85=8D=E7=BD=AE=E4=B8=AD=E5=A2=9E=E5=8A=A0=E9=83=A8?= =?UTF-8?q?=E5=88=86=E6=96=B0=E5=B8=AE=E5=8A=A9=E5=91=BD=E4=BB=A4=20`#?= =?UTF-8?q?=E5=96=B5=E5=96=B5=E6=97=A5=E5=8E=86`=E7=8E=B0=E5=9C=A8?= =?UTF-8?q?=E5=8F=AF=E9=80=9A=E8=BF=87`#=E6=97=A5=E5=8E=86=20#=E6=97=A5?= =?UTF-8?q?=E5=8E=86=E5=88=97=E8=A1=A8`=E8=A7=A6=E5=8F=91=20=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3=E8=83=A1=E6=A1=83E=E4=BC=A4=E5=AE=B3=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 + CHANGELOG.md | 8 ++ apps/help.js | 33 +++-- index.js | 2 +- resources/help/help-cfg_default.js | 154 ++++++++++++++++++++++++ resources/help/index.css | 4 +- resources/help/index.html | 12 +- resources/help/index.less | 4 +- resources/meta/character/胡桃/calc.js | 2 +- 9 files changed, 202 insertions(+), 19 deletions(-) create mode 100644 resources/help/help-cfg_default.js diff --git a/.gitignore b/.gitignore index de7c53ad..1b80c388 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,5 @@ /config.js *.css.map /resources/character-img/*/upload/ +/resources/help/help-list.js +/resources/help/help-cfg.js \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 7de14427..1b2ac17c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +# 1.8.2 + +* `#喵喵帮助`增加对自定义配置文件的支持 + * 已有配置文件可更名为help-cfg.js,防止后续更新冲突,后续会支持更多配置项 + * 在默认配置中增加部分新帮助命令 +* `#喵喵日历`现在可通过`#日历 #日历列表`触发 +* 修正胡桃E伤害计算错误 + # 1.8.1 * 增加`#添加刻晴图像`命令,感谢 **@叶** diff --git a/apps/help.js b/apps/help.js index 3b7efe50..2b6d0245 100644 --- a/apps/help.js +++ b/apps/help.js @@ -3,9 +3,10 @@ import { segment } from "oicq"; import lodash from "lodash"; import { currentVersion, changelogs } from "../components/Changelog.js"; import Common from "../components/Common.js"; +import fs from "fs"; const _path = process.cwd(); -const helpFilePath = `${_path}/plugins/miao-plugin/resources/help/help-list.js`; +const helpPath = `${_path}/plugins/miao-plugin/resources/help`; export async function help(e, { render }) { @@ -13,18 +14,35 @@ export async function help(e, { render }) { return false; } - let helpFile = {}; - helpFile = await import(`file://${helpFilePath}?version=${new Date().getTime()}`); + let custom = {}, help = {}; + if (fs.existsSync(`${helpPath}/help-cfg.js`)) { + help = await import(`file://${helpPath}/help-cfg.js?version=${new Date().getTime()}`); + } else if (fs.existsSync(`${helpPath}/help-list.js`)) { + help = await import(`file://${helpPath}/help-list.js?version=${new Date().getTime()}`); + } + + // 兼容一下旧字段 + if (lodash.isArray(help.helpCfg)) { + custom = { + helpList: help.helpCfg, + helpCfg: {} + }; + } else { + custom = help; + } + + let def = await import(`file://${helpPath}/help-cfg_default.js?version=${new Date().getTime()}`); + + let helpCfg = lodash.defaults(custom.helpCfg, def.helpCfg); + let helpList = custom.helpList || def.helpList; - const { helpCfg } = helpFile; let helpGroup = []; - lodash.forEach(helpCfg, (group) => { + lodash.forEach(helpList, (group) => { if (group.auth && group.auth === "master" && !e.isMaster) { return; } - lodash.forEach(group.list, (help) => { let icon = help.icon * 1; if (!icon) { @@ -40,7 +58,8 @@ export async function help(e, { render }) { }); return await Common.render("help/index", { - helpCfg: helpGroup, + helpCfg, + helpGroup, element: 'default' }, { e, render, scale: 1.2 }) } diff --git a/index.js b/index.js index 145e338a..bef4ec34 100644 --- a/index.js +++ b/index.js @@ -99,7 +99,7 @@ let rule = { describe: "【#帮助】 喵喵版本介绍", }, calendar: { - reg: "^#?喵喵(日历|活动|日历列表)$", + reg: "^(#|喵喵)+(日历|日历列表)$", describe: "【#日历】 活动日历", }, ...adminRule diff --git a/resources/help/help-cfg_default.js b/resources/help/help-cfg_default.js new file mode 100644 index 00000000..3fc92c3c --- /dev/null +++ b/resources/help/help-cfg_default.js @@ -0,0 +1,154 @@ +/* +* 请勿直接修改此文件,可能会导致后续更新冲突 +* 如需自定义可将文件复制一份,重命名为 help-cfg.js 后编辑 +* */ + +// 帮助配置 +export const helpCfg = { + title: "喵喵帮助", // 帮助标题 + subTitle: "Yunzai-Bot & Miao-Plugin" // 帮助副标题 +}; + +// 帮助菜单内容 +export const helpList = [{ + group: "游戏面板与信息查询", + list: [{ + icon: 61, + title: "#角色 #角色卡片 #探索", + desc: "你的原神角色数据,数据来自米游社" + }, { + icon: 63, + title: "#面板 #更新面板", + desc: "查看已经获取面板信息的角色列表" + }, { + icon: 66, + title: "#雷神面板 #雷神伤害", + desc: "查看角色详细面板及伤害信息" + }, { + icon: 65, + title: "#圣遗物列表 #雷神圣遗物", + desc: "查看圣遗物列表 / 评分详情" + }, { + icon: 64, + title: "#深渊 #深渊12层", + desc: "深渊数据,打完请2小时后查询", + }, { + icon: 67, + title: "#五星 #武器 #今日素材", + desc: "你的原神角色详情数据" + }, { + icon: 62, + title: "#五星列表 #练度统计", + desc: "角色列表数据", + }] +}, { + group: "资料及图片", + list: [{ + icon: 58, + title: "#刻晴 #心海", + desc: "你的原神角色卡片" + }, { + icon: 59, + title: "#老婆 #老公", + desc: "查看老婆、老公" + }, { + icon: 60, + title: "#老婆设置心海,雷神", + desc: "设置老婆列表,也可设置随机" + }, { + icon: 88, + title: "#老婆照片 #甘雨照片", + desc: "查看指定角色的图片" + }, { + icon: 53, + title: "#夜兰天赋 #胡桃命座", + desc: "查看角色的天赋与命座资料" + }, { + icon: 56, + title: "#深渊配队", + desc: "根据你的角色池推荐组队" + }, { + icon: 78, + title: "#角色持有 #角色0命", + desc: "查看角色的持有率、0命统计" + }, { + icon: 77, + title: "#深渊出场率 #深渊12层出场", + desc: "查看深渊出场率信息" + }, { + icon: 20, + title: "#刻晴攻略", + desc: "西风驿站攻略" + }, { + icon: 60, + title: "#心海图鉴 #护摩", + desc: "角色武器图鉴" + },] +}, { + group: "个人信息查询及签到", + desc: "需要绑定cookie", + list: [{ + icon: 15, + title: "#体力 #体力帮助", + desc: "查询体力,绑定Cookie帮助" + }, { + icon: 5, + title: "#原石 #原石统计", + desc: "札记数据,需要绑定Cookie" + }, { + icon: 10, + title: "#uid #绑定123456789", + desc: "查看绑定的uid 绑定uid" + }, { + icon: 22, + title: "#我的ck #删除ck", + desc: "查看绑定的cookie 删除cookie" + }, { + icon: 86, + title: "#签到", + desc: "米游社原神签到" + }] +}, { + group: "其他查询指令", + list: [{ + icon: 83, + title: "#日历 #日历列表", + desc: "查看活动日历" + }, { + icon: 6, + title: "#抽卡记录 #记录帮助", + desc: "统计游戏抽卡数据" + }, { + icon: 21, + title: "#角色统计 #武器统计", + desc: "按卡池统计抽卡数据" + }, { + icon: 8, + title: "十连 十连2 定轨", + desc: "真实模拟抽卡" + }, { + icon: 74, + title: "添加哈哈 删除哈哈", + desc: "添加表情,回复哈哈触发" + }, { + icon: 79, + title: "#帮助 #版本 #喵喵版本", + desc: "其他命令" + }] +}, { + group: "管理命令,仅管理员可用", + auth: "master", + list: [{ + icon: 85, + title: "#用户统计", + desc: "查看用户CK-UID列表" + }, { + icon: 32, + title: "#喵喵设置", + desc: "配置喵喵功能" + }, { + icon: 35, + title: "#喵喵更新图像", + desc: "更新喵喵的增量角色图像素材" + }] +}]; \ No newline at end of file diff --git a/resources/help/index.css b/resources/help/index.css index dae6002e..b4ff828b 100644 --- a/resources/help/index.css +++ b/resources/help/index.css @@ -1,12 +1,12 @@ body { transform: scale(1); - width: 800px; + width: 830px; background: url("../common/theme/bg-01.jpg"); } .container { background: url(../common/theme/main-01.png) top left no-repeat; background-size: 100% auto; - width: 800px; + width: 830px; } .label { font-family: Number, "微软雅黑", sans-serif; diff --git a/resources/help/index.html b/resources/help/index.html index 3395718c..e1634070 100644 --- a/resources/help/index.html +++ b/resources/help/index.html @@ -7,16 +7,16 @@ {{block 'main'}}
-
使用帮助
-
Yunzai-Bot & Miao-Plugin
+
{{helpCfg.title||"使用帮助"}}
+
{{helpCfg.subTitle || "Yunzai-Bot & Miao-Plugin"}}
-{{each helpCfg helpGroup}} +{{each helpGroup group}}
-
{{helpGroup.group}}
+
{{group.group}}
- {{each helpGroup.list help idx}} + {{each group.list help idx}} {{if idx%3 == 0}}
{{/if}} @@ -25,7 +25,7 @@ {{help.title}} {{help.desc}}
- {{if idx%3 ==2 || idx == helpGroup.list.length -1}} + {{if idx%3 ==2 || idx == group.list.length -1}}
{{/if}} {{/each}} diff --git a/resources/help/index.less b/resources/help/index.less index fb0818bd..0af07ea0 100644 --- a/resources/help/index.less +++ b/resources/help/index.less @@ -1,13 +1,13 @@ body { transform: scale(1); - width: 800px; + width: 830px; background: url("../common/theme/bg-01.jpg"); } .container { background: url(../common/theme/main-01.png) top left no-repeat; background-size: 100% auto; - width: 800px; + width: 830px; } .label { diff --git a/resources/meta/character/胡桃/calc.js b/resources/meta/character/胡桃/calc.js index 7dc2ae68..d74ba1f5 100644 --- a/resources/meta/character/胡桃/calc.js +++ b/resources/meta/character/胡桃/calc.js @@ -16,7 +16,7 @@ export const buffs = [{ title: "蝶引来生:开E获得[atkPlus]点攻击力加成", data: { atkPlus: ({ talent, attr, calc }) => { - return Math.min(talent.e['攻击力提高'] * calc(attr.hp) / 100, attr.atk.base * 3); + return Math.min(talent.e['攻击力提高'] * calc(attr.hp) / 100, attr.atk.base * 4); } } }, {