-
Notifications
You must be signed in to change notification settings - Fork 188
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
Conversation
### 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.
Codecov ReportAttention: Patch coverage is
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. 🚀 New features to boost your workflow:
|
This would be nice to have in 50.06, but not essential. |
I would prefer to skip the extra |
I never thought about that, and it makes a lot of sense |
There was a problem hiding this 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.
|
There was a problem hiding this 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"));
for (SkillPerquisite skillPerquisite : ability.getPrereqSkills()) { | ||
String skillPerquisiteString = skillPerquisite.toString(); | ||
// Step 1: Remove extra information | ||
skillPerquisiteString = skillPerquisiteString.replaceAll("\\{", "").replaceAll("}", ""); | ||
skillPerquisiteString = skillPerquisiteString.replaceAll("OR ", ""); |
There was a problem hiding this comment.
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.
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.
Requires #6820
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.