From 6e6ad0b14c31b9188c624d077d7416647f70994f Mon Sep 17 00:00:00 2001 From: milimoe Date: Sun, 13 Oct 2024 15:43:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E5=92=8C=E6=8E=A5?= =?UTF-8?q?=E6=94=B6=E6=9C=8D=E5=8A=A1=E5=99=A8=E6=8E=A7=E5=88=B6=E5=8F=B0?= =?UTF-8?q?=E7=9A=84=E8=BE=93=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OshimaCore/OshimaWebAPI.cs | 62 +++++++++++++++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/OshimaCore/OshimaWebAPI.cs b/OshimaCore/OshimaWebAPI.cs index c2e406b..208cb59 100644 --- a/OshimaCore/OshimaWebAPI.cs +++ b/OshimaCore/OshimaWebAPI.cs @@ -1,5 +1,7 @@ using Milimoe.FunGame.Core.Library.Common.Addon; using Milimoe.FunGame.Core.Library.Exception; +using Oshima.Core.Configs; +using Oshima.Core.Utils; using Oshima.FunGame.OshimaModules; namespace Oshima.Core.WebAPI @@ -14,9 +16,67 @@ namespace Oshima.Core.WebAPI public override string Author => OshimaGameModuleConstant.Author; + public override void ProcessInput(string input) + { + // OSM指令 + if (input.Length >= 4 && input[..4].Equals(".osm", StringComparison.CurrentCultureIgnoreCase)) + { + //MasterCommand.Execute(read, GeneralSettings.Master, false, GeneralSettings.Master, false); + WriteLine("试图使用 .osm 指令:" + input); + } + } + public override void AfterLoad(params object[] objs) { - base.AfterLoad(objs); + GeneralSettings.LoadSetting(); + GeneralSettings.SaveConfig(); + QQOpenID.LoadConfig(); + QQOpenID.SaveConfig(); + Daily.InitDaily(); + SayNo.InitSayNo(); + Ignore.InitIgnore(); + FunGameSimulation.InitCharacter(); + Task taskTime = Task.Factory.StartNew(async () => + { + while (true) + { + try + { + DateTime now = DateTime.Now; + if (now.Hour == 8 && now.Minute == 30 && !Daily.DailyNews) + { + Daily.DailyNews = true; + Console.ForegroundColor = ConsoleColor.Magenta; + Console.ForegroundColor = ConsoleColor.Gray; + } + if (now.Hour == 8 && now.Minute == 31) + { + Daily.DailyNews = false; + } + if (now.Hour == 0 && now.Minute == 0 && Daily.ClearDailys) + { + Daily.ClearDailys = false; + // 清空运势 + Daily.ClearDaily(); + Console.ForegroundColor = ConsoleColor.Magenta; + Console.WriteLine("已重置所有人的今日运势。"); + Console.ForegroundColor = ConsoleColor.Gray; + } + if (now.Hour == 0 && now.Minute == 1) + { + Daily.ClearDailys = true; + } + await Task.Delay(1000); + } + catch (Exception e) + { + Console.ForegroundColor = ConsoleColor.Red; + Console.WriteLine(e); + Console.ForegroundColor = ConsoleColor.Gray; + } + } + }); + } protected override bool BeforeLoad(params object[] objs)