diff --git a/gemp-lotr/gemp-lotr-async/src/main/java/com/gempukku/lotro/async/handler/HallRequestHandler.java b/gemp-lotr/gemp-lotr-async/src/main/java/com/gempukku/lotro/async/handler/HallRequestHandler.java
index 39e2dc7bc..8cb8561bd 100644
--- a/gemp-lotr/gemp-lotr-async/src/main/java/com/gempukku/lotro/async/handler/HallRequestHandler.java
+++ b/gemp-lotr/gemp-lotr-async/src/main/java/com/gempukku/lotro/async/handler/HallRequestHandler.java
@@ -130,11 +130,27 @@ public class HallRequestHandler extends LotroServerRequestHandler implements Uri
String deckName = getFormParameterSafely(postDecoder, "deckName");
String timer = getFormParameterSafely(postDecoder, "timer");
String desc = getFormParameterSafely(postDecoder, "desc");
+ String isPrivateVal = getFormParameterSafely(postDecoder, "isPrivate");
+ boolean isPrivate = (isPrivateVal != null ? Boolean.valueOf(isPrivateVal) : false);
Player resourceOwner = getResourceOwnerSafely(request, participantId);
+ if(isPrivate) {
+ if(desc.length()==0) {
+ responseWriter.writeXmlResponse(marshalException(new HallException("Private games must have your intended opponent in the description")));
+ return;
+ }
+
+ if(desc.equalsIgnoreCase(resourceOwner.getName())) {
+ responseWriter.writeXmlResponse(marshalException(new HallException("Absolutely no playing with yourself!! Private matches must be with someone else.")));
+ return;
+ }
+ }
+
+
+
try {
- _hallServer.createNewTable(format, resourceOwner, deckName, timer, desc);
+ _hallServer.createNewTable(format, resourceOwner, deckName, timer, desc, isPrivate);
responseWriter.writeXmlResponse(null);
}
catch (HallException e) {
@@ -142,7 +158,7 @@ public class HallRequestHandler extends LotroServerRequestHandler implements Uri
{
//try again assuming it's a new player with one of the default library decks selected
Player librarian = _playerDao.getPlayer("Librarian");
- _hallServer.spoofNewTable(format, resourceOwner, librarian, deckName, timer, "(New Player) " + desc);
+ _hallServer.spoofNewTable(format, resourceOwner, librarian, deckName, timer, "(New Player) " + desc, isPrivate);
responseWriter.writeXmlResponse(null);
}
catch (HallException ex) { }
diff --git a/gemp-lotr/gemp-lotr-async/src/main/web/css/gemp-001/hall.css b/gemp-lotr/gemp-lotr-async/src/main/web/css/gemp-001/hall.css
index 206a14252..44ae8eef4 100644
--- a/gemp-lotr/gemp-lotr-async/src/main/web/css/gemp-001/hall.css
+++ b/gemp-lotr/gemp-lotr-async/src/main/web/css/gemp-001/hall.css
@@ -387,4 +387,22 @@ a:visited {
display: flex;
gap: 4px;
margin: 1px;
+}
+
+#createTableBut {
+ min-width: 95px;
+}
+
+#supportedFormatsSelect {
+ min-width: 150px;
+}
+
+#decksSelect {
+ min-width: 220px;
+ flex-grow:2;
+}
+
+#tableDescInput {
+ min-width: 150px;
+ flex-grow: 1;
}
\ No newline at end of file
diff --git a/gemp-lotr/gemp-lotr-async/src/main/web/hall.html b/gemp-lotr/gemp-lotr-async/src/main/web/hall.html
index 035110364..cf7008631 100644
--- a/gemp-lotr/gemp-lotr-async/src/main/web/hall.html
+++ b/gemp-lotr/gemp-lotr-async/src/main/web/hall.html
@@ -280,13 +280,13 @@
diff --git a/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/communication.js b/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/communication.js
index 943e0fdf2..28d801da6 100644
--- a/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/communication.js
+++ b/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/communication.js
@@ -640,7 +640,7 @@ var GempLotrCommunication = Class.extend({
dataType:"xml"
});
},
- createTable:function (format, deckName, timer, desc, callback, errorMap) {
+ createTable:function (format, deckName, timer, desc, isPrivate, callback, errorMap) {
$.ajax({
type:"POST",
url:this.url + "/hall",
@@ -650,6 +650,7 @@ var GempLotrCommunication = Class.extend({
deckName:deckName,
timer:timer,
desc:desc,
+ isPrivate:isPrivate,
participantId:getUrlParam("participantId")},
success:this.deliveryCheck(callback),
error:this.errorCheck(errorMap),
diff --git a/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/hallUi.js b/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/hallUi.js
index 276454254..b8b79bc96 100644
--- a/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/hallUi.js
+++ b/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/hallUi.js
@@ -7,6 +7,7 @@ var GempLotrHallUI = Class.extend({
tableDescInput:null,
timerSelect:null,
createTableButton:null,
+ isPrivateCheckbox:null,
tablesDiv:null,
buttonsDiv:null,
@@ -36,6 +37,7 @@ var GempLotrHallUI = Class.extend({
this.tablesDiv = $("#tablesDiv");
this.tableDescInput = $("#tableDescInput");
+ this.isPrivateCheckbox = $("#isPrivateCheckbox");
var hallSettingsStr = $.cookie("hallSettings");
if (hallSettingsStr == null)
@@ -69,9 +71,10 @@ var GempLotrHallUI = Class.extend({
var deck = that.decksSelect.val();
var tableDesc = that.tableDescInput.val();
var timer = that.timerSelect.val();
+ var isPrivate = that.isPrivateCheckbox.is(':checked');
if (deck != null)
console.log("creating table");
- that.comm.createTable(format, deck, timer, tableDesc, function (xml) {
+ that.comm.createTable(format, deck, timer, tableDesc, isPrivate, function (xml) {
console.log("received table response");
that.processResponse(xml);
});
@@ -406,6 +409,7 @@ var GempLotrHallUI = Class.extend({
var formatName = table.getAttribute("format");
var tournamentName = table.getAttribute("tournament");
var userDesc = table.getAttribute("userDescription");
+ var isPrivate = (table.getAttribute("isPrivate") === "true");
var players = new Array();
if (playersAttr.length > 0)
players = playersAttr.split(",");
@@ -418,7 +422,14 @@ var GempLotrHallUI = Class.extend({
var name = "
" + tournamentName;
if(!!userDesc)
{
- name += " - [" + userDesc + "]";
+ if(isPrivate)
+ {
+ name += " - Private match for user '" + userDesc + "'.";
+ }
+ else
+ {
+ name += " - [" + userDesc + "]";
+ }
}
name += " | ";
row.append(name);
@@ -445,7 +456,8 @@ var GempLotrHallUI = Class.extend({
};
})(id));
lastField.append(but);
- } else {
+ }
+ else if(!isPrivate || userDesc === chat.userName) {
var that = this;
var but = $("");
diff --git a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/hall/GameSettings.java b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/hall/GameSettings.java
index 6b1b77d49..bceb21b22 100644
--- a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/hall/GameSettings.java
+++ b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/hall/GameSettings.java
@@ -16,10 +16,11 @@ public class GameSettings {
private final int maxSecondsPerPlayer;
private final int maxSecondsPerDecision;
private final String userDescription;
+ private final boolean isPrivate;
public GameSettings(CollectionType collectionType, LotroFormat lotroFormat, League league, LeagueSerieData leagueSerie,
boolean competitive, boolean privateGame, String timerName, int maxSecondsPerPlayer, int maxSecondsPerDecision,
- String description) {
+ String description, boolean isPrivate) {
this.collectionType = collectionType;
this.lotroFormat = lotroFormat;
this.league = league;
@@ -30,6 +31,7 @@ public class GameSettings {
this.maxSecondsPerPlayer = maxSecondsPerPlayer;
this.maxSecondsPerDecision = maxSecondsPerDecision;
this.userDescription = description;
+ this.isPrivate = isPrivate;
}
public CollectionType getCollectionType() {
@@ -69,4 +71,6 @@ public class GameSettings {
}
public String getUserDescription() { return userDescription; }
+
+ public boolean isUserPrivateGame() { return isPrivate; }
}
diff --git a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/hall/HallCommunicationChannel.java b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/hall/HallCommunicationChannel.java
index 48846fb55..9221d96c0 100644
--- a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/hall/HallCommunicationChannel.java
+++ b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/hall/HallCommunicationChannel.java
@@ -81,7 +81,7 @@ public class HallCommunicationChannel implements LongPollableResource {
}
@Override
- public void visitTable(String tableId, String gameId, boolean watchable, TableStatus status, String statusDescription, String formatName, String tournamentName, String userDesc, List playerIds, boolean playing, String winner) {
+ public void visitTable(String tableId, String gameId, boolean watchable, TableStatus status, String statusDescription, String formatName, String tournamentName, String userDesc, List playerIds, boolean playing, boolean isPrivate, String winner) {
Map props = new HashMap<>();
props.put("gameId", gameId);
props.put("watchable", String.valueOf(watchable));
@@ -89,6 +89,7 @@ public class HallCommunicationChannel implements LongPollableResource {
props.put("statusDescription", statusDescription);
props.put("format", formatName);
props.put("userDescription", userDesc);
+ props.put("isPrivate", String.valueOf(isPrivate));
props.put("tournament", tournamentName);
props.put("players", StringUtils.join(playerIds, ","));
props.put("playing", String.valueOf(playing));
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 90298dc4f..1d54ba0ac 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
@@ -11,7 +11,7 @@ public interface HallInfoVisitor {
public void motd(String motd);
- public void visitTable(String tableId, String gameId, boolean watchable, TableStatus status, String statusDescription, String formatName, String tournamentName, String userDesc, List playerIds, boolean playing, String winner);
+ public void visitTable(String tableId, String gameId, boolean watchable, TableStatus status, String statusDescription, String formatName, String tournamentName, String userDesc, List playerIds, boolean playing, boolean isPrivate, String winner);
public void visitTournamentQueue(String tournamentQueueKey, int cost, String collectionName, String formatName, String tournamentQueueName, String tournamentPrizes,
String pairingDescription, String startCondition, int playerCount, boolean playerSignedUp, boolean joinable);
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 1d20349ce..734d7a824 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
@@ -319,11 +319,11 @@ public class HallServer extends AbstractServer {
/**
* @return If table created, otherwise false (if the user already is sitting at a table or playing).
*/
- public void createNewTable(String type, Player player, String deckName, String timer, String description) throws HallException {
+ public void createNewTable(String type, Player player, String deckName, String timer, String description, boolean isPrivate) throws HallException {
if (_shutdown)
throw new HallException("Server is in shutdown mode. Server will be restarted after all running games are finished.");
- GameSettings gameSettings = createGameSettings(type, timer, description);
+ GameSettings gameSettings = createGameSettings(type, timer, description, isPrivate);
LotroDeck lotroDeck = validateUserAndDeck(gameSettings.getLotroFormat(), player, deckName, gameSettings.getCollectionType());
@@ -339,11 +339,11 @@ public class HallServer extends AbstractServer {
}
}
- public void spoofNewTable(String type, Player player, Player librarian, String deckName, String timer, String description) throws HallException {
+ public void spoofNewTable(String type, Player player, Player librarian, String deckName, String timer, String description, boolean isPrivate) throws HallException {
if (_shutdown)
throw new HallException("Server is in shutdown mode. Server will be restarted after all running games are finished.");
- GameSettings gameSettings = createGameSettings(type, timer, description);
+ GameSettings gameSettings = createGameSettings(type, timer, description, isPrivate);
LotroDeck lotroDeck = validateUserAndDeck(gameSettings.getLotroFormat(), librarian, deckName, gameSettings.getCollectionType());
@@ -359,7 +359,7 @@ public class HallServer extends AbstractServer {
}
}
- private GameSettings createGameSettings(String type, String timer, String description) throws HallException {
+ private GameSettings createGameSettings(String type, String timer, String description, boolean isPrivate) throws HallException {
League league = null;
LeagueSerieData leagueSerie = null;
CollectionType collectionType = _defaultCollectionType;
@@ -374,6 +374,10 @@ public class HallServer extends AbstractServer {
if (leagueSerie == null)
throw new HallException("There is no ongoing serie for that league");
+ if(isPrivate) {
+ throw new HallException("League games cannot be private");
+ }
+
format = _formatLibrary.getFormat(leagueSerie.getFormat());
collectionType = leagueSerie.getCollectionType();
@@ -385,7 +389,7 @@ public class HallServer extends AbstractServer {
throw new HallException("This format is not supported: " + type);
return new GameSettings(collectionType, format, league, leagueSerie,
- league != null, gameTimer.isLongGame(), gameTimer.getName(), gameTimer.getMaxSecondsPerPlayer(), gameTimer.getMaxSecondsPerDecision(), description);
+ league != null, gameTimer.isLongGame(), gameTimer.getName(), gameTimer.getMaxSecondsPerPlayer(), gameTimer.getMaxSecondsPerDecision(), description, isPrivate);
}
private GameTimer resolveTimer(String timer) {
@@ -812,7 +816,7 @@ public class HallServer extends AbstractServer {
private HallTournamentCallback(Tournament tournament) {
_tournament = tournament;
tournamentGameSettings = new GameSettings(null, _formatLibrary.getFormat(_tournament.getFormat()),
- null, null, true, false, "Tournament", 60 * 40, 60 * 5, null);
+ null, null, true, false, "Tournament", 60 * 40, 60 * 5, null, false);
}
@Override
diff --git a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/hall/TableHolder.java b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/hall/TableHolder.java
index e804245ce..f5cb4955d 100644
--- a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/hall/TableHolder.java
+++ b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/hall/TableHolder.java
@@ -177,7 +177,7 @@ public class TableHolder {
players = table.getPlayerNames();
if (isAdmin || isNoIgnores(players, player.getName()))
- visitor.visitTable(tableInformation.getKey(), null, false, HallInfoVisitor.TableStatus.WAITING, "Waiting", table.getGameSettings().getLotroFormat().getName(), getTournamentName(table), table.getGameSettings().getUserDescription(), players, table.getPlayerNames().contains(player.getName()), null);
+ visitor.visitTable(tableInformation.getKey(), null, false, HallInfoVisitor.TableStatus.WAITING, "Waiting", table.getGameSettings().getLotroFormat().getName(), getTournamentName(table), table.getGameSettings().getUserDescription(), players, table.getPlayerNames().contains(player.getName()), table.getGameSettings().isUserPrivateGame(), null);
}
// Then non-finished
@@ -192,7 +192,7 @@ public class TableHolder {
if (lotroGameMediator.isFinished())
finishedTables.put(runningGame.getKey(), runningTable);
else
- visitor.visitTable(runningGame.getKey(), lotroGameMediator.getGameId(), isAdmin || lotroGameMediator.isAllowSpectators(), HallInfoVisitor.TableStatus.PLAYING, lotroGameMediator.getGameStatus(), runningTable.getGameSettings().getLotroFormat().getName(), getTournamentName(runningTable), runningTable.getGameSettings().getUserDescription(), lotroGameMediator.getPlayersPlaying(), lotroGameMediator.getPlayersPlaying().contains(player.getName()), lotroGameMediator.getWinner());
+ visitor.visitTable(runningGame.getKey(), lotroGameMediator.getGameId(), isAdmin || lotroGameMediator.isAllowSpectators(), HallInfoVisitor.TableStatus.PLAYING, lotroGameMediator.getGameStatus(), runningTable.getGameSettings().getLotroFormat().getName(), getTournamentName(runningTable), runningTable.getGameSettings().getUserDescription(), lotroGameMediator.getPlayersPlaying(), lotroGameMediator.getPlayersPlaying().contains(player.getName()), runningTable.getGameSettings().isUserPrivateGame(), lotroGameMediator.getWinner());
if (!lotroGameMediator.isFinished() && lotroGameMediator.getPlayersPlaying().contains(player.getName()))
visitor.runningPlayerGame(lotroGameMediator.getGameId());
@@ -206,7 +206,7 @@ public class TableHolder {
LotroGameMediator lotroGameMediator = runningTable.getLotroGameMediator();
if (lotroGameMediator != null) {
if (isAdmin || isNoIgnores(lotroGameMediator.getPlayersPlaying(), player.getName()))
- visitor.visitTable(nonPlayingGame.getKey(), lotroGameMediator.getGameId(), false, HallInfoVisitor.TableStatus.FINISHED, lotroGameMediator.getGameStatus(), runningTable.getGameSettings().getLotroFormat().getName(), getTournamentName(runningTable), runningTable.getGameSettings().getUserDescription(), lotroGameMediator.getPlayersPlaying(), lotroGameMediator.getPlayersPlaying().contains(player.getName()), lotroGameMediator.getWinner());
+ visitor.visitTable(nonPlayingGame.getKey(), lotroGameMediator.getGameId(), false, HallInfoVisitor.TableStatus.FINISHED, lotroGameMediator.getGameStatus(), runningTable.getGameSettings().getLotroFormat().getName(), getTournamentName(runningTable), runningTable.getGameSettings().getUserDescription(), lotroGameMediator.getPlayersPlaying(), lotroGameMediator.getPlayersPlaying().contains(player.getName()), runningTable.getGameSettings().isUserPrivateGame(), lotroGameMediator.getWinner());
}
}
}