add right click drop item support and refactor CNewUIMyInventory::HandleInventoryActions#311
add right click drop item support and refactor CNewUIMyInventory::HandleInventoryActions#311eduardosmaniotto wants to merge 5 commits intosven-n:mainfrom
Conversation
…dleInventoryActions
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 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
🧠 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 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 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 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
|
There was a problem hiding this comment.
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.
|
@gemini-code-assist review |
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
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).
| if (TryDropItem(targetControl, pItem)) | |
| if (IsRepeat(VK_SHIFT) && TryDropItem(targetControl, pItem)) |
There was a problem hiding this comment.
@gemini-code-assist TryDropItem already check if item is high valuable before dropping.
There was a problem hiding this comment.
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.
| if (TryDropItem(targetControl, pItem)) | |
| if (IsRepeat(VK_SHIFT) && TryDropItem(targetControl, pItem)) |
output2.mp4