diff --git a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/hall/HallInfoVisitor.java b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/hall/HallInfoVisitor.java index ceaf2c787..5ddb5337c 100644 --- a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/hall/HallInfoVisitor.java +++ b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/hall/HallInfoVisitor.java @@ -5,7 +5,7 @@ import java.util.Set; public interface HallInfoVisitor { public void playerIsWaiting(boolean waiting); - public void visitTable(String tableId, String gameId, String tableStatus, Set playerIds); + public void visitTable(String tableId, String gameId, String tableStatus, String formatName, Set playerIds); public void runningPlayerGame(String gameId); } 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 bb2671677..1cecfd27b 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 @@ -23,9 +23,12 @@ public class HallServer extends AbstractServer { private Map _supportedFormatNames = new HashMap(); private Map _supportedFormats = new HashMap(); + private Map _formatCollectionIds = new HashMap(); + // TODO Reading/writing from/to these maps is done in multiple threads private Map _awaitingTables = new ConcurrentHashMap(); private Map _runningTables = new ConcurrentHashMap(); + private Map _runningTableFormatNames = new ConcurrentHashMap(); private int _nextTableId = 1; private final int _playerInactivityPeriod = 1000 * 10; // 10 seconds @@ -41,9 +44,11 @@ public class HallServer extends AbstractServer { _supportedFormatNames.put("fotr_block", "FotR Block"); _supportedFormats.put("fotr_block", new FotRBlockFormat(_lotroServer.getLotroCardBlueprintLibrary())); + _formatCollectionIds.put("fotr_block", "default"); if (test) { _supportedFormatNames.put("m_fotr_block", "Modified FotR Block"); _supportedFormats.put("m_fotr_block", new ModifiedFotRBlockFormat(_lotroServer.getLotroCardBlueprintLibrary())); + _formatCollectionIds.put("m_fotr_block", "default"); } } @@ -96,7 +101,7 @@ public class HallServer extends AbstractServer { } Player player = _lotroServer.getPlayerDao().getPlayer(playerId); - CardCollection collection = _collectionDao.getCollectionForPlayer(player, type); + CardCollection collection = _collectionDao.getCollectionForPlayer(player, _formatCollectionIds.get(type)); // TODO check that player has cards in collection return lotroDeck; @@ -131,6 +136,7 @@ public class HallServer extends AbstractServer { LotroGameMediator lotroGameMediator = _lotroServer.getGameById(gameId); lotroGameMediator.startGame(); _runningTables.put(tableId, gameId); + _runningTableFormatNames.put(tableId, awaitingTable.getFormatName()); _awaitingTables.remove(tableId); } @@ -158,13 +164,13 @@ public class HallServer extends AbstractServer { Map copy = new HashMap(_awaitingTables); for (Map.Entry table : copy.entrySet()) - visitor.visitTable(table.getKey(), null, "Waiting", table.getValue().getPlayerNames()); + visitor.visitTable(table.getKey(), null, "Waiting", table.getValue().getFormatName(), table.getValue().getPlayerNames()); Map runningCopy = new LinkedHashMap(_runningTables); for (Map.Entry runningGame : runningCopy.entrySet()) { LotroGameMediator lotroGameMediator = _lotroServer.getGameById(runningGame.getValue()); if (lotroGameMediator != null) - visitor.visitTable(runningGame.getKey(), runningGame.getValue(), lotroGameMediator.getGameStatus(), lotroGameMediator.getPlayersPlaying()); + visitor.visitTable(runningGame.getKey(), runningGame.getValue(), lotroGameMediator.getGameStatus(), _runningTableFormatNames.get(runningGame.getKey()), lotroGameMediator.getPlayersPlaying()); } String playerTable = getNonFinishedPlayerTable(participantId); @@ -213,8 +219,10 @@ public class HallServer extends AbstractServer { // Remove finished games HashMap copy = new HashMap(_runningTables); for (Map.Entry runningTable : copy.entrySet()) { - if (_lotroServer.getGameById(runningTable.getValue()) == null) + if (_lotroServer.getGameById(runningTable.getValue()) == null) { _runningTables.remove(runningTable.getKey()); + _runningTableFormatNames.remove(runningTable.getKey()); + } } long currentTime = System.currentTimeMillis(); diff --git a/gemp-lotr/gemp-lotr-web/src/main/java/com/gempukku/lotro/server/ServerResource.java b/gemp-lotr/gemp-lotr-web/src/main/java/com/gempukku/lotro/server/ServerResource.java index d5ae1e580..6ced92ca7 100644 --- a/gemp-lotr/gemp-lotr-web/src/main/java/com/gempukku/lotro/server/ServerResource.java +++ b/gemp-lotr/gemp-lotr-web/src/main/java/com/gempukku/lotro/server/ServerResource.java @@ -594,12 +594,13 @@ public class ServerResource { } @Override - public void visitTable(String tableId, String gameId, String tableStatus, Set playerIds) { + public void visitTable(String tableId, String gameId, String tableStatus, String formatName, Set playerIds) { Element table = _doc.createElement("table"); table.setAttribute("id", tableId); if (gameId != null) table.setAttribute("gameId", gameId); table.setAttribute("status", tableStatus); + table.setAttribute("format", formatName); table.setAttribute("players", mergeStrings(playerIds)); _hall.appendChild(table); } diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/hall.html b/gemp-lotr/gemp-lotr-web/src/main/webapp/hall.html index 3a798bd08..2fed33665 100644 --- a/gemp-lotr/gemp-lotr-web/src/main/webapp/hall.html +++ b/gemp-lotr/gemp-lotr-web/src/main/webapp/hall.html @@ -12,6 +12,12 @@ background-color: #000000; } + .tableFormatName { + text-align: center; + font-style: oblique; + font-size: 120%; + } + .tableStatus { text-align: center; font-style: italic; diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/hallUi.js b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/hallUi.js index 86af47174..6c10f0238 100644 --- a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/hallUi.js +++ b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/hallUi.js @@ -102,11 +102,12 @@ var GempLotrHallUI = Class.extend({ var gameId = table.getAttribute("gameId"); var status = table.getAttribute("status"); var playersAttr = table.getAttribute("players"); + var formatName = table.getAttribute("format"); var players = new Array(); if (playersAttr.length > 0) players = playersAttr.split(","); - var tableDiv = this.createTableDiv(id, gameId, status, players, waiting); + var tableDiv = this.createTableDiv(id, gameId, status, formatName, players, waiting); this.tablesDiv.append(tableDiv); } @@ -148,9 +149,10 @@ var GempLotrHallUI = Class.extend({ } }, - createTableDiv: function(id, gameId, status, players, waiting) { + createTableDiv: function(id, gameId, status, formatName, players, waiting) { var tableDiv = $("
"); tableDiv.css({ display: "inline-block", width: "120px", height: "120px", margin: "5px", "background-color": "#333300", color: "#ffffff"}); + tableDiv.append("
" + formatName + "
"); tableDiv.append("
" + status + "
"); tableDiv.append("Players:
"); for (var i = 0; i < players.length; i++)