#喵喵帮助增加对自定义配置文件的支持

* 已有配置文件可更名为help-cfg.js,防止后续更新冲突,后续会支持更多配置项
* 在默认配置中增加部分新帮助命令
`#喵喵日历`现在可通过`#日历 #日历列表`触发
修正胡桃E伤害计算错误
This commit is contained in:
yoimiya-kokomi 2022-06-29 04:30:34 +08:00
parent 67394bf623
commit 9bea49cc96
9 changed files with 202 additions and 19 deletions

2
.gitignore vendored
View File

@ -6,3 +6,5 @@
/config.js
*.css.map
/resources/character-img/*/upload/
/resources/help/help-list.js
/resources/help/help-cfg.js

View File

@ -1,3 +1,11 @@
# 1.8.2
* `#喵喵帮助`增加对自定义配置文件的支持
* 已有配置文件可更名为help-cfg.js防止后续更新冲突后续会支持更多配置项
* 在默认配置中增加部分新帮助命令
* `#喵喵日历`现在可通过`#日历 #日历列表`触发
* 修正胡桃E伤害计算错误
# 1.8.1
* 增加`#添加刻晴图像`命令,感谢 **@叶**

View File

@ -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 })
}

View File

@ -99,7 +99,7 @@ let rule = {
describe: "【#帮助】 喵喵版本介绍",
},
calendar: {
reg: "^#?喵喵(日历|活动|日历列表)$",
reg: "^(#|喵喵)+(日历|日历列表)$",
describe: "【#日历】 活动日历",
},
...adminRule

View File

@ -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: "更新喵喵的增量角色图像素材"
}]
}];

View File

@ -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;

View File

@ -7,16 +7,16 @@
{{block 'main'}}
<div class="info_box">
<div class="head-box type{{bgType}}">
<div class="title">使用帮助</div>
<div class="label">Yunzai-Bot & Miao-Plugin</div>
<div class="title">{{helpCfg.title||"使用帮助"}}</div>
<div class="label">{{helpCfg.subTitle || "Yunzai-Bot & Miao-Plugin"}}</div>
</div>
</div>
{{each helpCfg helpGroup}}
{{each helpGroup group}}
<div class="cont-box">
<div class="help-group">{{helpGroup.group}}</div>
<div class="help-group">{{group.group}}</div>
<div class="help-table">
{{each helpGroup.list help idx}}
{{each group.list help idx}}
{{if idx%3 == 0}}
<div class="tr">
{{/if}}
@ -25,7 +25,7 @@
<strong class="help-title">{{help.title}}</strong>
<span class="help-desc">{{help.desc}}</span>
</div>
{{if idx%3 ==2 || idx == helpGroup.list.length -1}}
{{if idx%3 ==2 || idx == group.list.length -1}}
</div>
{{/if}}
{{/each}}

View File

@ -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 {

View File

@ -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);
}
}
}, {