Tournaments 1v1 are not private, and they move to game faster if both players submitted a deck

This commit is contained in:
jakub.salavec
2025-02-19 14:59:58 +01:00
parent 8334e69867
commit 3609f3c735
4 changed files with 36 additions and 8 deletions

View File

@@ -416,20 +416,20 @@ var GempLotrHallUI = Class.extend({
if(result) { if(result) {
that.inTournament = true; that.inTournament = true;
let message = "You have signed up to participate in the <b>" + queueName let message = "You have signed up to participate in the <b>" + queueName
+ "</b> tournament.<br><br>You will use a snapshot of your '<b>" + deck +"</b>' deck as it is right now. " + + "</b> tournament.<br><br>You will use a snapshot of your '<b>" + deck +"</b>' deck as it is right now. " +
"If you need to change or update your deck, you will need to leave the queue and rejoin.<br><br>" + "If you need to change or update your deck, you will need to leave the queue and rejoin.<br><br>" +
"The first game begins at " + queueStart + ". Good luck!"; "The first game begins at " + queueStart + ". Good luck!";
if(type === "sealed") { if(type === "sealed") {
message = "You have signed up to participate in the <b>" + queueName message = "You have signed up to participate in the <b>" + queueName
+ "</b> tournament.<br><br>When the event begins, you will be issued sealed packs to open and make a deck. " + + "</b> tournament.<br><br>When the event begins, you will be issued sealed packs to open and make a deck. " +
"At any time during the deckbuilding phase and for a short time after it ends, you will need to lock-in your deck before the tournament begins.<br><br>" + "At any time during the deckbuilding phase and for a short time after it ends, you will need to lock-in your deck before the tournament begins.<br><br>" +
"Deckbuilding begins at " + queueStart + ". Good luck!"; "Deckbuilding begins at " + queueStart + ". Good luck!";
} }
if(type === "solodraft") { if(type === "solodraft") {
message = "You have signed up to participate in the <b>" + queueName message = "You have signed up to participate in the <b>" + queueName
+ "</b> tournament.<br><br>When the event begins, use the 'Go to Draft' button in the Active Tournaments Section, and then build your deck in the Deck Builder." + + "</b> tournament.<br><br>When the event begins, use the 'Go to Draft' button in the Active Tournaments Section, and then build your deck in the Deck Builder. " +
"At any time during the deckbuilding phase and for a short time after it ends, you will need to lock-in your deck before the tournament begins.<br><br>" + "At any time during the deckbuilding phase and for a short time after it ends, you will need to lock-in your deck before the tournament begins.<br><br>" +
"Deckbuilding begins at " + queueStart + ". Good luck!"; "Deckbuilding begins at " + queueStart + ". Good luck!";
} }

View File

@@ -867,8 +867,10 @@ public class HallServer extends AbstractServer {
private HallTournamentCallback(Tournament tournament) { private HallTournamentCallback(Tournament tournament) {
tournamentId = tournament.getTournamentId(); tournamentId = tournament.getTournamentId();
tournamentName = tournament.getTournamentName(); tournamentName = tournament.getTournamentName();
// Tournaments with just 2 players can be spectated
boolean privateGame = tournament.getPlayersInCompetitionCount() != 2;
tournamentGameSettings = new GameSettings(null, _formatLibrary.getFormat(tournament.getFormatCode()), tournamentGameSettings = new GameSettings(null, _formatLibrary.getFormat(tournament.getFormatCode()),
tournamentId, null, null, true, true, false, tournamentId, null, null, true, privateGame, false,
false, GameTimer.TOURNAMENT_TIMER, null); false, GameTimer.TOURNAMENT_TIMER, null);
wcGameSettings = new GameSettings(null, _formatLibrary.getFormat(tournament.getFormatCode()), wcGameSettings = new GameSettings(null, _formatLibrary.getFormat(tournament.getFormatCode()),

View File

@@ -7,10 +7,8 @@ import com.gempukku.lotro.draft.Draft;
import com.gempukku.lotro.draft2.SoloDraftDefinitions; import com.gempukku.lotro.draft2.SoloDraftDefinitions;
import com.gempukku.lotro.game.CardCollection; import com.gempukku.lotro.game.CardCollection;
import com.gempukku.lotro.game.DefaultCardCollection; import com.gempukku.lotro.game.DefaultCardCollection;
import com.gempukku.lotro.game.Player;
import com.gempukku.lotro.game.formats.LotroFormatLibrary; import com.gempukku.lotro.game.formats.LotroFormatLibrary;
import com.gempukku.lotro.hall.TableHolder; import com.gempukku.lotro.hall.TableHolder;
import com.gempukku.lotro.league.LeagueSerieInfo;
import com.gempukku.lotro.logic.vo.LotroDeck; import com.gempukku.lotro.logic.vo.LotroDeck;
import com.gempukku.lotro.packs.ProductLibrary; import com.gempukku.lotro.packs.ProductLibrary;
import com.gempukku.lotro.tournament.action.BroadcastAction; import com.gempukku.lotro.tournament.action.BroadcastAction;
@@ -47,6 +45,21 @@ public class SealedTournament extends BaseTournament implements Tournament {
&& _players.contains(player)) { && _players.contains(player)) {
_tournamentService.updateRecordedPlayerDeck(_tournamentId, player, deck); _tournamentService.updateRecordedPlayerDeck(_tournamentId, player, deck);
_playerDecks.put(player, deck); _playerDecks.put(player, deck);
// If 1v1 and both registered the deck, skip the wait and start playing
var players = _tournamentService.retrieveTournamentPlayers(_tournamentId);
boolean everyoneSubmitted = true;
for(var playerName : players) {
var registeredDeck = getPlayerDeck(playerName);
if(registeredDeck == null || StringUtils.isEmpty(registeredDeck.getDeckName())) {
everyoneSubmitted = false;
}
}
if (players.size() == 2 && everyoneSubmitted) {
_tournamentInfo.Stage = _sealedInfo.PostRegistrationStage();
_tournamentService.recordTournamentStage(_tournamentId, getTournamentStage());
}
return true; return true;
} }
return false; return false;

View File

@@ -27,8 +27,6 @@ public class SoloDraftTournament extends BaseTournament implements Tournament {
private static final int HIGH_ENOUGH_PRIME_NUMBER = 8963; private static final int HIGH_ENOUGH_PRIME_NUMBER = 8963;
private SoloDraftTournamentInfo _soloDraftInfo; private SoloDraftTournamentInfo _soloDraftInfo;
private long _deckBuildStartTime;
public SoloDraftTournament(TournamentService tournamentService, CollectionsManager collectionsManager, ProductLibrary productLibrary, public SoloDraftTournament(TournamentService tournamentService, CollectionsManager collectionsManager, ProductLibrary productLibrary,
LotroFormatLibrary formatLibrary, SoloDraftDefinitions soloDraftDefinitions, TableHolder tables, String tournamentId) { LotroFormatLibrary formatLibrary, SoloDraftDefinitions soloDraftDefinitions, TableHolder tables, String tournamentId) {
super(tournamentService, collectionsManager, productLibrary, formatLibrary, soloDraftDefinitions, tables, tournamentId); super(tournamentService, collectionsManager, productLibrary, formatLibrary, soloDraftDefinitions, tables, tournamentId);
@@ -51,6 +49,21 @@ public class SoloDraftTournament extends BaseTournament implements Tournament {
&& _players.contains(player)) { && _players.contains(player)) {
_tournamentService.updateRecordedPlayerDeck(_tournamentId, player, deck); _tournamentService.updateRecordedPlayerDeck(_tournamentId, player, deck);
_playerDecks.put(player, deck); _playerDecks.put(player, deck);
// If 1v1 and both registered the deck, skip the wait and start playing
var players = _tournamentService.retrieveTournamentPlayers(_tournamentId);
boolean everyoneSubmitted = true;
for(var playerName : players) {
var registeredDeck = getPlayerDeck(playerName);
if(registeredDeck == null || StringUtils.isEmpty(registeredDeck.getDeckName())) {
everyoneSubmitted = false;
}
}
if (players.size() == 2 && everyoneSubmitted) {
_tournamentInfo.Stage = _soloDraftInfo.PostRegistrationStage();
_tournamentService.recordTournamentStage(_tournamentId, getTournamentStage());
}
return true; return true;
} }
return false; return false;