mirror of
https://github.com/correl/mage.git
synced 2025-01-11 19:13:02 +00:00
* The list of open tables shows now the codes of boosters selected for sealed or draft tournaments in the deck type column.
This commit is contained in:
parent
ae6139f859
commit
aef53bc4ce
4 changed files with 30 additions and 1 deletions
|
@ -65,7 +65,6 @@ public class TableView implements Serializable {
|
|||
this.tableName = table.getName();
|
||||
this.controllerName = table.getControllerName();
|
||||
this.createTime = table.getCreateTime();
|
||||
this.deckType = table.getDeckType();
|
||||
this.tableState = table.getState();
|
||||
this.isTournament = table.isTournament();
|
||||
for (Seat seat: table.getSeats()) {
|
||||
|
@ -83,6 +82,7 @@ public class TableView implements Serializable {
|
|||
}
|
||||
}
|
||||
this.controllerName += sb.toString();
|
||||
this.deckType = table.getDeckType();
|
||||
} else {
|
||||
StringBuilder sb1 = new StringBuilder();
|
||||
for (TournamentPlayer tp: table.getTournament().getPlayers()) {
|
||||
|
@ -96,6 +96,7 @@ public class TableView implements Serializable {
|
|||
sb.append(" - Running round: ").append(table.getTournament().getRounds().size());
|
||||
}
|
||||
this.additionalInfo = sb.toString();
|
||||
this.deckType = new StringBuilder(table.getDeckType()).append(" ").append(table.getTournament().getSetsFormatedShort()).toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ package mage.server.tournament;
|
|||
import java.lang.reflect.Constructor;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import mage.cards.Sets;
|
||||
|
@ -65,9 +66,18 @@ public class TournamentFactory {
|
|||
try {
|
||||
con = tournaments.get(tournamentType).getConstructor(new Class[]{TournamentOptions.class});
|
||||
tournament = con.newInstance(new Object[] {options});
|
||||
// transfer set information, create short info string for included sets
|
||||
Map<String,Integer> setInfo = new LinkedHashMap<String,Integer>();
|
||||
for (String setCode: options.getLimitedOptions().getSetCodes()) {
|
||||
tournament.getSets().add(Sets.findSet(setCode));
|
||||
int count = setInfo.containsKey(setCode) ? setInfo.get(setCode) : 0;
|
||||
setInfo.put(setCode, count + 1);
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (Map.Entry<String,Integer> entry:setInfo.entrySet()) {
|
||||
sb.append(entry.getValue().toString()).append("x").append(entry.getKey()).append(" ");
|
||||
}
|
||||
tournament.setSetsFormatedShort(sb.toString());
|
||||
} catch (Exception ex) {
|
||||
logger.fatal("TournamentFactory error ", ex);
|
||||
return null;
|
||||
|
|
|
@ -50,6 +50,13 @@ public interface Tournament {
|
|||
Collection<TournamentPlayer> getPlayers();
|
||||
Collection<Round> getRounds();
|
||||
List<ExpansionSet> getSets();
|
||||
|
||||
void setSetsFormatedShort(String setInfo);
|
||||
/**
|
||||
* Gives back a String that shows the included sets (e.g. "3xRTR" or "1xDGM 1xGTC 1xRTR")
|
||||
* @return String
|
||||
*/
|
||||
String getSetsFormatedShort();
|
||||
void submitDeck(UUID playerId, Deck deck);
|
||||
void updateDeck(UUID playerId, Deck deck);
|
||||
void autoSubmit(UUID playerId, Deck deck);
|
||||
|
|
|
@ -53,6 +53,7 @@ public abstract class TournamentImpl implements Tournament {
|
|||
protected String matchName;
|
||||
protected TournamentOptions options;
|
||||
protected List<ExpansionSet> sets = new ArrayList<ExpansionSet>();
|
||||
protected String setsInfoShort;
|
||||
|
||||
protected TableEventSource tableEventSource = new TableEventSource();
|
||||
protected PlayerQueryEventSource playerQueryEventSource = new PlayerQueryEventSource();
|
||||
|
@ -100,6 +101,16 @@ public abstract class TournamentImpl implements Tournament {
|
|||
return sets;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSetsFormatedShort(String setsInfoShort) {
|
||||
this.setsInfoShort = setsInfoShort;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSetsFormatedShort() {
|
||||
return setsInfoShort;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void leave(UUID playerId) {
|
||||
if (players.containsKey(playerId)) {
|
||||
|
|
Loading…
Reference in a new issue