Bugfix - max player validation; Added - weekly draft tournament; Removed - immediately recurring constructed queues

This commit is contained in:
jakub.salavec
2025-06-16 18:42:05 +02:00
parent 1c24354e52
commit 2ca0a58066
7 changed files with 50 additions and 16 deletions

View File

@@ -249,7 +249,7 @@ public class TournamentRequestHandler extends LotroServerRequestHandler implemen
var tableDraftDefinition = _tableDraftLibrary.getTableDraftDefinition(tableDraftFormatCodeStr);
Throw400IfValidationFails("tableDraftFormatCode", tableDraftFormatCodeStr,tableDraftDefinition != null);
//Check if all players can get to one table
Throw400IfValidationFails("maxPlayers", maxPlayersStr, tableDraftDefinition.getMaxPlayers() > maxPlayers);
Throw400IfValidationFails("maxPlayers", maxPlayersStr, tableDraftDefinition.getMaxPlayers() >= maxPlayers);
tableDraftParams.tableDraftFormatCode = tableDraftFormatCodeStr;
tableDraftParams.format = tableDraftDefinition.getFormat();
tableDraftParams.draftTimerType = DraftTimer.getTypeFromString(tableDraftTimer);

View File

@@ -915,6 +915,7 @@ var GempLotrHallUI = Class.extend({
startTd +
systemTd +
playersTd +
costPrizesTds +
"</tr>";
} else {

View File

@@ -107,7 +107,7 @@ public class HallCommunicationChannel implements LongPollableResource {
@Override
public void visitTournamentQueue(String tournamentQueueKey, int cost, String collectionName, String formatName, String type, String tournamentQueueName,
String tournamentPrizes, String pairingDescription, String startCondition, int playerCount, String playerList, boolean playerSignedUp,
boolean joinable, boolean startable, int readyCheckSecsRemaining, boolean confirmedReadyCheck, boolean wc) {
boolean joinable, boolean startable, int readyCheckSecsRemaining, boolean confirmedReadyCheck, boolean wc, String draftCode) {
Map<String, String> props = new HashMap<>();
props.put("cost", String.valueOf(cost));
props.put("collection", collectionName);
@@ -125,8 +125,8 @@ public class HallCommunicationChannel implements LongPollableResource {
props.put("readyCheckSecsRemaining", String.valueOf(readyCheckSecsRemaining));
props.put("confirmedReadyCheck", String.valueOf(confirmedReadyCheck));
props.put("wc", String.valueOf(wc));
if (tournamentQueueKey.contains("table")) {
props.put("draftCode", tournamentQueueKey.replace("_queue", ""));
if (draftCode != null) {
props.put("draftCode", draftCode);
}
tournamentQueuesOnServer.put(tournamentQueueKey, props);

View File

@@ -15,7 +15,7 @@ public interface HallInfoVisitor {
public void visitTournamentQueue(String tournamentQueueKey, int cost, String collectionName, String formatName, String type, String tournamentQueueName, String tournamentPrizes,
String pairingDescription, String startCondition, int playerCount, String playerList, boolean playerSignedUp, boolean joinable, boolean startable,
int readyCheckSecsRemaining, boolean confirmedReadyCheck, boolean wc);
int readyCheckSecsRemaining, boolean confirmedReadyCheck, boolean wc, String draftCode);
public void visitTournament(String tournamentKey, String collectionName, String formatName, String tournamentName, String type,
String pairingDescription, String tournamentStage, int round, int playerCount, String playerList, boolean playerInCompetition, boolean abandoned, boolean joinable,

View File

@@ -420,4 +420,12 @@ public abstract class AbstractTournamentQueue implements TournamentQueue {
public boolean isWC() {
return _tournamentInfo._params.wc;
}
@Override
public String getDraftCode() {
if (_tournamentInfo instanceof TableDraftTournamentInfo) {
return ((TableDraftTournamentInfo) _tournamentInfo).tableDraftDefinition.getCode();
}
return null;
}
}

View File

@@ -54,4 +54,6 @@ public interface TournamentQueue {
boolean hasConfirmedReadyCheck(String player);
boolean isWC();
String getDraftCode();
}

View File

@@ -7,6 +7,7 @@ import com.gempukku.lotro.common.DBDefs;
import com.gempukku.lotro.db.GameHistoryDAO;
import com.gempukku.lotro.db.vo.CollectionType;
import com.gempukku.lotro.draft2.SoloDraftDefinitions;
import com.gempukku.lotro.draft3.TableDraftDefinition;
import com.gempukku.lotro.draft3.TableDraftDefinitions;
import com.gempukku.lotro.game.LotroCardBlueprintLibrary;
import com.gempukku.lotro.game.Player;
@@ -71,16 +72,6 @@ public class TournamentService {
return Tournament.getPairingMechanism(pairing);
}
private void addImmediateRecurringQueue(String queueId, String queueName, String prefix, String formatCode) {
TournamentQueueCallback callback = tournament -> _activeTournaments.put(tournament.getTournamentId(), tournament);
_tournamentQueues.put(queueId, new ImmediateRecurringQueue(this, queueId, queueName,
new TournamentInfo(this, _productLibrary, _formatLibrary, DateUtils.Today(),
new TournamentParams(prefix, queueName, formatCode, 1500, 4, Tournament.PairingType.SINGLE_ELIMINATION, Tournament.PrizeType.ON_DEMAND)),
callback, _collectionsManager)
);
}
private void addRecurringScheduledQueue(String queueId, String queueName, String time, String prefix, String formatCode) {
TournamentQueueCallback callback = tournament -> _activeTournaments.put(tournament.getTournamentId(), tournament);
@@ -90,6 +81,35 @@ public class TournamentService {
_tournamentRepeatPeriod, callback, _collectionsManager));
}
private void addRecurringScheduledTableDraft(String queueId, String queueName, String time, Duration repeatPeriod, String prefix, String formatCode, int minPlayers) {
TournamentQueueCallback callback = tournament -> _activeTournaments.put(tournament.getTournamentId(), tournament);
TableDraftTournamentParams draftParams = new TableDraftTournamentParams();
draftParams.type = Tournament.TournamentType.TABLE_DRAFT;
draftParams.deckbuildingDuration = 15;
draftParams.turnInDuration = 2;
TableDraftDefinition tableDraft = _tableDraftLibrary.getTableDraftDefinition(formatCode);
draftParams.tableDraftFormatCode = formatCode;
draftParams.format = tableDraft.getFormat();
draftParams.draftTimerType = tableDraft.getRecommendedTimer();
draftParams.requiresDeck = false;
draftParams.tournamentId = prefix;
draftParams.name = queueName;
draftParams.cost = 0;
draftParams.minimumPlayers = minPlayers;
draftParams.maximumPlayers = tableDraft.getMaxPlayers();
draftParams.playoff = Tournament.PairingType.SWISS_3;
draftParams.prizes = Tournament.PrizeType.DAILY;
_tournamentQueues.put(queueId, new RecurringScheduledQueue(this, queueId, queueName,
new TableDraftTournamentInfo(this, _productLibrary, _formatLibrary, DateUtils.ParseStringDate(time),
draftParams, _tableDraftLibrary), repeatPeriod, callback, _collectionsManager)
);
}
public void reloadTournaments(TableHolder tables) {
_tables = tables;
reloadQueues();
@@ -108,6 +128,9 @@ public class TournamentService {
addRecurringScheduledQueue("movie_daily_eu", "Daily Movie Block", "2013-01-16 19:30:00", "movieDailyEu-", "movie");
addRecurringScheduledQueue("movie_daily_us", "Daily Movie Block", "2013-01-17 00:30:00", "movieDailyUs-", "movie");
addRecurringScheduledTableDraft("weekly_fotr_draft", "Weekly FotR Live Draft", "2025-06-14 17:00:00",
Duration.ofDays(7), "weeklyFotrDraft-", "fotr_power_table_draft", 4);
} catch (DateTimeParseException exp) {
// Ignore, can't happen
System.out.println(exp);
@@ -136,7 +159,7 @@ public class TournamentService {
formatLibrary.getFormat(queue.getFormatCode()).getName(), queue.getInfo().Parameters().type.toString(), queue.getTournamentQueueName(),
queue.getPrizesDescription(), queue.getPairingDescription(), queue.getStartCondition(),
queue.getPlayerCount(), queue.getPlayerList(), queue.isPlayerSignedUp(player.getName()), queue.isJoinable(), queue.isStartable(player.getName()),
queue.getSecondsRemainingForReadyCheck(), queue.hasConfirmedReadyCheck(player.getName()), queue.isWC());
queue.getSecondsRemainingForReadyCheck(), queue.hasConfirmedReadyCheck(player.getName()), queue.isWC(), queue.getDraftCode());
}
for (var entry : _activeTournaments.entrySet()) {