Draft Cubes rework (better cube from deck, dynamic data, better errors processing, actual MTGO Vintage Cube) (#13705)

- GUI, table: added dynamic data support for Cube Types (no more depends on server's config names, part of #12050);
- server: replace multiple MTGO Vintage Cubes by single cube, updated to April 2025 (part of #12050);
- server: fixed table freeze on starting error (related to #11285);
- GUI, table: added better support of Cube From Deck (client/server side errors, additional info about loaded cards, etc);
This commit is contained in:
Oleg Agafonov 2025-05-31 20:15:31 +04:00 committed by GitHub
parent 2034b3fe59
commit 3d45a24959
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 755 additions and 61 deletions

View file

@ -43,6 +43,8 @@ public class NewTournamentDialog extends MageDialog {
// it's ok to have 4 players at the screen, 6 is fine for big screens too
private static final int MAX_WORKABLE_PLAYERS_PER_GAME = 6;
private static final String CUBE_FROM_DECK_NAME = "Cube From Deck";
// temp settings on loading players list
private final List<PlayerType> prefPlayerTypes = new ArrayList<>();
private final List<Integer> prefPlayerSkills = new ArrayList<>();
@ -712,6 +714,21 @@ public class NewTournamentDialog extends MageDialog {
}
}
// cube from deck uses weird choose logic from combobox select, so players can forget or cancel it
if (tournamentType.isDraft()
&& tOptions.getLimitedOptions().getDraftCubeName() != null
&& tOptions.getLimitedOptions().getDraftCubeName().contains(CUBE_FROM_DECK_NAME)) {
if (tOptions.getLimitedOptions().getCubeFromDeck() == null || tOptions.getLimitedOptions().getCubeFromDeck().getCards().isEmpty()) {
JOptionPane.showMessageDialog(
MageFrame.getDesktop(),
"Found empty cube. You must choose Cube From Deck again and select existing deck file.",
"Warning",
JOptionPane.WARNING_MESSAGE
);
return;
}
}
// save last settings
onSaveSettings(0, tOptions);
@ -826,7 +843,7 @@ public class NewTournamentDialog extends MageDialog {
private void cbDraftCubeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbDraftCubeActionPerformed
cubeFromDeckFilename = "";
if (cbDraftCube.getSelectedItem().toString().equals("Cube From Deck")) {
if (cbDraftCube.getSelectedItem().toString().startsWith(CUBE_FROM_DECK_NAME)) {
cubeFromDeckFilename = playerLoadDeck();
}
}//GEN-LAST:event_cbDraftCubeActionPerformed

View file

@ -191,15 +191,15 @@
}
public void updateDraft(DraftView draftView) {
if (draftView.getSets().size() != 3) {
if (draftView.getSetNames().size() != 3) {
// Random draft - TODO: can we access the type of draft here?
this.editPack1.setText("Random Boosters");
this.editPack2.setText("Random Boosters");
this.editPack3.setText("Random Boosters");
} else {
this.editPack1.setText(String.format("%s - %s", draftView.getSetCodes().get(0), draftView.getSets().get(0)));
this.editPack2.setText(String.format("%s - %s", draftView.getSetCodes().get(1), draftView.getSets().get(1)));
this.editPack3.setText(String.format("%s - %s", draftView.getSetCodes().get(2), draftView.getSets().get(2)));
this.editPack1.setText(draftView.getBoosterInfo(0));
this.editPack2.setText(draftView.getBoosterInfo(1));
this.editPack3.setText(draftView.getBoosterInfo(2));
}
// scroll too long text to the start