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

feat: adds the players team in the BV report #6222

Merged
merged 1 commit into from
Nov 29, 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
6 changes: 5 additions & 1 deletion megamek/src/megamek/common/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ public final class Player extends TurnOrdered {
public static final int TEAM_NONE = 0;
public static final int TEAM_UNASSIGNED = -1;
public static final String[] TEAM_NAMES = {"No Team", "Team 1", "Team 2", "Team 3", "Team 4", "Team 5"};

private transient IGame game;

private String name;
Expand Down Expand Up @@ -652,6 +651,11 @@ public String getColorForPlayer() {
return "<B><font color='" + getColour().getHexString(0x00F0F0F0) + "'>" + getName() + "</font></B>";
}

public String getColoredPlayerNameWithTeam() {
return "<B><font color='" + getColour().getHexString(0x00F0F0F0) + "'>" + getName() +
" (" + TEAM_NAMES[team] + ")</font></B>";
}

/**
* Clears any data from this Player that should not be transmitted to other players from the server,
* such as email addresses. Note that this changes this Player's data permanently and should typically
Expand Down
5 changes: 3 additions & 2 deletions megamek/src/megamek/server/totalwarfare/TWGameManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -1579,7 +1579,7 @@ void bvReports(boolean checkBlind) {
bvcPlayer.ejectedCrewKilledCount = ServerReportsHelper.getEjectedCrewKilledCount(player, game);
bvcPlayer.ejectedCrewFledCount = ServerReportsHelper.getFledEjectedCrew(player, game);

playerReport.addAll(bvReport(player.getColorForPlayer(), player.getId(), bvcPlayer, checkBlind));
playerReport.addAll(bvReport(player.getColoredPlayerNameWithTeam(), player.getId(), bvcPlayer, checkBlind));

int playerTeam = player.getTeam();

Expand Down Expand Up @@ -1611,7 +1611,8 @@ void bvReports(boolean checkBlind) {
if (!(checkBlind && doBlind() && suppressBlindBV())) {
for (Map.Entry<Integer, BVCountHelper> e : teamsInfo.entrySet()) {
BVCountHelper bvc = e.getValue();
teamReport.addAll(bvReport(Player.TEAM_NAMES[e.getKey()], Player.PLAYER_NONE, bvc, false));
var coloredTeamName = "<B>"+ Player.TEAM_NAMES[e.getKey()] + "</B>";
teamReport.addAll(bvReport(coloredTeamName, Player.PLAYER_NONE, bvc, false));
}
}

Expand Down