增加#喵喵设置功能

This commit is contained in:
yoimiya-kokomi 2022-04-10 05:33:21 +08:00
parent 7f2b058951
commit 93b3ff01a2
27 changed files with 740 additions and 38 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
*.psd *.psd
.idea .idea
/components/cfg.json

View File

@ -1,28 +1,108 @@
import { segment } from "oicq"; import { segment } from "oicq";
import fs from "fs"; import fs from "fs";
import { Character } from "../components/models.js";
import lodash from "lodash"; import lodash from "lodash";
import { createRequire } from "module"; import { createRequire } from "module";
import { exec } from "child_process"; import { exec } from "child_process";
import { Cfg } from "../components/index.js";
const require = createRequire(import.meta.url); const require = createRequire(import.meta.url);
let cfgMap = {
//import {wikiCharacter} from "../modules/wiki.js"; "角色": "char.char",
"老婆": "char.wife",
"查他人": "char.queryOther",
"天赋": "wiki.talent",
"命座": "wiki.cons",
"图片": "wiki.pic",
"深渊": "wiki.abyss",
"渲染": "sys.scale",
};
let sysCfgReg = `^#喵喵设置\s*(${lodash.keys(cfgMap).join("|")})?\s*(.*)$`;
export const rule = { export const rule = {
updateRes: { updateRes: {
reg: "#喵喵更新素材", reg: "^#喵喵更新图像$",
describe: "【#老婆,#老公,#女儿】角色详情", describe: "【#管理】更新素材",
},
sysCfg: {
reg: sysCfgReg,
describe: "【#管理】系统设置"
} }
}; };
const _path = process.cwd(); const _path = process.cwd();
const resPath = `${_path}/plugins/miao-plugin/resources/`; const resPath = `${_path}/plugins/miao-plugin/resources/`;
const plusPath = `${resPath}/miao-res-plus/`;
const checkAuth = async function (e) {
return await e.checkAuth({
auth: "master",
replyMsg: `只有主人才能命令喵喵哦~
(*/ω*)`
});
}
export async function sysCfg(e, { render }) {
if (!await checkAuth(e)) {
return true;
}
let cfgReg = new RegExp(sysCfgReg);
let regRet = cfgReg.exec(e.msg);
if (!regRet) {
return true;
}
if (regRet[1]) {
// 设置模式
let val = regRet[2] || "";
let cfgKey = cfgMap[regRet[1]];
if (cfgKey === "sys.scale") {
val = Math.min(200, Math.max(50, val * 1 || 100));
} else {
val = !/关闭/.test(val);
}
if (cfgKey) {
Cfg.set(cfgKey, val);
}
}
let cfg = {
chars: getStatus("char.char"),
wife: getStatus("char.wife"),
other: getStatus("char.queryOther"),
talent: getStatus("wiki.talent"),
cons: getStatus("wiki.cons"),
pic: getStatus("wiki.pic"),
abyss: getStatus("wiki.hutao"),
imgPlus: fs.existsSync(plusPath),
scale: Cfg.get("sys.scale", 100)
}
let base64 = await render("admin", "index", {
...cfg,
cfgScale: Cfg.scale(1.2)
}, "png");
if (base64) {
e.reply(segment.image(`base64://${base64}`));
}
return true;
}
const getStatus = function (rote) {
if (Cfg.get(rote, true)) {
return `<div class="cfg-status" >已开启</div>`;
} else {
return `<div class="cfg-status status-off">已关闭</div>`;
}
}
export async function updateRes(e) { export async function updateRes(e) {
if (!e.checkAuth({ auth: "master" })) { if (!await checkAuth(e)) {
return true; return true;
} }
@ -31,22 +111,23 @@ export async function updateRes(e) {
command = `git -C ${resPath}/miao-res-plus pull`; command = `git -C ${resPath}/miao-res-plus pull`;
exec(command, function (error, stdout, stderr) { exec(command, function (error, stdout, stderr) {
console.log(stdout); console.log(stdout);
if (stdout === "Already up to date.") { if (/Already up to date/.test(stdout)) {
e.reply("素材已经是最新了~"); e.reply("素材已经是最新了~");
return true;
} }
if (error) { if (error) {
e.reply("素材初始化失败!\nError code: " + error.code + "\n" + error.stack + "\n出错了,可以重试一下。"); e.reply("更新失败!\nError code: " + error.code + "\n" + error.stack + "\n 请稍后重试。");
} else { } else {
e.reply("额外素材初始化成功"); e.reply("角色图像加量包更新成功~");
} }
}); });
} else { } else {
command = `git clone https://gitee.com/yoimiya-kokomi/miao-res-plus.git ${resPath}/miao-res-plus/`; command = `git clone https://gitee.com/yoimiya-kokomi/miao-res-plus.git ${resPath}/miao-res-plus/`;
exec(command, function (error, stdout, stderr) { exec(command, function (error, stdout, stderr) {
if (error) { if (error) {
e.reply("素材初始化失败!\nError code: " + error.code + "\n" + error.stack + "\n出错了,可以重试一下。"); e.reply("角色图像加量包安装失败!\nError code: " + error.code + "\n" + error.stack + "\n 请稍后重试。");
} else { } else {
e.reply("额外素材初始化成功"); e.reply("角色图像加量包安装成功!您后续也可以通过 #喵喵更新图像 命令来更新图像");
} }
}); });
} }

View File

@ -1,6 +1,7 @@
import { segment } from "oicq"; import { segment } from "oicq";
import lodash from "lodash"; import lodash from "lodash";
import { Character } from "../components/models.js" import { Character } from "../components/models.js"
import { Cfg } from "../components/index.js";
import fs from "fs"; import fs from "fs";
import sizeOf from "image-size"; import sizeOf from "image-size";
@ -52,6 +53,10 @@ export async function character(e, { render, User }) {
if (!e.msg) { if (!e.msg) {
return; return;
} }
if (Cfg.isDisable(e, "char.char")) {
return;
}
let name = e.msg.replace(/#|老婆|老公|[1|2|5][0-9]{8}/g, "").trim(); let name = e.msg.replace(/#|老婆|老公|[1|2|5][0-9]{8}/g, "").trim();
let char = Character.get(name); let char = Character.get(name);
@ -69,8 +74,11 @@ export async function wife(e, { render, User }) {
msg = msg.replace(/#|\w/g, ""); msg = msg.replace(/#|\w/g, "");
if (!msg) return false; if (!msg) return false;
let msgRet = (new RegExp(wifeReg)).exec(msg); if (Cfg.isDisable(e, "char.wife")) {
return;
}
let msgRet = (new RegExp(wifeReg)).exec(msg);
if (!msgRet) return false; if (!msgRet) return false;
let target = msgRet[1], let target = msgRet[1],
@ -87,12 +95,18 @@ export async function wife(e, { render, User }) {
let MysApi = await e.getMysApi({ let MysApi = await e.getMysApi({
auth: "all", auth: "all",
target: "self", targetType: Cfg.get("char.queryOther", true) ? "all" : "self",
cookieType: "all", cookieType: "all",
actionName: "查询信息" actionName: "查询信息"
}); });
let selfUser = MysApi.selfUser; let selfUser = MysApi.selfUser;
let selfMysUser = await MysApi.selfUser.getMysUser();
let isSelf = true;
if (!selfMysUser || selfMysUser.uid !== MysApi.targetUser.uid) {
isSelf = false;
}
switch (action) { switch (action) {
case "卡片": case "卡片":
case "照片": case "照片":
@ -105,7 +119,7 @@ export async function wife(e, { render, User }) {
wifeList = await selfUser.getCfg(`wife.${targetCfg.key}`, []); wifeList = await selfUser.getCfg(`wife.${targetCfg.key}`, []);
let renderType = action === "卡片" ? "card" : "photo"; let renderType = action === "卡片" ? "card" : "photo";
// 存在设置 // 存在设置
if (wifeList && wifeList.length > 0) { if (wifeList && wifeList.length > 0 && isSelf) {
if (wifeList[0] === "随机") { if (wifeList[0] === "随机") {
// 如果选择为全部,则从列表中随机选择一个 // 如果选择为全部,则从列表中随机选择一个
avatarList = await getAvatarList(e, targetCfg.type, MysApi); avatarList = await getAvatarList(e, targetCfg.type, MysApi);
@ -131,8 +145,7 @@ export async function wife(e, { render, User }) {
case "选择": case "选择":
case "挑选": case "挑选":
case "指定": case "指定":
let selfMysUser = await MysApi.selfUser.getMysUser(); if (!isSelf) {
if (!selfMysUser || selfMysUser.uid !== MysApi.targetUser.uid) {
e.reply("只能指定自己的哦~"); e.reply("只能指定自己的哦~");
return true; return true;
} }
@ -170,6 +183,12 @@ export async function wife(e, { render, User }) {
case "是": case "是":
case "是谁": case "是谁":
// 查看当前选择老婆 // 查看当前选择老婆
if (!isSelf) {
e.reply("只能查看自己的哦~");
return true;
}
wifeList = await selfUser.getCfg(`wife.${targetCfg.key}`, []); wifeList = await selfUser.getCfg(`wife.${targetCfg.key}`, []);
if (wifeList && wifeList.length > 0) { if (wifeList && wifeList.length > 0) {
e.reply(`你的${targetCfg.keyword[0]}是:${wifeList.join("")}`); e.reply(`你的${targetCfg.keyword[0]}是:${wifeList.join("")}`);
@ -220,7 +239,7 @@ async function renderAvatar(e, avatar, render, renderType = "card") {
let roleId = char.id; let roleId = char.id;
let MysApi = await e.getMysApi({ let MysApi = await e.getMysApi({
auth: "all", auth: "all",
target: "all", targetType: Cfg.get("char.queryOther", true) ? "all" : "self",
cookieType: "all", cookieType: "all",
actionName: "查询信息" actionName: "查询信息"
}); });
@ -286,6 +305,7 @@ async function renderCard(e, avatar, render, renderType = "card") {
bg: getCharacterImg(avatar.name), bg: getCharacterImg(avatar.name),
...getCharacterData(avatar), ...getCharacterData(avatar),
ds: char.getData("name,id,title,desc"), ds: char.getData("name,id,title,desc"),
cfgScale: Cfg.scale(1.25)
}, "png"); }, "png");
if (base64) { if (base64) {
e.reply(segment.image(`base64://${base64}`)); e.reply(segment.image(`base64://${base64}`));
@ -300,7 +320,7 @@ async function getTalent(e, avatars) {
let MysApi = await e.getMysApi({ let MysApi = await e.getMysApi({
auth: "all", auth: "all",
target: "all", targetType: Cfg.get("char.queryOther", true) ? "all" : "self",
cookieType: "all", cookieType: "all",
actionName: "查询信息" actionName: "查询信息"
}); });

View File

@ -3,10 +3,14 @@
* *
* */ * */
import { HutaoApi, Character } from "../components/models.js"; import { HutaoApi, Character } from "../components/models.js";
import { Cfg } from "../components/index.js";
import lodash from "lodash"; import lodash from "lodash";
import { segment } from "oicq"; import { segment } from "oicq";
export async function consStat(e, { render }) { export async function consStat(e, { render }) {
if (Cfg.isDisable(e, "wiki.abyss")) {
return;
}
let consData = await HutaoApi.getCons(); let consData = await HutaoApi.getCons();
if (!consData) { if (!consData) {
@ -14,6 +18,8 @@ export async function consStat(e, { render }) {
return true; return true;
} }
let msg = e.msg; let msg = e.msg;
let mode = /持有/.test(msg) ? "char" : "cons"; let mode = /持有/.test(msg) ? "char" : "cons";
@ -71,7 +77,8 @@ export async function consStat(e, { render }) {
lastUpdate: consData.lastUpdate, lastUpdate: consData.lastUpdate,
pct: function (num) { pct: function (num) {
return (num * 100).toFixed(2); return (num * 100).toFixed(2);
} },
cfgScale: Cfg.scale(1.4)
}, "png"); }, "png");
if (base64) { if (base64) {
e.reply(segment.image(`base64://${base64}`)); e.reply(segment.image(`base64://${base64}`));
@ -80,6 +87,11 @@ export async function consStat(e, { render }) {
} }
export async function abyssPct(e, { render }) { export async function abyssPct(e, { render }) {
if (Cfg.isDisable(e, "wiki.abyss")) {
return;
}
let abyssData = await HutaoApi.getAbyssPct(); let abyssData = await HutaoApi.getAbyssPct();
if (!abyssData) { if (!abyssData) {
e.reply("暂时无法查询"); e.reply("暂时无法查询");
@ -119,7 +131,7 @@ export async function abyssPct(e, { render }) {
avatars.push({ avatars.push({
name: char.name, name: char.name,
star: char.star, star: char.star,
value: ds.value value: ds.value * 8
}) })
} }
}) })
@ -143,7 +155,8 @@ export async function abyssPct(e, { render }) {
lastUpdate: abyssData.lastUpdate, lastUpdate: abyssData.lastUpdate,
pct: function (num) { pct: function (num) {
return (num * 100).toFixed(2); return (num * 100).toFixed(2);
} },
cfgScale: Cfg.scale(1.4)
}, "png"); }, "png");
if (base64) { if (base64) {
e.reply(segment.image(`base64://${base64}`)); e.reply(segment.image(`base64://${base64}`));

View File

@ -2,6 +2,7 @@ import { segment } from "oicq";
import fs from "fs"; import fs from "fs";
import { Character } from "../components/models.js"; import { Character } from "../components/models.js";
import lodash from "lodash"; import lodash from "lodash";
import { Cfg } from "../components/index.js";
//import {wikiCharacter} from "../modules/wiki.js"; //import {wikiCharacter} from "../modules/wiki.js";
@ -32,6 +33,10 @@ export async function wiki(e, { render }) {
mode = "pic"; mode = "pic";
} }
if (Cfg.isDisable(e, `wiki.${mode}`)) {
return;
}
let char = Character.get(ret[1]); let char = Character.get(ret[1]);
@ -50,7 +55,8 @@ export async function wiki(e, { render }) {
...char, ...char,
mode, mode,
line: getLineData(char), line: getLineData(char),
_char: `/meta/character/${char.name}/` _char: `/meta/character/${char.name}/`,
cfgScale: Cfg.scale(1)
}); });
if (base64) { if (base64) {

195
apps/word-cloud.js Normal file
View File

@ -0,0 +1,195 @@
//技能列表配置了cookie能查
import fs from "fs";
import lodash from "lodash";
import common from "../../../lib/common.js";
import { segment } from "oicq";
export async function talentList(e, { render }) {
//缓存时间,单位小时
let cacheCd = 6;
let msg = e.msg.replace("#", "").trim();
if (msg === "角色统计" || msg === "武器统计") {
//暂时避让一下抽卡分析的关键词
return false;
}
let MysApi = await getMysApi(e);
if (!MysApi) return true;
let uid = MysApi.targetUid;
//禁止重复获取
if (skillLoading[e.user_id]) {
e.reply("角色数据获取中,请耐心等待...");
setTimeout(() => {
if (skillLoading[e.user_id]) delete skillLoading[e.user_id];
}, 60000);
return;
}
const displayMode = /(角色|武器|练度)/.test(e.msg) ? "weapon" : "talent";
//四星五星
let star = 0;
if (/(四|4)/.test(msg)) star = 4;
if (/(五|5)/.test(msg)) star = 5;
// 技能查询缓存
let cachePath = `./data/cache/`;
if (!fs.existsSync(cachePath)) {
fs.mkdirSync(cachePath);
}
cachePath += "talentList/";
if (!fs.existsSync(cachePath)) {
fs.mkdirSync(cachePath);
}
let avatarRet = [];
let hasCache = await redis.get(`cache:uid-talent-new:${uid}`); // 由于数据结构改变,临时修改一下键值,防止命中历史缓存导致展示错误
if (hasCache && !/force/.test(e.msg)) {
// 有缓存优先使用缓存
let jsonRet = fs.readFileSync(cachePath + `${uid}.json`, "utf8");
avatarRet = JSON.parse(jsonRet);
} else {
skillLoading[e.user_id] = true;
let resIndex = await MysApi.getCharacter();
if (!resIndex) {
delete skillLoading[e.user_id];
return true;
}
let avatarData = resIndex && resIndex.avatars || [];
// let skillRet = [], skill = [];
//配置了cookie的才去获取技能
// if (NoteCookie[e.user_id]) {
let skillRet = [], skill = [];
//配置了完整cookie的才去获取技能
if (NoteCookie[e.user_id] && NoteCookie[e.user_id].cookie.includes("cookie_token")) {
e.reply("角色数据获取中,请耐心等待...");
//批量获取技能数据分组10个id一次延迟100ms
let num = 10, ms = 100;
let avatarArr = lodash.chunk(avatarData, num);
for (let val of avatarArr) {
for (let avatar of val) {
skillRet.push(getSkill(e, uid, avatar, MysApi));
}
skillRet = await Promise.all(skillRet);
//过滤没有获取成功的
skillRet.filter(item => item.a);
skillRet = skillRet.filter(item => item.a);
await common.sleep(ms);
}
skill = lodash.keyBy(skillRet, "id");
}
// 天赋等级背景
const talentLvMap = '0,1,1,1,2,2,3,3,3,4,5'.split(',')
// 根据每日素材构建 角色->素材的映射关系
let charTalentMap = {};
daily.forEach((weekCfg, week) => {
lodash.forIn(weekCfg[0], (talentCfg, talentName) => {
talentCfg[1].forEach((charName) => {
charTalentMap[charName] = { name: talentName, week: [3, 1, 2][week] };
})
})
});
for (let idx in avatarData) {
let curr = avatarData[idx];
let avatar = lodash.pick(curr, "id,name,rarity,level,rarity,fetter".split(","));
// 埃洛伊rarity是105...
avatar.rarity = avatar.rarity > 5 ? 5 : avatar.rarity;
let weapon = curr.weapon || {};
"name,level,rarity,affix_level".split(",").forEach((idx) => {
avatar[`weapon_${idx}`] = curr.weapon[idx];
});
avatar.cons = curr.actived_constellation_num;
if (avatar.id == 10000007) {
avatar.name = "荧";
} else if (avatar.id == 10000005) {
avatar.name = "空";
} else {
let talent = charTalentMap[avatar.name] || {};
avatar.talent = talent.name;
avatar.talentWeek = talent.week; //`${talent.week}${talent.week + 3}`;
}
let skillRet = skill[avatar.id] || {};
const talentConsCfg = { a: 0, e: 3, q: 5 };
lodash.forIn(talentConsCfg, (consLevel, key) => {
let talent = skillRet[key] || {};
// 天赋等级
avatar[key] = talent.level_current || '-';
// 是否有命座加成
avatar[`${key}_plus`] = talent.level_current > talent.level_original;
// 天赋书星级
avatar[`${key}_lvl`] = talentLvMap[talent.level_original * 1];
avatar[`${key}_original`] = talent.level_original * 1;
})
avatar.aeq = avatar.a * 1 + avatar.e + avatar.q;
avatarRet.push(avatar);
}
fs.writeFileSync(cachePath + `${uid}.json`, JSON.stringify(avatarRet));
//缓存
await redis.set(`cache:uid-talent-new:${uid}`, uid, { EX: 3600 * cacheCd });
delete skillLoading[e.user_id];
// }
}
//超过八个角色才分类四星五星
if (star >= 4 && avatarRet.length > 8) {
avatarRet = avatarRet.filter(item => item.rarity == star);
}
let sortKey = ({
talent: "aeq,rarity,level,star,fetter,talentWeek",
weapon: "level,rarity,aeq,cons,weapon_level,weapon_rarity,weapon_affix_level,fetter"
})[displayMode].split(",");
avatarRet = lodash.orderBy(avatarRet, sortKey, lodash.repeat("desc,", sortKey.length).split(","));
let noTalent = avatarRet.length == 0 || /^\-+$/.test(avatarRet.map((d) => d.a).join(""));
let talentNotice = `技能列表每${cacheCd}小时更新一次`;
if (noTalent) {
talentNotice = "未绑定体力Cookie无法获取天赋列表。请回复 #体力 获取配置教程";
}
let week = new Date().getDay();
if (new Date().getHours() < 4) {
week--;
}
let base64 = await render("genshin", "talentList", {
save_id: uid,
uid: uid,
avatars: avatarRet,
bgType: Math.ceil(Math.random() * 3),
abbr: genshin.abbr,
displayMode,
isSelf: e.isSelf,
week: [3, 1, 2][week % 3],
talentNotice
});
if (base64) {
let msg = [];
if (e.isGroup) {
let name = lodash.truncate(e.sender.card, { length: 8 });
msg.push(segment.at(e.user_id, name));
}
msg.push(segment.image(`base64://${base64}`));
e.reply(msg);
}
return true; //事件结束不再往下
}

45
components/Cfg.js Normal file
View File

@ -0,0 +1,45 @@
import fs from "fs";
import lodash from "lodash";
const _path = process.cwd();
const _cfgPath = `${_path}/plugins/miao-plugin/components/`;
let cfg = {};
if (!fs.existsSync(_cfgPath)) {
fs.mkdirSync(_cfgPath);
}
try {
if (fs.existsSync(_cfgPath + "cfg.json")) {
cfg = JSON.parse(fs.readFileSync(_cfgPath + "miao-plugin.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"));
},
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;

View File

@ -1,3 +1,4 @@
import Data from "./Data.js"; import Data from "./Data.js";
import Cfg from "./Cfg.js";
export { Data } export { Data, Cfg }

View File

@ -3,9 +3,9 @@ import { consStat, abyssPct } from "./apps/stat.js";
import { wiki } from "./apps/wiki.js"; import { wiki } from "./apps/wiki.js";
import lodash from "lodash"; import lodash from "lodash";
import { rule as adminRule, updateRes } from "./apps/admin.js"; import { rule as adminRule, updateRes, sysCfg } from "./apps/admin.js";
export { character, wife, consStat, abyssPct, wiki, updateRes }; export { character, wife, consStat, abyssPct, wiki, updateRes, sysCfg };
let rule = { let rule = {

BIN
resources/admin/bg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

90
resources/admin/index.css Normal file
View File

@ -0,0 +1,90 @@
body {
transform: scale(1);
width: 520px;
}
.container {
background: url("bg.png") #000144 left top no-repeat;
background-size: 520px auto;
width:520px;
}
.head-box {
margin: 0 0 80px 0;
}
.cfg-box {
border-radius: 15px;
margin-top: 20px;
margin-bottom: 20px;
padding: 5px 15px;
overflow: hidden;
background: #f5f5f5;
box-shadow: 0 5px 10px 0 rgb(0 0 0 / 15%);
position: relative;
background: rgba(35, 38, 57, .8);
}
.cfg-group {
color: #ceb78b;
font-size: 18px;
font-weight: bold;
padding: 10px 20px;
}
.cfg-ul {
}
.cfg-li {
border-radius: 18px;
min-height: 36px;
position: relative;
overflow: hidden;
margin-bottom: 10px;
background: rgba(203, 196, 190, 0);
}
.cfg-line {
color: #4e5769;
line-height: 36px;
padding-left: 20px;
font-weight: bold;
border-radius: 16px;
box-shadow: 0 0 2px rgba(0, 0, 0, 0.5);
background: url("./cfg-right.jpg") right top #cbc4be no-repeat;
background-size: auto 36px;
}
.cfg-hint {
font-size: 12px;
font-weight: normal;
margin-top: 3px;
margin-bottom: -3px;
}
.cfg-status {
position: absolute;
top: 0;
right: 0;
height: 36px;
width: 160px;
text-align: center;
line-height: 36px;
font-size: 16px;
color: #495366;
font-weight: bold;
border-radius: 0 16px 16px 0;
font-family: Number, "微软雅黑", sans-serif;
}
.cfg-status.status-off {
color: #a95151;
}
.cfg-desc {
font-size: 12px;
color: #cbc4be;
margin: 5px 0 5px 20px;
}

114
resources/admin/index.html Normal file
View File

@ -0,0 +1,114 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8"/>
<link rel="shortcut icon" href="#"/>
<link rel="stylesheet" type="text/css" href="{{_res_path}}/common/common.css"/>
<link rel="stylesheet" type="text/css" href="{{_res_path}}/admin/index.css"/>
</head>
<body class="body_box" {{cfgScale}}>
<div id="container" class="container">
<div class="info_box">
<div class="head-box type{{bgType}}">
<div class="label">#喵喵设置</div>
<div class="title">喵喵管理面板</div>
</div>
</div>
<div class="cfg-box">
<div class="cfg-group">玩家&老婆卡片展示</div>
<ul class="cfg-ul">
<li class="cfg-li">
<div class="cfg-line">
角色查询
<span class="cfg-hint"> #喵喵设置角色 + 开启/关闭</span>
{{@chars}}
</div>
</li>
<li class="cfg-li">
<div class="cfg-line">
老婆查询
<span class="cfg-hint"> #喵喵设置老婆 + 开启/关闭</span>
{{@wife}}
</div>
</li>
<li class="cfg-li">
<div class="cfg-line">
允许查他人
<span class="cfg-hint"> #喵喵设置查他人 + 开启/关闭</span>
{{@other}}
</div>
</li>
<li class="cfg-li">
<div class="cfg-line">
角色图片扩展包
<span class="cfg-hint"> #喵喵更新图像</span>
{{if imgPlus}}
<div class="cfg-status">已安装</div>
{{else}}
<div class="cfg-status status-off">未安装</div>
{{/if}}
</div>
<div class="cfg-desc">角色图片的扩展包,包含更多的角色图片</div>
</li>
</ul>
</div>
<div class="cfg-box">
<div class="cfg-group">角色资料与信息查询</div>
<ul class="cfg-ul">
<li class="cfg-li">
<div class="cfg-line">
角色天赋
<span class="cfg-hint"> #喵喵设置天赋 + 开启/关闭</span>
{{@talent}}
</div>
</li>
<li class="cfg-li">
<div class="cfg-line">
角色命座
<span class="cfg-hint"> #喵喵设置命座 + 开启/关闭</span>
{{@cons}}
</div>
</li>
<li class="cfg-li">
<div class="cfg-line">
角色图片
<span class="cfg-hint"> #喵喵设置图片 + 开启/关闭</span>
{{@pic}}
</div>
</li>
<li class="cfg-li">
<div class="cfg-line">
深渊资料
<span class="cfg-hint"> #喵喵设置深渊 + 开启/关闭</span>
{{@abyss}}
</div>
<div class="cfg-desc">角色持有率、深渊出场率等信息</div>
</li>
</ul>
</div>
<div class="cfg-box">
<div class="cfg-group">系统设置</div>
<ul class="cfg-ul">
<li class="cfg-li">
<div class="cfg-line">
渲染精度
<span class="cfg-hint">#喵喵设置渲染100 </span>
<div class="cfg-status">{{scale}}</div>
</div>
<div class="cfg-desc">可选值50~150建议100。设置高精度会提高图片的精细度但因图片较大可能会影响渲染与发送速度</div>
</li>
<li class="cfg-li">
<div class="cfg-line">
更新版本
<div class="cfg-status">#喵喵更新</div>
</div>
<div class="cfg-desc">更新喵喵Plugin可能需要重启Yunzai-Bot</div>
</li>
</ul>
</div>
<div class="copyright"> Create By Yunzai-Bot & Miao-Plugin</div>
</div>
</body>
</html>

View File

@ -1,20 +1,20 @@
@font-face { @font-face {
font-family: "HWZhongSong"; font-family: "HWZhongSong";
src: url("../font/华文中宋.TTF"); src: url("../common/font/华文中宋.TTF");
font-weight: normal; font-weight: normal;
font-style: normal; font-style: normal;
} }
@font-face { @font-face {
font-family: "tttgbnumber"; font-family: "tttgbnumber";
src: url("../font/tttgbnumber.ttf"); src: url("../common/font/tttgbnumber.ttf");
font-weight: normal; font-weight: normal;
font-style: normal; font-style: normal;
} }
@font-face { @font-face {
font-family: "NZBZ"; font-family: "NZBZ";
src: url("../font/NZBZ.ttf"); src: url("../common/font/NZBZ.ttf");
font-weight: normal; font-weight: normal;
font-style: normal; font-style: normal;
} }

View File

@ -5,7 +5,7 @@
<link rel="shortcut icon" href="#"/> <link rel="shortcut icon" href="#"/>
<link rel="stylesheet" type="text/css" href="{{_res_path}}/character/card.css?v=1.0"/> <link rel="stylesheet" type="text/css" href="{{_res_path}}/character/card.css?v=1.0"/>
</head> </head>
<body class="{{bg.mode}}_mode"> <body class="{{bg.mode}}_mode" {{cfgScale}}>
<div class="container" id="container"> <div class="container" id="container">
<div class="char_name"> <div class="char_name">
<div class="uid">ID:{{uid}}</div> <div class="uid">ID:{{uid}}</div>

100
resources/common/common.css Normal file
View File

@ -0,0 +1,100 @@
@font-face {
font-family: "HWZS";
src: url("../common/font/华文中宋.TTF");
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: "Number";
src: url("../common/font/tttgbnumber.ttf");
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: "NZBZ";
src: url("../common/font/NZBZ.ttf");
font-weight: normal;
font-style: normal;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
user-select: none;
}
body {
font-size: 18px;
color: #1e1f20;
font-family: PingFangSC-Medium, PingFang SC, sans-serif;
transform: scale(1.4);
transform-origin: 0 0;
background: url("./bg1.png") top left no-repeat #2a3860;
background-size: contain;
width: 600px;
}
.container {
width: 600px;
padding: 20px 15px 10px 15px;
background-size: contain;
}
.head-box {
border-radius: 15px;
padding: 10px 20px;
position: relative;
color: #fff;
margin-top: 30px;
}
.head-box .title {
font-size: 36px;
font-family: NZBZ, sans-serif;
text-shadow: 0 0 1px #000, 1px 1px 3px rgba(0,0,0,.9);
}
.head-box .genshin_logo {
position: absolute;
top: 1px;
right: 15px;
width: 97px;
}
.head-box .label {
font-size: 16px;
text-shadow: 0 0 1px #000, 1px 1px 3px rgba(0,0,0,.9);
}
.notice {
color: #888;
font-size: 12px;
text-align: right;
padding: 12px 5px 5px;
}
.notice-center {
color: #fff;
text-align: center;
margin-bottom: 10px;
text-shadow: 1px 1px 1px #333;
}
.copyright {
font-size: 16px;
font-family: Number, sans-serif;
text-align: center;
color: #fff;
position: relative;
padding-left: 10px;
text-shadow: 1px 1px 1px #000;
margin-bottom: 10px;
}

@ -0,0 +1 @@
Subproject commit 6b582ed7f308ce1db3ccf0ab7ed9b01d0f77b7fd

View File

@ -7,7 +7,7 @@
<link rel="stylesheet" type="text/css" href="{{_res_path}}/stat/abyss-pct.css?v=1.0"/> <link rel="stylesheet" type="text/css" href="{{_res_path}}/stat/abyss-pct.css?v=1.0"/>
<link rel="preload" href="{{_res_path}}/font/tttgbnumber.ttf" as="font"> <link rel="preload" href="{{_res_path}}/font/tttgbnumber.ttf" as="font">
</head> </head>
<body id="container" class="body_box"> <body id="container" class="body_box" {{cfgScale}}>
<div class="container"> <div class="container">
<div class="info_box"> <div class="info_box">
<div class="head-box type{{bgType}}"> <div class="head-box type{{bgType}}">

View File

@ -7,7 +7,7 @@
<link rel="stylesheet" type="text/css" href="{{_res_path}}/stat/character.css?v=1.0"/> <link rel="stylesheet" type="text/css" href="{{_res_path}}/stat/character.css?v=1.0"/>
<link rel="preload" href="{{_res_path}}/font/tttgbnumber.ttf" as="font"> <link rel="preload" href="{{_res_path}}/font/tttgbnumber.ttf" as="font">
</head> </head>
<body id="container" class="body_box"> <body id="container" class="body_box" {{cfgScale}}>
<div class="container"> <div class="container">
<div class="info_box"> <div class="info_box">
<div class="head-box type{{bgType}}"> <div class="head-box type{{bgType}}">

View File

@ -1,18 +1,18 @@
@font-face { @font-face {
font-family: "tttgbnumber"; font-family: "tttgbnumber";
src: url("../../font/tttgbnumber.ttf"); src: url("../common/font/tttgbnumber.ttf");
font-weight: normal; font-weight: normal;
font-style: normal; font-style: normal;
} }
@font-face { @font-face {
font-family: HYWenHei-55W; font-family: HYWenHei-55W;
src: url('../../font/HYWenHei-55W.ttf'); src: url('../common/font/HYWenHei-55W.ttf');
} }
@font-face { @font-face {
font-family: "NZBZ"; font-family: "NZBZ";
src: url("../font/NZBZ.ttf"); src: url("../common/font/NZBZ.ttf");
font-weight: normal; font-weight: normal;
font-style: normal; font-style: normal;
} }

View File

@ -1,6 +1,6 @@
@font-face { @font-face {
font-family: "tttgbnumber"; font-family: "tttgbnumber";
src: url("../font/tttgbnumber.ttf"); src: url("../common/font/tttgbnumber.ttf");
font-weight: normal; font-weight: normal;
font-style: normal; font-style: normal;
} }

35
tools/test.txt Normal file

File diff suppressed because one or more lines are too long