feat(hs): team-select handler + join action with atomic balance reserve and base warp
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user