feat(hs): /starths force-start command + /hsteam GM test-join command
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
// <copyright file="HeykelSavasiTeamTestChatCommandPlugIn.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;
|
||||
using System.Runtime.InteropServices;
|
||||
using MUnique.OpenMU.GameLogic.MiniGames;
|
||||
using MUnique.OpenMU.GameLogic.PlayerActions.MiniGames;
|
||||
using MUnique.OpenMU.PlugIns;
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 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.
|
||||
/// </remarks>
|
||||
[Guid("AFCA36C1-B0A0-4D98-BBD6-2352FD18CCA8")]
|
||||
[PlugIn]
|
||||
[ChatCommandHelp(Command, CharacterStatus.GameMaster)]
|
||||
public class HeykelSavasiTeamTestChatCommandPlugIn : IChatCommandPlugIn
|
||||
{
|
||||
private const string Command = "/hsteam";
|
||||
|
||||
/// <summary>
|
||||
/// The game action which contains the logic to join a team of the event.
|
||||
/// </summary>
|
||||
private readonly HeykelSavasiJoinAction _joinAction = new();
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Key => Command;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public CharacterStatus MinCharacterStatusRequirement => CharacterStatus.GameMaster;
|
||||
|
||||
/// <inheritdoc />
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// <copyright file="StartHeykelSavasiEventChatCommandPlugIn.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.PlugIns;
|
||||
|
||||
/// <summary>
|
||||
/// A chat command plugin which handles the starths command.
|
||||
/// </summary>
|
||||
[Guid("F7FCB218-1A4F-462E-B091-90496FA65CA6")]
|
||||
[PlugIn]
|
||||
[ChatCommandHelp(Command, CharacterStatus.GameMaster)]
|
||||
public class StartHeykelSavasiEventChatCommandPlugIn : IChatCommandPlugIn
|
||||
{
|
||||
private const string Command = "/starths";
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Key => Command;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public CharacterStatus MinCharacterStatusRequirement => CharacterStatus.GameMaster;
|
||||
|
||||
/// <inheritdoc />
|
||||
public async ValueTask HandleCommandAsync(Player player, string command)
|
||||
{
|
||||
var strategy = player.GameContext.PlugInManager.GetStrategy<MiniGameType, IPeriodicMiniGameStartPlugIn>(MiniGameType.HeykelSavasi);
|
||||
strategy?.ForceStart();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user