From 8ea561ef043b98dbd173b0567a0d4fc950658a79 Mon Sep 17 00:00:00 2001 From: chr_ Date: Fri, 28 Jun 2024 17:08:15 +0800 Subject: [PATCH] =?UTF-8?q?feat=20=E6=96=B0=E5=A2=9E=20DL2=20=E5=91=BD?= =?UTF-8?q?=E4=BB=A4=20=E7=A7=BB=E9=99=A4=20RLE=E3=80=81SIM4=20DL22=20?= =?UTF-8?q?=E7=AD=89=E5=A4=B1=E6=95=88=E5=91=BD=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ASFEnhance/ASFEnhance.cs | 40 ++------ ASFEnhance/Event/Command.cs | 188 ++---------------------------------- Directory.Build.props | 2 +- 3 files changed, 17 insertions(+), 213 deletions(-) diff --git a/ASFEnhance/ASFEnhance.cs b/ASFEnhance/ASFEnhance.cs index d57f3d2a..a49af8d5 100644 --- a/ASFEnhance/ASFEnhance.cs +++ b/ASFEnhance/ASFEnhance.cs @@ -263,17 +263,8 @@ public Task OnLoaded() Update.Command.ResponsePluginUpdate(null), //Event - "SIM4" when access >= EAccess.Operator => - Event.Command.ResponseSim4(bot), - "DL2" when access >= EAccess.Operator => - Event.Command.ResponseDL2(bot), - - "DL22" when access >= EAccess.Operator => - Event.Command.ResponseDL22(bot, null), - - "RLE" when access >= EAccess.Operator => - Event.Command.ResponseRle(bot, null), + Event.Command.ResponseDL2(bot, null), "CLAIMITEM" or "CI" when access >= EAccess.Operator => @@ -283,9 +274,9 @@ public Task OnLoaded() "C20" when access >= EAccess.Operator => Event.Command.ResponseClaim20Th(bot), - "CV" or - "CHECKVOTE" when access >= EAccess.Operator => - Event.Command.ResponseCheckWinterSteamAwardVote(bot), + //"CV" or + //"CHECKVOTE" when access >= EAccess.Operator => + // Event.Command.ResponseCheckWinterSteamAwardVote(bot), //Shortcut "P" => @@ -506,21 +497,10 @@ public Task OnLoaded() Update.Command.ResponsePluginUpdate(Utilities.GetArgsAsText(args, 1, ",")), //Event - "SIM4" when access >= EAccess.Operator => - Event.Command.ResponseSim4(Utilities.GetArgsAsText(args, 1, ",")), - + "DL2" when argLength > 2 && access >= EAccess.Operator => + Event.Command.ResponseDL2(SkipBotNames(args, 1, 1), args.Last()), "DL2" when access >= EAccess.Operator => - Event.Command.ResponseDL2(Utilities.GetArgsAsText(args, 1, ",")), - - "DL22" when argLength > 2 && access >= EAccess.Operator => - Event.Command.ResponseDL22(SkipBotNames(args, 1, 1), args.Last()), - "DL22" when access >= EAccess.Operator => - Event.Command.ResponseDL22(args[1], null), - - "RLE" when argLength > 2 && access >= EAccess.Operator => - Event.Command.ResponseRle(SkipBotNames(args, 1, 1), args.Last()), - "RLE" when access >= EAccess.Operator => - Event.Command.ResponseRle(args[1], null), + Event.Command.ResponseDL2(args[1], null), "CLAIMITEM" or "CI" when access >= EAccess.Operator => @@ -530,9 +510,9 @@ public Task OnLoaded() "C20" when access >= EAccess.Operator => Event.Command.ResponseClaim20Th(Utilities.GetArgsAsText(args, 1, ",")), - "CV" or - "CHECKVOTE" when access >= EAccess.Operator => - Event.Command.ResponseCheckWinterSteamAwardVote(Utilities.GetArgsAsText(args, 1, ",")), + //"CV" or + //"CHECKVOTE" when access >= EAccess.Operator => + // Event.Command.ResponseCheckWinterSteamAwardVote(Utilities.GetArgsAsText(args, 1, ",")), //Shortcut "AL" => diff --git a/ASFEnhance/Event/Command.cs b/ASFEnhance/Event/Command.cs index 555ca5eb..5a7c007f 100644 --- a/ASFEnhance/Event/Command.cs +++ b/ASFEnhance/Event/Command.cs @@ -7,127 +7,19 @@ namespace ASFEnhance.Event; internal static class Command { /// - /// 获取SIM4贴纸 10.19 - ? - /// - /// - /// - internal static async Task ResponseSim4(Bot bot) - { - if (!bot.IsConnectedAndLoggedOn) - { - return bot.FormatBotResponse(Strings.BotNotConnected); - } - - var token = await WebRequest.FetchEventToken(bot, "simscelebrationsale").ConfigureAwait(false); - if (string.IsNullOrEmpty(token)) - { - return bot.FormatBotResponse(Langs.NetworkError); - } - - var door_indexs = new[] { 1, 3, 4, 5, 2 }; - - foreach (var index in door_indexs) - { - await WebRequest.DoEventTask(bot, token, index).ConfigureAwait(false); - } - - return bot.FormatBotResponse("Done!"); - } - - /// - /// 获取SIM4贴纸 (多个Bot) - /// - /// - /// - /// - internal static async Task ResponseSim4(string botNames) - { - if (string.IsNullOrEmpty(botNames)) - { - throw new ArgumentNullException(nameof(botNames)); - } - - var bots = Bot.GetBots(botNames); - - if ((bots == null) || (bots.Count == 0)) - { - return FormatStaticResponse(Strings.BotNotFound, botNames); - } - - var results = await Utilities.InParallel(bots.Select(bot => ResponseSim4(bot))).ConfigureAwait(false); - var responses = new List(results.Where(result => !string.IsNullOrEmpty(result))); - - return responses.Count > 0 ? string.Join(Environment.NewLine, responses) : null; - } - - /// - /// 获取DL2贴纸 11.11 - ? - /// - /// - /// - internal static async Task ResponseDL2(Bot bot) - { - if (!bot.IsConnectedAndLoggedOn) - { - return bot.FormatBotResponse(Strings.BotNotConnected); - } - - var token = await WebRequest.FetchEventToken(bot, "dyinglight").ConfigureAwait(false); - if (string.IsNullOrEmpty(token)) - { - return bot.FormatBotResponse(Langs.NetworkError); - } - - var door_indexs = new[] { 1, 3, 4, 5, 2 }; - - foreach (var index in door_indexs) - { - await WebRequest.DoEventTask(bot, token, index).ConfigureAwait(false); - } - - return bot.FormatBotResponse("Done!"); - } - - /// - /// 获取DL2贴纸 (多个Bot) - /// - /// - /// - /// - internal static async Task ResponseDL2(string botNames) - { - if (string.IsNullOrEmpty(botNames)) - { - throw new ArgumentNullException(nameof(botNames)); - } - - var bots = Bot.GetBots(botNames); - - if ((bots == null) || (bots.Count == 0)) - { - return FormatStaticResponse(Strings.BotNotFound, botNames); - } - - var results = await Utilities.InParallel(bots.Select(bot => ResponseDL2(bot))).ConfigureAwait(false); - var responses = new List(results.Where(result => !string.IsNullOrEmpty(result))); - - return responses.Count > 0 ? string.Join(Environment.NewLine, responses) : null; - } - - /// - /// 获取DL2贴纸 6.30 - ? + /// 获取DL2贴纸 6.28 - ? /// /// /// /// - internal static async Task ResponseDL22(Bot bot, string? query) + internal static async Task ResponseDL2(Bot bot, string? query) { if (!bot.IsConnectedAndLoggedOn) { return bot.FormatBotResponse(Strings.BotNotConnected); } - var token = await WebRequest.FetchEventToken(bot, "Techland", "techlandsummer2023").ConfigureAwait(false); + var token = await WebRequest.FetchEventToken(bot, "dyinglight2towerraid").ConfigureAwait(false); if (string.IsNullOrEmpty(token)) { return bot.FormatBotResponse(Langs.NetworkError); @@ -146,7 +38,7 @@ internal static class Command } else { - var door_indexs = new[] { 1, 3, 4, 5, 8, 7, 2, 6 }; + var door_indexs = new[] { 1 }; var tasks = door_indexs.Select(id => WebRequest.DoEventTask(bot, token, id)); await Utilities.InParallel(tasks).ConfigureAwait(false); } @@ -161,75 +53,7 @@ internal static class Command /// /// /// - internal static async Task ResponseDL22(string botNames, string? query) - { - if (string.IsNullOrEmpty(botNames)) - { - throw new ArgumentNullException(nameof(botNames)); - } - - var bots = Bot.GetBots(botNames); - - if ((bots == null) || (bots.Count == 0)) - { - return FormatStaticResponse(Strings.BotNotFound, botNames); - } - - var results = await Utilities.InParallel(bots.Select(bot => ResponseDL22(bot, query))).ConfigureAwait(false); - var responses = new List(results.Where(result => !string.IsNullOrEmpty(result))); - - return responses.Count > 0 ? string.Join(Environment.NewLine, responses) : null; - } - - - /// - /// 获取RLE贴纸 5.1 - ? - /// - /// - /// - /// - internal static async Task ResponseRle(Bot bot, string? query) - { - if (!bot.IsConnectedAndLoggedOn) - { - return bot.FormatBotResponse(Strings.BotNotConnected); - } - - var token = await WebRequest.FetchEventToken(bot, "redfall_launch").ConfigureAwait(false); - if (string.IsNullOrEmpty(token)) - { - return bot.FormatBotResponse(Langs.NetworkError); - } - - if (!string.IsNullOrEmpty(query)) - { - if (int.TryParse(query, out var id)) - { - await WebRequest.DoEventTask(bot, token, id).ConfigureAwait(false); - } - else - { - return bot.FormatBotResponse(Langs.AccountSubInvalidArg); - } - } - else - { - var door_indexs = new[] { 1, 2, 3, 4 }; - var tasks = door_indexs.Select(id => WebRequest.DoEventTask(bot, token, id)); - await Utilities.InParallel(tasks).ConfigureAwait(false); - } - - return bot.FormatBotResponse("Done!"); - } - - /// - /// 获取RLE贴纸 (多个Bot) - /// - /// - /// - /// - /// - internal static async Task ResponseRle(string botNames, string? query) + internal static async Task ResponseDL2(string botNames, string? query) { if (string.IsNullOrEmpty(botNames)) { @@ -243,7 +67,7 @@ internal static class Command return FormatStaticResponse(Strings.BotNotFound, botNames); } - var results = await Utilities.InParallel(bots.Select(bot => ResponseRle(bot, query))).ConfigureAwait(false); + var results = await Utilities.InParallel(bots.Select(bot => ResponseDL2(bot, query))).ConfigureAwait(false); var responses = new List(results.Where(result => !string.IsNullOrEmpty(result))); return responses.Count > 0 ? string.Join(Environment.NewLine, responses) : null; diff --git a/Directory.Build.props b/Directory.Build.props index 72f61f6a..f6b840d5 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,6 +1,6 @@ - 2.1.8.3 + 2.1.9.0