From c2aca285cb136d354ba9b3c40d36f7cb24ba70f5 Mon Sep 17 00:00:00 2001 From: bietiaop <1527109126@qq.com> Date: Mon, 22 Jul 2024 19:06:52 +0800 Subject: [PATCH] feat:help --- CHANGELOG.md | 7 ++ README.md | 49 ++--------- apps/help.js | 170 ++++++++++++++++++++++++++++++++++---- resources/help/index.css | 122 +++++++++++++++++++++++++++ resources/help/index.html | 33 ++++++++ resources/help/index.scss | 130 +++++++++++++++++++++++++++++ 6 files changed, 453 insertions(+), 58 deletions(-) create mode 100644 resources/help/index.css create mode 100644 resources/help/index.html create mode 100644 resources/help/index.scss diff --git a/CHANGELOG.md b/CHANGELOG.md index fd956ff..85bab18 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# 1.0 +* 重构帮助指令,发送 `%帮助` + +# 0.3 +* 修复攻略图角色“本”图片错误 +* 将 `mysid` 比较转为字符串,解决部分适配问题 + # 0.2 * 添加“式舆防卫战”查询,发送 `%式舆防卫战` 或者 `%深渊` diff --git a/README.md b/README.md index 3b5eb08..275f2af 100644 --- a/README.md +++ b/README.md @@ -29,51 +29,18 @@ git clone --depth=1 https://github.com/ZZZure/ZZZ-Plugin.git ./plugins/ZZZ-Plugi 以下所有功能前缀为:`#zzz`、`%`、`#ZZZ`、`#绝区零` 任选其一 -
- 便签 - 命令: note、便签、便笺、体力、每日 -

-
+![功能图片](https://s2.loli.net/2024/07/22/bJwasnB3XZASvP6.jpg) -
- 基本信息汇总(角色和邦布) - 命令: card、卡片、个人信息 -

-
+## 攻略、图鉴 -
- 更新抽卡记录(需要逍遥插件支持) - 命令: 刷新抽卡链接、更新抽卡链接、刷新抽卡记录、更新抽卡记录 -

-
+**攻略、图鉴建议使用第三方插件**,本插件的攻略功能是在没有专业插件的情况下的保底功能。 -
- 获取抽卡记录链接(需要逍遥插件支持) - 命令: 获取抽卡链接 -

暂时没有图片

-
+推荐使用的图鉴插件: -
- 抽卡记录 - 命令: 抽卡分析、抽卡记录 -

-
- -
- 角色攻略 - 命令: 角色名称/别名+攻略+(可选)来源数字 -

老图片,功能差不多

-

-
- -
- 刷新角色面板 - 命令: 刷新面板、更新面板、面板刷新、面板更新 -

暂时没有图片

-
- -
- 查看角色面板列表 - 命令: 面板、面板列表 -

暂时没有图片

-
- -
- 查看角色面板 - 命令: 角色名/别名+面板 -

-
+* [Atlas](https://github.com/Nwflower/Atlas) + Atlas是一个适用于V3版本及以上Yunzai-Bot的图鉴查询插件,可通过Yunzai-Bot查询游戏图鉴,插件代码严格遵循ES6规范。 +* [Mora-Plugin](https://gitee.com/Rrrrrrray/mora-plugin) + Mora-Plugin是一个Yunzai-Bot的插件 仅用于自我学习其他优秀插件 # 贡献 diff --git a/apps/help.js b/apps/help.js index 7ecebda..79d1e34 100644 --- a/apps/help.js +++ b/apps/help.js @@ -1,8 +1,129 @@ import { ZZZPlugin } from '../lib/plugin.js'; import { rulePrefix } from '../lib/common.js'; +import render from '../lib/render.js'; import settings from '../lib/settings.js'; import _ from 'lodash'; +/** + * @typedef {Object} HelpItem + * @property {string} title + * @property {string} desc + * @property {boolean} needCK + * @property {boolean} needSK + * @property {string[]} commands + */ +/** + * @typedef {Object} HelpData + * @property {string} title + * @property {'fire'|'ice'|'physdmg'|'thunder'|'dungeon'} icon + * @property {HelpItem[]} items + */ +/** + * @type {HelpData[]} + * @description 帮助数据 + */ +const helpData = [ + { + title: '信息查询', + icon: 'fire', + items: [ + { + title: '基本信息', + desc: '查看玩家的角色和邦布列表', + needCK: true, + needSK: false, + commands: ['card', '卡片', '个人信息'], + }, + { + title: '便签', + desc: '查看便签', + needCK: true, + needSK: false, + commands: ['note', '便签', '便笺', '体力', '每日'], + }, + ], + }, + { + title: '抽卡记录', + icon: 'ice', + items: [ + { + title: '刷新抽卡记录', + desc: '刷新抽卡记录', + needCK: true, + needSK: true, + commands: ['刷新/更新抽卡链接', '刷新/更新抽卡记录'], + }, + { + title: '获取抽卡记录链接', + desc: '获取抽卡记录链接', + needCK: true, + needSK: true, + commands: ['获取抽卡链接'], + }, + { + title: '查看抽卡记录', + desc: '查看抽卡记录', + needCK: false, + needSK: false, + commands: ['抽卡分析', '抽卡记录'], + }, + ], + }, + { + title: '角色面板', + icon: 'thunder', + items: [ + { + title: '刷新角色面板', + desc: '刷新角色面板', + needCK: true, + needSK: false, + commands: ['刷新面板', '更新面板', '面板刷新', '面板更新'], + }, + { + title: '查看角色面板列表', + desc: '查看已保存的角色面板列表', + needCK: false, + needSK: false, + commands: ['面板', '面板列表'], + }, + { + title: '查看角色面板', + desc: '查看角色面板', + needCK: false, + needSK: false, + commands: ['角色名+面板'], + }, + ], + }, + { + title: '式舆防卫战', + icon: 'dungeon', + items: [ + { + title: '查看式舆防卫战', + desc: '查看式舆防卫战(深渊)信息', + needCK: false, + needSK: false, + commands: ['式舆防卫战', '防卫战', '式舆', '深渊', '防卫'], + }, + ], + }, + { + title: '角色攻略', + icon: 'physdmg', + items: [ + { + title: '查看角色攻略', + desc: '查看角色攻略', + needCK: false, + needSK: false, + commands: ['角色名+攻略[+来源]'], + }, + ], + }, +]; export class Help extends ZZZPlugin { constructor() { super({ @@ -19,22 +140,37 @@ export class Help extends ZZZPlugin { }); } async help() { - const reply_msg = [ - 'ZZZ-Plugin 帮助还在制作中', - '目前主要功能如下:', - '所有功能前缀为:#zzz、%、#ZZZ、#绝区零 任选其一', - '便签 - 命令: note、便签、便笺、体力、每日', - '基本信息汇总(角色和邦布) - 命令: card、卡片、个人信息', - '更新抽卡记录(需要逍遥插件支持) - 命令: 刷新抽卡链接、更新抽卡链接、刷新抽卡记录、更新抽卡记录', - '获取抽卡记录链接(需要逍遥插件支持) - 命令: 获取抽卡链接', - '抽卡记录 - 命令: 抽卡分析、抽卡记录', - '角色攻略 - 命令: 角色名称/别名+攻略+(可选)来源数字', - '刷新角色面板 - 命令: 刷新面板、更新面板、面板刷新、面板更新', - '查看角色面板列表 - 命令: 面板、面板列表', - '查看角色面板 - 命令: 角色名/别名+面板', - '仓库地址:https://github.com/ZZZure/ZZZ-Plugin', - 'GsCore版:https://github.com/ZZZure/ZZZeroUID', - ].join('\n'); - await this.reply(reply_msg); + if (this.e?.isMaster) { + helpData.push({ + title: '管理功能', + icon: 'dungeon', + items: [ + { + title: '更新', + desc: '更新绝区零插件', + needCK: false, + needSK: false, + commands: ['[插件][强制]更新'], + }, + { + title: '下载资源', + desc: '提前下载插件所需资源,查询时无需再次下载', + needCK: false, + needSK: false, + commands: ['下载全部/所有资源'], + }, + { + title: '删除资源', + desc: '删除已经下载的资源,查询时需要再次下载(用于删除错误下载缓存)', + needCK: false, + needSK: false, + commands: ['删除全部/所有资源'], + }, + ], + }); + } + await render(this.e, 'help/index.html', { + helpData, + }); } } diff --git a/resources/help/index.css b/resources/help/index.css new file mode 100644 index 0000000..eef6910 --- /dev/null +++ b/resources/help/index.css @@ -0,0 +1,122 @@ +.special-title { + padding: 0; + font-size: 1.2em; +} + +.card { + margin: 0 1em; + padding: 1em 0; +} +.card .part { + border-radius: 0.5em; + background-color: rgba(255, 255, 255, 0.1); + backdrop-filter: blur(1em); + margin-top: 1.5em; +} +.card .part .title { + font-size: 1.2em; + padding: 0.3em 0.7em; + border-bottom: 1px solid rgba(126, 126, 126, 0.5); + display: flex; + gap: 0.2em; + align-items: flex-end; + color: rgb(234, 225, 213); + box-shadow: 0 0 0.5em rgba(0, 0, 0, 0.5); + background-color: rgba(152, 152, 152, 0.3); + border-radius: 0.5em 0.5em 0 0; + position: relative; +} +.card .part .title .property { + width: 1.8em; + position: absolute; + filter: drop-shadow(0.06em 0.06em 0 rgba(255, 255, 255, 0.5)); + left: 0.3em; +} +.card .part .title .content { + flex: 1; + margin-bottom: -0.13em; + filter: drop-shadow(0.06em 0.06em 0 rgba(0, 0, 0, 0.5)); + margin-left: 1.6em; +} +.card .part .list { + width: 100%; + overflow: hidden; + padding: 0.6em; + display: grid; + gap: 0.5em; + grid-template-columns: repeat(3, 1fr); + align-items: flex-start; +} +.card .part .list .item { + width: 100%; + background-color: rgba(255, 255, 255, 0.1); + border-radius: 0.4em; + padding: 0.4em 0.7em; + font-size: 0.8em; + display: flex; + flex-direction: column; + gap: 0.3em; + box-shadow: 0 0 0.7em rgba(0, 0, 0, 0.2); + overflow: hidden; +} +.card .part .list .item .name { + width: 100%; + font-size: 1.2em; + display: flex; + overflow: hidden; + align-items: flex-start; +} +.card .part .list .item .name.ck::before { + content: "CK"; + margin-top: 0.3em; + margin-right: 0.3em; + font-size: 0.6em; + padding: 0.1em 0.3em; + border-radius: 0.3em; + background-color: rgb(249, 149, 55); + text-shadow: 0 0 0.1em rgba(0, 0, 0, 0.5); +} +.card .part .list .item .name.sk::before { + content: "SK"; + margin-top: 0.3em; + margin-right: 0.3em; + font-size: 0.6em; + padding: 0.1em 0.3em; + border-radius: 0.3em; + background-color: rgb(249, 65, 55); + text-shadow: 0 0 0.1em rgba(0, 0, 0, 0.5); +} +.card .part .list .item .commands { + display: flex; + flex-wrap: wrap; + gap: 0.3em; + font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif; + font-weight: 500; + font-size: 0.9em; +} +.card .part .list .item .commands .command { + height: 1.6em; + line-height: 1.6em; + padding: 0em 0.5em; + border-radius: 0.5em 0.2em 0.5em 0.2em; + background-color: rgba(255, 255, 255, 0.1); + backdrop-filter: blur(5px); + color: rgb(255, 186, 96); + box-shadow: 0 0 0.1em rgba(0, 0, 0, 0.6); + border-bottom: 0.1em solid rgba(241, 22, 22, 0.7); +} +.card .part .list .item .commands .command::before { + content: "%"; + color: rgba(112, 13, 13, 0.45); + text-shadow: none; + margin-right: 0.1em; + margin-left: -0.2em; +} +.card .part .list .item .desc { + font-size: 1em; + font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif; + font-size: 0.8em; + color: rgb(225, 225, 225); +} + +/*# sourceMappingURL=index.css.map */ diff --git a/resources/help/index.html b/resources/help/index.html new file mode 100644 index 0000000..f7f3a43 --- /dev/null +++ b/resources/help/index.html @@ -0,0 +1,33 @@ +{{extend defaultLayout}} + +{{block 'css'}} + +{{/block}} + +{{block 'main'}} +
+ <% include(sys.specialTitle, {en: 'HELP' , cn: '绝区零帮助' }) %> + {{each helpData help i}} +
+
+
+
{{help.title}}
+
+
+ {{each help.items item j}} +
+
{{item.title}}
+
+ {{each item.commands command k}} + {{command}} + {{/each}} +
+
{{item.desc}}
+
+ {{/each}} +
+
+ {{/each}} + +
+{{/block}} \ No newline at end of file diff --git a/resources/help/index.scss b/resources/help/index.scss new file mode 100644 index 0000000..fe77126 --- /dev/null +++ b/resources/help/index.scss @@ -0,0 +1,130 @@ +.special-title { + padding: 0; + font-size: 1.2em; +} +.card { + margin: 0 1em; + padding: 1em 0; + .part { + border-radius: 0.5em; + background-color: rgba(255, 255, 255, 0.1); + backdrop-filter: blur(1em); + margin-top: 1.5em; + // overflow: hidden; + .title { + font-size: 1.2em; + padding: 0.3em 0.7em; + border-bottom: 1px solid rgba(126, 126, 126, 0.5); + display: flex; + gap: 0.2em; + align-items: flex-end; + color: rgb(234, 225, 213); + box-shadow: 0 0 0.5em rgba(0, 0, 0, 0.5); + background-color: rgba(152, 152, 152, 0.3); + border-radius: 0.5em 0.5em 0 0; + position: relative; + .property { + width: 1.8em; + position: absolute; + filter: drop-shadow(0.06em 0.06em 0 rgba(255, 255, 255, 0.5)); + left: 0.3em; + } + .content { + flex: 1; + margin-bottom: -0.13em; + // -webkit-text-stroke: 0.05em rgb(13, 63, 90); + filter: drop-shadow(0.06em 0.06em 0 rgba(0, 0, 0, 0.5)); + margin-left: 1.6em; + } + } + .list { + width: 100%; + overflow: hidden; + padding: 0.6em; + display: grid; + gap: 0.5em; + grid-template-columns: repeat(3, 1fr); + align-items: flex-start; + .item { + width: 100%; + background-color: rgba(255, 255, 255, 0.1); + border-radius: 0.4em; + padding: 0.4em 0.7em; + font-size: 0.8em; + display: flex; + flex-direction: column; + gap: 0.3em; + box-shadow: 0 0 0.7em rgba(0, 0, 0, 0.2); + overflow: hidden; + .name { + width: 100%; + font-size: 1.2em; + display: flex; + overflow: hidden; + align-items: flex-start; + &.ck { + &::before { + content: 'CK'; + margin-top: 0.3em; + margin-right: 0.3em; + font-size: 0.6em; + padding: 0.1em 0.3em; + border-radius: 0.3em; + background-color: rgb(249, 149, 55); + text-shadow: 0 0 0.1em rgba(0, 0, 0, 0.5); + } + } + &.sk { + &::before { + content: 'SK'; + margin-top: 0.3em; + margin-right: 0.3em; + font-size: 0.6em; + padding: 0.1em 0.3em; + border-radius: 0.3em; + background-color: rgb(249, 65, 55); + text-shadow: 0 0 0.1em rgba(0, 0, 0, 0.5); + } + } + } + .commands { + display: flex; + flex-wrap: wrap; + gap: 0.3em; + font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', + Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', + sans-serif; + font-weight: 500; + font-size: 0.9em; + .command { + height: 1.6em; + line-height: 1.6em; + padding: 0em 0.5em; + border-radius: 0.5em 0.2em 0.5em 0.2em; + background-color: rgba(255, 255, 255, 0.1); + backdrop-filter: blur(5px); + color: rgb(255, 186, 96); + box-shadow: 0 0 0.1em rgba(0, 0, 0, 0.6); + border-bottom: 0.1em solid rgba(241, 22, 22, 0.7); + // text-shadow: 0.05em 0.05em 0.2em rgba(0, 0, 0, 0.3); + &::before { + content: '%'; + color: rgba(112, 13, 13, 0.45); + text-shadow: none; + margin-right: 0.1em; + margin-left: -0.2em; + } + } + } + .desc { + font-size: 1em; + font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', + Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', + sans-serif; + font-size: 0.8em; + color: rgb(225, 225, 225); + } + } + } + } +}