Skip to content

feat(persistence): add Crest of Monarch drop group in Icarus#709

Open
olisikh wants to merge 3 commits intoMUnique:masterfrom
olisikh:feat/crest-of-monarch-drop-group
Open

feat(persistence): add Crest of Monarch drop group in Icarus#709
olisikh wants to merge 3 commits intoMUnique:masterfrom
olisikh:feat/crest-of-monarch-drop-group

Conversation

@olisikh
Copy link

@olisikh olisikh commented Mar 13, 2026

Adds a "Crest of Monarch" Drop Item group that drops a "Loch's feather +1" item, which is effectively a "Crest of Monarch" item, needed to craft "Cape of Lord" cape for Dark Lord class.

Asked LLM for help, I can read and understand C#, but I am not fluent in it.

@gemini-code-assist
Copy link

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request integrates the 'Crest of Monarch' item drop group into the game's Season 6 configuration for the Icarus map. It establishes a robust mechanism for this new drop through both initial data setup and a dedicated update plugin, ensuring consistent availability and proper behavior. The changes are thoroughly validated with new unit tests, confirming the drop group's correct properties and the update's idempotent nature.

Highlights

  • New Drop Group Update Plugin: Added a new update plugin, AddCrestOfMonarchDropGroupUpdateSeason6, responsible for programmatically adding the 'Crest of Monarch' drop group to the Icarus map's game configuration.
  • Update Version Enumeration: Included a new entry, AddCrestOfMonarchDropGroupSeason6, in the UpdateVersion enum to register the new persistence update.
  • Icarus Map Initialization: Modified the Icarus map initialization logic to directly include the 'Crest of Monarch' drop group, ensuring it's present from initial data creation.
  • Comprehensive Test Coverage: Introduced new test cases to verify the correct creation of the 'Crest of Monarch' drop group and to ensure the idempotency of its corresponding update plugin.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • src/Persistence/Initialization/Updates/AddCrestOfMonarchDropGroupUpdateSeason6.cs
    • Added a new update plugin for the 'Crest of Monarch' drop group.
  • src/Persistence/Initialization/Updates/UpdateVersion.cs
    • Added a new enumeration value for the 'Crest of Monarch' drop group update.
  • src/Persistence/Initialization/VersionSeasonSix/Maps/Icarus.cs
    • Configured the Icarus map to include the 'Crest of Monarch' drop group during initialization.
  • tests/MUnique.OpenMU.Persistence.Initialization.Tests/TestInitializationWithEfCore.cs
    • Added new test cases to validate the 'Crest of Monarch' drop group and its update plugin.
Activity
  • No specific activity has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds the 'Crest of Monarch' drop group to the Icarus map. This is achieved by adding a new update plugin for existing data and modifying the initial data creation for new setups. Tests have been added to verify the idempotency of the update plugin and the correctness of the initial data. My feedback includes a correction for a data issue with a timestamp and suggestions to replace magic numbers with named constants to improve code maintainability and consistency across the related files.

Comment on lines +52 to +80
{
var map = gameConfiguration.Maps.First(m => m.Number == Icarus.Number && m.Discriminator == 0);
var lochsFeather = gameConfiguration.Items.First(item => item.Group == 13 && item.Number == 14);
var crestId = GuidHelper.CreateGuid<DropItemGroup>(Icarus.Number, 2);

var crestGroup = gameConfiguration.DropItemGroups.FirstOrDefault(group => group.GetId() == crestId);
if (crestGroup is null)
{
crestGroup = context.CreateNew<DropItemGroup>();
crestGroup.SetGuid(Icarus.Number, 2);
gameConfiguration.DropItemGroups.Add(crestGroup);
}

crestGroup.Description = "Crest of Monarch";
crestGroup.Chance = 0.001;
crestGroup.MinimumMonsterLevel = 82;
crestGroup.MaximumMonsterLevel = null;
crestGroup.ItemLevel = 1;
if (crestGroup.PossibleItems.Count != 1 || crestGroup.PossibleItems.First().GetItemId() != lochsFeather.GetItemId())
{
crestGroup.PossibleItems.Clear();
crestGroup.PossibleItems.Add(lochsFeather);
}

if (!map.DropItemGroups.Any(group => group.GetId() == crestGroup.GetId()))
{
map.DropItemGroups.Add(crestGroup);
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This method contains several magic numbers (e.g., 13, 14, 2, 0.001, 82, 1). To improve readability and maintainability, consider defining these as named constants. This would also allow them to be shared with Icarus.cs and the test files, ensuring consistency.

For example, you could define constants at the class level:

private const byte LochsFeatherItemGroup = 13;
private const short LochsFeatherItemNumber = 14;
private const short CrestOfMonarchDropItemGroupId = 2;
private const double ItemDropChance = 0.001;
private const byte MinimumMonsterLevel = 82;
private const byte CrestOfMonarchItemLevel = 1;

Comment on lines +85 to +91
Assert.That(groups[0].Description.ToString(), Is.EqualTo("Crest of Monarch"));
Assert.That(groups[0].Chance, Is.EqualTo(0.001));
Assert.That(groups[0].MinimumMonsterLevel, Is.EqualTo((byte)82));
Assert.That(groups[0].ItemLevel, Is.EqualTo((byte)1));
Assert.That(groups[0].PossibleItems, Has.Count.EqualTo(1));
Assert.That(groups[0].PossibleItems.Single().Group, Is.EqualTo((byte)13));
Assert.That(groups[0].PossibleItems.Single().Number, Is.EqualTo((short)14));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

These assertions use hardcoded values (e.g., 82, 1, 13, 14). If you introduce constants for these magic numbers in the production code as suggested in other comments, please consider using those constants here as well. This makes the tests more robust to changes in these values and ensures consistency.

@olisikh
Copy link
Author

olisikh commented Mar 13, 2026

Can't tell why the build failed, managed to build it locally and run it just fine :(

@sven-n
Copy link
Member

sven-n commented Mar 15, 2026

D:\a\1\s\tests\MUnique.OpenMU.Persistence.Initialization.Tests\TestInitializationWithEfCore.cs(69,65): error CS0122: 'Icarus' is inaccessible due to its protection level [D:\a\1\s\tests\MUnique.OpenMU.Persistence.Initialization.Tests\MUnique.OpenMU.Persistence.Initialization.Tests.csproj]
D:\a\1\s\tests\MUnique.OpenMU.Persistence.Initialization.Tests\TestInitializationWithEfCore.cs(71,28): error CS0122: 'GuidHelper' is inaccessible due to its protection level [D:\a\1\s\tests\MUnique.OpenMU.Persistence.Initialization.Tests\MUnique.OpenMU.Persistence.Initialization.Tests.csproj]
D:\a\1\s\tests\MUnique.OpenMU.Persistence.Initialization.Tests\TestInitializationWithEfCore.cs(71,65): error CS0122: 'Icarus' is inaccessible due to its protection level [D:\a\1\s\tests\MUnique.OpenMU.Persistence.Initialization.Tests\MUnique.OpenMU.Persistence.Initialization.Tests.csproj]
D:\a\1\s\tests\MUnique.OpenMU.Persistence.Initialization.Tests\TestInitializationWithEfCore.cs(163,65): error CS0122: 'Icarus' is inaccessible due to its protection level [D:\a\1\s\tests\MUnique.OpenMU.Persistence.Initialization.Tests\MUnique.OpenMU.Persistence.Initialization.Tests.csproj]
D:\a\1\s\tests\MUnique.OpenMU.Persistence.Initialization.Tests\TestInitializationWithEfCore.cs(165,35): error CS0122: 'GuidHelper' is inaccessible due to its protection level [D:\a\1\s\tests\MUnique.OpenMU.Persistence.Initialization.Tests\MUnique.OpenMU.Persistence.Initialization.Tests.csproj]
D:\a\1\s\tests\MUnique.OpenMU.Persistence.Initialization.Tests\TestInitializationWithEfCore.cs(165,72): error CS0122: 'Icarus' is inaccessible due to its protection level [D:\a\1\s\tests\MUnique.OpenMU.Persistence.Initialization.Tests\MUnique.OpenMU.Persistence.Initialization.Tests.csproj]
D:\a\1\s\tests\MUnique.OpenMU.Persistence.Initialization.Tests\TestInitializationWithEfCore.cs(166,28): error CS0122: 'GuidHelper' is inaccessible due to its protection level [D:\a\1\s\tests\MUnique.OpenMU.Persistence.Initialization.Tests\MUnique.OpenMU.Persistence.Initialization.Tests.csproj]
D:\a\1\s\tests\MUnique.OpenMU.Persistence.Initialization.Tests\TestInitializationWithEfCore.cs(166,65): error CS0122: 'Icarus' is inaccessible due to its protection level [D:\a\1\s\tests\MUnique.OpenMU.Persistence.Initialization.Tests\MUnique.OpenMU.Persistence.Initialization.Tests.csproj]

I think you can fix this by adding this line to the AssemblyInfo.cs in the Persistence.Initialization project:
[assembly: InternalsVisibleTo("MUnique.OpenMU.Persistence.Initialization.Tests")]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants