Scheduled queue can only be joined 15 minutes in advance of the actual tournament start.

This commit is contained in:
marcins78@gmail.com
2013-01-06 04:10:05 +00:00
parent 8712e14c03
commit 23e874612a
7 changed files with 19 additions and 6 deletions

View File

@@ -72,7 +72,7 @@ public class HallCommunicationChannel {
@Override
public void visitTournamentQueue(String tournamentQueueKey, int cost, String collectionName, String formatName, String tournamentQueueName,
String tournamentPrizes, String pairingDescription, String startCondition, int playerCount, boolean playerSignedUp) {
String tournamentPrizes, String pairingDescription, String startCondition, int playerCount, boolean playerSignedUp, boolean joinable) {
Map<String, String> props = new HashMap<String, String>();
props.put("cost", String.valueOf(cost));
props.put("collection", collectionName);
@@ -83,6 +83,7 @@ public class HallCommunicationChannel {
props.put("system", pairingDescription);
props.put("start", startCondition);
props.put("signedUp", String.valueOf(playerSignedUp));
props.put("joinable", String.valueOf(joinable));
tournamentQueuesOnServer.put(tournamentQueueKey, props);
}

View File

@@ -16,7 +16,7 @@ public interface HallInfoVisitor {
public void visitTable(String tableId, String gameId, boolean watchable, TableStatus status, String statusDescription, String formatName, String tournamentName, List<String> playerIds, 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);
String pairingDescription, String startCondition, int playerCount, boolean playerSignedUp, boolean joinable);
public void visitTournament(String tournamentKey, String collectionName, String formatName, String tournamentName, String pairingDescription, String tournamentStage, int round, int playerCount, boolean playerInCompetition);

View File

@@ -354,7 +354,7 @@ public class HallServer extends AbstractServer {
visitor.visitTournamentQueue(tournamentQueueKey, tournamentQueue.getCost(), tournamentQueue.getCollectionType().getFullName(),
_formatLibrary.getFormat(tournamentQueue.getFormat()).getName(), tournamentQueue.getTournamentQueueName(),
tournamentQueue.getPrizesDescription(), tournamentQueue.getPairingDescription(), tournamentQueue.getStartCondition(),
tournamentQueue.getPlayerCount(), tournamentQueue.isPlayerSignedUp(player.getName()));
tournamentQueue.getPlayerCount(), tournamentQueue.isPlayerSignedUp(player.getName()), tournamentQueue.isJoinable());
}
for (Map.Entry<String, Tournament> tournamentEntry : _runningTournaments.entrySet()) {

View File

@@ -7,6 +7,7 @@ import com.gempukku.lotro.db.vo.CollectionType;
import java.util.Date;
public class ScheduledTournamentQueue extends AbstractTournamentQueue implements TournamentQueue {
private static final long _signupTimeBeforeStart = 1000 * 60 * 15; // 15 minutes before start
private long _startTime;
private int _minimumPlayers;
private String _startCondition;
@@ -81,7 +82,7 @@ public class ScheduledTournamentQueue extends AbstractTournamentQueue implements
long now = System.currentTimeMillis();
if (now > _startTime) {
if (_players.size() >= _minimumPlayers) {
for (String player : _players)
_tournamentService.addPlayer(_scheduledTournamentId, player, _playerDecks.get(player));
@@ -97,4 +98,9 @@ public class ScheduledTournamentQueue extends AbstractTournamentQueue implements
}
return false;
}
@Override
public boolean isJoinable() {
return System.currentTimeMillis() >= _startTime - _signupTimeBeforeStart;
}
}

View File

@@ -91,4 +91,8 @@ public class SingleEliminationRecurringQueue extends AbstractTournamentQueue imp
return false;
}
@Override
public boolean isJoinable() {
return true;
}
}

View File

@@ -33,4 +33,6 @@ public interface TournamentQueue {
public int getPlayerCount();
public boolean isPlayerSignedUp(String player);
public boolean isJoinable();
}

View File

@@ -392,7 +392,7 @@ var GempLotrHallUI = Class.extend({
var actionsField = $("<td></td>");
var joined = queue.getAttribute("signedUp");
if (joined != "true") {
if (joined != "true" && queue.getAttribute("joinable") == "true") {
var but = $("<button>Join queue</button>");
$(but).button().click((
function(queueId) {
@@ -406,7 +406,7 @@ var GempLotrHallUI = Class.extend({
}
)(id));
actionsField.append(but);
} else {
} else if (joined == "true") {
var but = $("<button>Leave queue</button>");
$(but).button().click((
function(queueId) {