-
Notifications
You must be signed in to change notification settings - Fork 337
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #469 from MUnique/dev/fix-socket-seed-crafting
Fixed socket seed crafting
- Loading branch information
Showing
3 changed files
with
73 additions
and
2 deletions.
There are no files selected for viewing
68 changes: 68 additions & 0 deletions
68
src/Persistence/Initialization/Updates/FixSocketSeedCraftingUpdatePlugIn.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,68 @@ | ||
// <copyright file="FixSocketSeedCraftingUpdatePlugIn.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.Runtime.InteropServices; | ||
using MUnique.OpenMU.DataModel.Configuration; | ||
using MUnique.OpenMU.DataModel.Configuration.Items; | ||
using MUnique.OpenMU.PlugIns; | ||
|
||
/// <summary> | ||
/// This update sets the right settings for the socket seed crafting. | ||
/// </summary> | ||
[PlugIn(PlugInName, PlugInDescription)] | ||
[Guid("C802EFC2-1D42-4218-871E-8886D115F3ED")] | ||
public class FixSocketSeedCraftingUpdatePlugIn : UpdatePlugInBase | ||
{ | ||
/// <summary> | ||
/// The plug in name. | ||
/// </summary> | ||
internal const string PlugInName = "Fixed socket seed crafting"; | ||
|
||
/// <summary> | ||
/// The plug in description. | ||
/// </summary> | ||
internal const string PlugInDescription = "This update sets the right settings for the socket seed crafting."; | ||
|
||
/// <inheritdoc /> | ||
public override string Name => PlugInName; | ||
|
||
/// <inheritdoc /> | ||
public override string Description => PlugInDescription; | ||
|
||
/// <inheritdoc /> | ||
public override UpdateVersion Version => UpdateVersion.FixSocketSeedCrafting; | ||
|
||
/// <inheritdoc /> | ||
public override string DataInitializationKey => VersionSeasonSix.DataInitialization.Id; | ||
|
||
/// <inheritdoc /> | ||
public override bool IsMandatory => true; | ||
|
||
/// <inheritdoc /> | ||
public override DateTime CreatedAt => new(2024, 08, 25, 15, 00, 0, DateTimeKind.Utc); | ||
|
||
/// <inheritdoc /> | ||
protected override async ValueTask ApplyAsync(IContext context, GameConfiguration gameConfiguration) | ||
{ | ||
var seedMaster = gameConfiguration.Monsters.FirstOrDefault(m => m.NpcWindow == NpcWindow.SeedMaster); | ||
if (seedMaster is null) | ||
{ | ||
return; | ||
} | ||
|
||
var seedCrafting = seedMaster.ItemCraftings.FirstOrDefault(c => c.Number == 42); | ||
if (seedCrafting?.SimpleCraftingSettings is not { } craftingSettings) | ||
{ | ||
return; | ||
} | ||
|
||
var option = gameConfiguration.ItemOptionTypes.First(o => object.Equals(o, ItemOptionTypes.Option)); | ||
foreach (var requirement in craftingSettings.RequiredItems) | ||
{ | ||
requirement.RequiredItemOptions.Remove(option); | ||
} | ||
} | ||
} |
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
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