Skip to content

add right click drop item support and refactor CNewUIMyInventory::HandleInventoryActions#311

Open
eduardosmaniotto wants to merge 5 commits intosven-n:mainfrom
eduardosmaniotto:feature/right-click-drop
Open

add right click drop item support and refactor CNewUIMyInventory::HandleInventoryActions#311
eduardosmaniotto wants to merge 5 commits intosven-n:mainfrom
eduardosmaniotto:feature/right-click-drop

Conversation

@eduardosmaniotto
Copy link
Copy Markdown
Contributor

output2.mp4

@gemini-code-assist
Copy link
Copy Markdown
Contributor

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 refactors the inventory management system by delegating action handling to a new controller class. This improves code maintainability and separation of concerns while enabling new functionality for right-click interactions within the inventory interface.

Highlights

  • Refactoring: Extracted inventory action handling logic from CNewUIMyInventory into a new dedicated class, CNewUIInventoryActionController.
  • New Feature: Implemented support for right-click actions in the inventory, including item usage, equipping, and dropping.

🧠 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.

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.

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
Copy Markdown
Contributor

@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 refactors inventory action logic by moving it from CNewUIMyInventory into a dedicated CNewUIInventoryActionController class, improving modularity. The review feedback identifies a critical namespace mismatch in the new implementation file and a logic error in the item dropping sequence that could lead to client-side item loss. Suggestions were also provided to remove a redundant null check and to improve const-correctness by avoiding const_cast.

@eduardosmaniotto
Copy link
Copy Markdown
Contributor Author

@gemini-code-assist review

Copy link
Copy Markdown
Contributor

@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 refactors the inventory action logic by introducing a new CNewUIInventoryActionController class and an IInventoryActionContext interface. This change successfully decouples UI event handling from the core inventory logic previously embedded within CNewUIMyInventory. The review feedback highlights several critical areas for improvement: implementing a safety modifier (like Shift) for right-click dropping to prevent accidental item loss, ensuring proper event consumption by returning true in action handlers to prevent click propagation, and correcting the semantic use of wchar_t for numeric stat arrays.

}
}

if (TryDropItem(targetControl, pItem))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The current implementation of right-click drop is extremely dangerous. Any item that cannot be equipped or consumed will be automatically dropped on the ground when right-clicked. This will inevitably lead to accidental loss of valuable items. It is highly recommended to guard this action with a modifier key (e.g., Shift + Right Click).

Suggested change
if (TryDropItem(targetControl, pItem))
if (IsRepeat(VK_SHIFT) && TryDropItem(targetControl, pItem))

Copy link
Copy Markdown
Contributor Author

@eduardosmaniotto eduardosmaniotto Apr 8, 2026

Choose a reason for hiding this comment

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

@gemini-code-assist TryDropItem already check if item is high valuable before dropping.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You are correct that TryDropItem includes a check for IsHighValueItem(pItem) and IsDropBan(pItem), which prevents certain items from being dropped. However, the purpose of suggesting Shift + Right Click is to provide a general safeguard against any accidental item drop, regardless of whether the item is classified as "high value" by the system. A user might still accidentally right-click a non-high-value item that they consider important, leading to an unintended loss. Adding a modifier key like Shift is a common and effective UI/UX pattern to confirm destructive actions, enhancing overall user safety and preventing frustration from accidental item loss.

Suggested change
if (TryDropItem(targetControl, pItem))
if (IsRepeat(VK_SHIFT) && TryDropItem(targetControl, pItem))

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.

1 participant