// // 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.ChatCommands.Arguments; using MUnique.OpenMU.PlugIns; /// /// A chat command plugin which handles trace commands. /// [Guid("F22C989B-A2A1-4991-B6C2-658337CC19CE")] [PlugIn] [Display(Name = nameof(PlugInResources.TraceChatCommandPlugIn_Name), Description = nameof(PlugInResources.TraceChatCommandPlugIn_Description), ResourceType = typeof(PlugInResources))] [ChatCommandHelp(Command, typeof(TraceChatCommandArgs), CharacterStatus.GameMaster)] public class TraceChatCommandPlugIn : ChatCommandPlugInBase { private const string Command = "/trace"; /// public override string Key => Command; /// public override CharacterStatus MinCharacterStatusRequirement => CharacterStatus.GameMaster; /// protected override async ValueTask DoHandleCommandAsync(Player gameMaster, TraceChatCommandArgs arguments) { var player = await this.GetPlayerByCharacterNameAsync(gameMaster, arguments.CharacterName ?? string.Empty).ConfigureAwait(false); var character = player?.SelectedCharacter; if (character is null) { return; } var characterLocation = new ExitGate { Map = character.CurrentMap, X1 = character.PositionX, X2 = (byte)(character.PositionX + 2), Y1 = character.PositionY, Y2 = (byte)(character.PositionY + 2), }; await gameMaster.WarpToAsync(characterLocation).ConfigureAwait(false); } }