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

Fixed New Day Reporting #5077

Merged
merged 2 commits into from
Oct 21, 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
4 changes: 2 additions & 2 deletions MekHQ/resources/mekhq/resources/Campaign.properties
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ LayeredForceIconLayer.LOGO.text=Logos
LayeredForceIconLayer.LOGO.toolTipText=This tab contains canon faction logos that can be added to the center of a force icon.

#### Anniversaries
anniversaryBirthday.text=%s is %s%s%s today!
anniversaryRecruitment.text=%s celebrates %s%s%s years with %s!
anniversaryBirthday.text=%s is <b>%s%s%s</b> today!
anniversaryRecruitment.text=%s celebrates <b>%s%s%s</b> years with %s!

#### Personnel Removal
personnelRemoval.text=Old personnel records have been tidied away.
Expand Down
25 changes: 14 additions & 11 deletions MekHQ/src/mekhq/campaign/Campaign.java
Original file line number Diff line number Diff line change
Expand Up @@ -1463,7 +1463,7 @@ public Person newDependent(boolean baby, Gender gender) {
person = newPerson(PersonnelRole.DEPENDENT, PersonnelRole.NONE,
new DefaultFactionSelector(getCampaignOptions().getRandomOriginOptions()),
new DefaultPlanetSelector(getCampaignOptions().getRandomOriginOptions()),
Gender.RANDOMIZE);
gender);
} else {
person = newPerson(PersonnelRole.DEPENDENT);
}
Expand Down Expand Up @@ -2250,13 +2250,11 @@ private void updatePartInUseData(PartInUse partInUse, Part incomingPart,
boolean ignoreMothballedUnits, PartQuality ignoreSparesUnderQuality) {

if (ignoreMothballedUnits && (null != incomingPart.getUnit()) && incomingPart.getUnit().isMothballed()) {
return;
} else if ((incomingPart.getUnit() != null) || (incomingPart instanceof MissingPart)) {
partInUse.setUseCount(partInUse.getUseCount() + getQuantity(incomingPart));
} else {
if (incomingPart.isPresent()) {
if (incomingPart.getQuality().toNumeric() < ignoreSparesUnderQuality.toNumeric()) {
return;
} else {
partInUse.setStoreCount(partInUse.getStoreCount() + getQuantity(incomingPart));
partInUse.addSpare(incomingPart);
Expand All @@ -2273,7 +2271,7 @@ private void updatePartInUseData(PartInUse partInUse, Part incomingPart,
* @param ignoreMothballedUnits don't count parts in mothballed units
* @param ignoreSparesUnderQuality don't count spare parts lower than this quality
*/
public void updatePartInUse(PartInUse partInUse, boolean ignoreMothballedUnits,
public void updatePartInUse(PartInUse partInUse, boolean ignoreMothballedUnits,
PartQuality ignoreSparesUnderQuality) {
partInUse.setUseCount(0);
partInUse.setStoreCount(0);
Expand All @@ -2290,7 +2288,7 @@ public void updatePartInUse(PartInUse partInUse, boolean ignoreMothballedUnits,
PartInUse newPiu = getPartInUse((Part) maybePart);
if (partInUse.equals(newPiu)) {
partInUse.setPlannedCount(partInUse.getPlannedCount()
+ getQuantity((maybePart instanceof MissingPart) ?
+ getQuantity((maybePart instanceof MissingPart) ?
((MissingPart) maybePart).getNewPart() :
(Part) maybePart) * maybePart.getQuantity());
}
Expand Down Expand Up @@ -2334,7 +2332,7 @@ public Set<PartInUse> getPartsInUse(boolean ignoreMothballedUnits,
inUse.put(partInUse, partInUse);
}
partInUse.setPlannedCount(partInUse.getPlannedCount()
+ getQuantity((maybePart instanceof MissingPart) ?
+ getQuantity((maybePart instanceof MissingPart) ?
((MissingPart) maybePart).getNewPart() :
(Part) maybePart) * maybePart.getQuantity());

Expand Down Expand Up @@ -3770,7 +3768,8 @@ private void processNewDayATB() {

AtBMoraleLevel morale = contract.getMoraleLevel();

String report = "<html>Current enemy condition is '" + morale + "' on contract " + contract.getName() + "<br><br>" + morale.getToolTipText() + "</html>";
String report = "Current enemy condition is <b>" + morale + "</b> on contract "
+ contract.getName() + "<br><br>" + morale.getToolTipText();

addReport(report);
}
Expand Down Expand Up @@ -4222,8 +4221,7 @@ public boolean newDay() {
setLocalDate(getLocalDate().plusDays(1));

// Determine if we have an active contract or not, as this can get used
// elsewhere before
// we actually hit the AtB new day (e.g., personnel market)
// elsewhere before we actually hit the AtB new day (e.g., personnel market)
if (getCampaignOptions().isUseAtB()) {
setHasActiveContract();
}
Expand All @@ -4234,6 +4232,8 @@ public boolean newDay() {
newReports.clear();
beginReport("<b>" + MekHQ.getMHQOptions().getLongDisplayFormattedDate(getLocalDate()) + "</b>");

MekHQ.triggerEvent(new NewDayEvent(this));

// New Year Changes
if (getLocalDate().getDayOfYear() == 1) {
// News is reloaded
Expand Down Expand Up @@ -4297,7 +4297,10 @@ public boolean newDay() {
processPersonnelRemoval();
}

MekHQ.triggerEvent(new NewDayEvent(this));
if ((campaignOptions.isEnableAutoAwards()) && (getLocalDate().getDayOfMonth() == 1)) {
AutoAwardsController autoAwardsController = new AutoAwardsController();
autoAwardsController.ManualController(this, false);
}

// this duplicates any turnover information so that it is still available on the
// new day.
Expand Down Expand Up @@ -8002,7 +8005,7 @@ private String doMaintenanceOnUnitPart(Unit u, Part p, Map<Part, Integer> partsT
// }
break;
}
if (p.getQuality().toNumeric() > oldQuality.toNumeric()) {
if (p.getQuality().toNumeric() > oldQuality.toNumeric()) {
partReport += ": " + ReportingUtilities.messageSurroundedBySpanWithColor(
MekHQ.getMHQOptions().getFontColorPositiveHexColor(),
"new quality is " + p.getQualityName());
Expand Down