From 885e931e19d95880d1c4cb5ac3218321932751f7 Mon Sep 17 00:00:00 2001 From: dzp Date: Sun, 5 May 2024 09:20:08 +0800 Subject: [PATCH] =?UTF-8?q?SQUASH:=20feat(pkuxkx):=20=E5=A2=9E=E5=8A=A0=20?= =?UTF-8?q?set=20=E7=8E=AF=E5=A2=83=E5=8F=98=E9=87=8F=E5=92=8C=20buff=20?= =?UTF-8?q?=E5=91=A8=E7=9B=B8=E5=85=B3=E8=A7=A6=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 抓取重启时间 --- mud/pkuxkx/plugins/basic/env.tin | 23 +++++++++++++++++++++-- mud/pkuxkx/plugins/shortcut.tin | 8 -------- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/mud/pkuxkx/plugins/basic/env.tin b/mud/pkuxkx/plugins/basic/env.tin index ce9d2d7f..a7bef556 100644 --- a/mud/pkuxkx/plugins/basic/env.tin +++ b/mud/pkuxkx/plugins/basic/env.tin @@ -15,8 +15,9 @@ PaoTin++ © 2020~2024 的所有版权均由担子炮(dzp ) {NOTE} {本文件属于 PaoTin++ 的一部分} }; -VAR {服务器环境变量} {env.Var} {}; -VAR {当前游戏周} {env.Week} {}; +VAR {服务器环境变量} {env.Var} {}; +VAR {当前游戏周} {env.Week} {}; +VAR {服务器重启时间} {env.RebootTime} {0}; event.Define {env/set} {无参} {$MODULE} {环境变量发生改变(set/unset)时发送本事件,本事件只会唤醒与变量名相匹配的钩子}; event.Define {env/update} {无参} {$MODULE} {环境变量列表已更新}; @@ -155,6 +156,13 @@ event.Define {env/time/update} {无参} {$MODULE} {当前游戏周的内容已 env.parse; }; + +#action {^北大侠客行再过%*将重新启动 ...$} { + #local time {@time.ParseDoC{%1}}; + #var env.RebootTime {@time.Now{} + $time}; + prompt.Set {{reboot}{$time}}; +}; + /* ╭───玄武之周┬──────────────────────────────────╮ │ 仆人 │玄武职业防御提升。 │ @@ -191,6 +199,17 @@ event.Define {env/time/update} {无参} {$MODULE} {当前游戏周的内容已 }; }; + #action {^│%*│北京时间%d年%d月%d日%s%d时%d分%d秒,将于%d月%d日%s%d时%d分重启。%s│$} { + #nop 简单处理一下,假设重启预报不会超过 24 小时。; + #local reboot {@math.Eval{(%%12 - %%6) * 3600 + (%%13 - %%7) * 60 + 60 - %%8}}; + #if { %%10 > %%4 } { + #local reboot {@math.Eval{(23 - %%6) * 3600 + (59 - %%7) * 60 + 60 - %%8}}; + #local reboot {@math.Eval{$reboot + %%12 * 3600 + %%13 * 60}}; + }; + #local env.RebootTime {@time.Now{} + $reboot}; + prompt.Set {{reboot}{$reboot}}; + }; + event.HandleOnce GA {basic/env} {basic/env} { event.Emit env/time/update; okLog 当前游戏周已更新。; diff --git a/mud/pkuxkx/plugins/shortcut.tin b/mud/pkuxkx/plugins/shortcut.tin index 43e42e2e..1df8968f 100644 --- a/mud/pkuxkx/plugins/shortcut.tin +++ b/mud/pkuxkx/plugins/shortcut.tin @@ -198,14 +198,6 @@ load-lib sync; #subst {~\e[34m} {\e[94m}; -VAR 服务器重启时间 gServerRebootTime {0}; - -#action {^北大侠客行再过%*将重新启动 ...$} { - #local time {@time.ParseDoC{%1}}; - #var gServerRebootTime {@time.Now{} + $time}; - prompt.Set {{reboot}{$time}}; -}; - #alias {list-armors} { #class rbz-list-armors open;