//
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
//
namespace MUnique.OpenMU.Persistence.Initialization;
using MUnique.OpenMU.AttributeSystem;
using MUnique.OpenMU.DataModel.Configuration;
///
/// Extension methods for .
///
internal static class MonsterDefinitionExtensions
{
///
/// Adds the attributes with their values to the .
///
/// The monster definition.
/// The attributes with values.
/// The context.
/// The game configuration.
public static void AddAttributes(this MonsterDefinition monsterDefinition, IDictionary attributesWithValues, IContext context, GameConfiguration gameConfiguration)
{
foreach (var attributeWithValue in attributesWithValues)
{
var attribute = context.CreateNew();
attribute.AttributeDefinition = attributeWithValue.Key.GetPersistent(gameConfiguration);
attribute.Value = attributeWithValue.Value;
monsterDefinition.Attributes.Add(attribute);
attribute.SetGuid(monsterDefinition.Number, attribute.AttributeDefinition.Id.ExtractFirstTwoBytes());
}
}
}