-
Notifications
You must be signed in to change notification settings - Fork 335
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add initialization plugin to add the new attribute
- Loading branch information
Showing
1 changed file
with
57 additions
and
0 deletions.
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
src/Persistence/Initialization/Updates/AddPointsPerResetAttributePlugIn.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// <copyright file="AddPointsPerResetAttributePlugIn.cs" company="MUnique"> | ||
// Licensed under the MIT License. See LICENSE file in the project root for full license information. | ||
// </copyright> | ||
|
||
namespace MUnique.OpenMU.Persistence.Initialization.Updates; | ||
|
||
using System; | ||
using System.Runtime.InteropServices; | ||
using MUnique.OpenMU.AttributeSystem; | ||
|
||
using MUnique.OpenMU.DataModel.Configuration; | ||
using MUnique.OpenMU.GameLogic.Attributes; | ||
using MUnique.OpenMU.PlugIns; | ||
|
||
/// <summary> | ||
/// This update adds the <see cref="Stats.PointsPerReset"/>. | ||
/// </summary> | ||
[PlugIn(PlugInName, PlugInDescription)] | ||
[Guid("6011A1B8-7FA5-48EB-935D-EEAF83017799")] | ||
public class AddPointsPerResetAttributePlugIn : UpdatePlugInBase | ||
{ | ||
/// <summary> | ||
/// The plug in name. | ||
/// </summary> | ||
internal const string PlugInName = "Adds attribute PointsPerReset"; | ||
|
||
/// <summary> | ||
/// The plug in description. | ||
/// </summary> | ||
internal const string PlugInDescription = "This update adds the attribute PointsPerReset."; | ||
|
||
/// <inheritdoc /> | ||
public override string Name => PlugInName; | ||
|
||
/// <inheritdoc /> | ||
public override string Description => PlugInDescription; | ||
|
||
/// <inheritdoc /> | ||
public override UpdateVersion Version => UpdateVersion.AddPointsPerResetByClassAttribute; | ||
|
||
/// <inheritdoc /> | ||
public override string DataInitializationKey => VersionSeasonSix.DataInitialization.Id; | ||
|
||
/// <inheritdoc /> | ||
public override bool IsMandatory => true; | ||
|
||
/// <inheritdoc /> | ||
public override DateTime CreatedAt => new(2024, 06, 09, 13, 30, 0, DateTimeKind.Utc); | ||
|
||
/// <inheritdoc /> | ||
protected override async ValueTask ApplyAsync(IContext context, GameConfiguration gameConfiguration) | ||
{ | ||
var attribute = Stats.PointsPerReset; | ||
var persistentAttribute = context.CreateNew<AttributeDefinition>(attribute.Id, attribute.Designation, attribute.Description); | ||
gameConfiguration.Attributes.Add(persistentAttribute); | ||
} | ||
} |