use of mage.game.draft.DraftOptions in project mage by magefree.
the class NewTournamentDialog method btnOkActionPerformed.
// GEN-LAST:event_cbTournamentTypeActionPerformed
private void btnOkActionPerformed(java.awt.event.ActionEvent evt) {
// GEN-FIRST:event_btnOkActionPerformed
// get settings
TournamentOptions tOptions = getTournamentOptions();
// CHECKS
TournamentTypeView tournamentType = (TournamentTypeView) cbTournamentType.getSelectedItem();
if (tournamentType.isRandom() || tournamentType.isRichMan()) {
if (tOptions.getLimitedOptions().getSetCodes().isEmpty()) {
JOptionPane.showMessageDialog(MageFrame.getDesktop(), "Warning, you must select packs for the pool", "Warning", JOptionPane.WARNING_MESSAGE);
return;
}
}
if (tournamentType.isDraft() && tOptions.getLimitedOptions() instanceof DraftOptions) {
DraftOptions draftOptions = (DraftOptions) tOptions.getLimitedOptions();
if (draftOptions.getTiming() == TimingOption.NONE) {
JOptionPane.showMessageDialog(MageFrame.getDesktop(), "Warning, you must select draft timing option", "Warning", JOptionPane.WARNING_MESSAGE);
return;
}
}
// save last settings
onSaveSettings(0, tOptions);
// run
table = SessionHandler.createTournamentTable(roomId, tOptions);
if (table == null) {
// message must be send by server!
return;
}
// join AI
for (TournamentPlayerPanel player : players) {
if (player.getPlayerType().getSelectedItem() != PlayerType.HUMAN) {
if (!player.joinTournamentTable(roomId, table.getTableId(), DeckImporter.importDeckFromFile(this.player1Panel.getDeckFile(), true))) {
// error message must be send by sever
SessionHandler.removeTable(roomId, table.getTableId());
table = null;
return;
}
}
}
// join itself
if (SessionHandler.joinTournamentTable(roomId, table.getTableId(), this.player1Panel.getPlayerName(), PlayerType.HUMAN, 1, DeckImporter.importDeckFromFile(this.player1Panel.getDeckFile(), true), tOptions.getPassword())) {
// all fine, can close create dialog (join dialog will be opened after feedback from server)
this.hideDialog();
return;
}
JOptionPane.showMessageDialog(MageFrame.getDesktop(), "Error joining tournament.", "Error", JOptionPane.ERROR_MESSAGE);
SessionHandler.removeTable(roomId, table.getTableId());
table = null;
}
use of mage.game.draft.DraftOptions in project mage by magefree.
the class BoosterDraftSwissTournament method draft.
protected void draft() {
draft = new BoosterDraft((DraftOptions) options.getLimitedOptions(), getSets());
for (TournamentPlayer player : players.values()) {
draft.addPlayer(player.getPlayer());
player.setState(TournamentPlayerState.DRAFTING);
}
tableEventSource.fireTableEvent(TableEvent.EventType.START_DRAFT, null, draft);
}
use of mage.game.draft.DraftOptions in project mage by magefree.
the class RandomBoosterDraftEliminationTournament method draft.
@Override
protected void draft() {
draft = new RandomBoosterDraft((DraftOptions) options.getLimitedOptions(), getSets());
for (TournamentPlayer player : players.values()) {
draft.addPlayer(player.getPlayer());
player.setState(TournamentPlayerState.DRAFTING);
}
tableEventSource.fireTableEvent(EventType.START_DRAFT, null, draft);
}
use of mage.game.draft.DraftOptions in project mage by magefree.
the class RichManCubeDraftEliminationTournament method draft.
protected void draft() {
draft = new RichManCubeBoosterDraft((DraftOptions) options.getLimitedOptions(), getSets());
for (TournamentPlayer player : players.values()) {
draft.addPlayer(player.getPlayer());
player.setState(TournamentPlayerState.DRAFTING);
}
tableEventSource.fireTableEvent(EventType.START_DRAFT, null, draft);
}
Aggregations