// // Licensed under the MIT License. See LICENSE file in the project root for full license information. // namespace MUnique.OpenMU.GameLogic.PlugIns.ChatCommands; using System.Runtime.InteropServices; using MUnique.OpenMU.GameLogic.PlugIns.PeriodicTasks; using MUnique.OpenMU.GameLogic.Views; using MUnique.OpenMU.Interfaces; using MUnique.OpenMU.PlugIns; /// Resets Castle Siege to the ownership phase and clears registrations. GM only. [Guid("A1B2C3D4-0005-4E5F-9A0B-CA5710000005")] [PlugIn] [Display(Name = "Castle Siege Reset", Description = "GM command: /csreset")] [ChatCommandHelp(Command, CharacterStatus.GameMaster)] public class CastleSiegeResetChatCommandPlugIn : IChatCommandPlugIn { private const string Command = "/csreset"; /// public string Key => Command; /// public CharacterStatus MinCharacterStatusRequirement => CharacterStatus.GameMaster; /// public async ValueTask HandleCommandAsync(Player player, string command) { var context = CastleSiegeEventPlugIn.TryGetContext(player.GameContext); if (context is null) { await player.InvokeViewPlugInAsync(p => p.ShowMessageAsync("Castle Siege plugin not active.", MessageType.BlueNormal)).ConfigureAwait(false); return; } await context.ResetAsync(DateTime.UtcNow).ConfigureAwait(false); await player.InvokeViewPlugInAsync(p => p.ShowMessageAsync("Castle Siege reset to ownership phase.", MessageType.BlueNormal)).ConfigureAwait(false); } }