Skip to content
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

Deleted StratConSkillGenerator.java #6046

Merged
merged 2 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

29 changes: 26 additions & 3 deletions megamek/src/megamek/common/enums/SkillLevel.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
*/
package megamek.common.enums;

import megamek.MegaMek;
import megamek.logging.MMLogger;

import java.util.List;
import java.util.ResourceBundle;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import megamek.MegaMek;
import megamek.logging.MMLogger;

public enum SkillLevel {
// region Enum Declarations
NONE("SkillLevel.NONE.text", "SkillLevel.NONE.toolTipText"),
Expand Down Expand Up @@ -190,6 +190,29 @@ public static SkillLevel parseFromString(final String text) {

return REGULAR;
}

/**
* Parses an integer value to a {@link SkillLevel} enumeration.
*
* @param value the integer value to parse
* @return the {@link SkillLevel} enum corresponding to the given integer value
* @throws IllegalStateException if the integer value does not match any {@link SkillLevel} enum
* value
*/
public static SkillLevel parseFromInteger(final int value) {
return switch (value) {
case 0 -> NONE;
case 1 -> ULTRA_GREEN;
case 2 -> GREEN;
case 3 -> REGULAR;
case 4 -> VETERAN;
case 5 -> ELITE;
case 6 -> HEROIC;
case 7 -> LEGENDARY;
default -> throw new IllegalStateException(
"Unexpected value in megamek/common/enums/SkillLevel.java: " + value);
};
}
// endregion File I/O

@Override
Expand Down