diff --git a/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/game/LotroFormat.java b/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/game/LotroFormat.java index 6bfd9bf10..08de84515 100644 --- a/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/game/LotroFormat.java +++ b/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/game/LotroFormat.java @@ -9,5 +9,7 @@ public interface LotroFormat { public boolean hasMulliganRule(); + public String getName(); + public void validateDeck(Player player, LotroDeck deck) throws DeckInvalidException; } diff --git a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/db/vo/CollectionType.java b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/db/vo/CollectionType.java new file mode 100644 index 000000000..b87c3badc --- /dev/null +++ b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/db/vo/CollectionType.java @@ -0,0 +1,19 @@ +package com.gempukku.lotro.db.vo; + +public class CollectionType { + private String _code; + private String _fullName; + + public CollectionType(String code, String fullName) { + _code = code; + _fullName = fullName; + } + + public String getCode() { + return _code; + } + + public String getFullName() { + return _fullName; + } +} diff --git a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/db/vo/League.java b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/db/vo/League.java index e9f86ce75..0d40bce28 100644 --- a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/db/vo/League.java +++ b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/db/vo/League.java @@ -23,6 +23,10 @@ public class League { return _id; } + public CollectionType getCollectionType() { + return new CollectionType(_type, _name); + } + public String getType() { return _type; } diff --git a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/LotroServer.java b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/LotroServer.java index 1ed077938..c13aed269 100644 --- a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/LotroServer.java +++ b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/LotroServer.java @@ -107,14 +107,14 @@ public class LotroServer extends AbstractServer { return "Game" + gameId; } - public synchronized String createNewGame(LotroFormat lotroFormat, String formatName, LotroGameParticipant[] participants, boolean competetive) { + public synchronized String createNewGame(LotroFormat lotroFormat, LotroGameParticipant[] participants, boolean competetive) { if (participants.length < 2) throw new IllegalArgumentException("There has to be at least two players"); final String gameId = String.valueOf(_nextGameId); String chatRoomName = getChatRoomName(gameId); ChatRoomMediator room = _chatServer.createChatRoom(chatRoomName, 30); - room.sendMessage("System", "You're starting a game of " + formatName); + room.sendMessage("System", "You're starting a game of " + lotroFormat.getName()); LotroGameMediator lotroGameMediator = new LotroGameMediator(lotroFormat, participants, _lotroCardBlueprintLibrary, competetive ? 60 * 40 : 60 * 80); lotroGameMediator.addGameResultListener( @@ -132,7 +132,7 @@ public class LotroServer extends AbstractServer { for (LotroGameParticipant participant : participants) deckNames.put(participant.getPlayerId(), participant.getDeckName()); - final GameRecorder.GameRecordingInProgress gameRecordingInProgress = _gameRecorder.recordGame(lotroGameMediator, formatName, deckNames); + final GameRecorder.GameRecordingInProgress gameRecordingInProgress = _gameRecorder.recordGame(lotroGameMediator, lotroFormat.getName(), deckNames); lotroGameMediator.addGameResultListener( new GameResultListener() { @Override diff --git a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/formats/DefaultLotroFormat.java b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/formats/DefaultLotroFormat.java index 04ee45dd1..3e54ecf19 100644 --- a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/formats/DefaultLotroFormat.java +++ b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/formats/DefaultLotroFormat.java @@ -14,6 +14,7 @@ import java.util.Set; public abstract class DefaultLotroFormat implements LotroFormat { private LotroCardBlueprintLibrary _library; + private String _name; private Block _siteBlock; private boolean _validateShadowFPCount = true; private int _maximumSameName = 4; @@ -24,8 +25,9 @@ public abstract class DefaultLotroFormat implements LotroFormat { private Set _restrictedCards = new HashSet(); private Set _validSets = new HashSet(); - public DefaultLotroFormat(LotroCardBlueprintLibrary library, Block siteBlock, boolean validateShadowFPCount, int minimumDeckSize, int maximumSameName, boolean mulliganRule, boolean canCancelRingBearerSkirmish) { + public DefaultLotroFormat(LotroCardBlueprintLibrary library, String name, Block siteBlock, boolean validateShadowFPCount, int minimumDeckSize, int maximumSameName, boolean mulliganRule, boolean canCancelRingBearerSkirmish) { _library = library; + _name = name; _siteBlock = siteBlock; _validateShadowFPCount = validateShadowFPCount; _minimumDeckSize = minimumDeckSize; @@ -34,6 +36,11 @@ public abstract class DefaultLotroFormat implements LotroFormat { _canCancelRingBearerSkirmish = canCancelRingBearerSkirmish; } + @Override + public String getName() { + return _name; + } + @Override public boolean hasMulliganRule() { return _mulliganRule; diff --git a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/formats/ExpandedFormat.java b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/formats/ExpandedFormat.java index f9ad96c1f..dd07fdd44 100644 --- a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/formats/ExpandedFormat.java +++ b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/formats/ExpandedFormat.java @@ -5,7 +5,7 @@ import com.gempukku.lotro.game.LotroCardBlueprintLibrary; public class ExpandedFormat extends DefaultLotroFormat { public ExpandedFormat(LotroCardBlueprintLibrary library) { - super(library, Block.OTHER, true, 60, 4, true, false); + super(library, "Expanded", Block.OTHER, true, 60, 4, true, false); addValidSet(0); addValidSet(1); addValidSet(2); diff --git a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/formats/FotRBlockFormat.java b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/formats/FotRBlockFormat.java index 668ce0bdb..6efed41f2 100644 --- a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/formats/FotRBlockFormat.java +++ b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/formats/FotRBlockFormat.java @@ -5,7 +5,7 @@ import com.gempukku.lotro.game.LotroCardBlueprintLibrary; public class FotRBlockFormat extends DefaultLotroFormat { public FotRBlockFormat(LotroCardBlueprintLibrary library, boolean mulliganRule) { - super(library, Block.FELLOWSHIP, true, 60, 4, mulliganRule, true); + super(library, (mulliganRule ? "Community " : "") + "Fellowship block", Block.FELLOWSHIP, true, 60, 4, mulliganRule, true); addRestrictedCard("1_248"); addValidSet(1); addValidSet(2); diff --git a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/formats/FreeFormat.java b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/formats/FreeFormat.java deleted file mode 100644 index f4abff101..000000000 --- a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/formats/FreeFormat.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.gempukku.lotro.game.formats; - -import com.gempukku.lotro.common.Block; -import com.gempukku.lotro.game.LotroCardBlueprintLibrary; - -public class FreeFormat extends DefaultLotroFormat { - public FreeFormat(LotroCardBlueprintLibrary library) { - super(library, Block.FELLOWSHIP, false, 0, Integer.MAX_VALUE, false, true); - } - - @Override - public boolean isOrderedSites() { - return true; - } -} diff --git a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/formats/KingBlockFormat.java b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/formats/KingBlockFormat.java index 759b7bcb9..692053979 100644 --- a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/formats/KingBlockFormat.java +++ b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/formats/KingBlockFormat.java @@ -5,7 +5,7 @@ import com.gempukku.lotro.game.LotroCardBlueprintLibrary; public class KingBlockFormat extends DefaultLotroFormat { public KingBlockFormat(LotroCardBlueprintLibrary library, boolean mulliganRule) { - super(library, Block.KING, true, 60, 4, mulliganRule, true); + super(library, (mulliganRule ? "Community " : "") + "King block", Block.KING, true, 60, 4, mulliganRule, true); addRestrictedCard("7_49"); addValidSet(7); addValidSet(8); diff --git a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/formats/MovieFormat.java b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/formats/MovieFormat.java index e23a541de..78d9502c4 100644 --- a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/formats/MovieFormat.java +++ b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/formats/MovieFormat.java @@ -5,7 +5,7 @@ import com.gempukku.lotro.game.LotroCardBlueprintLibrary; public class MovieFormat extends DefaultLotroFormat { public MovieFormat(LotroCardBlueprintLibrary library) { - super(library, Block.KING, true, 60, 4, true, false); + super(library, "Movie block", Block.KING, true, 60, 4, true, false); addBannedCard("8_1"); addBannedCard("3_38"); addBannedCard("3_106"); diff --git a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/formats/OpenFormat.java b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/formats/OpenFormat.java index 7131b7130..eaca992c8 100644 --- a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/formats/OpenFormat.java +++ b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/formats/OpenFormat.java @@ -5,7 +5,7 @@ import com.gempukku.lotro.game.LotroCardBlueprintLibrary; public class OpenFormat extends DefaultLotroFormat { public OpenFormat(LotroCardBlueprintLibrary library) { - super(library, Block.OTHER, true, 60, 4, true, false); + super(library, "Open", Block.OTHER, true, 60, 4, true, false); addValidSet(0); addValidSet(1); addValidSet(2); diff --git a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/formats/TTTBlockFormat.java b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/formats/TTTBlockFormat.java index e735236b2..a7e0123d2 100644 --- a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/formats/TTTBlockFormat.java +++ b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/formats/TTTBlockFormat.java @@ -5,7 +5,7 @@ import com.gempukku.lotro.game.LotroCardBlueprintLibrary; public class TTTBlockFormat extends DefaultLotroFormat { public TTTBlockFormat(LotroCardBlueprintLibrary library, boolean mulliganRule) { - super(library, Block.TWO_TOWERS, true, 60, 4, mulliganRule, true); + super(library, (mulliganRule ? "Community " : "") + "Two Towers block", Block.TWO_TOWERS, true, 60, 4, mulliganRule, true); addValidSet(4); addValidSet(5); addValidSet(6); diff --git a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/formats/TowersStandardFormat.java b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/formats/TowersStandardFormat.java index c05ed9eb3..540b092cf 100644 --- a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/formats/TowersStandardFormat.java +++ b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/formats/TowersStandardFormat.java @@ -5,7 +5,7 @@ import com.gempukku.lotro.game.LotroCardBlueprintLibrary; public class TowersStandardFormat extends DefaultLotroFormat { public TowersStandardFormat(LotroCardBlueprintLibrary library) { - super(library, Block.TWO_TOWERS, true, 60, 4, true, true); + super(library, "Towers Standard", Block.TWO_TOWERS, true, 60, 4, true, true); addBannedCard("1_40"); addBannedCard("1_45"); diff --git a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/formats/WarOfTheRingBlockFormat.java b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/formats/WarOfTheRingBlockFormat.java index 29568fb8c..0f544b1ec 100644 --- a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/formats/WarOfTheRingBlockFormat.java +++ b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/formats/WarOfTheRingBlockFormat.java @@ -5,7 +5,7 @@ import com.gempukku.lotro.game.LotroCardBlueprintLibrary; public class WarOfTheRingBlockFormat extends DefaultLotroFormat { public WarOfTheRingBlockFormat(LotroCardBlueprintLibrary library, boolean mulliganRule) { - super(library, Block.OTHER, true, 60, 4, mulliganRule, false); + super(library, (mulliganRule ? "Community " : "") + "War of the Ring block", Block.OTHER, true, 60, 4, mulliganRule, false); addRestrictedCard("11_132"); addRestrictedCard("11_100"); addValidSet(11); diff --git a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/hall/AwaitingTable.java b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/hall/AwaitingTable.java index a35b7bc57..5d8fbc018 100644 --- a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/hall/AwaitingTable.java +++ b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/hall/AwaitingTable.java @@ -1,5 +1,6 @@ package com.gempukku.lotro.hall; +import com.gempukku.lotro.db.vo.CollectionType; import com.gempukku.lotro.db.vo.League; import com.gempukku.lotro.db.vo.LeagueSerie; import com.gempukku.lotro.game.LotroFormat; @@ -8,8 +9,7 @@ import com.gempukku.lotro.game.LotroGameParticipant; import java.util.*; public class AwaitingTable { - private String _formatName; - private String _collectionType; + private CollectionType _collectionType; private LotroFormat _lotroFormat; private League _league; private LeagueSerie _leagueSerie; @@ -17,10 +17,9 @@ public class AwaitingTable { private int _capacity = 2; - public AwaitingTable(String formatName, String collectionType, LotroFormat lotroFormat, League league, LeagueSerie leagueSerie) { - _formatName = formatName; - _collectionType = collectionType; + public AwaitingTable(LotroFormat lotroFormat, CollectionType collectionType, League league, LeagueSerie leagueSerie) { _lotroFormat = lotroFormat; + _collectionType = collectionType; _league = league; _leagueSerie = leagueSerie; } @@ -47,11 +46,7 @@ public class AwaitingTable { return Collections.unmodifiableSet(new HashSet(_players.values())); } - public String getFormatName() { - return _formatName; - } - - public String getCollectionType() { + public CollectionType getCollectionType() { return _collectionType; } diff --git a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/hall/HallServer.java b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/hall/HallServer.java index 718176129..0dccb7ab0 100644 --- a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/hall/HallServer.java +++ b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/hall/HallServer.java @@ -3,6 +3,7 @@ package com.gempukku.lotro.hall; import com.gempukku.lotro.AbstractServer; import com.gempukku.lotro.chat.ChatServer; import com.gempukku.lotro.db.CollectionDAO; +import com.gempukku.lotro.db.vo.CollectionType; import com.gempukku.lotro.db.vo.League; import com.gempukku.lotro.db.vo.LeagueSerie; import com.gempukku.lotro.game.*; @@ -20,9 +21,7 @@ public class HallServer extends AbstractServer { private CollectionDAO _collectionDao; private LotroServer _lotroServer; - private Map _supportedFormatNames = new LinkedHashMap(); - private Map _supportedFormats = new HashMap(); - private Map _formatCollectionIds = new HashMap(); + private Map _supportedFormats = new LinkedHashMap(); // TODO Reading/writing from/to these maps is done in multiple threads private Map _awaitingTables = new ConcurrentHashMap(); @@ -36,6 +35,8 @@ public class HallServer extends AbstractServer { private String _motd; + private CollectionType _allCardsCollectionType = new CollectionType("default", "All cards"); + public HallServer(LotroServer lotroServer, ChatServer chatServer, LeagueService leagueService, LotroCardBlueprintLibrary library, CollectionDAO collectionDao, boolean test) { _lotroServer = lotroServer; _chatServer = chatServer; @@ -44,18 +45,18 @@ public class HallServer extends AbstractServer { _collectionDao = collectionDao; _chatServer.createChatRoom("Game Hall", 10); - addFormat("fotr_block", "Fellowship block", "default", new FotRBlockFormat(library, false)); - addFormat("c_fotr_block", "Community Fellowship block", "default", new FotRBlockFormat(library, true)); - addFormat("ttt_block", "Two Towers block", "default", new TTTBlockFormat(library, false)); - addFormat("c_ttt_block", "Community Two Towers block", "default", new TTTBlockFormat(library, true)); - addFormat("towers_standard", "Towers Standard", "default", new TowersStandardFormat(library)); - addFormat("king_block", "King block", "default", new KingBlockFormat(library, false)); - addFormat("c_king_block", "Community King block", "default", new KingBlockFormat(library, true)); - addFormat("movie", "Movie block", "default", new MovieFormat(library)); - addFormat("war_block", "War of the Ring block", "default", new WarOfTheRingBlockFormat(library, false)); - addFormat("c_war_block", "Community War of the Ring block", "default", new WarOfTheRingBlockFormat(library, true)); - addFormat("open", "Open", "default", new OpenFormat(library)); - addFormat("expanded", "Expanded", "default", new ExpandedFormat(library)); + addFormat("fotr_block", new FotRBlockFormat(library, false)); + addFormat("c_fotr_block", new FotRBlockFormat(library, true)); + addFormat("ttt_block", new TTTBlockFormat(library, false)); + addFormat("c_ttt_block", new TTTBlockFormat(library, true)); + addFormat("towers_standard", new TowersStandardFormat(library)); + addFormat("king_block", new KingBlockFormat(library, false)); + addFormat("c_king_block", new KingBlockFormat(library, true)); + addFormat("movie", new MovieFormat(library)); + addFormat("war_block", new WarOfTheRingBlockFormat(library, false)); + addFormat("c_war_block", new WarOfTheRingBlockFormat(library, true)); + addFormat("open", new OpenFormat(library)); + addFormat("expanded", new ExpandedFormat(library)); // addFormat("whatever", "Format for testing", "default", new FreeFormat(library)); } @@ -68,9 +69,7 @@ public class HallServer extends AbstractServer { _motd = motd; } - private void addFormat(String formatCode, String formatName, String formatCollectionId, LotroFormat format) { - _supportedFormatNames.put(formatCode, formatName); - _formatCollectionIds.put(formatCode, formatCollectionId); + private void addFormat(String formatCode, LotroFormat format) { _supportedFormats.put(formatCode, format); } @@ -78,12 +77,8 @@ public class HallServer extends AbstractServer { return _awaitingTables.size() + _runningTables.size(); } - public Map getSupportedFormatNames() { - return Collections.unmodifiableMap(_supportedFormatNames); - } - - public LotroFormat getSupportedFormat(String formatId) { - return _supportedFormats.get(formatId); + public Map getSupportedFormats() { + return Collections.unmodifiableMap(_supportedFormats); } public Set getRunningLeagues() { @@ -96,11 +91,8 @@ public class HallServer extends AbstractServer { public synchronized void createNewTable(String type, Player player, String deckName) throws HallException { League league = null; LeagueSerie leagueSerie = null; - String collectionType = _formatCollectionIds.get(type); + CollectionType collectionType = _allCardsCollectionType; LotroFormat format = _supportedFormats.get(type); - String formatName = null; - if (format != null) - formatName = _supportedFormatNames.get(type); if (format == null) { // Maybe it's a league format? @@ -110,8 +102,7 @@ public class HallServer extends AbstractServer { if (leagueSerie == null) throw new HallException("There is no ongoing serie for that league"); format = _supportedFormats.get(leagueSerie.getFormat()); - formatName = _supportedFormatNames.get(leagueSerie.getFormat()); - collectionType = league.getType(); + collectionType = league.getCollectionType(); } } // It's not a normal format and also not a league one @@ -121,13 +112,13 @@ public class HallServer extends AbstractServer { LotroDeck lotroDeck = validateUserAndDeck(format, player, deckName, collectionType); String tableId = String.valueOf(_nextTableId++); - AwaitingTable table = new AwaitingTable(formatName, collectionType, format, league, leagueSerie); + AwaitingTable table = new AwaitingTable(format, collectionType, league, leagueSerie); _awaitingTables.put(tableId, table); joinTableInternal(tableId, player.getName(), table, deckName, lotroDeck); } - private LotroDeck validateUserAndDeck(LotroFormat format, Player player, String deckName, String collectionType) throws HallException { + private LotroDeck validateUserAndDeck(LotroFormat format, Player player, String deckName, CollectionType collectionType) throws HallException { if (isPlayerBusy(player.getName())) throw new HallException("You can't play more than one game at a time or wait at more than one table"); @@ -142,7 +133,7 @@ public class HallServer extends AbstractServer { } // Now check if player owns all the cards - CardCollection collection = _collectionDao.getCollectionForPlayer(player, collectionType); + CardCollection collection = _collectionDao.getCollectionForPlayer(player, collectionType.getCode()); Map deckCardCounts = CollectionUtils.getTotalCardCountForDeck(lotroDeck); final Map collectionCardCounts = collection.getAll(); @@ -184,13 +175,13 @@ public class HallServer extends AbstractServer { Set players = awaitingTable.getPlayers(); LotroGameParticipant[] participants = players.toArray(new LotroGameParticipant[players.size()]); League league = awaitingTable.getLeague(); - String gameId = _lotroServer.createNewGame(awaitingTable.getLotroFormat(), awaitingTable.getFormatName(), participants, league != null); + String gameId = _lotroServer.createNewGame(awaitingTable.getLotroFormat(), participants, league != null); LotroGameMediator lotroGameMediator = _lotroServer.getGameById(gameId); if (league != null) _leagueService.leagueGameStarting(league, awaitingTable.getLeagueSerie(), lotroGameMediator); lotroGameMediator.startGame(); _runningTables.put(tableId, gameId); - _runningTableFormatNames.put(tableId, awaitingTable.getFormatName()); + _runningTableFormatNames.put(tableId, awaitingTable.getLotroFormat().getName()); _awaitingTables.remove(tableId); } @@ -218,7 +209,7 @@ public class HallServer extends AbstractServer { Map copy = new HashMap(_awaitingTables); for (Map.Entry table : copy.entrySet()) - visitor.visitTable(table.getKey(), null, "Waiting", table.getValue().getFormatName(), table.getValue().getPlayerNames(), null); + visitor.visitTable(table.getKey(), null, "Waiting", table.getValue().getLotroFormat().getName(), table.getValue().getPlayerNames(), null); Map runningCopy = new LinkedHashMap(_runningTables); for (Map.Entry runningGame : runningCopy.entrySet()) { diff --git a/gemp-lotr/gemp-lotr-web/src/main/java/com/gempukku/lotro/server/DeckResource.java b/gemp-lotr/gemp-lotr-web/src/main/java/com/gempukku/lotro/server/DeckResource.java index 7c7a8d3e9..1fc74553b 100644 --- a/gemp-lotr/gemp-lotr-web/src/main/java/com/gempukku/lotro/server/DeckResource.java +++ b/gemp-lotr/gemp-lotr-web/src/main/java/com/gempukku/lotro/server/DeckResource.java @@ -20,7 +20,6 @@ import javax.xml.parsers.ParserConfigurationException; import java.util.ArrayList; import java.util.Collections; import java.util.List; -import java.util.Map; @Singleton @Path("/deck") @@ -157,14 +156,12 @@ public class DeckResource extends AbstractResource { StringBuilder sb = new StringBuilder(); sb.append("Free People: " + fpCount + ", Shadow: " + shadowCount + "
"); - for (Map.Entry supportedFormats : _hallServer.getSupportedFormatNames().entrySet()) { - String formatName = supportedFormats.getValue(); - LotroFormat format = _hallServer.getSupportedFormat(supportedFormats.getKey()); + for (LotroFormat format : _hallServer.getSupportedFormats().values()) { try { format.validateDeck(resourceOwner, deck); - sb.append("" + formatName + ": valid
"); + sb.append("" + format.getName() + ": valid
"); } catch (DeckInvalidException exp) { - sb.append("" + formatName + ": " + exp.getMessage() + "
"); + sb.append("" + format.getName() + ": " + exp.getMessage() + "
"); } } diff --git a/gemp-lotr/gemp-lotr-web/src/main/java/com/gempukku/lotro/server/HallResource.java b/gemp-lotr/gemp-lotr-web/src/main/java/com/gempukku/lotro/server/HallResource.java index 086f1ac64..9ce6edba5 100644 --- a/gemp-lotr/gemp-lotr-web/src/main/java/com/gempukku/lotro/server/HallResource.java +++ b/gemp-lotr/gemp-lotr-web/src/main/java/com/gempukku/lotro/server/HallResource.java @@ -1,6 +1,7 @@ package com.gempukku.lotro.server; import com.gempukku.lotro.db.vo.League; +import com.gempukku.lotro.game.LotroFormat; import com.gempukku.lotro.game.Player; import com.gempukku.lotro.hall.HallException; import com.gempukku.lotro.hall.HallInfoVisitor; @@ -45,10 +46,10 @@ public class HallResource extends AbstractResource { hall.setAttribute("motd", motd); _hallServer.processTables(resourceOwner, new SerializeHallInfoVisitor(doc, hall)); - for (Map.Entry format : _hallServer.getSupportedFormatNames().entrySet()) { + for (Map.Entry format : _hallServer.getSupportedFormats().entrySet()) { Element formatElem = doc.createElement("format"); formatElem.setAttribute("type", format.getKey()); - formatElem.appendChild(doc.createTextNode(format.getValue())); + formatElem.appendChild(doc.createTextNode(format.getValue().getName())); hall.appendChild(formatElem); } for (League league : _hallServer.getRunningLeagues()) {