From e0fafe7e03f2b03281d35dd553f412882ee5c59f Mon Sep 17 00:00:00 2001 From: Acentech Dev Date: Tue, 21 Jul 2026 00:44:00 +0300 Subject: [PATCH] feat(hs): /starths force-start command + /hsteam GM test-join command --- .../HeykelSavasiTeamTestChatCommandPlugIn.cs | 70 +++++++++++++++++++ ...StartHeykelSavasiEventChatCommandPlugIn.cs | 33 +++++++++ 2 files changed, 103 insertions(+) create mode 100644 src/GameLogic/PlugIns/ChatCommands/HeykelSavasiTeamTestChatCommandPlugIn.cs create mode 100644 src/GameLogic/PlugIns/ChatCommands/StartHeykelSavasiEventChatCommandPlugIn.cs diff --git a/src/GameLogic/PlugIns/ChatCommands/HeykelSavasiTeamTestChatCommandPlugIn.cs b/src/GameLogic/PlugIns/ChatCommands/HeykelSavasiTeamTestChatCommandPlugIn.cs new file mode 100644 index 0000000..ee1d576 --- /dev/null +++ b/src/GameLogic/PlugIns/ChatCommands/HeykelSavasiTeamTestChatCommandPlugIn.cs @@ -0,0 +1,70 @@ +// +// Licensed under the MIT License. See LICENSE file in the project root for full license information. +// + +namespace MUnique.OpenMU.GameLogic.PlugIns.ChatCommands; + +using System; +using System.Runtime.InteropServices; +using MUnique.OpenMU.GameLogic.MiniGames; +using MUnique.OpenMU.GameLogic.PlayerActions.MiniGames; +using MUnique.OpenMU.PlugIns; + +/// +/// A chat command plugin which allows a game master to join a team of the currently open +/// Heykel Savasi (statue war) event without using the client team-select panel. +/// +/// +/// This is a GM testing aid which substitutes for the client team-select panel (which is +/// implemented in a separate phase for the PC and mobile clients). It allows the whole server +/// side flow of the Heykel Savasi event to be tested end-to-end before the client UI exists. +/// +[Guid("AFCA36C1-B0A0-4D98-BBD6-2352FD18CCA8")] +[PlugIn] +[ChatCommandHelp(Command, CharacterStatus.GameMaster)] +public class HeykelSavasiTeamTestChatCommandPlugIn : IChatCommandPlugIn +{ + private const string Command = "/hsteam"; + + /// + /// The game action which contains the logic to join a team of the event. + /// + private readonly HeykelSavasiJoinAction _joinAction = new(); + + /// + public string Key => Command; + + /// + public CharacterStatus MinCharacterStatusRequirement => CharacterStatus.GameMaster; + + /// + public async ValueTask HandleCommandAsync(Player player, string command) + { + var parts = command.Split(' ', StringSplitOptions.RemoveEmptyEntries); + var arg = parts.Length > 1 ? parts[1].ToLowerInvariant() : string.Empty; + + var team = arg switch + { + "blue" => HeykelSavasiTeam.Blue, + "red" => HeykelSavasiTeam.Red, + _ => HeykelSavasiTeam.None, + }; + + if (team == HeykelSavasiTeam.None) + { + await player.ShowBlueMessageAsync("Kullanim: /hsteam red|blue").ConfigureAwait(false); + return; + } + + var context = player.GameContext is GameContext gameContext + ? await gameContext.GetOpenHeykelSavasiAsync().ConfigureAwait(false) + : null; + if (context is null) + { + await player.ShowBlueMessageAsync("Heykel Savasi kayit acik degil.").ConfigureAwait(false); + return; + } + + await this._joinAction.JoinAsync(player, team, context).ConfigureAwait(false); + } +} diff --git a/src/GameLogic/PlugIns/ChatCommands/StartHeykelSavasiEventChatCommandPlugIn.cs b/src/GameLogic/PlugIns/ChatCommands/StartHeykelSavasiEventChatCommandPlugIn.cs new file mode 100644 index 0000000..72c043e --- /dev/null +++ b/src/GameLogic/PlugIns/ChatCommands/StartHeykelSavasiEventChatCommandPlugIn.cs @@ -0,0 +1,33 @@ +// +// 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.PlugIns; + +/// +/// A chat command plugin which handles the starths command. +/// +[Guid("F7FCB218-1A4F-462E-B091-90496FA65CA6")] +[PlugIn] +[ChatCommandHelp(Command, CharacterStatus.GameMaster)] +public class StartHeykelSavasiEventChatCommandPlugIn : IChatCommandPlugIn +{ + private const string Command = "/starths"; + + /// + public string Key => Command; + + /// + public CharacterStatus MinCharacterStatusRequirement => CharacterStatus.GameMaster; + + /// + public async ValueTask HandleCommandAsync(Player player, string command) + { + var strategy = player.GameContext.PlugInManager.GetStrategy(MiniGameType.HeykelSavasi); + strategy?.ForceStart(); + } +}