Skip to content

Commit

Permalink
Merge pull request #5297 from IllianiCBT/stratCon_boldText
Browse files Browse the repository at this point in the history
Enhanced Formatting in StratCon Scenario Information
  • Loading branch information
IllianiCBT authored Dec 12, 2024
2 parents 97d8a43 + 2585e95 commit 1adaf8f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 27 deletions.
35 changes: 17 additions & 18 deletions MekHQ/src/mekhq/campaign/stratcon/StratconScenario.java
Original file line number Diff line number Diff line change
Expand Up @@ -167,54 +167,53 @@ public void setCurrentState(ScenarioState state) {

@Override
public String getInfo() {
return getInfo(null, true);
return getInfo(null);
}

public String getInfo(@Nullable Campaign campaign, boolean html) {
public String getInfo(@Nullable Campaign campaign) {
StringBuilder stateBuilder = new StringBuilder();

if (isStrategicObjective()) {
stateBuilder.append("<span color='").append(MekHQ.getMHQOptions().getFontColorNegativeHexColor()).append("'>Contract objective located</span>")
.append(html ? "<br/>" : "");
stateBuilder.append("<span color='").append(MekHQ.getMHQOptions().getFontColorNegativeHexColor())
.append("'>Contract objective located</span><br/>");
}

stateBuilder.append("Scenario: ")
stateBuilder.append("<b>Scenario:</b> ")
.append(backingScenario.getName())
.append(html ? "<br/>" : "");
.append("<br/>");

if (backingScenario.getTemplate() != null) {
stateBuilder.append(backingScenario.getTemplate().shortBriefing)
.append(html ? "<br/>" : "");
stateBuilder.append("<i>").append(backingScenario.getTemplate().shortBriefing).append("</i>")
.append("<br/>");
}

if (isRequiredScenario()) {
stateBuilder.append("<span color='").append(MekHQ.getMHQOptions().getFontColorNegativeHexColor()).append("'>Deployment required by contract</span>")
.append(html ? "<br/>" : "").append("<span color='").append(MekHQ.getMHQOptions().getFontColorNegativeHexColor()).append("'>-1 VP if lost/ignored; +1 VP if won</span>")
.append(html ? "<br/>" : "");
stateBuilder.append("<span color='").append(MekHQ.getMHQOptions().getFontColorNegativeHexColor())
.append("'>-1 VP if lost/ignored; +1 VP if won</span><br/>");
}

stateBuilder.append("Status: ")
stateBuilder.append("<b>Status:</b> ")
.append(currentState.getScenarioStateName())
.append("<br/>");

stateBuilder.append("Terrain: ")
stateBuilder.append("<b>Terrain:</b> ")
.append(backingScenario.getMap())
.append("<br/>");

if (deploymentDate != null) {
stateBuilder.append("Deployment Date: ")
stateBuilder.append("<b>Deployment Date:</b> ")
.append(deploymentDate)
.append("<br/>");
}

if (actionDate != null) {
stateBuilder.append("Battle Date: ")
stateBuilder.append("<b>Battle Date:</b> ")
.append(actionDate)
.append("<br/>");
}

if (returnDate != null) {
stateBuilder.append("Return Date: ")
stateBuilder.append("<b>Return Date:</b> ")
.append(returnDate)
.append("<br/>");
}
Expand All @@ -223,9 +222,9 @@ public String getInfo(@Nullable Campaign campaign, boolean html) {
AtBDynamicScenario backingScenario = getBackingScenario();

if (backingScenario != null) {
stateBuilder.append(String.format("Hostile BV: %d<br>",
stateBuilder.append(String.format("<b>Hostile BV:</b> %d<br>",
backingScenario.getTeamTotalBattleValue(campaign, false)));
stateBuilder.append(String.format("Allied BV: %d",
stateBuilder.append(String.format("<b>Allied BV:</b> %d",
backingScenario.getTeamTotalBattleValue(campaign, true)));
}
}
Expand Down
16 changes: 8 additions & 8 deletions MekHQ/src/mekhq/gui/StratconPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -855,18 +855,18 @@ private String buildSelectedHexInfo(Campaign campaign) {
StringBuilder infoBuilder = new StringBuilder();
infoBuilder.append("<html><br/>");

infoBuilder.append("Average Temperature: ");
infoBuilder.append("<b>Average Temperature:</b> ");
infoBuilder.append(currentTrack.getTemperature());
infoBuilder.append("&deg;C<br/>");
infoBuilder.append("Terrain Type: ");
infoBuilder.append("<b>Terrain Type:</b> ");
infoBuilder.append(currentTrack.getTerrainTile(boardState.getSelectedCoords()));
infoBuilder.append("<br/>");

boolean coordsRevealed = currentTrack.hasActiveTrackReveal()
|| currentTrack.getRevealedCoords().contains(boardState.getSelectedCoords());
if (coordsRevealed) {
infoBuilder.append("<span color='").append(MekHQ.getMHQOptions().getFontColorPositiveHexColor())
.append("'>Recon Complete</span><br/>");
.append("'><i>Recon Complete</i></span><br/>");
}

if (currentTrack.getAssignedCoordForces().containsKey(boardState.getSelectedCoords())) {
Expand All @@ -875,13 +875,13 @@ private String buildSelectedHexInfo(Campaign campaign) {
infoBuilder.append(force.getName()).append(" assigned");

if (currentTrack.getStickyForces().contains(forceID)) {
infoBuilder.append(" - remain deployed");
infoBuilder.append("<i> - remain deployed</i>");
}

infoBuilder.append("<br/>")
.append("Returns on ")
.append("<i>Returns on ")
.append(currentTrack.getAssignedForceReturnDates().get(forceID))
.append("<br/>");
.append("</i><br/>");
}
}

Expand Down Expand Up @@ -913,14 +913,14 @@ private String buildSelectedHexInfo(Campaign campaign) {

} else {
infoBuilder.append("<span color='").append(MekHQ.getMHQOptions().getFontColorNegative())
.append("'>Recon Incomplete</span>");
.append("'><i>Recon Incomplete</i></span>");
}
infoBuilder.append("<br/>");

StratconScenario selectedScenario = getSelectedScenario();
if ((selectedScenario != null) &&
((selectedScenario.getDeploymentDate() != null) || currentTrack.isGmRevealed())) {
infoBuilder.append(selectedScenario.getInfo(campaign, true));
infoBuilder.append(selectedScenario.getInfo(campaign));
}

infoBuilder.append("</html>");
Expand Down
2 changes: 1 addition & 1 deletion MekHQ/src/mekhq/gui/stratcon/StratconScenarioWizard.java
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ private void setInstructions(GridBagConstraints gbc) {
if (currentTrackState.isGmRevealed()
|| currentTrackState.getRevealedCoords().contains(currentScenario.getCoords()) ||
(currentScenario.getDeploymentDate() != null)) {
labelBuilder.append(currentScenario.getInfo(campaign, true));
labelBuilder.append(currentScenario.getInfo(campaign));
}

if (Objects.requireNonNull(currentScenario.getCurrentState()) == ScenarioState.UNRESOLVED) {
Expand Down

0 comments on commit 1adaf8f

Please sign in to comment.