mirror of
https://github.com/ctrlcvs/xiaoyao-cvs-plugin.git
synced 2024-12-23 03:20:52 +08:00
优化部分功能
This commit is contained in:
parent
1ea0910b59
commit
35244746be
32
apps/Note.js
32
apps/Note.js
@ -24,7 +24,7 @@ const _path = process.cwd();
|
||||
export async function Note(e, {
|
||||
render
|
||||
}) {
|
||||
if(!Cfg.get("sys.Note")){
|
||||
if (!Cfg.get("sys.Note")) {
|
||||
return false;
|
||||
}
|
||||
let cookie, uid;
|
||||
@ -110,26 +110,24 @@ export async function Note(e, {
|
||||
resinMaxTime = ` ${resinMaxTime}`;
|
||||
}
|
||||
}
|
||||
|
||||
for (let val of data.expeditions) {
|
||||
val.remained_time = new Date().getTime() + val.remained_time * 1000;
|
||||
let remainedDate = new Date(val.remained_time);
|
||||
val.remained_time = format("hh:mm", remainedDate);
|
||||
if (format("dd", remainedDate) != nowDay) {
|
||||
val.remained_time = `明天 ${val.remained_time}`;
|
||||
} else {
|
||||
val.remained_time = ` ${val.remained_time}`;
|
||||
}
|
||||
}
|
||||
let remained_time = "";
|
||||
if (data.expeditions && data.expeditions.length >= 1) {
|
||||
remained_time = lodash.map(data.expeditions, "remained_time");
|
||||
remained_time = lodash.min(remained_time);
|
||||
if (remained_time > 0) {
|
||||
for (let val of data.expeditions) {
|
||||
val.remained_time = new Date().getTime() + val.remained_time * 1000;
|
||||
let remainedDate = new Date(val.remained_time);
|
||||
val.remained_time = format("hh:mm", remainedDate);
|
||||
if (format("dd", remainedDate) != nowDay) {
|
||||
val.remained_time = `明天 ${val.remained_time}`;
|
||||
} else {
|
||||
val.remained_time = ` ${val.remained_time}`;
|
||||
}
|
||||
}
|
||||
remained_time = new Date().getTime() + remained_time * 1000;
|
||||
let remainedDate = new Date(remained_time);
|
||||
remained_time = format("hh:mm", remainedDate);
|
||||
|
||||
if (format("dd", remainedDate) != nowDay) {
|
||||
remained_time = `明天 ${remained_time}`;
|
||||
} else {
|
||||
@ -158,7 +156,7 @@ export async function Note(e, {
|
||||
let day = format("MM-dd hh:mm", new Date());
|
||||
let week = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];
|
||||
day += " " + week[new Date().getDay()];
|
||||
|
||||
|
||||
//参量质变仪
|
||||
if (data?.transformer?.obtained) {
|
||||
data.transformer.reached = data.transformer.recovery_time.reached;
|
||||
@ -175,12 +173,12 @@ export async function Note(e, {
|
||||
}
|
||||
data.transformer.recovery_time = recovery_time;
|
||||
}
|
||||
var image= fs.readdirSync(`./plugins/xiaoyao-cvs-plugin/resources/dailyNote/background_image`);
|
||||
var list_img=[];
|
||||
var image = fs.readdirSync(`./plugins/xiaoyao-cvs-plugin/resources/dailyNote/background_image`);
|
||||
var list_img = [];
|
||||
for (let val of image) {
|
||||
list_img.push(val)
|
||||
}
|
||||
var imgs=list_img[lodash.random(0, list_img.length-1)];
|
||||
var imgs =list_img.length==1?list_img.length[0]:list_img[lodash.random(0, list_img.length - 1)];
|
||||
return await Common.render("dailyNote/dailyNote", {
|
||||
save_id: uid,
|
||||
uid: uid,
|
||||
|
@ -15,7 +15,7 @@ export async function AtlasAlias(e) {
|
||||
// if (await foodInfo(e)) return true;
|
||||
if (await RelicsInfo(e)) return true;
|
||||
// if (await monsterInfo(e)) return true;
|
||||
var name = e.msg.replace(/#|#|信息|图鉴|命座|天赋|突破|圣遗物|原魔|食物|食材|的|特殊|材|料|特色|料理|理|色/g, "");
|
||||
var name = e.msg.replace(/#|#|信息|图鉴|命座|天赋|突破|圣遗物|食物|食材|的|特殊|材|料|特色|料理|理|色/g, "");
|
||||
send_Msg(e, "all", name)
|
||||
return true;
|
||||
}
|
||||
@ -41,6 +41,11 @@ export async function roleInfo(e) {
|
||||
}
|
||||
|
||||
const send_Msg = function(e, type, name) {
|
||||
let path = `${_path}/plugins/xiaoyao-cvs-plugin/resources/xiaoyao-plus/${type}/${name}.png`
|
||||
if (fs.existsSync(path)) {
|
||||
e.reply(segment.image(`file:///${path}`));
|
||||
return true;
|
||||
}
|
||||
if (type == "all") {
|
||||
for (let val of list) {
|
||||
let new_name = info_img(e, Data.readJSON(`${_path}/plugins/xiaoyao-cvs-plugin/resources/Atlas_alias/`,
|
||||
@ -52,7 +57,7 @@ const send_Msg = function(e, type, name) {
|
||||
}
|
||||
}
|
||||
}
|
||||
let path = `${_path}/plugins/xiaoyao-cvs-plugin/resources/xiaoyao-plus/${type}/${name}.png`
|
||||
path = `${_path}/plugins/xiaoyao-cvs-plugin/resources/xiaoyao-plus/${type}/${name}.png`
|
||||
if (!fs.existsSync(path)) {
|
||||
return true;
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ export const render = async function (path, params, cfg) {
|
||||
scale: Cfg.scale(cfg.scale || 1),
|
||||
copyright: `Created By Yunzai-Bot<span class="version">${yunzaiVersion}</span> & xiaoyao-cvs-Plugin<span class="version">${currentVersion}</span>`
|
||||
}
|
||||
});
|
||||
},"png");
|
||||
|
||||
if (base64) {
|
||||
e.reply(segment.image(`base64://${base64}`));
|
||||
|
34
index.js
34
index.js
@ -13,14 +13,18 @@ import {
|
||||
} from "./apps/Note.js"
|
||||
import {
|
||||
rule as adminRule,
|
||||
updateRes,sysCfg,
|
||||
updateRes,
|
||||
sysCfg,
|
||||
updateMiaoPlugin
|
||||
} from "./apps/admin.js";
|
||||
import { currentVersion } from "./components/Changelog.js";
|
||||
import {
|
||||
currentVersion
|
||||
} from "./components/Changelog.js";
|
||||
export {
|
||||
updateRes,
|
||||
updateMiaoPlugin,
|
||||
versionInfo,sysCfg,
|
||||
versionInfo,
|
||||
sysCfg,
|
||||
help,
|
||||
AtlasAlias,
|
||||
Note
|
||||
@ -29,15 +33,15 @@ export {
|
||||
let rule = {
|
||||
versionInfo: {
|
||||
reg: "^#图鉴版本$",
|
||||
describe: "【#帮助】 喵喵版本介绍",
|
||||
describe: "【#帮助】 图鉴版本介绍",
|
||||
},
|
||||
help: {
|
||||
reg: "^#图鉴(列表|帮助|help)$",
|
||||
reg: "^#?(图鉴)?(命令|帮助|菜单|help|说明|功能|指令|使用说明)$",
|
||||
describe: "查看插件的功能",
|
||||
},
|
||||
AtlasAlias: {
|
||||
reg: "#*(.*)(信息|图鉴|命座|天赋|突破|材料|特色料理|特殊料理)$",
|
||||
describe: "【刻晴信息、刻晴图鉴、刻晴突破、刻晴命座】角色信息图鉴",
|
||||
describe: "角色、食物、怪物、武器信息图鉴",
|
||||
},
|
||||
Note: {
|
||||
reg: "^#*(体力|树脂|查询体力|便笺|便签)$",
|
||||
@ -57,13 +61,13 @@ export {
|
||||
};
|
||||
|
||||
console.log(`图鉴插件${currentVersion}初始化~`);
|
||||
setTimeout(async function () {
|
||||
let msgStr = await redis.get("xiaoyao:restart-msg");
|
||||
if (msgStr) {
|
||||
let msg = JSON.parse(msgStr);
|
||||
await common.relpyPrivate(msg.qq, msg.msg);
|
||||
await redis.del("xiaoyao:restart-msg");
|
||||
let msgs = [`当前版本: ${currentVersion}`, `您可使用 #图鉴版本 命令查看更新信息`];
|
||||
await common.relpyPrivate(msg.qq, msgs.join("\n"));
|
||||
}
|
||||
setTimeout(async function() {
|
||||
let msgStr = await redis.get("xiaoyao:restart-msg");
|
||||
if (msgStr) {
|
||||
let msg = JSON.parse(msgStr);
|
||||
await common.relpyPrivate(msg.qq, msg.msg);
|
||||
await redis.del("xiaoyao:restart-msg");
|
||||
let msgs = [`当前版本: ${currentVersion}`, `您可使用 #图鉴版本 命令查看更新信息`];
|
||||
await common.relpyPrivate(msg.qq, msgs.join("\n"));
|
||||
}
|
||||
}, 1000);
|
||||
|
@ -8,84 +8,87 @@ html {
|
||||
height: 100%;
|
||||
font-family: HYWenHei-55W, monospace;
|
||||
}
|
||||
|
||||
#container {
|
||||
min-height: 900px;
|
||||
height: auto;
|
||||
width: 100%;
|
||||
}
|
||||
min-height: 900px;
|
||||
height: auto;
|
||||
width: 100%;
|
||||
/* background-color: rgba(0,0,0,0.5); */
|
||||
}
|
||||
|
||||
.title {
|
||||
position: absolute;
|
||||
top: 64px;
|
||||
left: 225px;
|
||||
font-weight: bold;
|
||||
font-size: 22px;
|
||||
text-align: left;
|
||||
}
|
||||
.title {
|
||||
position: absolute;
|
||||
top: 75px;
|
||||
left: 225px;
|
||||
font-weight: bold;
|
||||
font-size: 22px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.item {
|
||||
width: 228px;
|
||||
left: 200px;
|
||||
top: 350px;
|
||||
color: #7b8386;
|
||||
font-weight: bold;
|
||||
font-size: 22px;
|
||||
margin-left: 205px;
|
||||
margin-bottom: 25px;
|
||||
}
|
||||
.item {
|
||||
width: 228px;
|
||||
left: 200px;
|
||||
top: 350px;
|
||||
color: #7b8386;
|
||||
font-weight: bold;
|
||||
font-size: 22px;
|
||||
margin-left: 205px;
|
||||
margin-bottom: 25px;
|
||||
}
|
||||
|
||||
.paiqian {
|
||||
position: absolute;
|
||||
width: 400px;
|
||||
height: 26px;
|
||||
left: 520px;
|
||||
top: 80px;
|
||||
text-align: center;
|
||||
color: #7b8386;
|
||||
font-weight: bold;
|
||||
font-size: 20px;
|
||||
}
|
||||
.paiqian {
|
||||
position: absolute;
|
||||
width: 400px;
|
||||
height: 26px;
|
||||
left: 520px;
|
||||
top: 80px;
|
||||
text-align: center;
|
||||
color: #7b8386;
|
||||
font-weight: bold;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.icon {
|
||||
width: 65px;
|
||||
margin: 5px 0 4px 13px;
|
||||
display: inline-block;
|
||||
vertical-align: bottom;
|
||||
}
|
||||
.icon {
|
||||
width: 65px;
|
||||
margin: 3px 0 4px 13px;
|
||||
display: inline-block;
|
||||
vertical-align: bottom;
|
||||
}
|
||||
|
||||
.icon_div {
|
||||
display: inline-block;
|
||||
vertical-align: super;
|
||||
margin-top: -10px;
|
||||
margin-left: 15px;
|
||||
}
|
||||
.icon_div {
|
||||
display: inline-block;
|
||||
vertical-align: super;
|
||||
margin-top: -10px;
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
.all_icon {
|
||||
text-align: left;
|
||||
position: relative;
|
||||
top: -25px;
|
||||
}
|
||||
.all_icon {
|
||||
text-align: left;
|
||||
position: relative;
|
||||
top: -25px;
|
||||
}
|
||||
|
||||
.time {
|
||||
position: relative;
|
||||
top: -20px;
|
||||
}
|
||||
.time {
|
||||
position: relative;
|
||||
top: -20px;
|
||||
}
|
||||
|
||||
.item .main .time {
|
||||
font-size: 12px;
|
||||
display: block;
|
||||
position: initial;
|
||||
}
|
||||
.item .main .time {
|
||||
font-size: 12px;
|
||||
display: block;
|
||||
position: initial;
|
||||
}
|
||||
|
||||
.item .main {
|
||||
display: block;
|
||||
}
|
||||
.item .main {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.item .top {
|
||||
font-weight: bold;
|
||||
font-size: 30px;
|
||||
display: block;
|
||||
}
|
||||
.item:nth-last-child(2){
|
||||
margin-top: 35px;
|
||||
}
|
||||
.item .top {
|
||||
font-weight: bold;
|
||||
font-size: 30px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.item:nth-last-child(2) {
|
||||
/* margin-top: 35px; */
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
<link rel="shortcut icon" href="#" />
|
||||
<link rel="stylesheet" type="text/css" href="{{_res_path}}dailyNote/dailyNote.css?v=1.0" />
|
||||
<link rel="preload" href="{{_res_path}}font/tttgbnumber.ttf" as="font">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div class="container" id="container"
|
||||
@ -17,14 +18,14 @@
|
||||
<span>{{day}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item" style="padding-top: 185px;">
|
||||
<div class="item" style="padding-top: 175px;">
|
||||
<div class="top">
|
||||
<span>{{current_resin}}/{{max_resin}}</span>
|
||||
</div>
|
||||
<div class="main">
|
||||
<div class="time">
|
||||
{{if resinMaxTime}}
|
||||
将于{{resinMaxTime}} 全部恢复
|
||||
将于<span class="span">{{resinMaxTime}}</span>全部恢复
|
||||
{{else}}树脂已完全恢复{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
@ -41,7 +42,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="item">
|
||||
<div class="main">
|
||||
<div class="top">
|
||||
@ -68,7 +68,7 @@
|
||||
<div class="time">
|
||||
{{if transformer.obtained }}
|
||||
{{if transformer.reached}}已准备完成
|
||||
{{else}}{{transformer.recovery_time}}后可使用{{/if}}
|
||||
{{else}}<span class="span">{{transformer.recovery_time}}</span>后可使用{{/if}}
|
||||
{{else}}尚未获得{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
@ -84,7 +84,7 @@
|
||||
<div class="info">
|
||||
<div class="time">
|
||||
{{if coinTime}}
|
||||
预计{{coinTime}}后达到上限
|
||||
预计<span class="span">{{coinTime}}</span>后达到上限
|
||||
{{else}}存储已满{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
@ -99,7 +99,8 @@
|
||||
<div class="info">
|
||||
<div class="time">
|
||||
{{if !expeditions || expeditions.length<=0}}尚未进行派遣
|
||||
{{else if remained_time && remained_time!=0}}最快将于{{remained_time}} 完成
|
||||
{{else if remained_time && remained_time!=0}}最快将于<span class="span">{{remained_time}}</span>
|
||||
完成
|
||||
{{else}}派遣已完成{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
@ -118,12 +119,5 @@
|
||||
|
||||
</div>
|
||||
</body>
|
||||
<script type="text/javascript">
|
||||
var count = 35;
|
||||
var item = document.getElementsByClassName("item");
|
||||
for (var i = 0; i < item.length; i++) {
|
||||
item[i].style.top = (count) + "%"
|
||||
count += 16;
|
||||
}
|
||||
</script>
|
||||
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user