diff --git a/Mage.Client/src/main/java/mage/client/table/TablesPanel.java b/Mage.Client/src/main/java/mage/client/table/TablesPanel.java index 3399b5cff70..b61b6569cb2 100644 --- a/Mage.Client/src/main/java/mage/client/table/TablesPanel.java +++ b/Mage.Client/src/main/java/mage/client/table/TablesPanel.java @@ -94,15 +94,13 @@ public class TablesPanel extends javax.swing.JPanel { .addColumn(5, 180, String.class, "Game Type",null) .addColumn(6, 80, String.class, "Info", "Match / Tournament settings" - + "
Wins = Number of games you need to wins to win a match" - + "
Time = Time limit per player" - + "
FM: = Numbers of freee mulligans" - + "
Constr.: = Construction time for limited tournament formats" - + "
RB = Rollback allowed" - + "
PC = Planechase active" - + "
EC = One or more emblem cards in use" + + "
Wins = Number of games you need to wins to win a match" + + "
Time = Time limit per player" + + "
Constr.: = Construction time for limited tournament formats" + + "
RB = Rollbacks allowed" + "
SP = Spectators allowed" + "
Rng: Range of visibility for multiplayer matches" + + "
Custom options: Nonstandard options, hover for details" ) .addColumn(7, 120, String.class, "Status", "Table status
" diff --git a/Mage.Common/src/main/java/mage/view/TableView.java b/Mage.Common/src/main/java/mage/view/TableView.java index 7056aa8e9d8..63abb2e3f5d 100644 --- a/Mage.Common/src/main/java/mage/view/TableView.java +++ b/Mage.Common/src/main/java/mage/view/TableView.java @@ -1,5 +1,7 @@ package mage.view; +import mage.cards.decks.DeckCardInfo; +import mage.constants.MatchBufferTime; import mage.constants.SkillLevel; import mage.constants.TableState; import mage.game.Game; @@ -97,45 +99,30 @@ public class TableView implements Serializable { } this.controllerName += sb.toString(); this.deckType = table.getDeckType(); - StringBuilder addInfo = new StringBuilder(); + StringBuilder infoTextShort = new StringBuilder(); + StringBuilder infoTextLong = new StringBuilder(); if (table.getMatch().getGames().isEmpty()) { - addInfo.append("Wins:").append(table.getMatch().getWinsNeeded()); - addInfo.append(" Time: ").append(table.getMatch().getOptions().getMatchTimeLimit().toString()); - addInfo.append(" Buffer: ").append(table.getMatch().getOptions().getMatchBufferTime().toString()); - if (table.getMatch().getOptions().getMulliganType() != MulliganType.GAME_DEFAULT) { - addInfo.append(" Mulligan: \"").append(table.getMatch().getOptions().getMulliganType().toString()).append("\""); - } - if (table.getMatch().getFreeMulligans() > 0) { - addInfo.append(" FM: ").append(table.getMatch().getFreeMulligans()); - } - if (table.getMatch().getOptions().isCustomStartLifeEnabled()) { - addInfo.append(" StartLife: ").append(table.getMatch().getOptions().getCustomStartLife()); - } - if (table.getMatch().getOptions().isCustomStartHandSizeEnabled()) { - addInfo.append(" StartHandSize: ").append(table.getMatch().getOptions().getCustomStartHandSize()); - } + infoTextShort.append("Wins: ").append(table.getMatch().getWinsNeeded()); + infoTextLong.append("Wins required: ").append(table.getMatch().getWinsNeeded()) + .append(" (Best of ").append(table.getMatch().getWinsNeeded()*2-1).append(")"); + buildMatchOptionsTextShared(table.getMatch().getOptions(),infoTextShort,infoTextLong); } else { - addInfo.append("Wins:").append(table.getMatch().getWinsNeeded()); - addInfo.append(sbScore.toString()); - } - if (table.getMatch().getOptions().isRollbackTurnsAllowed()) { - addInfo.append(" RB"); - } - if (table.getMatch().getOptions().isPlaneChase()) { - addInfo.append(" PC"); - } - if (!(table.getMatch().getOptions().getPerPlayerEmblemCards().isEmpty()) - || !(table.getMatch().getOptions().getGlobalEmblemCards().isEmpty())) { - addInfo.append(" EC"); + infoTextShort.append("Wins: ").append(table.getMatch().getWinsNeeded()).append(sbScore); + infoTextLong.append("Wins required: ").append(table.getMatch().getWinsNeeded()).append(sbScore); } + infoTextLong.append("
Seats: ").append(this.seatsInfo); if (table.getMatch().getOptions().isSpectatorsAllowed()) { - addInfo.append(" SP"); + infoTextShort.append(", SP"); + infoTextLong.append("
Spectators allowed (SP)"); } + infoTextLong.append("
Game type: ").append(table.getGameType()); + infoTextLong.append("
Deck type: ").append(table.getDeckType()); if (table.getNumberOfSeats() > 3) { - addInfo.append(" Rng: ").append(table.getMatch().getOptions().getRange().toString()); + infoTextShort.append(", Rng: ").append(table.getMatch().getOptions().getRange().toString()); + infoTextLong.append("
Range of Influence: ").append(table.getMatch().getOptions().getRange().toString()); } - this.additionalInfoShort = addInfo.toString(); - this.additionalInfoFull = addInfo.toString(); // TODO: add tooltip details here + this.additionalInfoShort = infoTextShort.toString(); + this.additionalInfoFull = infoTextLong.toString(); this.skillLevel = table.getMatch().getOptions().getSkillLevel(); this.quitRatio = Integer.toString(table.getMatch().getOptions().getQuitRatio()); this.minimumRating = Integer.toString(table.getMatch().getOptions().getMinimumRating()); @@ -146,7 +133,7 @@ public class TableView implements Serializable { } else { // TOURNAMENT if (table.getTournament().getOptions().getNumberRounds() > 0) { - this.gameType = new StringBuilder(this.gameType).append(' ').append(table.getTournament().getOptions().getNumberRounds()).append(" Rounds").toString(); + this.gameType = this.gameType + ' ' + table.getTournament().getOptions().getNumberRounds() + " Rounds"; } StringBuilder sb1 = new StringBuilder(); for (TournamentPlayer tp : table.getTournament().getPlayers()) { @@ -156,10 +143,13 @@ public class TableView implements Serializable { } this.controllerName += sb1.toString(); this.seatsInfo = "" + table.getTournament().getPlayers().size() + "/" + table.getNumberOfSeats(); - StringBuilder infoText = new StringBuilder(); + StringBuilder infoTextShort = new StringBuilder(); + StringBuilder infoTextLong = new StringBuilder(); StringBuilder stateText = new StringBuilder(table.getState().toString()); - infoText.append("Wins:").append(table.getTournament().getOptions().getMatchOptions().getWinsNeeded()); - infoText.append(" Seats: ").append(this.seatsInfo); + infoTextShort.append("Wins: ").append(table.getTournament().getOptions().getMatchOptions().getWinsNeeded()); + infoTextLong.append("Wins required: ").append(table.getTournament().getOptions().getMatchOptions().getWinsNeeded()) + .append(" (Best of ").append(table.getTournament().getOptions().getMatchOptions().getWinsNeeded()*2-1).append(")"); + infoTextLong.append("
Seats: ").append(this.seatsInfo); switch (table.getState()) { case WAITING: case READY_TO_START: @@ -167,42 +157,25 @@ public class TableView implements Serializable { if (TableState.WAITING.equals(table.getState())) { stateText.append(" (").append(table.getTournament().getPlayers().size()).append('/').append(table.getNumberOfSeats()).append(')'); } - MatchOptions tourneyMatchOptions = table.getTournament().getOptions().getMatchOptions(); - infoText.append(" Time: ").append(tourneyMatchOptions.getMatchTimeLimit().toString()); - infoText.append(" Buffer: ").append(tourneyMatchOptions.getMatchBufferTime().toString()); - if (tourneyMatchOptions.getMulliganType() != MulliganType.GAME_DEFAULT) { - infoText.append(" Mulligan: \"").append(tourneyMatchOptions.getMulliganType().toString()).append("\""); - } - if (tourneyMatchOptions.getFreeMulligans() > 0) { - infoText.append(" FM: ").append(tourneyMatchOptions.getFreeMulligans()); - } - if (tourneyMatchOptions.isCustomStartLifeEnabled()) { - infoText.append(" StartLife: ").append(tourneyMatchOptions.getCustomStartLife()); - } - if (tourneyMatchOptions.isCustomStartHandSizeEnabled()) { - infoText.append(" StartHandSize: ").append(tourneyMatchOptions.getCustomStartHandSize()); - } + buildMatchOptionsTextShared(table.getTournament().getOptions().getMatchOptions(), infoTextShort, infoTextLong); if (table.getTournament().getTournamentType().isLimited()) { - infoText.append(" Constr.: ").append(table.getTournament().getOptions().getLimitedOptions().getConstructionTime() / 60).append(" Min."); + infoTextShort.append(", Constr.: ").append(table.getTournament().getOptions().getLimitedOptions().getConstructionTime() / 60).append("m"); + infoTextLong.append("
Construction time: ").append(table.getTournament().getOptions().getLimitedOptions().getConstructionTime() / 60).append(" Minutes"); } if (table.getTournament().getOptions().getLimitedOptions() instanceof DraftOptions) { DraftOptions draftOptions = (DraftOptions) table.getTournament().getOptions().getLimitedOptions(); - infoText.append(" Pick time: ").append(draftOptions.getTiming().getShortName()); - } - if (tourneyMatchOptions.isRollbackTurnsAllowed()) { - infoText.append(" RB"); - } - if (tourneyMatchOptions.isPlaneChase()) { - infoText.append(" PC"); - } - if (!(table.getTournament().getOptions().getMatchOptions().getPerPlayerEmblemCards().isEmpty()) - || !(table.getTournament().getOptions().getMatchOptions().getGlobalEmblemCards().isEmpty())) { - infoText.append(" EC"); + infoTextShort.append(", Pick time: ").append(draftOptions.getTiming().getShortName()); + infoTextLong.append("
Pick time: ").append(draftOptions.getTiming().getName()); } if (table.getTournament().getOptions().isWatchingAllowed()) { - infoText.append(" SP"); + infoTextShort.append(", SP"); + infoTextLong.append("
Spectators allowed (SP)"); + } + infoTextLong.append("
Game type: ").append(table.getGameType()); + infoTextLong.append("
Deck type: ").append(table.getDeckType()); + if (!table.getTournament().getBoosterInfo().isEmpty()){ + infoTextLong.append("
Boosters: ").append(table.getTournament().getBoosterInfo()); } - break; case DUELING: stateText.append(" Round: ").append(table.getTournament().getRounds().size()); @@ -215,8 +188,8 @@ public class TableView implements Serializable { break; default: } - this.additionalInfoShort = infoText.toString(); - this.additionalInfoFull = infoText.toString(); // TODO: add tooltip details here + this.additionalInfoShort = infoTextShort.toString(); + this.additionalInfoFull = infoTextLong.toString(); this.tableStateText = stateText.toString(); this.deckType = table.getDeckType() + ' ' + table.getTournament().getBoosterInfo(); this.skillLevel = table.getTournament().getOptions().getMatchOptions().getSkillLevel(); @@ -229,6 +202,53 @@ public class TableView implements Serializable { } } + private void buildMatchOptionsTextShared(MatchOptions options, StringBuilder shortBuilder, StringBuilder longBuilder){ + longBuilder.append("
Time: ").append(options.getMatchTimeLimit().toString()); + shortBuilder.append(", Time: ").append(options.getMatchTimeLimit().getShortName()); + if (options.getMatchBufferTime() != MatchBufferTime.NONE){ + shortBuilder.append("(+").append(options.getMatchBufferTime().getShortName()).append(")"); + longBuilder.append("
Buffer time: ").append(options.getMatchBufferTime().toString()); + } + int customOptions = 0; + if (options.getMulliganType() != MulliganType.GAME_DEFAULT) { + longBuilder.append("
Mulligan: \"").append(options.getMulliganType().toString()).append("\""); + customOptions += 1; + } + if (options.getFreeMulligans() > 0) { + longBuilder.append("
Free Mulligans: ").append(options.getFreeMulligans()); + customOptions += 1; + } + if (options.isCustomStartLifeEnabled()) { + longBuilder.append("
Starting Life: ").append(options.getCustomStartLife()); + customOptions += 1; + } + if (options.isCustomStartHandSizeEnabled()) { + longBuilder.append("
Starting Hand Size: ").append(options.getCustomStartHandSize()); + customOptions += 1; + } + if (options.isPlaneChase()) { + longBuilder.append("
Planechase"); + customOptions += 1; + } + if (!(options.getPerPlayerEmblemCards().isEmpty()) + || !(options.getGlobalEmblemCards().isEmpty())) { + longBuilder.append("
Emblem cards:"); + for(DeckCardInfo card: options.getPerPlayerEmblemCards()){ + longBuilder.append("
* ").append(card.getCardName()).append(" (per player)"); + } + for(DeckCardInfo card: options.getGlobalEmblemCards()){ + longBuilder.append("
* ").append(card.getCardName()).append(" (global)"); + } + customOptions += 1; + } + if (customOptions > 0){ + shortBuilder.append(", Custom options (").append(customOptions).append(")"); + } + if (options.isRollbackTurnsAllowed()) { + shortBuilder.append(", RB"); + longBuilder.append("
Rollbacks allowed (RB)"); + } + } public UUID getTableId() { return tableId; } diff --git a/Mage/src/main/java/mage/constants/MatchBufferTime.java b/Mage/src/main/java/mage/constants/MatchBufferTime.java index 195bb72c844..9dea64619e4 100644 --- a/Mage/src/main/java/mage/constants/MatchBufferTime.java +++ b/Mage/src/main/java/mage/constants/MatchBufferTime.java @@ -10,23 +10,21 @@ package mage.constants; * @author alexander-novo */ public enum MatchBufferTime { - NONE(0, "None"), - SEC__01(1, "1 Second"), - SEC__02(2, "2 Seconds"), - SEC__03(3, "3 Seconds"), - SEC__05(5, "5 Seconds"), - SEC__10(10, "10 Seconds"), - SEC__15(15, "15 Seconds"), - SEC__20(20, "20 Seconds"), - SEC__25(25, "25 Seconds"), - SEC__30(30, "30 Seconds"); + NONE(0), + SEC__01(1), + SEC__02(2), + SEC__03(3), + SEC__05(5), + SEC__10(10), + SEC__15(15), + SEC__20(20), + SEC__25(25), + SEC__30(30); private final int bufferSecs; - private final String name; - MatchBufferTime(int bufferSecs, String name) { + MatchBufferTime(int bufferSecs) { this.bufferSecs = bufferSecs; - this.name = name; } public int getBufferSecs() { @@ -34,11 +32,25 @@ public enum MatchBufferTime { } public String getName() { - return name; + if (this == NONE){ + return "None"; + } else if (this == SEC__01){ + return "1 Second"; + } else { + return bufferSecs + " Seconds"; + } } @Override public String toString() { - return name; + return getName(); + } + + public String getShortName() { + if (this == NONE){ + return "None"; + } else { + return bufferSecs + "s"; + } } } diff --git a/Mage/src/main/java/mage/constants/MatchTimeLimit.java b/Mage/src/main/java/mage/constants/MatchTimeLimit.java index 139355d4b2b..267508bb9e6 100644 --- a/Mage/src/main/java/mage/constants/MatchTimeLimit.java +++ b/Mage/src/main/java/mage/constants/MatchTimeLimit.java @@ -7,27 +7,25 @@ package mage.constants; * @author LevelX2 */ public enum MatchTimeLimit { - NONE(0,"None"), - MIN__10(600, "10 Minutes"), - MIN__15(900, "15 Minutes"), - MIN__20(1200, "20 Minutes"), - MIN__25(1500, "25 Minutes"), - MIN__30(1800, "30 Minutes"), - MIN__35(2100, "35 Minutes"), - MIN__40(2400, "40 Minutes"), - MIN__45(2700, "45 Minutes"), - MIN__50(3000, "50 Minutes"), - MIN__55(3300, "55 Minutes"), - MIN__60(3600, "60 Minutes"), - MIN__90(5400, "90 Minutes"), - MIN_120(7200, "120 Minutes"); + NONE(0), + MIN__10(600), + MIN__15(900), + MIN__20(1200), + MIN__25(1500), + MIN__30(1800), + MIN__35(2100), + MIN__40(2400), + MIN__45(2700), + MIN__50(3000), + MIN__55(3300), + MIN__60(3600), + MIN__90(5400), + MIN_120(7200); private final int prioritySecs; - private final String name; - MatchTimeLimit(int prioritySecs, String name) { + MatchTimeLimit(int prioritySecs) { this.prioritySecs = prioritySecs; - this.name = name; } public int getPrioritySecs() { @@ -35,11 +33,23 @@ public enum MatchTimeLimit { } public String getName() { - return name; + if (this == NONE){ + return "None"; + } else { + return (prioritySecs/60)+" Minutes"; + } } @Override public String toString() { - return name; + return getName(); + } + + public String getShortName() { + if (this == NONE){ + return "None"; + } else { + return (prioritySecs/60) + "m"; + } } }