mirror of
https://github.com/correl/mage.git
synced 2025-04-09 09:11:05 -09:00
* Added Momir Basic format to table filtering so Momir Basic games are shown.
This commit is contained in:
parent
5262d8d358
commit
79c04eef47
2 changed files with 79 additions and 73 deletions
Mage.Client/src/main/java/mage/client
|
@ -71,7 +71,9 @@ public class NewTableDialog extends MageDialog {
|
||||||
|
|
||||||
private static final String LIMITED = "Limited";
|
private static final String LIMITED = "Limited";
|
||||||
|
|
||||||
/** Creates new form NewTableDialog */
|
/**
|
||||||
|
* Creates new form NewTableDialog
|
||||||
|
*/
|
||||||
public NewTableDialog() {
|
public NewTableDialog() {
|
||||||
session = MageFrame.getSession();
|
session = MageFrame.getSession();
|
||||||
lastSessionId = "";
|
lastSessionId = "";
|
||||||
|
@ -82,10 +84,10 @@ public class NewTableDialog extends MageDialog {
|
||||||
MageFrame.getUI().addButton(MageComponents.NEW_TABLE_OK_BUTTON, btnOK);
|
MageFrame.getUI().addButton(MageComponents.NEW_TABLE_OK_BUTTON, btnOK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This method is called from within the constructor to
|
/**
|
||||||
* initialize the form.
|
* This method is called from within the constructor to initialize the form.
|
||||||
* WARNING: Do NOT modify this code. The content of this method is
|
* WARNING: Do NOT modify this code. The content of this method is always
|
||||||
* always regenerated by the Form Editor.
|
* regenerated by the Form Editor.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||||
|
@ -391,8 +393,7 @@ public class NewTableDialog extends MageDialog {
|
||||||
this.player1Panel.getPlayerName(),
|
this.player1Panel.getPlayerName(),
|
||||||
"Human", 1,
|
"Human", 1,
|
||||||
DeckImporterUtil.importDeck(this.player1Panel.getDeckFile()),
|
DeckImporterUtil.importDeck(this.player1Panel.getDeckFile()),
|
||||||
this.txtPassword.getText())
|
this.txtPassword.getText())) {
|
||||||
) {
|
|
||||||
for (TablePlayerPanel player : players) {
|
for (TablePlayerPanel player : players) {
|
||||||
if (!player.getPlayerType().equals("Human")) {
|
if (!player.getPlayerType().equals("Human")) {
|
||||||
if (!player.joinTable(roomId, table.getTableId())) {
|
if (!player.joinTable(roomId, table.getTableId())) {
|
||||||
|
@ -432,7 +433,8 @@ public class NewTableDialog extends MageDialog {
|
||||||
}//GEN-LAST:event_spnNumWinsnumPlayersChanged
|
}//GEN-LAST:event_spnNumWinsnumPlayersChanged
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks about not valid game option combinations and shows an error message
|
* Checks about not valid game option combinations and shows an error
|
||||||
|
* message
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ -451,6 +453,12 @@ public class NewTableDialog extends MageDialog {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case "Variant Magic - Momir Basic":
|
||||||
|
if (!options.getGameType().startsWith("Momir Basic")) {
|
||||||
|
JOptionPane.showMessageDialog(MageFrame.getDesktop(), "Deck type Momir Basic needs also a Momir Basic game type", "Error", JOptionPane.ERROR_MESSAGE);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
switch (options.getGameType()) {
|
switch (options.getGameType()) {
|
||||||
case "Commander Two Player Duel":
|
case "Commander Two Player Duel":
|
||||||
|
@ -504,8 +512,7 @@ public class NewTableDialog extends MageDialog {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} // remove player panels no longer needed
|
||||||
// remove player panels no longer needed
|
|
||||||
else if (numPlayers < players.size()) {
|
else if (numPlayers < players.size()) {
|
||||||
while (players.size() != numPlayers) {
|
while (players.size() != numPlayers) {
|
||||||
players.remove(players.size() - 1);
|
players.remove(players.size() - 1);
|
||||||
|
@ -585,7 +592,6 @@ public class NewTableDialog extends MageDialog {
|
||||||
prefPlayerTypes.addAll(Arrays.asList(playerTypes.split(",")));
|
prefPlayerTypes.addAll(Arrays.asList(playerTypes.split(",")));
|
||||||
this.spnNumPlayers.setValue(Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_NUMBER_PLAYERS, "2")));
|
this.spnNumPlayers.setValue(Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_NUMBER_PLAYERS, "2")));
|
||||||
|
|
||||||
|
|
||||||
String gameTypeName = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_GAME_TYPE, "Two Player Duel");
|
String gameTypeName = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_GAME_TYPE, "Two Player Duel");
|
||||||
for (GameTypeView gtv : session.getGameTypes()) {
|
for (GameTypeView gtv : session.getGameTypes()) {
|
||||||
if (gtv.getName().equals(gameTypeName)) {
|
if (gtv.getName().equals(gameTypeName)) {
|
||||||
|
@ -608,7 +614,6 @@ public class NewTableDialog extends MageDialog {
|
||||||
this.spnNumWins.setValue(Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_NUMBER_OF_WINS, "2")));
|
this.spnNumWins.setValue(Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_NUMBER_OF_WINS, "2")));
|
||||||
this.chkRollbackTurnsAllowed.setSelected(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_ROLLBACK_TURNS_ALLOWED, "Yes").equals("Yes"));
|
this.chkRollbackTurnsAllowed.setSelected(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_ROLLBACK_TURNS_ALLOWED, "Yes").equals("Yes"));
|
||||||
|
|
||||||
|
|
||||||
int range = Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_RANGE, "1"));
|
int range = Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_RANGE, "1"));
|
||||||
for (RangeOfInfluence roi : RangeOfInfluence.values()) {
|
for (RangeOfInfluence roi : RangeOfInfluence.values()) {
|
||||||
if (roi.getRange() == range) {
|
if (roi.getRange() == range) {
|
||||||
|
@ -633,7 +638,8 @@ public class NewTableDialog extends MageDialog {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save the settings to java prefs to reload it next time the dialog will be created
|
* Save the settings to java prefs to reload it next time the dialog will be
|
||||||
|
* created
|
||||||
*
|
*
|
||||||
* @param options
|
* @param options
|
||||||
* @param deckFile
|
* @param deckFile
|
||||||
|
|
|
@ -501,7 +501,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
||||||
// type
|
// type
|
||||||
List<RowFilter<Object, Object>> typeFilterList = new ArrayList<>();
|
List<RowFilter<Object, Object>> typeFilterList = new ArrayList<>();
|
||||||
if (btnTypeMatch.isSelected()) {
|
if (btnTypeMatch.isSelected()) {
|
||||||
typeFilterList.add(RowFilter.regexFilter("Two|Commander|Free|Tiny", TableTableModel.COLUMN_GAME_TYPE));
|
typeFilterList.add(RowFilter.regexFilter("Two|Commander|Free|Tiny|Momir", TableTableModel.COLUMN_GAME_TYPE));
|
||||||
}
|
}
|
||||||
if (btnTypeTourneyConstructed.isSelected()) {
|
if (btnTypeTourneyConstructed.isSelected()) {
|
||||||
typeFilterList.add(RowFilter.regexFilter("Constructed", TableTableModel.COLUMN_GAME_TYPE));
|
typeFilterList.add(RowFilter.regexFilter("Constructed", TableTableModel.COLUMN_GAME_TYPE));
|
||||||
|
@ -537,7 +537,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
||||||
formatFilterList.add(RowFilter.regexFilter("^Limited", TableTableModel.COLUMN_DECK_TYPE));
|
formatFilterList.add(RowFilter.regexFilter("^Limited", TableTableModel.COLUMN_DECK_TYPE));
|
||||||
}
|
}
|
||||||
if (btnFormatOther.isSelected()) {
|
if (btnFormatOther.isSelected()) {
|
||||||
formatFilterList.add(RowFilter.regexFilter("^Constructed - Pauper|^Constructed - Extended|^Constructed - Historical|^Constructed - Super", TableTableModel.COLUMN_DECK_TYPE));
|
formatFilterList.add(RowFilter.regexFilter("^Momir Basic|^Constructed - Pauper|^Constructed - Extended|^Constructed - Historical|^Constructed - Super", TableTableModel.COLUMN_DECK_TYPE));
|
||||||
}
|
}
|
||||||
|
|
||||||
List<RowFilter<Object, Object>> skillFilterList = new ArrayList<>();
|
List<RowFilter<Object, Object>> skillFilterList = new ArrayList<>();
|
||||||
|
|
Loading…
Add table
Reference in a new issue