//
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
//
namespace MUnique.OpenMU.GameLogic.PlayerActions.MuHelper;
using MUnique.OpenMU.GameLogic.Views.MuHelper;
///
/// Action to update the mu helper configuration.
///
public class UpdateMuHelperConfigurationAction
{
///
/// Toggle mu bot status.
///
/// the player.
/// mu bot data to be saved.
public async ValueTask SaveDataAsync(Player player, Memory data)
{
if (player.SelectedCharacter is not { } character)
{
return;
}
try
{
character.MuHelperConfiguration = data.ToArray();
await player.InvokeViewPlugInAsync(p => p.UpdateMuHelperConfigurationAsync(character.MuHelperConfiguration)).ConfigureAwait(false);
}
catch (Exception e)
{
player.Logger.LogWarning($"Cannot save MU Helper Configuration => {e}");
}
}
}