Skip to content

Commit 41e83f6

Browse files
authored
Merge pull request #4008 from IllianiCBT/AutoMedals
Added the Automatic Tracking of Award Eligibility and Additional Award Enhancements
2 parents 8862fb6 + 843c8c4 commit 41e83f6

36 files changed

+4636
-694
lines changed

MekHQ/data/universe/awards/standard.xml

+599-622
Large diffs are not rendered by default.

MekHQ/docs/Awards Module.pdf

1.02 MB
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
AutoAwardsDialog.title=Award Ceremony
2+
3+
txtInstructions.title=Instructions
4+
txtInstructions.text=Deselect awards you do not want issued, then select 'Issue Awards' to issue the remaining awards. Selecting 'Skip' will skip the current award type. Selecting 'Skip All' will skip this and all remaining award types.
5+
6+
btnDeselectAll.text=Deselect All
7+
btnSelectAll.text=Select All
8+
9+
btnDone.text=Issue Awards
10+
btnSkip.text=Skip
11+
btnSkipAll.text=Skip All

MekHQ/resources/mekhq/resources/CampaignGUI.properties

+2-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ miCargoReport.text=Cargo Report...
8888
# View Menu
8989
menuView.text=View
9090
miShowHistoricalReportLog.text=Historical Daily Report Log
91-
miRetirementDefectionDialog.text=Employee Turnover Dialog...
91+
miRetirementDefectionDialog.text=Employee Turnover Dialog
92+
miAwardEligibilityDialog.text=Award Eligibility Dialog
9293

9394
# Manage Campaign Menu
9495
menuManageCampaign.text=Manage Campaign

MekHQ/resources/mekhq/resources/CampaignOptionsDialog.properties

+39
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,45 @@ exponentialRandomDeathPanel.title=Exponential Random Death
379379
lblExponentialRandomDeathAge.text=* age)
380380
ageRangeRandomDeathPanel.title=Age Range Random Death
381381
lblAgeRange.text=Age Range
382+
383+
384+
# Awards
385+
awardsPanel.title=Awards
386+
lblAwardBonusStyle.text=Award Bonuses
387+
lblAwardBonusStyle.toolTipText=Toggle XP and/or Edge bonuses from awards.
388+
chkEnableAutoAwards.text=Track Award Eligibility
389+
chkEnableAutoAwards.toolTipText=Enable the automatic tracking of award eligibility.
390+
chkIssuePosthumousAwards.text=Issue Posthumous Awards
391+
chkIssuePosthumousAwards.toolTipText=Enabling this setting will qualify personnel for awards even if they are dead (excludes formation-based kill awards).
392+
chkIssueBestAwardOnly.text=Only Issue Best Award
393+
chkIssueBestAwardOnly.toolTipText=Activating this setting will disqualify personnel from receiving an award if they qualify for a higher-tier award of the same type.
394+
chkIgnoreStandardSet.text=Ignore Standard Set
395+
chkIgnoreStandardSet.toolTipText=Ignore the default set of awards
396+
lblAwardTierSize.text=Award Tier Size
397+
lblAwardTierSize.toolTipText=How many times must an award be issued before using the image of the next tier
398+
autoAwardsPanel.title=Award Tracking
399+
chkEnableContractAwards.text=Contract
400+
chkEnableContractAwards.toolTipText=Awards issued for completing Contracts.
401+
chkEnableFactionHunterAwards.text=Faction Hunter
402+
chkEnableFactionHunterAwards.toolTipText=Awards issued for completing AtB Contracts against specific Factions.
403+
chkEnableInjuryAwards.text=Injury
404+
chkEnableInjuryAwards.toolTipText=Awards issued for suffering Hits during a Scenario.
405+
chkEnableIndividualKillAwards.text=Kill (Individual)
406+
chkEnableIndividualKillAwards.toolTipText=Awards issued for pilot kills in Scenarios or Missions.
407+
chkEnableFormationKillAwards.text=Kill (Formation)
408+
chkEnableFormationKillAwards.toolTipText=Awards issued for formation kills (Lance, Company, etc.) in Missions.
409+
chkEnableRankAwards.text=Rank
410+
chkEnableRankAwards.toolTipText=Awards issued for achieving specific Ranks.
411+
chkEnableScenarioAwards.text=Scenario
412+
chkEnableScenarioAwards.toolTipText=Awards issued for completing a certain number of Scenarios.
413+
chkEnableSkillAwards.text=Skill
414+
chkEnableSkillAwards.toolTipText=Awards issued for reaching certain levels in specific Skills.
415+
chkEnableTheatreOfWarAwards.text=Theatre of War
416+
chkEnableTheatreOfWarAwards.toolTipText=Awards issued for partaking in galactic conflicts.
417+
chkEnableTimeAwards.text=Time
418+
chkEnableTimeAwards.toolTipText=Awards for remaining in the unit for a certain duration.
419+
chkEnableMiscAwards.text=Misc
420+
chkEnableMiscAwards.toolTipText=Miscellaneous awards (see documentation).
382421
##end Personnel Tab
383422

384423
## Finances Tab

MekHQ/resources/mekhq/resources/Personnel.properties

+10
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,16 @@ AgeGroup.TODDLER.toolTipText=Personnel are Toddlers from their 1st birthday unti
5151
AgeGroup.BABY.text=Baby
5252
AgeGroup.BABY.toolTipText=Personnel are babies until their 1st birthday.
5353

54+
# Award Enum
55+
AwardBonuses.BOTH.text=XP/Edge
56+
AwardBonuses.BOTH.toolTipText=All Award bonuses are enabled
57+
AwardBonuses.XP.text=XP
58+
AwardBonuses.XP.toolTipText=Only XP Award bonuses are enabled
59+
AwardBonuses.EDGE.text=Edge
60+
AwardBonuses.EDGE.toolTipText=Only Edge Award bonuses are enabled
61+
AwardBonuses.NONE.text=None
62+
AwardBonuses.NONE.toolTipText=All Award bonuses are disabled
63+
5464
# BabySurnameStyle Enum
5565
BabySurnameStyle.FATHERS.text=Fathers
5666
BabySurnameStyle.FATHERS.toolTipText=The baby will use the father's surname, or the mother's surname if there is no father

MekHQ/src/mekhq/MHQConstants.java

+2
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ public final class MHQConstants extends SuiteConstants {
114114
public static final String PAID_RETIREMENT_FOREGROUND = "paidRetirementForeground";
115115
public static final String PAID_RETIREMENT_BACKGROUND = "paidRetirementBackground";
116116
public static final String STRATCON_HEX_COORD_FOREGROUND = "stratconHexCoordForeground";
117+
public static final String AUTO_AWARDS_FOREGROUND = "paidRetirementForeground";
118+
public static final String AUTO_AWARDS_BACKGROUND = "paidRetirementBackground";
117119
//endregion Colours
118120

119121
//region Fonts

MekHQ/src/mekhq/campaign/CampaignOptions.java

+233
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,25 @@ public static String getTransitUnitName(final int unit) {
318318
private double[] exponentialRandomDeathFemaleValues;
319319
private Map<TenYearAgeRange, Double> ageRangeRandomDeathMaleValues;
320320
private Map<TenYearAgeRange, Double> ageRangeRandomDeathFemaleValues;
321+
322+
// Awards
323+
private AwardBonus awardBonusStyle;
324+
private boolean enableAutoAwards;
325+
private boolean issuePosthumousAwards;
326+
private boolean issueBestAwardOnly;
327+
private boolean ignoreStandardSet;
328+
private int awardTierSize;
329+
private boolean enableContractAwards;
330+
private boolean enableFactionHunterAwards;
331+
private boolean enableInjuryAwards;
332+
private boolean enableIndividualKillAwards;
333+
private boolean enableFormationKillAwards;
334+
private boolean enableRankAwards;
335+
private boolean enableScenarioAwards;
336+
private boolean enableSkillAwards;
337+
private boolean enableTheatreOfWarAwards;
338+
private boolean enableTimeAwards;
339+
private boolean enableMiscAwards;
321340
//endregion Personnel Tab
322341

323342
//region Finance tab
@@ -803,6 +822,25 @@ public CampaignOptions() {
803822
getAgeRangeRandomDeathFemaleValues().put(TenYearAgeRange.SIXTY_FIVE_SEVENTY_FOUR, 1421.0);
804823
getAgeRangeRandomDeathFemaleValues().put(TenYearAgeRange.SEVENTY_FIVE_EIGHTY_FOUR, 3788.0);
805824
getAgeRangeRandomDeathFemaleValues().put(TenYearAgeRange.EIGHTY_FIVE_OR_OLDER, 12870.0);
825+
826+
// Awards
827+
setAwardBonusStyle(AwardBonus.BOTH);
828+
setEnableAutoAwards(true);
829+
setIssuePosthumousAwards(false);
830+
setIssueBestAwardOnly(true);
831+
setIgnoreStandardSet(false);
832+
setAwardTierSize(5);
833+
setEnableContractAwards(true);
834+
setEnableFactionHunterAwards(true);
835+
setEnableInjuryAwards(true);
836+
setEnableIndividualKillAwards(true);
837+
setEnableFormationKillAwards(true);
838+
setEnableRankAwards(true);
839+
setEnableScenarioAwards(true);
840+
setEnableSkillAwards(true);
841+
setEnableTheatreOfWarAwards(true);
842+
setEnableTimeAwards(true);
843+
setEnableMiscAwards(true);
806844
//endregion Personnel Tab
807845

808846
//region Finances Tab
@@ -2215,6 +2253,144 @@ public void setAgeRangeRandomDeathFemaleValues(final Map<TenYearAgeRange, Double
22152253
this.ageRangeRandomDeathFemaleValues = ageRangeRandomDeathFemaleValues;
22162254
}
22172255
//endregion Death
2256+
2257+
//region Awards
2258+
public boolean isIssuePosthumousAwards() {
2259+
return issuePosthumousAwards;
2260+
}
2261+
2262+
public void setIssuePosthumousAwards(final boolean issuePosthumousAwards) {
2263+
this.issuePosthumousAwards = issuePosthumousAwards;
2264+
}
2265+
2266+
public boolean isIssueBestAwardOnly() {
2267+
return issueBestAwardOnly;
2268+
}
2269+
2270+
public void setIssueBestAwardOnly(final boolean issueBestAwardOnly) {
2271+
this.issueBestAwardOnly = issueBestAwardOnly;
2272+
}
2273+
2274+
public boolean isIgnoreStandardSet() {
2275+
return ignoreStandardSet;
2276+
}
2277+
2278+
public void setIgnoreStandardSet(final boolean ignoreStandardSet) {
2279+
this.ignoreStandardSet = ignoreStandardSet;
2280+
}
2281+
2282+
public int getAwardTierSize() {
2283+
return awardTierSize;
2284+
}
2285+
2286+
public void setAwardTierSize(final int awardTierSize) {
2287+
this.awardTierSize = awardTierSize;
2288+
}
2289+
2290+
public AwardBonus getAwardBonusStyle() {
2291+
return awardBonusStyle;
2292+
}
2293+
2294+
public void setAwardBonusStyle(final AwardBonus awardBonusStyle) {
2295+
this.awardBonusStyle = awardBonusStyle;
2296+
}
2297+
2298+
public boolean isEnableAutoAwards() {
2299+
return enableAutoAwards;
2300+
}
2301+
2302+
public void setEnableAutoAwards(final boolean enableAutoAwards) {
2303+
this.enableAutoAwards = enableAutoAwards;
2304+
}
2305+
2306+
public boolean isEnableContractAwards() {
2307+
return enableContractAwards;
2308+
}
2309+
2310+
public void setEnableContractAwards(final boolean enableContractAwards) {
2311+
this.enableContractAwards = enableContractAwards;
2312+
}
2313+
2314+
public boolean isEnableFactionHunterAwards() {
2315+
return enableFactionHunterAwards;
2316+
}
2317+
2318+
public void setEnableFactionHunterAwards(final boolean enableFactionHunterAwards) {
2319+
this.enableFactionHunterAwards = enableFactionHunterAwards;
2320+
}
2321+
2322+
public boolean isEnableInjuryAwards() {
2323+
return enableInjuryAwards;
2324+
}
2325+
2326+
public void setEnableInjuryAwards(final boolean enableInjuryAwards) {
2327+
this.enableInjuryAwards = enableInjuryAwards;
2328+
}
2329+
2330+
public boolean isEnableIndividualKillAwards() {
2331+
return enableIndividualKillAwards;
2332+
}
2333+
2334+
public void setEnableIndividualKillAwards(final boolean enableIndividualKillAwards) {
2335+
this.enableIndividualKillAwards = enableIndividualKillAwards;
2336+
}
2337+
2338+
public boolean isEnableFormationKillAwards() {
2339+
return enableFormationKillAwards;
2340+
}
2341+
2342+
public void setEnableFormationKillAwards(final boolean enableFormationKillAwards) {
2343+
this.enableFormationKillAwards = enableFormationKillAwards;
2344+
}
2345+
2346+
public boolean isEnableRankAwards() {
2347+
return enableRankAwards;
2348+
}
2349+
2350+
public void setEnableRankAwards(final boolean enableRankAwards) {
2351+
this.enableRankAwards = enableRankAwards;
2352+
}
2353+
2354+
public boolean isEnableScenarioAwards() {
2355+
return enableScenarioAwards;
2356+
}
2357+
2358+
public void setEnableScenarioAwards(final boolean enableScenarioAwards) {
2359+
this.enableScenarioAwards = enableScenarioAwards;
2360+
}
2361+
2362+
public boolean isEnableSkillAwards() {
2363+
return enableSkillAwards;
2364+
}
2365+
2366+
public void setEnableSkillAwards(final boolean enableSkillAwards) {
2367+
this.enableSkillAwards = enableSkillAwards;
2368+
}
2369+
2370+
public boolean isEnableTheatreOfWarAwards() {
2371+
return enableTheatreOfWarAwards;
2372+
}
2373+
2374+
public void setEnableTheatreOfWarAwards(final boolean enableTheatreOfWarAwards) {
2375+
this.enableTheatreOfWarAwards = enableTheatreOfWarAwards;
2376+
}
2377+
2378+
public boolean isEnableTimeAwards() {
2379+
return enableTimeAwards;
2380+
}
2381+
2382+
public void setEnableTimeAwards(final boolean enableTimeAwards) {
2383+
this.enableTimeAwards = enableTimeAwards;
2384+
}
2385+
2386+
public boolean isEnableMiscAwards() {
2387+
return enableMiscAwards;
2388+
}
2389+
2390+
public void setEnableMiscAwards(final boolean enableMiscAwards) {
2391+
this.enableMiscAwards = enableMiscAwards;
2392+
}
2393+
//endregion Awards
22182394
//endregion Personnel Tab
22192395

22202396
//region Finances Tab
@@ -3756,6 +3932,26 @@ public void writeToXml(final PrintWriter pw, int indent) {
37563932
}
37573933
MHQXMLUtility.writeSimpleXMLCloseTag(pw, --indent, "ageRangeRandomDeathFemaleValues");
37583934
//endregion Death
3935+
3936+
//region Awards
3937+
MHQXMLUtility.writeSimpleXMLTag(pw, indent, "awardBonusStyle", getAwardBonusStyle().name());
3938+
MHQXMLUtility.writeSimpleXMLTag(pw, indent, "enableAutoAwards", isEnableAutoAwards());
3939+
MHQXMLUtility.writeSimpleXMLTag(pw, indent, "issuePosthumousAwards", isIssuePosthumousAwards());
3940+
MHQXMLUtility.writeSimpleXMLTag(pw, indent, "issueBestAwardOnly", isIssueBestAwardOnly());
3941+
MHQXMLUtility.writeSimpleXMLTag(pw, indent, "ignoreStandardSet", isIgnoreStandardSet());
3942+
MHQXMLUtility.writeSimpleXMLTag(pw, indent, "awardTierSize", getAwardTierSize());
3943+
MHQXMLUtility.writeSimpleXMLTag(pw, indent, "enableContractAwards", isEnableContractAwards());
3944+
MHQXMLUtility.writeSimpleXMLTag(pw, indent, "enableFactionHunterAwards", isEnableFactionHunterAwards());
3945+
MHQXMLUtility.writeSimpleXMLTag(pw, indent, "enableInjuryAwards", isEnableInjuryAwards());
3946+
MHQXMLUtility.writeSimpleXMLTag(pw, indent, "enableIndividualKillAwards", isEnableIndividualKillAwards());
3947+
MHQXMLUtility.writeSimpleXMLTag(pw, indent, "enableFormationKillAwards", isEnableFormationKillAwards());
3948+
MHQXMLUtility.writeSimpleXMLTag(pw, indent, "enableRankAwards", isEnableRankAwards());
3949+
MHQXMLUtility.writeSimpleXMLTag(pw, indent, "enableScenarioAwards", isEnableScenarioAwards());
3950+
MHQXMLUtility.writeSimpleXMLTag(pw, indent, "enableSkillAwards", isEnableSkillAwards());
3951+
MHQXMLUtility.writeSimpleXMLTag(pw, indent, "enableTheatreOfWarAwards", isEnableTheatreOfWarAwards());
3952+
MHQXMLUtility.writeSimpleXMLTag(pw, indent, "enableTimeAwards", isEnableTimeAwards());
3953+
MHQXMLUtility.writeSimpleXMLTag(pw, indent, "enableMiscAwards", isEnableMiscAwards());
3954+
//endregion Awards
37593955
//endregion Personnel Tab
37603956

37613957
//region Finances Tab
@@ -4470,6 +4666,43 @@ public static CampaignOptions generateCampaignOptionsFromXml(Node wn, Version ve
44704666
}
44714667
}
44724668
//endregion Death
4669+
4670+
//region Awards
4671+
} else if (wn2.getNodeName().equalsIgnoreCase("awardBonusStyle")) {
4672+
retVal.setAwardBonusStyle(AwardBonus.valueOf(wn2.getTextContent().trim()));
4673+
} else if (wn2.getNodeName().equalsIgnoreCase("enableAutoAwards")) {
4674+
retVal.setEnableAutoAwards(Boolean.parseBoolean(wn2.getTextContent().trim()));
4675+
} else if (wn2.getNodeName().equalsIgnoreCase("issuePosthumousAwards")) {
4676+
retVal.setIssuePosthumousAwards(Boolean.parseBoolean(wn2.getTextContent().trim()));
4677+
} else if (wn2.getNodeName().equalsIgnoreCase("issueBestAwardOnly")) {
4678+
retVal.setIssueBestAwardOnly(Boolean.parseBoolean(wn2.getTextContent().trim()));
4679+
} else if (wn2.getNodeName().equalsIgnoreCase("ignoreStandardSet")) {
4680+
retVal.setIgnoreStandardSet(Boolean.parseBoolean(wn2.getTextContent().trim()));
4681+
} else if (wn2.getNodeName().equalsIgnoreCase("awardTierSize")) {
4682+
retVal.setAwardTierSize(Integer.parseInt(wn2.getTextContent()));
4683+
} else if (wn2.getNodeName().equalsIgnoreCase("enableContractAwards")) {
4684+
retVal.setEnableContractAwards(Boolean.parseBoolean(wn2.getTextContent().trim()));
4685+
} else if (wn2.getNodeName().equalsIgnoreCase("enableFactionHunterAwards")) {
4686+
retVal.setEnableFactionHunterAwards(Boolean.parseBoolean(wn2.getTextContent().trim()));
4687+
} else if (wn2.getNodeName().equalsIgnoreCase("enableInjuryAwards")) {
4688+
retVal.setEnableInjuryAwards(Boolean.parseBoolean(wn2.getTextContent().trim()));
4689+
} else if (wn2.getNodeName().equalsIgnoreCase("enableIndividualKillAwards")) {
4690+
retVal.setEnableIndividualKillAwards(Boolean.parseBoolean(wn2.getTextContent().trim()));
4691+
} else if (wn2.getNodeName().equalsIgnoreCase("enableFormationKillAwards")) {
4692+
retVal.setEnableFormationKillAwards(Boolean.parseBoolean(wn2.getTextContent().trim()));
4693+
} else if (wn2.getNodeName().equalsIgnoreCase("enableRankAwards")) {
4694+
retVal.setEnableRankAwards(Boolean.parseBoolean(wn2.getTextContent().trim()));
4695+
} else if (wn2.getNodeName().equalsIgnoreCase("enableScenarioAwards")) {
4696+
retVal.setEnableScenarioAwards(Boolean.parseBoolean(wn2.getTextContent().trim()));
4697+
} else if (wn2.getNodeName().equalsIgnoreCase("enableSkillAwards")) {
4698+
retVal.setEnableSkillAwards(Boolean.parseBoolean(wn2.getTextContent().trim()));
4699+
} else if (wn2.getNodeName().equalsIgnoreCase("enableTheatreOfWarAwards")) {
4700+
retVal.setEnableTheatreOfWarAwards(Boolean.parseBoolean(wn2.getTextContent().trim()));
4701+
} else if (wn2.getNodeName().equalsIgnoreCase("enableTimeAwards")) {
4702+
retVal.setEnableTimeAwards(Boolean.parseBoolean(wn2.getTextContent().trim()));
4703+
} else if (wn2.getNodeName().equalsIgnoreCase("enableMiscAwards")) {
4704+
retVal.setEnableMiscAwards(Boolean.parseBoolean(wn2.getTextContent().trim()));
4705+
//endregion Awards
44734706
//endregion Personnel Tab
44744707

44754708
//region Finances Tab

MekHQ/src/mekhq/campaign/ResolveScenarioTracker.java

+16
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import mekhq.campaign.parts.Armor;
3838
import mekhq.campaign.parts.Part;
3939
import mekhq.campaign.personnel.Person;
40+
import mekhq.campaign.personnel.autoAwards.AutoAwardsController;
4041
import mekhq.campaign.personnel.enums.PersonnelStatus;
4142
import mekhq.campaign.personnel.enums.PrisonerStatus;
4243
import mekhq.campaign.unit.TestUnit;
@@ -1413,6 +1414,7 @@ public void resolveScenario(ScenarioStatus resolution, String report) {
14131414
for (Kill k : status.getKills()) {
14141415
getCampaign().addKill(k);
14151416
}
1417+
14161418
if (status.isMissing()) {
14171419
person.changeStatus(getCampaign(), getCampaign().getLocalDate(), PersonnelStatus.MIA);
14181420
} else if (status.isDead()) {
@@ -1430,6 +1432,20 @@ public void resolveScenario(ScenarioStatus resolution, String report) {
14301432
if (status.toRemove()) {
14311433
getCampaign().removePerson(person, false);
14321434
}
1435+
1436+
if (getCampaign().getCampaignOptions().isEnableAutoAwards()) {
1437+
if (!person.getStatus().isDead() || getCampaign().getCampaignOptions().isIssuePosthumousAwards()) {
1438+
int injuryCount = 0;
1439+
1440+
if (status.getHits() > person.getHits()) {
1441+
injuryCount = status.getHits() - person.getHits();
1442+
}
1443+
1444+
AutoAwardsController autoAwardsController = new AutoAwardsController();
1445+
1446+
autoAwardsController.PostScenarioController(campaign, scenario.getId(), person.getId(), injuryCount);
1447+
}
1448+
}
14331449
}
14341450

14351451
//region Prisoners

0 commit comments

Comments
 (0)