diff --git a/MekHQ/src/mekhq/campaign/Campaign.java b/MekHQ/src/mekhq/campaign/Campaign.java index 94271aca9e..085fc70f0b 100644 --- a/MekHQ/src/mekhq/campaign/Campaign.java +++ b/MekHQ/src/mekhq/campaign/Campaign.java @@ -21,23 +21,6 @@ */ package mekhq.campaign; -import static mekhq.campaign.personnel.backgrounds.BackgroundsController.randomMercenaryCompanyNameGenerator; -import static mekhq.campaign.personnel.education.EducationController.getAcademy; -import static mekhq.campaign.personnel.turnoverAndRetention.RetirementDefectionTracker.Payout.isBreakingContract; -import static mekhq.campaign.unit.Unit.SITE_FACILITY_MAINTENANCE; - -import java.io.PrintWriter; -import java.text.MessageFormat; -import java.time.DayOfWeek; -import java.time.LocalDate; -import java.time.Month; -import java.time.temporal.ChronoUnit; -import java.util.*; -import java.util.Map.Entry; -import java.util.stream.Collectors; - -import javax.swing.JOptionPane; - import megamek.client.generator.RandomGenderGenerator; import megamek.client.generator.RandomNameGenerator; import megamek.client.generator.RandomUnitGenerator; @@ -54,11 +37,7 @@ import megamek.common.loaders.BLKFile; import megamek.common.loaders.EntityLoadingException; import megamek.common.loaders.EntitySavingException; -import megamek.common.options.GameOptions; -import megamek.common.options.IBasicOption; -import megamek.common.options.IOption; -import megamek.common.options.IOptionGroup; -import megamek.common.options.OptionsConstants; +import megamek.common.options.*; import megamek.common.util.BuildingBlock; import megamek.common.weapons.autocannons.ACWeapon; import megamek.common.weapons.flamers.FlamerWeapon; @@ -71,11 +50,7 @@ import mekhq.campaign.Quartermaster.PartAcquisitionResult; import mekhq.campaign.againstTheBot.AtBConfiguration; import mekhq.campaign.event.*; -import mekhq.campaign.finances.Accountant; -import mekhq.campaign.finances.CurrencyManager; -import mekhq.campaign.finances.Finances; -import mekhq.campaign.finances.Loan; -import mekhq.campaign.finances.Money; +import mekhq.campaign.finances.*; import mekhq.campaign.finances.enums.TransactionType; import mekhq.campaign.force.Force; import mekhq.campaign.force.Lance; @@ -90,12 +65,7 @@ import mekhq.campaign.market.ShoppingList; import mekhq.campaign.market.unitMarket.AbstractUnitMarket; import mekhq.campaign.market.unitMarket.DisabledUnitMarket; -import mekhq.campaign.mission.AtBContract; -import mekhq.campaign.mission.AtBDynamicScenario; -import mekhq.campaign.mission.AtBScenario; -import mekhq.campaign.mission.Contract; -import mekhq.campaign.mission.Mission; -import mekhq.campaign.mission.Scenario; +import mekhq.campaign.mission.*; import mekhq.campaign.mission.atb.AtBScenarioFactory; import mekhq.campaign.mission.enums.AtBLanceRole; import mekhq.campaign.mission.enums.MissionStatus; @@ -105,12 +75,7 @@ import mekhq.campaign.parts.equipment.AmmoBin; import mekhq.campaign.parts.equipment.EquipmentPart; import mekhq.campaign.parts.equipment.MissingEquipmentPart; -import mekhq.campaign.personnel.Bloodname; -import mekhq.campaign.personnel.Person; -import mekhq.campaign.personnel.PersonnelOptions; -import mekhq.campaign.personnel.Skill; -import mekhq.campaign.personnel.SkillType; -import mekhq.campaign.personnel.SpecialAbility; +import mekhq.campaign.personnel.*; import mekhq.campaign.personnel.autoAwards.AutoAwardsController; import mekhq.campaign.personnel.death.AbstractDeath; import mekhq.campaign.personnel.death.DisabledRandomDeath; @@ -129,21 +94,16 @@ import mekhq.campaign.personnel.ranks.Ranks; import mekhq.campaign.personnel.turnoverAndRetention.Fatigue; import mekhq.campaign.personnel.turnoverAndRetention.RetirementDefectionTracker; +import mekhq.campaign.rating.CamOpsReputation.ReputationController; import mekhq.campaign.rating.FieldManualMercRevDragoonsRating; import mekhq.campaign.rating.IUnitRating; import mekhq.campaign.rating.UnitRatingMethod; -import mekhq.campaign.rating.CamOpsReputation.ReputationController; import mekhq.campaign.storyarc.StoryArc; import mekhq.campaign.stratcon.StratconContractInitializer; import mekhq.campaign.stratcon.StratconRulesManager; import mekhq.campaign.stratcon.StratconTrackState; -import mekhq.campaign.unit.CargoStatistics; import mekhq.campaign.unit.CrewType; -import mekhq.campaign.unit.HangarStatistics; -import mekhq.campaign.unit.TestUnit; -import mekhq.campaign.unit.Unit; -import mekhq.campaign.unit.UnitOrder; -import mekhq.campaign.unit.UnitTechProgression; +import mekhq.campaign.unit.*; import mekhq.campaign.universe.*; import mekhq.campaign.universe.Planet.PlanetaryEvent; import mekhq.campaign.universe.PlanetarySystem.PlanetarySystemEvent; @@ -190,8 +150,6 @@ public class Campaign implements ITechManager { public static final String REPORT_LINEBREAK = "

"; - private static final MMLogger logger = MMLogger.create(Person.class); - private UUID id; // we have three things to track: (1) teams, (2) units, (3) repair tasks @@ -4254,7 +4212,7 @@ private void processRandomDependents() { int lowerRoll = (dependents.size() > dependentCapacity) ? getLowerRandomInt() : Compute.randomInt(100); - if (lowerRoll <= 4 - getUnitRatingMod()) { + if (lowerRoll <= 4 - getAtBUnitRatingMod()) { addReport(String.format(resources.getString("dependentLeavesForce.text"), dependent.getFullTitle())); @@ -4272,7 +4230,7 @@ private void processRandomDependents() { for (int i = 0; i < rollCount; i++) { int lowerRoll = (dependentCount <= (dependentCapacity / 2)) ? getLowerRandomInt() : Compute.randomInt(100); - if (lowerRoll <= (getUnitRatingMod() * 2)) { + if (lowerRoll <= (getAtBUnitRatingMod() * 2)) { final Person dependent = newDependent(false, Gender.RANDOMIZE); recruitPerson(dependent, PrisonerStatus.FREE, true, false); diff --git a/MekHQ/src/mekhq/campaign/CampaignOptions.java b/MekHQ/src/mekhq/campaign/CampaignOptions.java index 3a13f94937..ed8d130226 100644 --- a/MekHQ/src/mekhq/campaign/CampaignOptions.java +++ b/MekHQ/src/mekhq/campaign/CampaignOptions.java @@ -19,23 +19,13 @@ */ package mekhq.campaign; -import java.io.PrintWriter; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - import megamek.Version; import megamek.codeUtilities.MathUtility; import megamek.common.EquipmentType; import megamek.common.TechConstants; import megamek.common.enums.SkillLevel; import megamek.logging.MMLogger; +import mekhq.MekHQ; import mekhq.Utilities; import mekhq.campaign.enums.PlanetaryAcquisitionFactionLimit; import mekhq.campaign.finances.Money; @@ -45,10 +35,17 @@ import mekhq.campaign.market.enums.UnitMarketMethod; import mekhq.campaign.mission.enums.AtBLanceRole; import mekhq.campaign.parts.enums.PartRepairType; +import mekhq.campaign.personnel.Skills; import mekhq.campaign.personnel.enums.*; import mekhq.campaign.rating.UnitRatingMethod; import mekhq.service.mrms.MRMSOption; import mekhq.utilities.MHQXMLUtility; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +import java.io.PrintWriter; +import java.util.*; +import java.util.Map.Entry; /** * @author natit @@ -6165,7 +6162,7 @@ public static CampaignOptions generateCampaignOptionsFromXml(Node wn, Version ve } else if (wn2.getNodeName().equalsIgnoreCase("scenarioModBV")) { retVal.setScenarioModBV(Integer.parseInt(wn2.getTextContent().trim())); } else if (wn2.getNodeName().equalsIgnoreCase("autoconfigMunitions")) { - retVal.setAutoconfigMunitions(Boolean.parseBoolean(wn2.getTextContent().trim())); + retVal.setAutoConfigMunitions(Boolean.parseBoolean(wn2.getTextContent().trim())); //region Legacy // Removed in 0.49.* @@ -6217,7 +6214,7 @@ public static CampaignOptions generateCampaignOptionsFromXml(Node wn, Version ve } else if (values.length == 9) { retVal.migrateMarriageSurnameWeights47(values); } else { - LogManager.getLogger().error("Unknown length of randomMarriageSurnameWeights"); + logger.error("Unknown length of randomMarriageSurnameWeights"); } } else if (wn2.getNodeName().equalsIgnoreCase("logConception")) { // Legacy - 0.49.4 Removal retVal.setLogProcreation(Boolean.parseBoolean(wn2.getTextContent().trim())); @@ -6277,7 +6274,7 @@ public static CampaignOptions generateCampaignOptionsFromXml(Node wn, Version ve retVal.setUnitRatingMethod(UnitRatingMethod.NONE); } } else if (wn2.getNodeName().equalsIgnoreCase("probPhenoMW")) { // Legacy - retVal.phenotypeProbabilities[Phenotype.MECHWARRIOR.ordinal()] = Integer.parseInt(wn2.getTextContent().trim()); + retVal.phenotypeProbabilities[Phenotype.MEKWARRIOR.ordinal()] = Integer.parseInt(wn2.getTextContent().trim()); } else if (wn2.getNodeName().equalsIgnoreCase("probPhenoBA")) { // Legacy retVal.phenotypeProbabilities[Phenotype.ELEMENTAL.ordinal()] = Integer.parseInt(wn2.getTextContent().trim()); } else if (wn2.getNodeName().equalsIgnoreCase("probPhenoAero")) { // Legacy diff --git a/MekHQ/src/mekhq/campaign/io/CampaignXmlParser.java b/MekHQ/src/mekhq/campaign/io/CampaignXmlParser.java index 710242eaa6..3251695314 100644 --- a/MekHQ/src/mekhq/campaign/io/CampaignXmlParser.java +++ b/MekHQ/src/mekhq/campaign/io/CampaignXmlParser.java @@ -18,44 +18,12 @@ */ package mekhq.campaign.io; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.io.PrintStream; -import java.time.LocalDate; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.UUID; - -import javax.xml.parsers.DocumentBuilder; - -import org.apache.commons.lang3.StringUtils; -import org.w3c.dom.DOMException; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - import megamek.Version; import megamek.client.generator.RandomGenderGenerator; import megamek.client.generator.RandomNameGenerator; import megamek.client.ui.swing.util.PlayerColour; import megamek.common.Entity; -import megamek.common.EntityMovementMode; -import megamek.common.Jumpship; -import megamek.common.Mek; -import megamek.common.MekSummaryCache; -import megamek.common.MiscType; -import megamek.common.Mounted; -import megamek.common.SmallCraft; -import megamek.common.Tank; +import megamek.common.*; import megamek.common.annotations.Nullable; import megamek.common.icons.Camouflage; import megamek.common.weapons.bayweapons.BayWeapon; @@ -63,12 +31,7 @@ import mekhq.MekHQ; import mekhq.NullEntityException; import mekhq.Utilities; -import mekhq.campaign.Campaign; -import mekhq.campaign.CampaignOptions; -import mekhq.campaign.CurrentLocation; -import mekhq.campaign.Kill; -import mekhq.campaign.RandomSkillPreferences; -import mekhq.campaign.Warehouse; +import mekhq.campaign.*; import mekhq.campaign.againstTheBot.AtBConfiguration; import mekhq.campaign.finances.Finances; import mekhq.campaign.force.Force; @@ -81,20 +44,8 @@ import mekhq.campaign.mission.Mission; import mekhq.campaign.mission.Scenario; import mekhq.campaign.mod.am.InjuryTypes; -import mekhq.campaign.parts.EnginePart; -import mekhq.campaign.parts.MekActuator; -import mekhq.campaign.parts.MekLocation; -import mekhq.campaign.parts.MissingEnginePart; -import mekhq.campaign.parts.MissingMekActuator; -import mekhq.campaign.parts.MissingPart; -import mekhq.campaign.parts.Part; -import mekhq.campaign.parts.equipment.AmmoBin; -import mekhq.campaign.parts.equipment.EquipmentPart; -import mekhq.campaign.parts.equipment.HeatSink; -import mekhq.campaign.parts.equipment.MASC; -import mekhq.campaign.parts.equipment.MissingAmmoBin; -import mekhq.campaign.parts.equipment.MissingEquipmentPart; -import mekhq.campaign.parts.equipment.MissingMASC; +import mekhq.campaign.parts.*; +import mekhq.campaign.parts.equipment.*; import mekhq.campaign.personnel.Person; import mekhq.campaign.personnel.PersonnelOptions; import mekhq.campaign.personnel.SkillType; @@ -301,7 +252,7 @@ public Campaign parse() throws CampaignXmlParseException, NullEntityException { } else if (xn.equalsIgnoreCase("location")) { retVal.setLocation(CurrentLocation.generateInstanceFromXML(wn, retVal)); } else if (xn.equalsIgnoreCase("skillTypes")) { - processSkillTypeNodes(wn); + processSkillTypeNodes(retVal, wn, version); } else if (xn.equalsIgnoreCase("specialAbilities")) { processSpecialAbilityNodes(retVal, wn, version); } else if (xn.equalsIgnoreCase("storyArc")) { diff --git a/MekHQ/src/mekhq/campaign/mission/BotForceRandomizer.java b/MekHQ/src/mekhq/campaign/mission/BotForceRandomizer.java index 05426c9d68..8a922275ba 100644 --- a/MekHQ/src/mekhq/campaign/mission/BotForceRandomizer.java +++ b/MekHQ/src/mekhq/campaign/mission/BotForceRandomizer.java @@ -18,17 +18,6 @@ */ package mekhq.campaign.mission; -import java.io.PrintWriter; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import org.apache.commons.math3.distribution.GammaDistribution; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - import megamek.Version; import megamek.client.generator.RandomGenderGenerator; import megamek.client.generator.RandomNameGenerator; @@ -36,16 +25,11 @@ import megamek.client.generator.skillGenerators.AbstractSkillGenerator; import megamek.client.generator.skillGenerators.TaharqaSkillGenerator; import megamek.codeUtilities.StringUtility; -import megamek.common.Compute; -import megamek.common.Crew; -import megamek.common.Entity; -import megamek.common.EntityWeightClass; -import megamek.common.MekFileParser; -import megamek.common.MekSummary; -import megamek.common.UnitType; +import megamek.common.*; import megamek.common.annotations.Nullable; import megamek.common.enums.Gender; import megamek.common.enums.SkillLevel; +import megamek.logging.MMLogger; import mekhq.campaign.Campaign; import mekhq.campaign.personnel.Bloodname; import mekhq.campaign.personnel.enums.Phenotype; @@ -57,7 +41,6 @@ import mekhq.campaign.universe.UnitGeneratorParameters; import mekhq.utilities.MHQXMLUtility; import org.apache.commons.math3.distribution.GammaDistribution; -import org.apache.logging.log4j.LogManager; import org.w3c.dom.Node; import org.w3c.dom.NodeList; @@ -501,7 +484,7 @@ public Entity getEntity(int uType, int weightClass, Campaign campaign) { String[] crewNameArray = rng.generateGivenNameSurnameSplit(gender, faction.isClan(), faction.getShortName()); String crewName = crewNameArray[0]; - crewName += !StringUtility.isNullOrBlank(crewNameArray[1]) ? " " + crewNameArray[1] : ""; + crewName += !StringUtility.isNullOrBlank(crewNameArray[1]) ? ' ' + crewNameArray[1] : ""; Map> extraData = new HashMap<>(); Map innerMap = new HashMap<>(); @@ -552,7 +535,7 @@ public Entity getEntity(int uType, int weightClass, Campaign campaign) { if (!phenotype.isNone()) { String bloodname = Bloodname.randomBloodname(faction.getShortName(), phenotype, campaign.getGameYear()).getName(); - crewName += " " + bloodname; + crewName += ' ' + bloodname; innerMap.put(Crew.MAP_BLOODNAME, bloodname); innerMap.put(Crew.MAP_PHENOTYPE, phenotype.name()); } @@ -714,7 +697,7 @@ private double calculateMeanWeightClass(List playerUnits) { } public String getShortDescription() { - String sb = forceMultiplier + " (" + balancingMethod.toString() + ")"; + String sb = forceMultiplier + " (" + balancingMethod.toString() + ')'; return sb; } @@ -728,9 +711,9 @@ public String getShortDescription() { public String getDescription(Campaign campaign) { StringBuilder sb = new StringBuilder(); sb.append(Factions.getInstance().getFaction(factionCode).getFullName(campaign.getGameYear())); - sb.append(" "); + sb.append(' '); sb.append(skill.toString()); - sb.append(" "); + sb.append(' '); String typeDesc = UnitType.getTypeDisplayableName(unitType); if (percentConventional > 0) { typeDesc = typeDesc + " and Conventional"; @@ -740,7 +723,7 @@ public String getDescription(Campaign campaign) { sb.append(forceMultiplier); sb.append(" multiplier ("); sb.append(balancingMethod.toString()); - sb.append(")"); + sb.append(')'); return sb.toString(); } diff --git a/MekHQ/src/mekhq/campaign/personnel/enums/PersonnelStatus.java b/MekHQ/src/mekhq/campaign/personnel/enums/PersonnelStatus.java index 45dabd1b3e..005baf2f40 100644 --- a/MekHQ/src/mekhq/campaign/personnel/enums/PersonnelStatus.java +++ b/MekHQ/src/mekhq/campaign/personnel/enums/PersonnelStatus.java @@ -18,69 +18,69 @@ */ package mekhq.campaign.personnel.enums; +import megamek.logging.MMLogger; +import mekhq.MekHQ; + import java.util.List; import java.util.ResourceBundle; import java.util.stream.Collectors; import java.util.stream.Stream; -import megamek.logging.MMLogger; -import mekhq.MekHQ; - /** * TODO : Add PoW, On Leave and AWOL implementations */ public enum PersonnelStatus { // region Enum Declarations - ACTIVE("PersonnelStatus.ACTIVE.text", "PersonnelStatus.ACTIVE.toolTipText", "PersonnelStatus.ACTIVE.reportText", - "PersonnelStatus.ACTIVE.logText"), - MIA("PersonnelStatus.MIA.text", "PersonnelStatus.MIA.toolTipText", "PersonnelStatus.MIA.reportText", - "PersonnelStatus.MIA.logText"), - POW("PersonnelStatus.POW.text", "PersonnelStatus.POW.toolTipText", "PersonnelStatus.POW.reportText", - "PersonnelStatus.POW.logText"), + ACTIVE("PersonnelStatus.ACTIVE.text", "PersonnelStatus.ACTIVE.toolTipText", + "PersonnelStatus.ACTIVE.reportText", "PersonnelStatus.ACTIVE.logText"), + MIA("PersonnelStatus.MIA.text", "PersonnelStatus.MIA.toolTipText", + "PersonnelStatus.MIA.reportText", "PersonnelStatus.MIA.logText"), + POW("PersonnelStatus.POW.text", "PersonnelStatus.POW.toolTipText", + "PersonnelStatus.POW.reportText", "PersonnelStatus.POW.logText"), ON_LEAVE("PersonnelStatus.ON_LEAVE.text", "PersonnelStatus.ON_LEAVE.toolTipText", "PersonnelStatus.ON_LEAVE.reportText", "PersonnelStatus.ON_LEAVE.logText"), - AWOL("PersonnelStatus.AWOL.text", "PersonnelStatus.AWOL.toolTipText", "PersonnelStatus.AWOL.reportText", - "PersonnelStatus.AWOL.logText"), - RETIRED("PersonnelStatus.RETIRED.text", "PersonnelStatus.RETIRED.toolTipText", "PersonnelStatus.RETIRED.reportText", - "PersonnelStatus.RETIRED.logText"), + ON_MATERNITY_LEAVE("PersonnelStatus.ON_MATERNITY_LEAVE.text", "PersonnelStatus.ON_MATERNITY_LEAVE.toolTipText", + "PersonnelStatus.ON_MATERNITY_LEAVE.reportText", "PersonnelStatus.ON_MATERNITY_LEAVE.logText"), + AWOL("PersonnelStatus.AWOL.text", "PersonnelStatus.AWOL.toolTipText", + "PersonnelStatus.AWOL.reportText", "PersonnelStatus.AWOL.logText"), + RETIRED("PersonnelStatus.RETIRED.text", "PersonnelStatus.RETIRED.toolTipText", + "PersonnelStatus.RETIRED.reportText", "PersonnelStatus.RETIRED.logText"), RESIGNED("PersonnelStatus.RESIGNED.text", "PersonnelStatus.RESIGNED.toolTipText", "PersonnelStatus.RESIGNED.reportText", "PersonnelStatus.RESIGNED.logText"), - SACKED("PersonnelStatus.SACKED.text", "PersonnelStatus.SACKED.toolTipText", "PersonnelStatus.SACKED.reportText", - "PersonnelStatus.SACKED.logText"), - LEFT("PersonnelStatus.LEFT.text", "PersonnelStatus.LEFT.toolTipText", "PersonnelStatus.LEFT.reportText", - "PersonnelStatus.LEFT.logText"), + SACKED("PersonnelStatus.SACKED.text", "PersonnelStatus.SACKED.toolTipText", + "PersonnelStatus.SACKED.reportText", "PersonnelStatus.SACKED.logText"), + LEFT("PersonnelStatus.LEFT.text", "PersonnelStatus.LEFT.toolTipText", + "PersonnelStatus.LEFT.reportText", "PersonnelStatus.LEFT.logText"), DESERTED("PersonnelStatus.DESERTED.text", "PersonnelStatus.DESERTED.toolTipText", "PersonnelStatus.DESERTED.reportText", "PersonnelStatus.DESERTED.logText"), DEFECTED("PersonnelStatus.DEFECTED.text", "PersonnelStatus.DEFECTED.toolTipText", "PersonnelStatus.DEFECTED.reportText", "PersonnelStatus.DEFECTED.logText"), - STUDENT("PersonnelStatus.STUDENT.text", "PersonnelStatus.STUDENT.toolTipText", "PersonnelStatus.STUDENT.reportText", - "PersonnelStatus.STUDENT.logText"), - MISSING("PersonnelStatus.MISSING.text", "PersonnelStatus.MISSING.toolTipText", "PersonnelStatus.MISSING.reportText", - "PersonnelStatus.MISSING.logText"), - KIA("PersonnelStatus.KIA.text", "PersonnelStatus.KIA.toolTipText", "PersonnelStatus.KIA.reportText", - "PersonnelStatus.KIA.logText"), + STUDENT("PersonnelStatus.STUDENT.text", "PersonnelStatus.STUDENT.toolTipText", + "PersonnelStatus.STUDENT.reportText", "PersonnelStatus.STUDENT.logText"), + MISSING("PersonnelStatus.MISSING.text", "PersonnelStatus.MISSING.toolTipText", + "PersonnelStatus.MISSING.reportText", "PersonnelStatus.MISSING.logText"), + KIA("PersonnelStatus.KIA.text", "PersonnelStatus.KIA.toolTipText", + "PersonnelStatus.KIA.reportText", "PersonnelStatus.KIA.logText"), HOMICIDE("PersonnelStatus.HOMICIDE.text", "PersonnelStatus.HOMICIDE.toolTipText", "PersonnelStatus.HOMICIDE.reportText", "PersonnelStatus.HOMICIDE.logText"), - WOUNDS("PersonnelStatus.WOUNDS.text", "PersonnelStatus.WOUNDS.toolTipText", "PersonnelStatus.WOUNDS.reportText", - "PersonnelStatus.WOUNDS.logText"), - DISEASE("PersonnelStatus.DISEASE.text", "PersonnelStatus.DISEASE.toolTipText", "PersonnelStatus.DISEASE.reportText", - "PersonnelStatus.DISEASE.logText"), + WOUNDS("PersonnelStatus.WOUNDS.text", "PersonnelStatus.WOUNDS.toolTipText", + "PersonnelStatus.WOUNDS.reportText", "PersonnelStatus.WOUNDS.logText"), + DISEASE("PersonnelStatus.DISEASE.text", "PersonnelStatus.DISEASE.toolTipText", + "PersonnelStatus.DISEASE.reportText", "PersonnelStatus.DISEASE.logText"), ACCIDENTAL("PersonnelStatus.ACCIDENTAL.text", "PersonnelStatus.ACCIDENTAL.toolTipText", "PersonnelStatus.ACCIDENTAL.reportText", "PersonnelStatus.ACCIDENTAL.logText"), NATURAL_CAUSES("PersonnelStatus.NATURAL_CAUSES.text", "PersonnelStatus.NATURAL_CAUSES.toolTipText", "PersonnelStatus.NATURAL_CAUSES.reportText", "PersonnelStatus.NATURAL_CAUSES.logText"), - OLD_AGE("PersonnelStatus.OLD_AGE.text", "PersonnelStatus.OLD_AGE.toolTipText", "PersonnelStatus.OLD_AGE.reportText", - "PersonnelStatus.OLD_AGE.logText"), - MEDICAL_COMPLICATIONS("PersonnelStatus.MEDICAL_COMPLICATIONS.text", - "PersonnelStatus.MEDICAL_COMPLICATIONS.toolTipText", "PersonnelStatus.MEDICAL_COMPLICATIONS.reportText", - "PersonnelStatus.MEDICAL_COMPLICATIONS.logText"), - PREGNANCY_COMPLICATIONS("PersonnelStatus.PREGNANCY_COMPLICATIONS.text", - "PersonnelStatus.PREGNANCY_COMPLICATIONS.toolTipText", "PersonnelStatus.PREGNANCY_COMPLICATIONS.reportText", - "PersonnelStatus.PREGNANCY_COMPLICATIONS.logText"), + OLD_AGE("PersonnelStatus.OLD_AGE.text", "PersonnelStatus.OLD_AGE.toolTipText", + "PersonnelStatus.OLD_AGE.reportText", "PersonnelStatus.OLD_AGE.logText"), + MEDICAL_COMPLICATIONS("PersonnelStatus.MEDICAL_COMPLICATIONS.text", "PersonnelStatus.MEDICAL_COMPLICATIONS.toolTipText", + "PersonnelStatus.MEDICAL_COMPLICATIONS.reportText", "PersonnelStatus.MEDICAL_COMPLICATIONS.logText"), + PREGNANCY_COMPLICATIONS("PersonnelStatus.PREGNANCY_COMPLICATIONS.text", "PersonnelStatus.PREGNANCY_COMPLICATIONS.toolTipText", + "PersonnelStatus.PREGNANCY_COMPLICATIONS.reportText", "PersonnelStatus.PREGNANCY_COMPLICATIONS.logText"), UNDETERMINED("PersonnelStatus.UNDETERMINED.text", "PersonnelStatus.UNDETERMINED.toolTipText", "PersonnelStatus.UNDETERMINED.reportText", "PersonnelStatus.UNDETERMINED.logText"), - SUICIDE("PersonnelStatus.SUICIDE.text", "PersonnelStatus.SUICIDE.toolTipText", "PersonnelStatus.SUICIDE.reportText", - "PersonnelStatus.SUICIDE.logText"); + SUICIDE("PersonnelStatus.SUICIDE.text", "PersonnelStatus.SUICIDE.toolTipText", + "PersonnelStatus.SUICIDE.reportText", "PersonnelStatus.SUICIDE.logText"); // endregion Enum Declarations // region Variable Declarations diff --git a/MekHQ/src/mekhq/campaign/universe/generators/companyGenerators/AbstractCompanyGenerator.java b/MekHQ/src/mekhq/campaign/universe/generators/companyGenerators/AbstractCompanyGenerator.java index 2737ba4037..2ea402711d 100644 --- a/MekHQ/src/mekhq/campaign/universe/generators/companyGenerators/AbstractCompanyGenerator.java +++ b/MekHQ/src/mekhq/campaign/universe/generators/companyGenerators/AbstractCompanyGenerator.java @@ -18,26 +18,8 @@ */ package mekhq.campaign.universe.generators.companyGenerators; -import java.time.LocalDate; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; -import java.util.Map.Entry; -import java.util.Objects; -import java.util.ResourceBundle; -import java.util.function.Predicate; -import java.util.stream.Collectors; -import java.util.stream.IntStream; -import java.util.stream.Stream; - import megamek.client.generator.RandomCallsignGenerator; -import megamek.common.AmmoType; -import megamek.common.Entity; -import megamek.common.EntityWeightClass; -import megamek.common.MekFileParser; -import megamek.common.MekSummary; -import megamek.common.UnitType; +import megamek.common.*; import megamek.common.annotations.Nullable; import megamek.common.options.OptionsConstants; import megamek.logging.MMLogger; @@ -63,6 +45,7 @@ import mekhq.campaign.personnel.Skill; import mekhq.campaign.personnel.SkillType; import mekhq.campaign.personnel.enums.PersonnelRole; +import mekhq.campaign.personnel.enums.education.EducationLevel; import mekhq.campaign.personnel.generator.AbstractPersonnelGenerator; import mekhq.campaign.personnel.ranks.Rank; import mekhq.campaign.unit.Unit; @@ -83,6 +66,14 @@ import mekhq.campaign.universe.selectors.planetSelectors.RangedPlanetSelector; import mekhq.campaign.work.WorkTime; +import java.time.LocalDate; +import java.util.*; +import java.util.Map.Entry; +import java.util.function.Predicate; +import java.util.stream.Collectors; +import java.util.stream.IntStream; +import java.util.stream.Stream; + /** * Startup: * Second Panel: Presets, Date, Starting Faction, Starting Planet, AtB diff --git a/MekHQ/src/mekhq/gui/adapter/PersonnelTableMouseAdapter.java b/MekHQ/src/mekhq/gui/adapter/PersonnelTableMouseAdapter.java index 1f8fc9858b..5b89015eb6 100644 --- a/MekHQ/src/mekhq/gui/adapter/PersonnelTableMouseAdapter.java +++ b/MekHQ/src/mekhq/gui/adapter/PersonnelTableMouseAdapter.java @@ -18,27 +18,6 @@ */ package mekhq.gui.adapter; -import static megamek.client.ui.WrapLayout.wordWrap; -import static mekhq.campaign.personnel.education.Academy.skillParser; -import static mekhq.campaign.personnel.education.EducationController.getAcademy; -import static mekhq.campaign.personnel.education.EducationController.makeEnrollmentCheck; - -import java.awt.Color; -import java.awt.event.ActionEvent; -import java.awt.event.MouseEvent; -import java.time.LocalDate; -import java.util.*; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import javax.swing.JCheckBoxMenuItem; -import javax.swing.JMenu; -import javax.swing.JMenuItem; -import javax.swing.JOptionPane; -import javax.swing.JPopupMenu; -import javax.swing.JSplitPane; -import javax.swing.JTable; - import megamek.client.generator.RandomCallsignGenerator; import megamek.client.generator.RandomNameGenerator; import megamek.client.ui.dialogs.PortraitChooserDialog; @@ -62,26 +41,12 @@ import mekhq.campaign.finances.enums.TransactionType; import mekhq.campaign.log.LogEntry; import mekhq.campaign.log.PersonalLogger; -import mekhq.campaign.personnel.Award; -import mekhq.campaign.personnel.AwardsFactory; -import mekhq.campaign.personnel.Injury; -import mekhq.campaign.personnel.Person; -import mekhq.campaign.personnel.PersonnelOptions; -import mekhq.campaign.personnel.SkillType; -import mekhq.campaign.personnel.SpecialAbility; +import mekhq.campaign.personnel.*; import mekhq.campaign.personnel.autoAwards.AutoAwardsController; import mekhq.campaign.personnel.education.Academy; import mekhq.campaign.personnel.education.AcademyFactory; import mekhq.campaign.personnel.education.EducationController; -import mekhq.campaign.personnel.enums.ManeiDominiClass; -import mekhq.campaign.personnel.enums.ManeiDominiRank; -import mekhq.campaign.personnel.enums.MergingSurnameStyle; -import mekhq.campaign.personnel.enums.PersonnelRole; -import mekhq.campaign.personnel.enums.PersonnelStatus; -import mekhq.campaign.personnel.enums.PrisonerStatus; -import mekhq.campaign.personnel.enums.Profession; -import mekhq.campaign.personnel.enums.ROMDesignation; -import mekhq.campaign.personnel.enums.SplittingSurnameStyle; +import mekhq.campaign.personnel.enums.*; import mekhq.campaign.personnel.enums.education.EducationLevel; import mekhq.campaign.personnel.enums.education.EducationStage; import mekhq.campaign.personnel.generator.SingleSpecialAbilityGenerator; @@ -104,6 +69,21 @@ import mekhq.gui.utilities.MultiLineTooltip; import mekhq.gui.utilities.StaticChecks; +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.MouseEvent; +import java.time.LocalDate; +import java.util.List; +import java.util.*; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import static megamek.client.ui.WrapLayout.wordWrap; +import static mekhq.campaign.personnel.education.Academy.skillParser; +import static mekhq.campaign.personnel.education.EducationController.getAcademy; +import static mekhq.campaign.personnel.education.EducationController.makeEnrollmentCheck; + public class PersonnelTableMouseAdapter extends JPopupMenuAdapter { private static final MMLogger logger = MMLogger.create(PersonnelTableMouseAdapter.class); diff --git a/MekHQ/src/mekhq/gui/enums/PersonnelFilter.java b/MekHQ/src/mekhq/gui/enums/PersonnelFilter.java index 526c04578d..28f5d3b35d 100644 --- a/MekHQ/src/mekhq/gui/enums/PersonnelFilter.java +++ b/MekHQ/src/mekhq/gui/enums/PersonnelFilter.java @@ -30,10 +30,6 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import mekhq.MekHQ; -import mekhq.campaign.personnel.Person; -import mekhq.campaign.personnel.enums.PersonnelRole; - public enum PersonnelFilter { // region Enum Declarations // region Standard Personnel Filters @@ -393,18 +389,20 @@ public boolean getFilteredInformation(final Person person, LocalDate currentDate case SUPPORT -> active && (MekHQ.getMHQOptions().getPersonnelFilterOnPrimaryRole() ? !person.getPrimaryRole().isCombat() : person.hasSupportRole(true)); - case MECHWARRIORS -> + case MEKWARRIORS -> active && (MekHQ.getMHQOptions().getPersonnelFilterOnPrimaryRole() ? - person.getPrimaryRole().isMechWarriorGrouping() : (person.getPrimaryRole().isMechWarriorGrouping() || person.getSecondaryRole().isMechWarriorGrouping())); - case MECHWARRIOR -> + person.getPrimaryRole().isMekWarriorGrouping() : + (person.getPrimaryRole().isMekWarriorGrouping() || person.getSecondaryRole().isMekWarriorGrouping())); + case MEKWARRIOR -> active && (MekHQ.getMHQOptions().getPersonnelFilterOnPrimaryRole() ? - person.getPrimaryRole().isMechWarrior() : person.hasRole(PersonnelRole.MECHWARRIOR)); + person.getPrimaryRole().isMekWarrior() : person.hasRole(PersonnelRole.MEKWARRIOR)); case LAM_PILOT -> active && (MekHQ.getMHQOptions().getPersonnelFilterOnPrimaryRole() ? person.getPrimaryRole().isLAMPilot() : person.hasRole(PersonnelRole.LAM_PILOT)); case VEHICLE_CREWMEMBER -> active && (MekHQ.getMHQOptions().getPersonnelFilterOnPrimaryRole() ? - person.getPrimaryRole().isVehicleCrewmember() : (person.getPrimaryRole().isVehicleCrewmember() || person.getSecondaryRole().isVehicleCrewmember())); + person.getPrimaryRole().isVehicleCrew() : + (person.getPrimaryRole().isVehicleCrew() || person.getSecondaryRole().isVehicleCrew())); case GROUND_VEHICLE_DRIVER -> active && (MekHQ.getMHQOptions().getPersonnelFilterOnPrimaryRole() ? person.getPrimaryRole().isGroundVehicleDriver() : person.hasRole(PersonnelRole.GROUND_VEHICLE_DRIVER)); @@ -426,9 +424,9 @@ public boolean getFilteredInformation(final Person person, LocalDate currentDate case CONVENTIONAL_AIRCRAFT_PILOT -> active && (MekHQ.getMHQOptions().getPersonnelFilterOnPrimaryRole() ? person.getPrimaryRole().isConventionalAircraftPilot() : person.hasRole(PersonnelRole.CONVENTIONAL_AIRCRAFT_PILOT)); - case PROTOMECH_PILOT -> + case PROTOMEK_PILOT -> active && (MekHQ.getMHQOptions().getPersonnelFilterOnPrimaryRole() ? - person.getPrimaryRole().isProtoMechPilot() : person.hasRole(PersonnelRole.PROTOMECH_PILOT)); + person.getPrimaryRole().isProtoMekPilot() : person.hasRole(PersonnelRole.PROTOMEK_PILOT)); case BATTLE_ARMOUR -> active && (MekHQ.getMHQOptions().getPersonnelFilterOnPrimaryRole() ? person.getPrimaryRole().isBattleArmour() : person.hasRole(PersonnelRole.BATTLE_ARMOUR)); @@ -437,7 +435,8 @@ public boolean getFilteredInformation(final Person person, LocalDate currentDate person.getPrimaryRole().isSoldier() : person.hasRole(PersonnelRole.SOLDIER)); case VESSEL_CREWMEMBER -> active && (MekHQ.getMHQOptions().getPersonnelFilterOnPrimaryRole() ? - person.getPrimaryRole().isVesselCrewmember() : (person.getPrimaryRole().isVesselCrewmember() || person.getSecondaryRole().isVesselCrewmember())); + person.getPrimaryRole().isVesselCrew() : + (person.getPrimaryRole().isVesselCrew() || person.getSecondaryRole().isVesselCrew())); case VESSEL_PILOT -> active && (MekHQ.getMHQOptions().getPersonnelFilterOnPrimaryRole() ? person.getPrimaryRole().isVesselPilot() : person.hasRole(PersonnelRole.VESSEL_PILOT)); @@ -453,15 +452,15 @@ public boolean getFilteredInformation(final Person person, LocalDate currentDate case TECH -> active && (MekHQ.getMHQOptions().getPersonnelFilterOnPrimaryRole() ? person.getPrimaryRole().isTech() : person.isTech()); - case MECH_TECH -> + case MEK_TECH -> active && (MekHQ.getMHQOptions().getPersonnelFilterOnPrimaryRole() ? - person.getPrimaryRole().isMechTech() : person.hasRole(PersonnelRole.MECH_TECH)); + person.getPrimaryRole().isMekTech() : person.hasRole(PersonnelRole.MEK_TECH)); case MECHANIC -> active && (MekHQ.getMHQOptions().getPersonnelFilterOnPrimaryRole() ? person.getPrimaryRole().isMechanic() : person.hasRole(PersonnelRole.MECHANIC)); case AERO_TECH -> active && (MekHQ.getMHQOptions().getPersonnelFilterOnPrimaryRole() ? - person.getPrimaryRole().isAeroTech() : person.hasRole(PersonnelRole.AERO_TECH)); + person.getPrimaryRole().isAeroTek() : person.hasRole(PersonnelRole.AERO_TEK)); case BA_TECH -> active && (MekHQ.getMHQOptions().getPersonnelFilterOnPrimaryRole() ? person.getPrimaryRole().isBATech() : person.hasRole(PersonnelRole.BA_TECH));