36 lines
1.4 KiB
C#
36 lines
1.4 KiB
C#
// <copyright file="CastleSiegeStatusChatCommandPlugIn.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>Shows the current Castle Siege status. GM only.</summary>
|
|
[Guid("A1B2C3D4-0001-4E5F-9A0B-CA5710000001")]
|
|
[PlugIn]
|
|
[Display(Name = "Castle Siege Status", Description = "GM command: /csstatus")]
|
|
[ChatCommandHelp(Command, CharacterStatus.GameMaster)]
|
|
public class CastleSiegeStatusChatCommandPlugIn : IChatCommandPlugIn
|
|
{
|
|
private const string Command = "/csstatus";
|
|
|
|
/// <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);
|
|
var text = context?.GetStatusText() ?? "Castle Siege plugin not active.";
|
|
await player.InvokeViewPlugInAsync<IShowMessagePlugIn>(p => p.ShowMessageAsync(text, MessageType.BlueNormal)).ConfigureAwait(false);
|
|
}
|
|
}
|