bugfix: prevent quest item pickup by players without active quest#821
bugfix: prevent quest item pickup by players without active quest#821eduardosmaniotto wants to merge 9 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces ownership and quest-binding restrictions when picking up dropped items. It adds checks to ensure players cannot pick up items bound to other characters unless they have an active quest for them, and respects the owner-pickup priority period. A review comment suggests adding a defensive null check on RequiredItems within the quest check logic to prevent a potential NullReferenceException.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Why not keep it locked to the quest player until it disappears? Otherwise the item will end up blocked in another player's inventory (can't sell, store or trade). |
That's only for regular items. Quest items will not be able to be picked up after the 10s window. I updated the description to make it clearer; currently if you try to steal a regular item, there is no message to the player. This PR fixes that too. |
|
Thanks, I'll merge it, but I have one hint: The code now implicates that every dropped item which is bound to a character is a quest item, too 😄 |
I could create a IsQuestItem in ItemDefinition. It would be a simple check during runtime. What do you think? |
|
Makes sense, it simplifies the code 😄 |
Summary of ChangesHello, 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 addresses a bug where party members without an active quest could pick up and hoard quest items dropped by monsters. By introducing a specific quest item flag and updating the pickup validation logic, the system now enforces that only eligible characters can acquire these items, while maintaining existing owner-priority mechanics for other loot. Highlights
New Features🧠 You can now enable Memory (public preview) 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. Using Gemini Code AssistThe 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
Customization To customize the 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 Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. 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. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a new IsQuestItem flag to ItemDefinition to restrict quest item pickups to characters with matching active quests, rather than relying solely on character-bound checks. It updates the pickup logic, adds database migrations, introduces an update plugin to flag existing quest items, and adds a localized message for ineligible pickups. Feedback suggests simplifying the LINQ query in PlayerHasActiveQuestForItem using OfType<QuestDefinition>() to remove null-forgiving operators, and removing the unnecessary async keyword from the synchronous ApplyAsync method in the update plugin.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Fixes #761
Bug: Quest items can be picked up by party members without active quest
Problem: When a monster drops a quest item (e.g., promotion quest items like Scroll of Emperor), ALL party members are set as owners of the dropped item. The only guard —
IsBoundToCharacter— checks whether the picker is an owner, which passes for all party members. This means characters without the active quest can pick up and hoard quest items.Root cause:
AttackableNpcBase.cs:444assignskiller.Party?.PartyList.AsEnumerable()as owners, andDroppedItem.TryPickUpByAsync()only checks ownership, not quest eligibility.Changes
PickupItemAction.cs(+22 lines):PlayerHasActiveQuestForItemhelper — scansCharacter.QuestStatesfor any active quest whoseRequiredItemsmatch the item definition and levelIsBoundToCharacterand player has no active quest requiring it → shows "This item doesn't belong to you." and rejectsDroppedItem.cs(+11 lines):IsPlayerAnOwnerchanged fromprivatetopublicsoPickupItemActioncan query itIsOwnerPickupPriorityActiveproperty exposing the 10-second owner-priority windowPlayerMessage.resx/PlayerMessage.Designer.cs(+12 lines):ItemDoesNotBelongToYou= "This item doesn't belong to you."Behavior