8000 Improvement: Added Categorization of SPAs to Right-Click Personnel Menu by IllianiBird · Pull Request #6822 · MegaMek/mekhq · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Improvement: Added Categorization of SPAs to Right-Click Personnel Menu #6822

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 2, 2025

Conversation

IllianiBird
Copy link
Collaborator
@IllianiBird IllianiBird commented Apr 29, 2025

Requires #6820

image

Dev Notes

We had some feedback that, with the increased number of SPAs, it was difficult to quickly jump to a desired SPA via the right-click personnel menu.

This PR addresses that issue by using the same dynamic categorization used by Campaign Options.

### Dev Notes
We had some feedback that, with the increased number of SPAs, it was difficult to quickly jump to a desired SPA via the right-click personnel menu.

This PR addresses that issue by use the same dynamic categorization used by Campaign Options.
@IllianiBird IllianiBird added GUI UX User experience labels Apr 29, 2025
@IllianiBird IllianiBird self-assigned this Apr 29, 2025
Copy link
codecov bot commented Apr 29, 2025

Codecov Report

Attention: Patch coverage is 0% with 97 lines in your changes missing coverage. Please review.

Project coverage is 11.45%. Comparing base (5edad64) to head (629229c).
Report is 67 commits behind head on master.

Files with missing lines Patch % Lines
.../mekhq/gui/adapter/PersonnelTableMouseAdapter.java 0.00% 68 Missing ⚠️
...src/mekhq/utilities/spaUtilities/SpaUtilities.java 0.00% 28 Missing ⚠️
...khq/gui/campaignOptions/contents/AbilitiesTab.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #6822      +/-   ##
============================================
- Coverage     11.46%   11.45%   -0.02%     
+ Complexity     6508     6506       -2     
============================================
  Files          1098     1100       +2     
  Lines        140812   140936     +124     
  Branches      21831    21842      +11     
============================================
- Hits          16150    16142       -8     
- Misses       122995   123127     +132     
  Partials       1667     1667              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@IllianiBird
Copy link
Collaborator Author

This would be nice to have in 50.06, but not essential.

@IllianiBird IllianiBird changed the title Added Categorization of SPAs to Right-Click Personnel Menu PR: Added Categorization of SPAs to Right-Click Personnel Menu Apr 30, 2025
@Scoppio
Copy link
Collaborator
Scoppio commented May 1, 2025

I would prefer to skip the extra special abilities context menu and move combat abilities and the others the the previous menu, its not too large that it is hard to work with, and 3 more entries wont destroy it.

@IllianiBird
Copy link
Collaborator Author

I never thought about that, and it makes a lot of sense

Copy link
Collaborator
@Scoppio Scoppio left a comment

Choose a reason for hiding this comment

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

It is approved, but would like to see the change mentioned going in.

@IllianiBird
Copy link
Collaborator Author
  • Updated to incorporate Luana's feedback

@IllianiBird IllianiBird changed the title PR: Added Categorization of SPAs to Right-Click Personnel Menu Improvement: Added Categorization of SPAs to Right-Click Personnel Menu May 1, 2025
@HammerGS HammerGS requested a review from Copilot May 2, 2025 03:29
Copy link
Contributor
@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR improves the right-click personnel menu by categorizing Special Pilot Abilities (SPAs) to ease the selection process. Key changes include the introduction of a dedicated utility (SpaUtilities.java) for SPA categorization, refactoring of ability categorization in the AbilitiesTab, and the splitting of ability menu items into separate submenus in PersonnelTableMouseAdapter.

Reviewed Changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.

File Description
MekHQ/src/mekhq/utilities/spaUtilities/SpaUtilities.java Added a new utility to determine SPA categories based on ability cost and prerequisites.
MekHQ/src/mekhq/gui/campaignOptions/contents/AbilitiesTab.java Refactored to use the new SPA categorization utility, removing redundant code.
MekHQ/src/mekhq/gui/adapter/PersonnelTableMouseAdapter.java Updated to separate SPA menu items into categorized submenus using the new categorization utility.
Files not reviewed (1)
  • MekHQ/resources/mekhq/resources/GUI.properties: Language not supported
Comments suppressed due to low confidence (1)

MekHQ/src/mekhq/gui/adapter/PersonnelTableMouseAdapter.java:2508

  • Ensure that all new resource keys (e.g., 'combatAbilityMenu.text', 'maneuveringAbilityMenu.text', 'utilityAbilityMenu.text', and 'characterFlawMenu.text') are defined in the resource bundle to prevent missing labels at runtime.
JMenu combatAbilityMenu = new JMenu(resources.getString("combatAbilityMenu.text"));

Comment on lines 115 to 119
for (SkillPerquisite skillPerquisite : ability.getPrereqSkills()) {
String skillPerquisiteString = skillPerquisite.toString();
// Step 1: Remove extra information
skillPerquisiteString = skillPerquisiteString.replaceAll("\\{", "").replaceAll("}", "");
skillPerquisiteString = skillPerquisiteString.replaceAll("OR ", "");
Copy link
Preview
Copilot AI May 2, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider precompiling the regex patterns or minimizing repeated replaceAll calls inside the loop to improve maintainability and performance.

Suggested change
for (SkillPerquisite skillPerquisite : ability.getPrereqSkills()) {
String skillPerquisiteString = skillPerquisite.toString();
// Step 1: Remove extra information
skillPerquisiteString = skillPerquisiteString.replaceAll("\\{", "").replaceAll("}", "");
skillPerquisiteString = skillPerquisiteString.replaceAll("OR ", "");
// Precompile regex patterns
final Pattern curlyBracesPattern = Pattern.compile("[{}]");
final Pattern orPattern = Pattern.compile("OR ");
for (SkillPerquisite skillPerquisite : ability.getPrereqSkills()) {
String skillPerquisiteString = skillPerquisite.toString();
// Step 1: Remove extra information
skillPerquisiteString = curlyBracesPattern.matcher(skillPerquisiteString).replaceAll("");
skillPerquisiteString = orPattern.matcher(skillPerquisiteString).replaceAll("");

Copilot uses AI. Check for mistakes.

@Scoppio Scoppio merged commit 6416eb7 into MegaMek:master May 2, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
4C23
Labels
GUI UX User experience
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0