mirror of
https://github.com/yoimiya-kokomi/miao-plugin.git
synced 2024-11-22 15:36:27 +00:00
750cdddbce
* `#喵喵日历` 优化 * 对角色、武器UP的日历展示做合并优化 * 增强从活动详情解析日期的能力,使一些活动日期更加准确 * `#角色面板` 伤害计算增加 琴、莫娜
45 lines
1.0 KiB
JavaScript
45 lines
1.0 KiB
JavaScript
import fs from "fs";
|
|
import lodash from "lodash";
|
|
|
|
const _path = process.cwd();
|
|
const _cfgPath = `${_path}/plugins/miao-plugin/components/`;
|
|
let cfg = {};
|
|
|
|
try {
|
|
if (fs.existsSync(_cfgPath + "cfg.json")) {
|
|
cfg = JSON.parse(fs.readFileSync(_cfgPath + "cfg.json", "utf8")) || {};
|
|
}
|
|
} catch (e) {
|
|
// do nth
|
|
}
|
|
|
|
let Cfg = {
|
|
get(rote, def = '') {
|
|
return lodash.get(cfg, rote, def);
|
|
},
|
|
set(rote, val) {
|
|
lodash.set(cfg, rote, val);
|
|
fs.writeFileSync(_cfgPath + "cfg.json", JSON.stringify(cfg, null, "\t"));
|
|
},
|
|
del(rote) {
|
|
lodash.set(cfg, rote, undefined);
|
|
fs.writeFileSync(_cfgPath + "cfg.json", JSON.stringify(cfg, null, "\t"));
|
|
},
|
|
scale(pct = 1) {
|
|
let scale = Cfg.get("sys.scale", 100);
|
|
scale = Math.min(2, Math.max(0.5, scale / 100));
|
|
pct = pct * scale;
|
|
return `style=transform:scale(${pct})`;
|
|
},
|
|
isDisable(e, rote) {
|
|
if (Cfg.get(rote, true)) {
|
|
return false;
|
|
}
|
|
if (/^#*喵喵/.test(e.msg || "")) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
};
|
|
|
|
export default Cfg; |