Skip to content

Remove drop level gap condition for jewels#697

Open
ze-dom wants to merge 8 commits intoMUnique:masterfrom
ze-dom:bugfix/remove_jewels_level_drop_gap
Open

Remove drop level gap condition for jewels#697
ze-dom wants to merge 8 commits intoMUnique:masterfrom
ze-dom:bugfix/remove_jewels_level_drop_gap

Conversation

@ze-dom
Copy link
Contributor

@ze-dom ze-dom commented Feb 19, 2026

Todo

  • UpdatePlugin (after discussion)
  • Comment changes with source references

This fix removes the drop level gap condition for Jewels, Imp, Angel, Uniria, Ale, and Town Portal Scroll, which was preventing these items from dropping by mobs with higher levels than that limit.

Remarks
Let me know your opinion on the following points, as to whether we should add them or not:

  1. Orbs, Scrolls and other skill items seem to have a lower drop rate (zTeamS6.3, emu) than other items. We could create a new drop group for this.
  2. Second and third class excellent items seem to be extra rarer (zTeamS6.3, emu) than other excellent items.
  3. Jewel of Chaos is not as rare as other jewels/Imp/Angel/Uniria/Ale/Town Portal Scroll (zTeamS6.3, emu) (about (3/7)/(1/11)=4.7 times less rare).

Apparently in zTeamS6.3, they moved the jewel item checks somewhere else and mobs didn't drop them. Maybe they sold them in NPC stores or something.

@ze-dom ze-dom changed the title First commit Remove drop level gap condition for jewels Feb 19, 2026
}
else
{
filteredPossibleItems = [.. selectedGroup.PossibleItems.Where(it => it.DropLevel == 0 || (it.DropLevel <= monsterLevel && it.DropLevel > monsterLevel - 12))];
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Accordint to zTeamS6.3 (1, 2), emu (1, 2), the gap is 18 and not 12. Let me know if you want to change.

Copy link
Member

Choose a reason for hiding this comment

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

That's a good question... I'm not sure if it is the correct value for all items. This would mean that Items can drop up to Level 5. If I remember correctly, this wasn't possible for all items. E.g. leather boots and gloves dropped until level 5, while other armor parts were limited to 3 or 4.
This 12 is btw at two places, it probably needs a constant, or to defined in ItemDefinition.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Apparently the old Monster.xml database had an maxitemlevel attribute, which defined exactly that (zTeamS6.3: 1, 2; emu: 1, 2).

Copy link
Member

Choose a reason for hiding this comment

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

That's custom stuff, the original server didn't have xml config files ;-)
Let's just keep it like it is, for the moment.

Copy link
Member

@sven-n sven-n left a comment

Choose a reason for hiding this comment

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

Good and simple solution. I had a way more complicated solution in mind, but I like yours more 😅
Please just move this one method to the base class, instead of inheriting every class from Jewels.

/// Initializer for pets.
/// </summary>
public class Pets : InitializerBase
public class Pets : Jewels
Copy link
Member

Choose a reason for hiding this comment

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

This looks strange. Can you move the AddItemToJewelItemDrop to InitializerBase instead?

@ze-dom
Copy link
Contributor Author

ze-dom commented Feb 24, 2026

Ok. What about the remarks in the PR description, what do you want to do about those?

}
else
{
filteredPossibleItems = [.. selectedGroup.PossibleItems.Where(it => it.DropLevel == 0 || (it.DropLevel <= monsterLevel && it.DropLevel > monsterLevel - DropLevelMaxGap))];
Copy link
Contributor Author

Choose a reason for hiding this comment

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

After adding the DropLevelMaxGap constant, the previous thread disappeared: #697 (comment)

@ze-dom ze-dom requested a review from sven-n March 4, 2026 16:23
@ze-dom ze-dom marked this pull request as ready for review March 5, 2026 17:52
@ze-dom
Copy link
Contributor Author

ze-dom commented Mar 5, 2026

All set. Please check my remarks in the original PR description. You may want to do something about those.

@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 refines the item drop mechanics by eliminating a restrictive level gap condition for jewels and other valuable consumables like Imp, Angel, Uniria, Ale, and Town Portal Scrolls. This ensures these items can consistently drop from a wider range of monster levels, improving game balance and player experience. The changes involve categorizing these items with a new SpecialItemType.Jewel, implementing specific drop rules (e.g., for 'Jewel of Chaos'), and standardizing the update process across various game versions through a new plugin architecture.

Highlights

  • Removed Drop Level Gap for Jewels: The primary change removes the level gap condition for jewels and similar items (Imp, Angel, Uniria, Ale, Town Portal Scroll), allowing them to drop from monsters regardless of a significant level difference. This addresses an issue where higher-level mobs were prevented from dropping these items.
  • Introduced SpecialItemType.Jewel: A new enumeration member, Jewel, has been added to SpecialItemType to specifically categorize these items, enabling distinct drop logic for them.
  • Specific 'Jewel of Chaos' Drop Logic: Implemented a rule to prevent the 'Jewel of Chaos' from dropping from monsters with a level higher than 66, aligning with specific game mechanics.
  • Refactored Item Initialization and Updates: A new base class (RemoveJewelDropLevelGapPlugInBase) and a helper method (AddItemToJewelItemDrop) were introduced to streamline the process of assigning jewel-like items to their respective drop groups across different game versions (0.75, 0.95d, Season 6) via dedicated update plugins.

🧠 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/DataModel/Configuration/DropItemGroup.cs
    • Added a new Jewel enumeration member to SpecialItemType.
  • src/GameLogic/DefaultDropGenerator.cs
    • Introduced a DropLevelMaxGap constant.
    • Modified item filtering logic to exempt Jewel type items from level gap restrictions.
    • Added logic to prevent 'Jewel of Chaos' drops after monster level 66.
    • Updated GetDroppableItems to utilize the new DropLevelMaxGap constant.
  • src/Persistence/Initialization/GameConfigurationInitializerBase.cs
    • Updated the ItemType for the main jewels drop group to SpecialItemType.Jewel.
  • src/Persistence/Initialization/InitializerBase.cs
    • Added a protected helper method, AddItemToJewelItemDrop, for registering items into the jewel drop group.
  • src/Persistence/Initialization/Updates/RemoveJewelDropLevelGapPlugIn075.cs
    • Added a new update plugin to remove the jewel drop level gap for version 0.75.
  • src/Persistence/Initialization/Updates/RemoveJewelDropLevelGapPlugIn095d.cs
    • Added a new update plugin to remove the jewel drop level gap for version 0.95d.
  • src/Persistence/Initialization/Updates/RemoveJewelDropLevelGapPlugInBase.cs
    • Added an abstract base class for update plugins, which sets the ItemType for the jewel drop group and adds specific items to it.
  • src/Persistence/Initialization/Updates/RemoveJewelDropLevelGapPlugInSeason6.cs
    • Added a new update plugin to remove the jewel drop level gap for Season 6, including specific handling for 'Jewel of Guardian'.
  • src/Persistence/Initialization/Updates/UpdateVersion.cs
    • Added new enum members for the jewel drop level gap update plugins.
  • src/Persistence/Initialization/Version075/Items/Jewels.cs
    • Removed the AddItemToJewelItemDrop method, which was refactored to a base class.
  • src/Persistence/Initialization/Version075/Items/Pets.cs
    • Updated pet creation to use the new AddItemToJewelItemDrop helper method for specific pets.
  • src/Persistence/Initialization/Version075/Items/Potions.cs
    • Updated potion creation to use the new AddItemToJewelItemDrop helper method for 'Alcohol' and 'Town Portal Scroll'.
  • src/Persistence/Initialization/Version095d/Items/Pets.cs
    • Updated pet creation to use the new AddItemToJewelItemDrop helper method for specific pets.
  • src/Persistence/Initialization/VersionSeasonSix/Items/Pets.cs
    • Updated pet creation to use the new AddItemToJewelItemDrop helper method for specific pets.
  • src/Persistence/Initialization/VersionSeasonSix/Items/Potions.cs
    • Updated potion creation to use the new AddItemToJewelItemDrop helper method for 'Alcohol' and 'Town Portal Scroll'.
  • src/Persistence/Initialization/VersionSeasonSix/Maps/LandOfTrials.cs
    • Updated the ItemType for the 'Jewel of Guardian' drop group to SpecialItemType.Jewel.
Activity
  • No human activity (comments, reviews, or progress updates) 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

The pull request successfully implements the removal of the drop level gap condition for jewels and similar items by introducing a new SpecialItemType.Jewel and updating the drop generation logic. It also includes the necessary data initialization updates across different game versions. The refactoring of AddItemToJewelItemDrop into a base class is a good improvement for code reusability. However, there are several instances of hardcoded values and magic numbers that could be improved for better maintainability and readability.

Comment on lines +444 to +447
if (monsterLevel > 66)
{
// Jewel of Chaos doesn't drop after a certain monster level
filteredPossibleItems.RemoveAll(it => it.Group == 12 && it.Number == 15);

Choose a reason for hiding this comment

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

medium

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.

/// <param name="item">The jewel you want to register.</param>
protected void AddItemToJewelItemDrop(ItemDefinition item)
{
var id = GuidHelper.CreateGuid<DropItemGroup>(4);

Choose a reason for hiding this comment

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

medium

The magic number 4 used in GuidHelper.CreateGuid<DropItemGroup>(4) to identify the jewel drop group should be replaced with a named constant for improved readability and maintainability.

public override bool IsMandatory => true;

/// <inheritdoc />
public override DateTime CreatedAt => new(2026, 3, 5, 16, 0, 0, DateTimeKind.Utc);

Choose a reason for hiding this comment

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

medium

The CreatedAt property is set to a future date (2026, 3, 5). This property should reflect the actual date when this plugin was created or introduced into the codebase, not a future date.

/// <inheritdoc />
protected override async ValueTask ApplyAsync(IContext context, GameConfiguration gameConfiguration)
{
var jewelsDropGroupId = new Guid("00000200-0004-0000-0000-000000000000");

Choose a reason for hiding this comment

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

medium

The GUID string "00000200-0004-0000-0000-000000000000" for jewelsDropGroupId is a magic string. It would be beneficial to define this as a named constant to enhance readability and reduce the risk of errors if the GUID needs to be referenced elsewhere.

Comment on lines +46 to +47
{ ItemGroups.Misc1, [0, 1, 2] }, // angel, imp, uniria
{ ItemGroups.Misc2, [9, 10] }, // alcohol, town portal scroll

Choose a reason for hiding this comment

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

medium

The item numbers 0, 1, 2 for ItemGroups.Misc1 and 9, 10 for ItemGroups.Misc2 are magic numbers. Consider defining these as named constants or enum members to make the code more self-documenting and easier to understand, especially for items like 'angel', 'imp', 'uniria', 'alcohol', and 'town portal scroll'.

{
await base.ApplyAsync(context, gameConfiguration).ConfigureAwait(false);

var jewelOfGuardianDropGroupId = new Guid("00000200-001f-0001-0000-000000000000");

Choose a reason for hiding this comment

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

medium

The GUID string "00000200-001f-0001-0000-000000000000" for jewelOfGuardianDropGroupId is a magic string. It should be defined as a named constant for better readability and maintainability.

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