42 lines
1.7 KiB
C#
42 lines
1.7 KiB
C#
// <copyright file="CastleSiegeStartChatCommandPlugIn.cs" company="MUnique">
|
|
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
|
|
// </copyright>
|
|
|
|
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;
|
|
|
|
/// <summary>Forces the Castle Siege into the registration phase. GM only.</summary>
|
|
[Guid("A1B2C3D4-0002-4E5F-9A0B-CA5710000002")]
|
|
[PlugIn]
|
|
[Display(Name = "Castle Siege Start", Description = "GM command: /csstart")]
|
|
[ChatCommandHelp(Command, CharacterStatus.GameMaster)]
|
|
public class CastleSiegeStartChatCommandPlugIn : IChatCommandPlugIn
|
|
{
|
|
private const string Command = "/csstart";
|
|
|
|
/// <inheritdoc />
|
|
public string Key => Command;
|
|
|
|
/// <inheritdoc/>
|
|
public CharacterStatus MinCharacterStatusRequirement => CharacterStatus.GameMaster;
|
|
|
|
/// <inheritdoc />
|
|
public async ValueTask HandleCommandAsync(Player player, string command)
|
|
{
|
|
var context = CastleSiegeEventPlugIn.TryGetContext(player.GameContext);
|
|
if (context is null)
|
|
{
|
|
await player.InvokeViewPlugInAsync<IShowMessagePlugIn>(p => p.ShowMessageAsync("Castle Siege plugin not active.", MessageType.BlueNormal)).ConfigureAwait(false);
|
|
return;
|
|
}
|
|
|
|
await context.ForceStartRegistrationAsync(DateTime.UtcNow).ConfigureAwait(false);
|
|
await player.InvokeViewPlugInAsync<IShowMessagePlugIn>(p => p.ShowMessageAsync("Castle Siege: registration started.", MessageType.BlueNormal)).ConfigureAwait(false);
|
|
}
|
|
}
|