feat(hs): team-select handler + join action with atomic balance reserve and base warp

This commit is contained in:
Acentech Dev
2026-07-20 23:42:07 +03:00
parent 7e954b610f
commit cd55e726f1
3 changed files with 148 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
// <copyright file="HeykelSavasiJoinAction.cs" company="MUnique">
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
// </copyright>
namespace MUnique.OpenMU.GameLogic.PlayerActions.MiniGames;
using MUnique.OpenMU.GameLogic.MiniGames;
using MUnique.OpenMU.GameLogic.Views;
using MUnique.OpenMU.Interfaces;
/// <summary>
/// Player action which implements joining a team of the Heykel Savasi (statue war) event.
/// </summary>
public class HeykelSavasiJoinAction
{
/// <summary>
/// Tries to join the given player to the given team of the Heykel Savasi event, and warps the
/// player to the team's base spawn gate on success.
/// </summary>
/// <param name="player">The player who wants to join.</param>
/// <param name="team">The team which the player wants to join.</param>
/// <param name="context">The currently open Heykel Savasi context.</param>
public async ValueTask JoinAsync(Player player, HeykelSavasiTeam team, HeykelSavasiContext context)
{
if (await context.TryJoinTeamAsync(player, team).ConfigureAwait(false))
{
await player.WarpToAsync(context.GetTeamSpawnGate(team)).ConfigureAwait(false);
}
else
{
await player.InvokeViewPlugInAsync<IShowMessagePlugIn>(p =>
p.ShowMessageAsync("Takima simdi katilamadin (denge/durum).", MessageType.BlueNormal)).ConfigureAwait(false);
}
}
}