baseline: OpenMU upstream b5a0961 (fresh source)

This commit is contained in:
Acentech Dev
2026-07-14 19:00:35 +03:00
parent 450402e47d
commit 36fc125d5c
11968 changed files with 748705 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
// <copyright file="RemoveVaultPinAction.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.Vault;
using MUnique.OpenMU.GameLogic.Views.Vault;
/// <summary>
/// Action which removes the pin for the vault of a player, if the correct account password is provided.
/// </summary>
public class RemoveVaultPinAction
{
/// <summary>
/// Removes the pin for the vault of a player, if the correct account password is provided.
/// </summary>
/// <param name="player">The player.</param>
/// <param name="accountPassword">The account password.</param>
public async ValueTask RemovePinAsync(Player player, string accountPassword)
{
if (player.Account is not null && BCrypt.Net.BCrypt.Verify(accountPassword, player.Account.PasswordHash))
{
player.Account.VaultPassword = string.Empty;
player.IsVaultLocked = false;
await player.InvokeViewPlugInAsync<IUpdateVaultStatePlugIn>(p => p.UpdateStateAsync()).ConfigureAwait(false);
}
else
{
await player.InvokeViewPlugInAsync<IShowVaultLockChangeResponse>(p => p.ShowResponseAsync(VaultLockChangeResult.RemovePinFailedByWrongPassword)).ConfigureAwait(false);
}
}
}

View File

@@ -0,0 +1,38 @@
// <copyright file="SetVaultPinAction.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.Vault;
using MUnique.OpenMU.GameLogic.Views.Vault;
/// <summary>
/// Action which sets a new pin for the vault of a player, if the correct account password is provided.
/// </summary>
public class SetVaultPinAction
{
/// <summary>
/// Sets a new pin for the vault of a player, if the correct account password is provided.
/// </summary>
/// <param name="player">The player.</param>
/// <param name="newPin">The new pin.</param>
/// <param name="accountPassword">The account password.</param>
public async ValueTask SetPinAsync(Player player, string newPin, string accountPassword)
{
if (player.Account is null || player.IsVaultLocked)
{
await player.InvokeViewPlugInAsync<IShowVaultLockChangeResponse>(p => p.ShowResponseAsync(VaultLockChangeResult.SetPinFailedBecauseLock)).ConfigureAwait(false);
return;
}
if (BCrypt.Net.BCrypt.Verify(accountPassword, player.Account.PasswordHash))
{
player.Account.VaultPassword = newPin;
await player.InvokeViewPlugInAsync<IShowVaultLockChangeResponse>(p => p.ShowResponseAsync(VaultLockChangeResult.Unlocked)).ConfigureAwait(false);
}
else
{
await player.InvokeViewPlugInAsync<IShowVaultLockChangeResponse>(p => p.ShowResponseAsync(VaultLockChangeResult.SetPinFailedBecauseLock)).ConfigureAwait(false);
}
}
}

View File

@@ -0,0 +1,34 @@
// <copyright file="UnlockVaultAction.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.Vault;
using MUnique.OpenMU.GameLogic.Views.Vault;
/// <summary>
/// Action which unlocks the vault of a player, if the correct pin is provided.
/// </summary>
public class UnlockVaultAction
{
/// <summary>
/// Unlocks the vault of a player, if the correct pin is provided.
/// </summary>
/// <param name="player">The player.</param>
/// <param name="pin">The pin.</param>
public async ValueTask UnlockVaultAsync(Player player, string pin)
{
VaultLockChangeResult result;
if (player.Account?.VaultPassword == pin)
{
player.IsVaultLocked = false;
result = VaultLockChangeResult.Unlocked;
}
else
{
result = VaultLockChangeResult.UnlockFailedByWrongPin;
}
await player.InvokeViewPlugInAsync<IShowVaultLockChangeResponse>(p => p.ShowResponseAsync(result)).ConfigureAwait(false);
}
}