-
Notifications
You must be signed in to change notification settings - Fork 474
Remove drop level gap condition for jewels #697
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
aeb3afb
bb25d55
3411943
34e92b3
6743719
59215b8
282d2d6
8638219
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,8 @@ public class DefaultDropGenerator : IDropGenerator | |
| /// </summary> | ||
| public static readonly int BaseMoneyDrop = 7; | ||
|
|
||
| private static readonly int DropLevelMaxGap = 12; | ||
|
|
||
| private readonly IRandomizer _randomizer; | ||
|
|
||
| /// <summary> | ||
|
|
@@ -433,7 +435,23 @@ private void AddRandomExcOptions(Item item) | |
| else | ||
| { | ||
| var monsterLevel = (int)monster[Stats.Level]; | ||
| var filteredPossibleItems = selectedGroup.PossibleItems.Where(it => it.DropLevel == 0 || ((it.DropLevel <= monsterLevel) && (it.DropLevel > monsterLevel - 12))).ToArray(); | ||
| List<ItemDefinition> filteredPossibleItems; | ||
|
|
||
| if (selectedGroup.ItemType == SpecialItemType.Jewel) | ||
| { | ||
| filteredPossibleItems = [.. selectedGroup.PossibleItems.Where(it => it.DropLevel <= monsterLevel)]; | ||
|
|
||
| if (monsterLevel > 66) | ||
| { | ||
| // Jewel of Chaos doesn't drop after a certain monster level | ||
| filteredPossibleItems.RemoveAll(it => it.Group == 12 && it.Number == 15); | ||
| } | ||
sven-n marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| else | ||
| { | ||
| filteredPossibleItems = [.. selectedGroup.PossibleItems.Where(it => it.DropLevel == 0 || (it.DropLevel <= monsterLevel && it.DropLevel > monsterLevel - DropLevelMaxGap))]; | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After adding the |
||
| } | ||
|
|
||
| return this.GenerateItemDrop(selectedGroup, filteredPossibleItems); | ||
| } | ||
| } | ||
|
|
@@ -490,7 +508,7 @@ private void AddRandomExcOptions(Item item) | |
| return this._droppableItemsPerMonsterLevel[monsterLevel] | ||
| ??= (from it in this._droppableItems | ||
| where (it.DropLevel <= monsterLevel) | ||
| && (it.DropLevel > monsterLevel - 12) | ||
| && (it.DropLevel > monsterLevel - DropLevelMaxGap) | ||
| && (!socketItems || it.MaximumSockets > 0) | ||
| select it).ToList(); | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -195,4 +195,15 @@ protected IncreasableItemOption CreateItemOption(int number, AttributeDefinition | |
|
|
||
| return itemOption; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Register the jewel (or jewel-like item) in the drop item group for jewels. | ||
| /// </summary> | ||
| /// <param name="item">The jewel you want to register.</param> | ||
| protected void AddItemToJewelItemDrop(ItemDefinition item) | ||
| { | ||
| var id = GuidHelper.CreateGuid<DropItemGroup>(4); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| var jewelsItemDrop = this.GameConfiguration.DropItemGroups.First(x => x.GetId() == id); | ||
| jewelsItemDrop.PossibleItems.Add(item); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| // <copyright file="RemoveJewelDropLevelGapPlugIn075.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.PlugIns; | ||
|
|
||
| /// <summary> | ||
| /// This update removes the existing drop level gap condition for jewels and similar items that should always drop. | ||
| /// </summary> | ||
| [PlugIn] | ||
| [Display(Name = PlugInName, Description = PlugInDescription)] | ||
| [Guid("CD958BC1-F17A-4C60-B66D-BD29D49B6ADA")] | ||
| public class RemoveJewelDropLevelGapPlugIn075 : RemoveJewelDropLevelGapPlugInBase | ||
| { | ||
| /// <inheritdoc /> | ||
| public override string DataInitializationKey => Version075.DataInitialization.Id; | ||
|
|
||
| /// <inheritdoc /> | ||
| public override UpdateVersion Version => UpdateVersion.RemoveJewelDropLevelGap075; | ||
|
|
||
| /// <inheritdoc /> | ||
| protected override async ValueTask ApplyAsync(IContext context, GameConfiguration gameConfiguration) | ||
| { | ||
| await base.ApplyAsync(context, gameConfiguration).ConfigureAwait(false); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| // <copyright file="RemoveJewelDropLevelGapPlugIn095d.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.PlugIns; | ||
|
|
||
| /// <summary> | ||
| /// This update removes the existing drop level gap condition for jewels and similar items that should always drop. | ||
| /// </summary> | ||
| [PlugIn] | ||
| [Display(Name = PlugInName, Description = PlugInDescription)] | ||
| [Guid("6614E91E-5749-478A-96A4-3240E7C1280E")] | ||
| public class RemoveJewelDropLevelGapPlugIn095D : RemoveJewelDropLevelGapPlugInBase | ||
| { | ||
| /// <inheritdoc /> | ||
| public override string DataInitializationKey => Version095d.DataInitialization.Id; | ||
|
|
||
| /// <inheritdoc /> | ||
| public override UpdateVersion Version => UpdateVersion.RemoveJewelDropLevelGap095d; | ||
|
|
||
| /// <inheritdoc /> | ||
| protected override async ValueTask ApplyAsync(IContext context, GameConfiguration gameConfiguration) | ||
| { | ||
| await base.ApplyAsync(context, gameConfiguration).ConfigureAwait(false); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| // <copyright file="RemoveJewelDropLevelGapPlugInBase.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 MUnique.OpenMU.DataModel.Configuration; | ||
| using MUnique.OpenMU.Persistence.Initialization.Items; | ||
|
|
||
| /// <summary> | ||
| /// This update removes the existing drop level gap condition for jewels and similar items that should always drop. | ||
| /// </summary> | ||
| public abstract class RemoveJewelDropLevelGapPlugInBase : UpdatePlugInBase | ||
| { | ||
| /// <summary> | ||
| /// The plug in name. | ||
| /// </summary> | ||
| internal const string PlugInName = "Remove Jewel Drop Level Gap"; | ||
|
|
||
| /// <summary> | ||
| /// The plug in description. | ||
| /// </summary> | ||
| internal const string PlugInDescription = "This update removes the existing drop level gap condition for jewels and similar items that should always drop."; | ||
|
|
||
| /// <inheritdoc /> | ||
| public override string Name => PlugInName; | ||
|
|
||
| /// <inheritdoc /> | ||
| public override string Description => PlugInDescription; | ||
|
|
||
| /// <inheritdoc /> | ||
| public override bool IsMandatory => true; | ||
|
|
||
| /// <inheritdoc /> | ||
| public override DateTime CreatedAt => new(2026, 3, 5, 16, 0, 0, DateTimeKind.Utc); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| /// <inheritdoc /> | ||
| protected override async ValueTask ApplyAsync(IContext context, GameConfiguration gameConfiguration) | ||
| { | ||
| var jewelsDropGroupId = new Guid("00000200-0004-0000-0000-000000000000"); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| var jewelsDropGroup = gameConfiguration.DropItemGroups.First(x => x.GetId() == jewelsDropGroupId); | ||
| jewelsDropGroup.ItemType = SpecialItemType.Jewel; | ||
|
|
||
| Dictionary<ItemGroups, List<int>> itemGroupToItemNumbers = new() | ||
| { | ||
| { ItemGroups.Misc1, [0, 1, 2] }, // angel, imp, uniria | ||
| { ItemGroups.Misc2, [9, 10] }, // alcohol, town portal scroll | ||
|
Comment on lines
+46
to
+47
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The item numbers |
||
| }; | ||
| foreach (var entry in itemGroupToItemNumbers) | ||
| { | ||
| var items = gameConfiguration.Items.Where(i => i.Group == (int)entry.Key && entry.Value.Contains(i.Number)); | ||
| foreach (var item in items) | ||
| { | ||
| jewelsDropGroup.PossibleItems.Add(item); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| // <copyright file="RemoveJewelDropLevelGapPlugInSeason6.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.PlugIns; | ||
|
|
||
| /// <summary> | ||
| /// This update removes the existing drop level gap condition for jewels and similar items that should always drop. | ||
| /// </summary> | ||
| [PlugIn] | ||
| [Display(Name = PlugInName, Description = PlugInDescription)] | ||
| [Guid("AB1C9F8B-5E3B-4F2A-BDCD-9C0F1E5A6B7C")] | ||
| public class RemoveJewelDropLevelGapPlugInSeason6 : RemoveJewelDropLevelGapPlugInBase | ||
| { | ||
| /// <inheritdoc /> | ||
| public override string DataInitializationKey => VersionSeasonSix.DataInitialization.Id; | ||
|
|
||
| /// <inheritdoc /> | ||
| public override UpdateVersion Version => UpdateVersion.RemoveJewelDropLevelGapSeason6; | ||
|
|
||
| /// <inheritdoc /> | ||
| protected override async ValueTask ApplyAsync(IContext context, GameConfiguration gameConfiguration) | ||
| { | ||
| await base.ApplyAsync(context, gameConfiguration).ConfigureAwait(false); | ||
|
|
||
| var jewelOfGuardianDropGroupId = new Guid("00000200-001f-0001-0000-000000000000"); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| if (gameConfiguration.DropItemGroups.FirstOrDefault(x => x.GetId() == jewelOfGuardianDropGroupId) is { } jewelOfGuardianDropGroup) | ||
| { | ||
| jewelOfGuardianDropGroup.ItemType = SpecialItemType.Jewel; | ||
| } | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic for the 'Jewel of Chaos' not dropping after monster level 66 is hardcoded directly into the drop generation. Consider externalizing this rule into a configurable setting or a data-driven approach, especially if similar exceptions might arise for other items in the future.