mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
Merge branch 'master' of https://github.com/brodee/mage
This commit is contained in:
commit
4c94938c14
146 changed files with 4424 additions and 1541 deletions
|
@ -6,7 +6,7 @@
|
|||
<parent>
|
||||
<groupId>org.mage</groupId>
|
||||
<artifactId>mage-root</artifactId>
|
||||
<version>1.4.31</version>
|
||||
<version>1.4.32</version>
|
||||
</parent>
|
||||
|
||||
<groupId>org.mage</groupId>
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
XMage.de 1 (Europe/Germany) fast :xmage.de:17171
|
||||
old xmage.de (Europe/Germany) :185.3.232.200:17171
|
||||
XMage Players MTG:xmageplayersmtg.ddns.net:17171
|
||||
XMage.tahiti :xmage.tahiti.one:443
|
||||
Seedds Server (Asia) :115.29.203.80:17171
|
||||
localhost -> connect to your local server (must be started):localhost:17171
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.client.deck.generator;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -7,6 +6,7 @@ import java.util.List;
|
|||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import mage.cards.Card;
|
||||
import mage.cards.decks.Deck;
|
||||
import mage.cards.repository.CardCriteria;
|
||||
|
@ -368,7 +368,6 @@ public final class DeckGenerator {
|
|||
private static Card getBasicLand(ColoredManaSymbol color, Map<String, List<CardInfo>> basicLands) {
|
||||
String landName = DeckGeneratorPool.getBasicLandName(color.toString());
|
||||
List<CardInfo> basicLandsInfo = basicLands.get(landName);
|
||||
return basicLandsInfo.get(RandomUtil.nextInt(basicLandsInfo.size() - 1)).getMockCard().copy();
|
||||
return basicLandsInfo.get(RandomUtil.nextInt(basicLandsInfo.size())).getMockCard().copy();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,15 +3,28 @@ package mage.client.deckeditor;
|
|||
import mage.util.StreamUtils;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.datatransfer.DataFlavor;
|
||||
import java.awt.datatransfer.UnsupportedFlavorException;
|
||||
import java.awt.event.*;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
public class DeckImportFromClipboardDialog extends JDialog {
|
||||
|
||||
private static final String FORMAT_TEXT =
|
||||
"// Example:\n" +
|
||||
"//1 Library of Congress\n" +
|
||||
"//1 Cryptic Gateway\n" +
|
||||
"//1 Azami, Lady of Scrolls\n" +
|
||||
"// NB: This is slow as, and will lock your screen :)\n" +
|
||||
"\n" +
|
||||
"// Your current clipboard:\n";
|
||||
|
||||
private JPanel contentPane;
|
||||
private JButton buttonOK;
|
||||
private JButton buttonCancel;
|
||||
|
@ -21,6 +34,9 @@ public class DeckImportFromClipboardDialog extends JDialog {
|
|||
|
||||
public DeckImportFromClipboardDialog() {
|
||||
initComponents();
|
||||
|
||||
onRefreshClipboard();
|
||||
|
||||
setContentPane(contentPane);
|
||||
setModal(true);
|
||||
getRootPane().setDefaultButton(buttonOK);
|
||||
|
@ -40,6 +56,15 @@ public class DeckImportFromClipboardDialog extends JDialog {
|
|||
contentPane.registerKeyboardAction(e -> onCancel(), KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
|
||||
}
|
||||
|
||||
private Optional<String> getClipboardStringData() {
|
||||
try {
|
||||
return Optional.of((String)Toolkit.getDefaultToolkit().getSystemClipboard().getData(DataFlavor.stringFlavor));
|
||||
} catch (HeadlessException | UnsupportedFlavorException | IOException e) {
|
||||
//e.printStackTrace();
|
||||
}
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
private void onOK() {
|
||||
BufferedWriter bw = null;
|
||||
try {
|
||||
|
@ -60,6 +85,10 @@ public class DeckImportFromClipboardDialog extends JDialog {
|
|||
dispose();
|
||||
}
|
||||
|
||||
private void onRefreshClipboard() {
|
||||
txtDeckList.setText(FORMAT_TEXT + getClipboardStringData().orElse(""));
|
||||
}
|
||||
|
||||
public String getTmpPath() {
|
||||
return tmpPath;
|
||||
}
|
||||
|
@ -143,7 +172,7 @@ public class DeckImportFromClipboardDialog extends JDialog {
|
|||
|
||||
txtDeckList.setMinimumSize(new Dimension(250, 400));
|
||||
txtDeckList.setPreferredSize(new Dimension(550, 400));
|
||||
txtDeckList.setText("// Example:\n//1 Library of Congress\n//1 Cryptic Gateway\n//1 Azami, Lady of Scrolls\n// NB: This is slow as, and will lock your screen :)");
|
||||
txtDeckList.setText(FORMAT_TEXT);
|
||||
JScrollPane txtScrollableDeckList = new JScrollPane(txtDeckList);
|
||||
panel3.add(txtScrollableDeckList, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0,
|
||||
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
|
||||
|
|
|
@ -340,8 +340,8 @@
|
|||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/flags/us.png"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="W"/>
|
||||
<Property name="toolTipText" type="java.lang.String" value="Connect to vaporservermtg.com (USA)"/>
|
||||
<Property name="text" type="java.lang.String" value="P"/>
|
||||
<Property name="toolTipText" type="java.lang.String" value="Connect to mtg.powersofwar.com (USA)"/>
|
||||
<Property name="actionCommand" type="java.lang.String" value="connectXmageus"/>
|
||||
<Property name="alignmentY" type="float" value="0.0"/>
|
||||
<Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
|
||||
|
|
|
@ -270,8 +270,8 @@ public class ConnectDialog extends MageDialog {
|
|||
});
|
||||
|
||||
btnFind3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/flags/us.png"))); // NOI18N
|
||||
btnFind3.setText("W");
|
||||
btnFind3.setToolTipText("Connect to vaporservermtg.com (USA)");
|
||||
btnFind3.setText("P");
|
||||
btnFind3.setToolTipText("Connect to mtg.powersofwar.com (USA)");
|
||||
btnFind3.setActionCommand("connectXmageus");
|
||||
btnFind3.setAlignmentY(0.0F);
|
||||
btnFind3.setMargin(new java.awt.Insets(2, 2, 2, 2));
|
||||
|
@ -688,7 +688,7 @@ public class ConnectDialog extends MageDialog {
|
|||
}//GEN-LAST:event_btnFind2findPublicServerActionPerformed
|
||||
|
||||
private void connectXmageus(java.awt.event.ActionEvent evt) {
|
||||
String serverAddress = "vapormtgserver.com";
|
||||
String serverAddress = "mtg.powersofwar.com";
|
||||
this.txtServer.setText(serverAddress);
|
||||
this.txtPort.setText("17171");
|
||||
// Update userName and password according to the chosen server.
|
||||
|
|
|
@ -51,6 +51,7 @@ public class NewTableDialog extends MageDialog {
|
|||
this.spnNumWins.setModel(new SpinnerNumberModel(1, 1, 5, 1));
|
||||
this.spnFreeMulligans.setModel(new SpinnerNumberModel(0, 0, 5, 1));
|
||||
this.spnQuitRatio.setModel(new SpinnerNumberModel(100, 0, 100, 5));
|
||||
this.spnMinimumRating.setModel(new SpinnerNumberModel(0, 0, 3000, 10));
|
||||
this.spnEdhPowerLevel.setModel(new SpinnerNumberModel(100, 0, 100, 5));
|
||||
MageFrame.getUI().addButton(MageComponents.NEW_TABLE_OK_BUTTON, btnOK);
|
||||
}
|
||||
|
@ -102,8 +103,10 @@ public class NewTableDialog extends MageDialog {
|
|||
btnPreviousConfiguration2 = new javax.swing.JButton();
|
||||
btnCancel = new javax.swing.JButton();
|
||||
lblQuitRatio = new javax.swing.JLabel();
|
||||
lblMinimumRating = new javax.swing.JLabel();
|
||||
lblEdhPowerLevel = new javax.swing.JLabel();
|
||||
spnQuitRatio = new javax.swing.JSpinner();
|
||||
spnMinimumRating = new javax.swing.JSpinner();
|
||||
spnEdhPowerLevel = new javax.swing.JSpinner();
|
||||
|
||||
setTitle("New Table");
|
||||
|
@ -186,9 +189,11 @@ public class NewTableDialog extends MageDialog {
|
|||
btnCancel.addActionListener(evt -> btnCancelActionPerformed(evt));
|
||||
|
||||
lblQuitRatio.setText("Allowed quit %");
|
||||
lblMinimumRating.setText("Minimum rating");
|
||||
lblEdhPowerLevel.setText("EDH power level");
|
||||
|
||||
spnQuitRatio.setToolTipText("Players with quit % more than this value can't join this table");
|
||||
spnMinimumRating.setToolTipText("Players with rating less than this value can't join this table");
|
||||
spnEdhPowerLevel.setToolTipText("Players with decks with a higher power level can't join this table");
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
|
@ -239,9 +244,10 @@ public class NewTableDialog extends MageDialog {
|
|||
.addComponent(lblQuitRatio)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(spnQuitRatio, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblEdhPowerLevel)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(lblMinimumRating)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(spnEdhPowerLevel, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE))))
|
||||
.addComponent(spnMinimumRating, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE))))
|
||||
.addComponent(jLabel1, javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jLabel2, javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
|
@ -270,7 +276,11 @@ public class NewTableDialog extends MageDialog {
|
|||
.addGap(18, 18, 18)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(lblNumWins)
|
||||
.addComponent(spnNumWins, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addComponent(spnNumWins, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(lblEdhPowerLevel)
|
||||
.addComponent(spnEdhPowerLevel, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addComponent(jSeparator2)
|
||||
.addComponent(player1Panel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(pnlOtherPlayers, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
|
@ -297,14 +307,13 @@ public class NewTableDialog extends MageDialog {
|
|||
.addComponent(cbTimeLimit, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(cbDeckType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lbDeckType)
|
||||
.addComponent(cbDeckType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(chkRated)
|
||||
.addComponent(lblQuitRatio)
|
||||
.addComponent(chkRated)
|
||||
.addComponent(spnQuitRatio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblEdhPowerLevel)
|
||||
.addComponent(chkRated)
|
||||
.addComponent(spnEdhPowerLevel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(lblMinimumRating)
|
||||
.addComponent(spnMinimumRating, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
|
@ -326,6 +335,7 @@ public class NewTableDialog extends MageDialog {
|
|||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(lblSkillLevel)
|
||||
.addComponent(lblNumWins)
|
||||
.addComponent(lblEdhPowerLevel)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(lblRange)
|
||||
.addComponent(lblAttack)))
|
||||
|
@ -334,7 +344,8 @@ public class NewTableDialog extends MageDialog {
|
|||
.addComponent(cbRange, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(cbAttackOption, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(cbSkillLevel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(spnNumWins, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
|
||||
.addComponent(spnNumWins, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(spnEdhPowerLevel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
|
@ -394,6 +405,7 @@ public class NewTableDialog extends MageDialog {
|
|||
options.setFreeMulligans((Integer) this.spnFreeMulligans.getValue());
|
||||
options.setPassword(this.txtPassword.getText());
|
||||
options.setQuitRatio((Integer) this.spnQuitRatio.getValue());
|
||||
options.setMinimumRating((Integer) this.spnMinimumRating.getValue());
|
||||
options.setEdhPowerLevel((Integer) this.spnEdhPowerLevel.getValue());
|
||||
String serverAddress = SessionHandler.getSession().getServerHostname().orElseGet(() -> "");
|
||||
options.setBannedUsers(IgnoreList.ignoreList(serverAddress));
|
||||
|
@ -695,6 +707,7 @@ public class NewTableDialog extends MageDialog {
|
|||
}
|
||||
|
||||
this.spnQuitRatio.setValue(Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_QUIT_RATIO, "100")));
|
||||
this.spnMinimumRating.setValue(Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_MINIMUM_RATING + versionStr, "0")));
|
||||
this.spnEdhPowerLevel.setValue(0);
|
||||
}
|
||||
|
||||
|
@ -729,6 +742,7 @@ public class NewTableDialog extends MageDialog {
|
|||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_SPECTATORS_ALLOWED + versionStr, options.isSpectatorsAllowed() ? "Yes" : "No");
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_PLANECHASE + versionStr, options.isPlaneChase() ? "Yes" : "No");
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_QUIT_RATIO + versionStr, Integer.toString(options.getQuitRatio()));
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_MINIMUM_RATING + versionStr, Integer.toString(options.getMinimumRating()));
|
||||
StringBuilder playerTypesString = new StringBuilder();
|
||||
for (Object player : players) {
|
||||
if (playerTypesString.length() > 0) {
|
||||
|
@ -770,6 +784,7 @@ public class NewTableDialog extends MageDialog {
|
|||
private javax.swing.JLabel lblNumWins;
|
||||
private javax.swing.JLabel lblPassword;
|
||||
private javax.swing.JLabel lblQuitRatio;
|
||||
private javax.swing.JLabel lblMinimumRating;
|
||||
private javax.swing.JLabel lblEdhPowerLevel;
|
||||
private javax.swing.JLabel lblRange;
|
||||
private javax.swing.JLabel lblSkillLevel;
|
||||
|
@ -779,6 +794,7 @@ public class NewTableDialog extends MageDialog {
|
|||
private javax.swing.JSpinner spnNumPlayers;
|
||||
private javax.swing.JSpinner spnNumWins;
|
||||
private javax.swing.JSpinner spnQuitRatio;
|
||||
private javax.swing.JSpinner spnMinimumRating;
|
||||
private javax.swing.JSpinner spnEdhPowerLevel;
|
||||
private javax.swing.JTextField txtName;
|
||||
private javax.swing.JTextField txtPassword;
|
||||
|
|
|
@ -75,6 +75,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
this.spnConstructTime.setModel(new SpinnerNumberModel(10, CONSTRUCTION_TIME_MIN, CONSTRUCTION_TIME_MAX, 2));
|
||||
this.spnNumRounds.setModel(new SpinnerNumberModel(2, 2, 10, 1));
|
||||
this.spnQuitRatio.setModel(new SpinnerNumberModel(100, 0, 100, 5));
|
||||
this.spnMinimumRating.setModel(new SpinnerNumberModel(0, 0, 3000, 10));
|
||||
}
|
||||
|
||||
public void showDialog(UUID roomId) {
|
||||
|
@ -165,6 +166,8 @@ public class NewTournamentDialog extends MageDialog {
|
|||
pnlRandomPacks = new javax.swing.JPanel();
|
||||
lblQuitRatio = new javax.swing.JLabel();
|
||||
spnQuitRatio = new javax.swing.JSpinner();
|
||||
lblMinimumRating = new javax.swing.JLabel();
|
||||
spnMinimumRating = new javax.swing.JSpinner();
|
||||
|
||||
setTitle("New Tournament");
|
||||
|
||||
|
@ -315,8 +318,10 @@ public class NewTournamentDialog extends MageDialog {
|
|||
pnlRandomPacks.setLayout(new javax.swing.BoxLayout(pnlRandomPacks, javax.swing.BoxLayout.Y_AXIS));
|
||||
|
||||
lblQuitRatio.setText("Allowed quit %:");
|
||||
lblMinimumRating.setText("Minimum rating:");
|
||||
|
||||
spnQuitRatio.setToolTipText("Players with quit % more than this value can't join this table");
|
||||
spnMinimumRating.setToolTipText("Players with rating less than this value can't join this table");
|
||||
spnNumSeats.setToolTipText("The number of seats for each duel. If more than 2, will set number of wins to 1");
|
||||
spnNumPlayers.setToolTipText("The total number of players who will draft");
|
||||
|
||||
|
@ -386,11 +391,15 @@ public class NewTournamentDialog extends MageDialog {
|
|||
.addComponent(lblNumWins)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(spnNumWins, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(lblQuitRatio)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(spnQuitRatio, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(lblMinimumRating)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(spnMinimumRating, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(chkRated))
|
||||
.addComponent(cbTournamentType, javax.swing.GroupLayout.PREFERRED_SIZE, 290, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
|
@ -444,6 +453,8 @@ public class NewTournamentDialog extends MageDialog {
|
|||
.addComponent(spnNumWins, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblQuitRatio)
|
||||
.addComponent(spnQuitRatio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblMinimumRating)
|
||||
.addComponent(spnMinimumRating, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(chkRated))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
|
@ -522,6 +533,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
tOptions.setWatchingAllowed(cbAllowSpectators.isSelected());
|
||||
tOptions.setPlaneChase(cbPlaneChase.isSelected());
|
||||
tOptions.setQuitRatio((Integer) spnQuitRatio.getValue());
|
||||
tOptions.setMinimumRating((Integer) spnMinimumRating.getValue());
|
||||
for (TournamentPlayerPanel player : players) {
|
||||
tOptions.getPlayerTypes().add((PlayerType) player.getPlayerType().getSelectedItem());
|
||||
}
|
||||
|
@ -1065,6 +1077,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
this.spnFreeMulligans.setValue(Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TOURNAMENT_NUMBER_OF_FREE_MULLIGANS + versionStr, "0")));
|
||||
this.spnNumWins.setValue(Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TOURNAMENT_NUMBER_OF_WINS + versionStr, "2")));
|
||||
this.spnQuitRatio.setValue(Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TOURNAMENT_QUIT_RATIO + versionStr, "100")));
|
||||
this.spnMinimumRating.setValue(Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TOURNAMENT_MINIMUM_RATING + versionStr, "0")));
|
||||
|
||||
TournamentTypeView tournamentType = (TournamentTypeView) cbTournamentType.getSelectedItem();
|
||||
activatePanelElements(tournamentType);
|
||||
|
@ -1150,6 +1163,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_NUMBER_OF_FREE_MULLIGANS + versionStr, Integer.toString(tOptions.getMatchOptions().getFreeMulligans()));
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_NUMBER_OF_WINS + versionStr, Integer.toString(tOptions.getMatchOptions().getWinsNeeded()));
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_QUIT_RATIO + versionStr, Integer.toString(tOptions.getQuitRatio()));
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_MINIMUM_RATING + versionStr, Integer.toString(tOptions.getMinimumRating()));
|
||||
|
||||
if (tOptions.getTournamentType().startsWith("Sealed")) {
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_PACKS_SEALED + versionStr, tOptions.getLimitedOptions().getSetCodes().toString());
|
||||
|
@ -1221,6 +1235,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
private javax.swing.JLabel lblPassword;
|
||||
private javax.swing.JLabel lblPlayer1;
|
||||
private javax.swing.JLabel lblQuitRatio;
|
||||
private javax.swing.JLabel lblMinimumRating;
|
||||
private javax.swing.JLabel lblTournamentType;
|
||||
private mage.client.table.NewPlayerPanel player1Panel;
|
||||
private javax.swing.JPanel pnlDraftOptions;
|
||||
|
@ -1235,6 +1250,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
private javax.swing.JSpinner spnNumRounds;
|
||||
private javax.swing.JSpinner spnNumWins;
|
||||
private javax.swing.JSpinner spnQuitRatio;
|
||||
private javax.swing.JSpinner spnMinimumRating;
|
||||
private javax.swing.JTextField txtName;
|
||||
private javax.swing.JTextField txtPassword;
|
||||
private org.jdesktop.beansbinding.BindingGroup bindingGroup;
|
||||
|
|
|
@ -222,6 +222,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
public static final String KEY_NEW_TABLE_NUMBER_PLAYERS = "newTableNumberPlayers";
|
||||
public static final String KEY_NEW_TABLE_PLAYER_TYPES = "newTablePlayerTypes";
|
||||
public static final String KEY_NEW_TABLE_QUIT_RATIO = "newTableQuitRatio";
|
||||
public static final String KEY_NEW_TABLE_MINIMUM_RATING = "newTableMinimumRating";
|
||||
public static final String KEY_NEW_TABLE_RATED = "newTableRated";
|
||||
|
||||
// pref setting for new tournament dialog
|
||||
|
@ -243,6 +244,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
public static final String KEY_NEW_TOURNAMENT_ALLOW_ROLLBACKS = "newTournamentAllowRollbacks";
|
||||
public static final String KEY_NEW_TOURNAMENT_DECK_FILE = "newTournamentDeckFile";
|
||||
public static final String KEY_NEW_TOURNAMENT_QUIT_RATIO = "newTournamentQuitRatio";
|
||||
public static final String KEY_NEW_TOURNAMENT_MINIMUM_RATING = "newTournamentMinimumRating";
|
||||
public static final String KEY_NEW_TOURNAMENT_RATED = "newTournamentRated";
|
||||
|
||||
// pref setting for deck generator
|
||||
|
|
|
@ -26,6 +26,8 @@ import mage.view.CardView;
|
|||
import mage.view.PermanentView;
|
||||
import net.xeoh.plugins.base.PluginManager;
|
||||
import net.xeoh.plugins.base.impl.PluginManagerFactory;
|
||||
import net.xeoh.plugins.base.util.uri.ClassURI;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.mage.plugins.card.CardPluginImpl;
|
||||
import static org.mage.plugins.card.utils.CardImageUtils.getImagesDir;
|
||||
|
@ -46,13 +48,15 @@ public enum Plugins implements MagePlugins {
|
|||
|
||||
@Override
|
||||
public void loadPlugins() {
|
||||
|
||||
LOGGER.info("Loading plugins...");
|
||||
pm = PluginManagerFactory.createPluginManager();
|
||||
pm.addPluginsFrom(new File(PLUGINS_DIRECTORY + File.separator).toURI());
|
||||
this.cardPlugin = new CardPluginImpl();
|
||||
pm.addPluginsFrom(new ClassURI(CardPluginImpl.class).toURI());
|
||||
pm.addPluginsFrom(new ClassURI(ThemePluginImpl.class).toURI());
|
||||
|
||||
this.cardPlugin = pm.getPlugin(CardPlugin.class);
|
||||
this.counterPlugin = pm.getPlugin(CounterPlugin.class);
|
||||
this.themePlugin = new ThemePluginImpl();
|
||||
this.themePlugin = pm.getPlugin(ThemePlugin.class);
|
||||
LOGGER.info("Done.");
|
||||
}
|
||||
|
||||
|
|
|
@ -1,66 +1,58 @@
|
|||
|
||||
|
||||
/*
|
||||
* TablesPanel.java
|
||||
*
|
||||
* Created on 15-Dec-2009, 10:54:01 PM
|
||||
*/
|
||||
package mage.client.table;
|
||||
package mage.client.table;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.beans.PropertyVetoException;
|
||||
import java.io.File;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CancellationException;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import javax.swing.*;
|
||||
import javax.swing.table.AbstractTableModel;
|
||||
import javax.swing.table.DefaultTableCellRenderer;
|
||||
import javax.swing.table.TableCellRenderer;
|
||||
import mage.cards.decks.importer.DeckImporterUtil;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.SessionHandler;
|
||||
import mage.client.chat.ChatPanelBasic;
|
||||
import mage.client.components.MageComponents;
|
||||
import mage.client.dialog.*;
|
||||
import static mage.client.dialog.PreferencesDialog.KEY_TABLES_COLUMNS_ORDER;
|
||||
import static mage.client.dialog.PreferencesDialog.KEY_TABLES_COLUMNS_WIDTH;
|
||||
import static mage.client.dialog.PreferencesDialog.KEY_TABLES_FILTER_SETTINGS;
|
||||
import static mage.client.dialog.PreferencesDialog.KEY_TABLES_DIVIDER_LOCATION_1;
|
||||
import static mage.client.dialog.PreferencesDialog.KEY_TABLES_DIVIDER_LOCATION_2;
|
||||
import static mage.client.dialog.PreferencesDialog.KEY_TABLES_DIVIDER_LOCATION_3;
|
||||
import mage.client.util.ButtonColumn;
|
||||
import mage.client.util.GUISizeHelper;
|
||||
import mage.client.util.IgnoreList;
|
||||
import mage.client.util.MageTableRowSorter;
|
||||
import mage.client.util.URLHandler;
|
||||
import mage.client.util.gui.GuiDisplayUtil;
|
||||
import mage.client.util.gui.TableUtil;
|
||||
import mage.constants.*;
|
||||
import mage.game.match.MatchOptions;
|
||||
import mage.players.PlayerType;
|
||||
import mage.remote.MageRemoteException;
|
||||
import mage.view.MatchView;
|
||||
import mage.view.RoomUsersView;
|
||||
import mage.view.TableView;
|
||||
import mage.view.UserRequestMessage;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.ocpsoft.prettytime.Duration;
|
||||
import org.ocpsoft.prettytime.PrettyTime;
|
||||
import org.ocpsoft.prettytime.units.JustNow;
|
||||
import mage.cards.decks.importer.DeckImporterUtil;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.SessionHandler;
|
||||
import mage.client.chat.ChatPanelBasic;
|
||||
import mage.client.components.MageComponents;
|
||||
import mage.client.dialog.*;
|
||||
import mage.client.util.*;
|
||||
import mage.client.util.gui.GuiDisplayUtil;
|
||||
import mage.client.util.gui.TableUtil;
|
||||
import mage.constants.*;
|
||||
import mage.game.match.MatchOptions;
|
||||
import mage.players.PlayerType;
|
||||
import mage.remote.MageRemoteException;
|
||||
import mage.view.MatchView;
|
||||
import mage.view.RoomUsersView;
|
||||
import mage.view.TableView;
|
||||
import mage.view.UserRequestMessage;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.mage.card.arcane.CardRendererUtils;
|
||||
import org.ocpsoft.prettytime.Duration;
|
||||
import org.ocpsoft.prettytime.PrettyTime;
|
||||
import org.ocpsoft.prettytime.units.JustNow;
|
||||
|
||||
/**
|
||||
*
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import javax.swing.table.AbstractTableModel;
|
||||
import javax.swing.table.DefaultTableCellRenderer;
|
||||
import javax.swing.table.TableCellRenderer;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.beans.PropertyVetoException;
|
||||
import java.io.File;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CancellationException;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static mage.client.dialog.PreferencesDialog.*;
|
||||
|
||||
/**
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class TablesPanel extends javax.swing.JPanel {
|
||||
public class TablesPanel extends javax.swing.JPanel {
|
||||
|
||||
private static final Logger LOGGER = Logger.getLogger(TablesPanel.class);
|
||||
private static final int[] DEFAULT_COLUMNS_WIDTH = {35, 150, 120, 180, 80, 120, 80, 60, 40, 40, 60};
|
||||
|
@ -134,6 +126,41 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
}
|
||||
};
|
||||
|
||||
// skill renderer
|
||||
TableCellRenderer skillCellRenderer = new DefaultTableCellRenderer() {
|
||||
|
||||
// base panel to render
|
||||
private JPanel renderPanel = new JPanel();
|
||||
private ImageIcon skillIcon = new ImageIcon(this.getClass().getResource("/info/yellow_star_16.png"));
|
||||
|
||||
@Override
|
||||
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
|
||||
|
||||
// get table text cell settings
|
||||
DefaultTableCellRenderer baseRenderer = (DefaultTableCellRenderer) table.getDefaultRenderer(String.class);
|
||||
JLabel baseComp = (JLabel) baseRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
|
||||
String skillCode = baseComp.getText();
|
||||
|
||||
// apply settings to render panel from parent
|
||||
renderPanel.setOpaque(baseComp.isOpaque());
|
||||
renderPanel.setForeground(CardRendererUtils.copyColor(baseComp.getForeground()));
|
||||
renderPanel.setBackground(CardRendererUtils.copyColor(baseComp.getBackground()));
|
||||
renderPanel.setBorder(baseComp.getBorder());
|
||||
|
||||
// create each skill symbol as child label
|
||||
renderPanel.removeAll();
|
||||
renderPanel.setLayout(new BoxLayout(renderPanel, BoxLayout.X_AXIS));
|
||||
for (char skillSymbol : skillCode.toCharArray()) {
|
||||
JLabel symbolLabel = new JLabel();
|
||||
symbolLabel.setBorder(new EmptyBorder(0, 3, 0, 0));
|
||||
symbolLabel.setIcon(skillIcon);
|
||||
renderPanel.add(symbolLabel);
|
||||
}
|
||||
|
||||
return renderPanel;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates new form TablesPanel
|
||||
*/
|
||||
|
@ -158,6 +185,9 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
|
||||
// time ago
|
||||
tableTables.getColumnModel().getColumn(TableTableModel.COLUMN_CREATED).setCellRenderer(timeAgoCellRenderer);
|
||||
// skill level
|
||||
tableTables.getColumnModel().getColumn(TableTableModel.COLUMN_SKILL).setCellRenderer(skillCellRenderer);
|
||||
|
||||
/* date sorter (not need, default is good - see getColumnClass)
|
||||
activeTablesSorter.setComparator(TableTableModel.COLUMN_CREATED, new Comparator<Date>() {
|
||||
@Override
|
||||
|
@ -166,6 +196,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
}
|
||||
|
||||
});*/
|
||||
|
||||
// default sort by created date (last games from above)
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new RowSorter.SortKey(TableTableModel.COLUMN_CREATED, SortOrder.DESCENDING));
|
||||
|
@ -326,9 +357,14 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
table.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
int row = table.convertRowIndexToModel(table.getSelectedRow());
|
||||
if (e.getClickCount() == 2 && row != -1) {
|
||||
action.actionPerformed(new ActionEvent(e.getSource(), e.getID(), "" + row));
|
||||
if (e.getClickCount() == 2) {
|
||||
int selRow = table.getSelectedRow();
|
||||
if (selRow != -1) {
|
||||
int dataRow = table.convertRowIndexToModel(selRow);
|
||||
if (dataRow != -1) {
|
||||
action.actionPerformed(new ActionEvent(e.getSource(), e.getID(), "" + dataRow));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -620,15 +656,16 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
formatFilterList.add(RowFilter.regexFilter("^Momir Basic|^Constructed - Pauper|^Constructed - Frontier|^Constructed - Extended|^Constructed - Eternal|^Constructed - Historical|^Constructed - Super|^Constructed - Freeform|^Australian Highlander|^Canadian Highlander|^Constructed - Old", TableTableModel.COLUMN_DECK_TYPE));
|
||||
}
|
||||
|
||||
// skill
|
||||
java.util.List<RowFilter<Object, Object>> skillFilterList = new ArrayList<>();
|
||||
if (btnSkillBeginner.isSelected()) {
|
||||
skillFilterList.add(RowFilter.regexFilter(SkillLevel.BEGINNER.toString(), TableTableModel.COLUMN_SKILL));
|
||||
skillFilterList.add(RowFilter.regexFilter(this.tableModel.getSkillLevelAsCode(SkillLevel.BEGINNER, true), TableTableModel.COLUMN_SKILL));
|
||||
}
|
||||
if (btnSkillCasual.isSelected()) {
|
||||
skillFilterList.add(RowFilter.regexFilter(SkillLevel.CASUAL.toString(), TableTableModel.COLUMN_SKILL));
|
||||
skillFilterList.add(RowFilter.regexFilter(this.tableModel.getSkillLevelAsCode(SkillLevel.CASUAL, true), TableTableModel.COLUMN_SKILL));
|
||||
}
|
||||
if (btnSkillSerious.isSelected()) {
|
||||
skillFilterList.add(RowFilter.regexFilter(SkillLevel.SERIOUS.toString(), TableTableModel.COLUMN_SKILL));
|
||||
skillFilterList.add(RowFilter.regexFilter(this.tableModel.getSkillLevelAsCode(SkillLevel.SERIOUS, true), TableTableModel.COLUMN_SKILL));
|
||||
}
|
||||
|
||||
String ratedMark = TableTableModel.RATED_VALUE_YES;
|
||||
|
@ -1221,6 +1258,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
options.setSkillLevel(SkillLevel.CASUAL);
|
||||
options.setRollbackTurnsAllowed(true);
|
||||
options.setQuitRatio(100);
|
||||
options.setMinimumRating(0);
|
||||
String serverAddress = SessionHandler.getSession().getServerHostname().orElseGet(() -> "");
|
||||
options.setBannedUsers(IgnoreList.ignoreList(serverAddress));
|
||||
table = SessionHandler.createTable(roomId, options);
|
||||
|
@ -1335,14 +1373,15 @@ class TableTableModel extends AbstractTableModel {
|
|||
public static final int COLUMN_SKILL = 8;
|
||||
public static final int COLUMN_RATING = 9;
|
||||
public static final int COLUMN_QUIT_RATIO = 10;
|
||||
public static final int ACTION_COLUMN = 11; // column the action is located (starting with 0)
|
||||
public static final int COLUMN_MINIMUM_RATING = 11;
|
||||
public static final int ACTION_COLUMN = 12; // column the action is located (starting with 0)
|
||||
|
||||
public static final String RATED_VALUE_YES = "YES";
|
||||
public static final String RATED_VALUE_NO = "";
|
||||
|
||||
public static final String PASSWORD_VALUE_YES = "YES";
|
||||
|
||||
private final String[] columnNames = new String[]{"M/T", "Deck Type", "Owner / Players", "Game Type", "Info", "Status", "Password", "Created / Started", "Skill Level", "Rating", "Quit %", "Action"};
|
||||
private final String[] columnNames = new String[]{"M/T", "Deck Type", "Owner / Players", "Game Type", "Info", "Status", "Password", "Created / Started", "Skill Level", "Rated", "Quit %", "Min Rating", "Action"};
|
||||
|
||||
private TableView[] tables = new TableView[0];
|
||||
|
||||
|
@ -1354,6 +1393,31 @@ class TableTableModel extends AbstractTableModel {
|
|||
this.fireTableDataChanged();
|
||||
}
|
||||
|
||||
public String getSkillLevelAsCode(SkillLevel skill, boolean asRegExp) {
|
||||
String res;
|
||||
switch (skill) {
|
||||
case BEGINNER:
|
||||
res = "*";
|
||||
break;
|
||||
case CASUAL:
|
||||
res = "**";
|
||||
break;
|
||||
case SERIOUS:
|
||||
res = "***";
|
||||
break;
|
||||
default:
|
||||
res = "";
|
||||
break;
|
||||
}
|
||||
|
||||
// regexp format for search table rows
|
||||
if (asRegExp) {
|
||||
res = String.format("^%s$", res.replace("*", "\\*"));
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRowCount() {
|
||||
return tables.length;
|
||||
|
@ -1384,12 +1448,14 @@ class TableTableModel extends AbstractTableModel {
|
|||
case 7:
|
||||
return tables[arg0].getCreateTime(); // use cell render, not format here
|
||||
case 8:
|
||||
return tables[arg0].getSkillLevel();
|
||||
return this.getSkillLevelAsCode(tables[arg0].getSkillLevel(), false);
|
||||
case 9:
|
||||
return tables[arg0].isRated() ? RATED_VALUE_YES : RATED_VALUE_NO;
|
||||
case 10:
|
||||
return tables[arg0].getQuitRatio();
|
||||
case 11:
|
||||
return tables[arg0].getMinimumRating();
|
||||
case 12:
|
||||
switch (tables[arg0].getTableState()) {
|
||||
|
||||
case WAITING:
|
||||
|
@ -1419,14 +1485,14 @@ class TableTableModel extends AbstractTableModel {
|
|||
default:
|
||||
return "";
|
||||
}
|
||||
case 12:
|
||||
return tables[arg0].isTournament();
|
||||
case 13:
|
||||
return tables[arg0].isTournament();
|
||||
case 14:
|
||||
if (!tables[arg0].getGames().isEmpty()) {
|
||||
return tables[arg0].getGames().get(0);
|
||||
}
|
||||
return null;
|
||||
case 14:
|
||||
case 15:
|
||||
return tables[arg0].getTableId();
|
||||
}
|
||||
return "";
|
||||
|
|
|
@ -1,8 +1,3 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.mage.card.arcane;
|
||||
|
||||
import java.awt.*;
|
||||
|
@ -74,9 +69,9 @@ public final class CardRendererUtils {
|
|||
int b = c.getBlue();
|
||||
int alpha = c.getAlpha();
|
||||
|
||||
int plus_r = (int) (Math.min (255 - r, r) / 2);
|
||||
int plus_g = (int) (Math.min (255 - g, g) / 2);
|
||||
int plus_b = (int) (Math.min (255 - b, b) / 2);
|
||||
int plus_r = (int) (Math.min(255 - r, r) / 2);
|
||||
int plus_g = (int) (Math.min(255 - g, g) / 2);
|
||||
int plus_b = (int) (Math.min(255 - b, b) / 2);
|
||||
|
||||
return new Color(r - plus_r,
|
||||
g - plus_g,
|
||||
|
@ -192,4 +187,12 @@ public final class CardRendererUtils {
|
|||
.replaceAll("<i>", "")
|
||||
.replaceAll("</i>", "");
|
||||
}
|
||||
|
||||
public static Color copyColor(Color color) {
|
||||
if (color != null) {
|
||||
return new Color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha());
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,10 +9,13 @@ import java.awt.*;
|
|||
import java.awt.image.BufferedImage;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
/**
|
||||
* @author JayDi85
|
||||
*/
|
||||
public final class ManaSymbolsCellRenderer extends DefaultTableCellRenderer {
|
||||
|
||||
// base panel to render
|
||||
private JPanel manaPanel = new JPanel();
|
||||
private JPanel renderPanel = new JPanel();
|
||||
|
||||
@Override
|
||||
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
|
||||
|
@ -20,47 +23,47 @@ public final class ManaSymbolsCellRenderer extends DefaultTableCellRenderer {
|
|||
|
||||
// get table text cell settings
|
||||
DefaultTableCellRenderer baseRenderer = (DefaultTableCellRenderer) table.getDefaultRenderer(String.class);
|
||||
JLabel baseLabel = (JLabel)baseRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
|
||||
JLabel baseComp = (JLabel) baseRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
|
||||
|
||||
// apply settings to mana panel from parent
|
||||
manaPanel.setOpaque(baseLabel.isOpaque());
|
||||
manaPanel.setForeground(baseLabel.getForeground());
|
||||
manaPanel.setBackground(baseLabel.getBackground());
|
||||
renderPanel.setOpaque(baseComp.isOpaque());
|
||||
renderPanel.setForeground(CardRendererUtils.copyColor(baseComp.getForeground()));
|
||||
renderPanel.setBackground(CardRendererUtils.copyColor(baseComp.getBackground()));
|
||||
renderPanel.setBorder(baseComp.getBorder());
|
||||
|
||||
// icons size with margin
|
||||
int symbolWidth = GUISizeHelper.symbolTableSize;
|
||||
int symbolHorizontalMargin = 2;
|
||||
|
||||
// create each mana symbol as child label
|
||||
String manaCost = (String)value;
|
||||
manaPanel.removeAll();
|
||||
manaPanel.setLayout(new BoxLayout(manaPanel, BoxLayout.X_AXIS));
|
||||
if(manaCost != null){
|
||||
String manaCost = (String) value;
|
||||
renderPanel.removeAll();
|
||||
renderPanel.setLayout(new BoxLayout(renderPanel, BoxLayout.X_AXIS));
|
||||
if (manaCost != null) {
|
||||
StringTokenizer tok = new StringTokenizer(manaCost, " ");
|
||||
while (tok.hasMoreTokens()) {
|
||||
String symbol = tok.nextToken();
|
||||
|
||||
JLabel symbolLabel = new JLabel();
|
||||
//symbolLabel.setBorder(new LineBorder(new Color(150, 150, 150))); // debug
|
||||
symbolLabel.setBorder(new EmptyBorder(0, symbolHorizontalMargin,0, 0));
|
||||
symbolLabel.setBorder(new EmptyBorder(0, symbolHorizontalMargin, 0, 0));
|
||||
|
||||
BufferedImage image = ManaSymbols.getSizedManaSymbol(symbol, symbolWidth);
|
||||
if (image != null){
|
||||
if (image != null) {
|
||||
// icon
|
||||
symbolLabel.setIcon(new ImageIcon(image));
|
||||
}else
|
||||
{
|
||||
} else {
|
||||
// text
|
||||
symbolLabel.setText("{" + symbol + "}");
|
||||
symbolLabel.setOpaque(baseLabel.isOpaque());
|
||||
symbolLabel.setForeground(baseLabel.getForeground());
|
||||
symbolLabel.setBackground(baseLabel.getBackground());
|
||||
symbolLabel.setOpaque(baseComp.isOpaque());
|
||||
symbolLabel.setForeground(baseComp.getForeground());
|
||||
symbolLabel.setBackground(baseComp.getBackground());
|
||||
}
|
||||
|
||||
manaPanel.add(symbolLabel);
|
||||
renderPanel.add(symbolLabel);
|
||||
}
|
||||
}
|
||||
|
||||
return manaPanel;
|
||||
return renderPanel;
|
||||
}
|
||||
}
|
||||
|
|
BIN
Mage.Client/src/main/resources/info/yellow_star_16.png
Normal file
BIN
Mage.Client/src/main/resources/info/yellow_star_16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 478 B |
BIN
Mage.Client/src/main/resources/info/yellow_star_24.png
Normal file
BIN
Mage.Client/src/main/resources/info/yellow_star_24.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 658 B |
BIN
Mage.Client/src/main/resources/info/yellow_star_32.png
Normal file
BIN
Mage.Client/src/main/resources/info/yellow_star_32.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 931 B |
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>org.mage</groupId>
|
||||
<artifactId>mage-root</artifactId>
|
||||
<version>1.4.31</version>
|
||||
<version>1.4.32</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>mage-common</artifactId>
|
||||
|
|
|
@ -13,8 +13,8 @@ public class MageVersion implements Serializable, Comparable<MageVersion> {
|
|||
*/
|
||||
public final static int MAGE_VERSION_MAJOR = 1;
|
||||
public final static int MAGE_VERSION_MINOR = 4;
|
||||
public final static int MAGE_VERSION_PATCH = 31;
|
||||
public final static String MAGE_VERSION_MINOR_PATCH = "V4";
|
||||
public final static int MAGE_VERSION_PATCH = 32;
|
||||
public final static String MAGE_VERSION_MINOR_PATCH = "V0";
|
||||
public final static String MAGE_VERSION_INFO = "";
|
||||
|
||||
private final int major;
|
||||
|
|
|
@ -36,6 +36,7 @@ public class TableView implements Serializable {
|
|||
private List<SeatView> seats = new ArrayList<>();
|
||||
private List<UUID> games = new ArrayList<>();
|
||||
private final String quitRatio;
|
||||
private final String minimumRating;
|
||||
private final boolean limited;
|
||||
private final boolean rated;
|
||||
private final boolean passworded;
|
||||
|
@ -111,6 +112,7 @@ public class TableView implements Serializable {
|
|||
this.additionalInfo = addInfo.toString();
|
||||
this.skillLevel = table.getMatch().getOptions().getSkillLevel();
|
||||
this.quitRatio = Integer.toString(table.getMatch().getOptions().getQuitRatio());
|
||||
this.minimumRating = Integer.toString(table.getMatch().getOptions().getMinimumRating());
|
||||
this.limited = table.getMatch().getOptions().isLimited();
|
||||
this.rated = table.getMatch().getOptions().isRated();
|
||||
this.passworded = !table.getMatch().getOptions().getPassword().isEmpty();
|
||||
|
@ -159,6 +161,7 @@ public class TableView implements Serializable {
|
|||
this.deckType = table.getDeckType() + ' ' + table.getTournament().getBoosterInfo() + (tableNameInfo != null ? tableNameInfo : "");
|
||||
this.skillLevel = table.getTournament().getOptions().getMatchOptions().getSkillLevel();
|
||||
this.quitRatio = Integer.toString(table.getTournament().getOptions().getQuitRatio());
|
||||
this.minimumRating = Integer.toString(table.getTournament().getOptions().getMinimumRating());
|
||||
this.limited = table.getTournament().getOptions().getMatchOptions().isLimited();
|
||||
this.rated = table.getTournament().getOptions().getMatchOptions().isRated();
|
||||
this.passworded = !table.getTournament().getOptions().getPassword().isEmpty();
|
||||
|
@ -223,9 +226,9 @@ public class TableView implements Serializable {
|
|||
return skillLevel;
|
||||
}
|
||||
|
||||
public String getQuitRatio() {
|
||||
return quitRatio;
|
||||
}
|
||||
public String getQuitRatio() { return quitRatio; }
|
||||
|
||||
public String getMinimumRating() { return minimumRating; }
|
||||
|
||||
public boolean isLimited() {
|
||||
return limited;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>org.mage</groupId>
|
||||
<artifactId>mage-plugins</artifactId>
|
||||
<version>1.4.31</version>
|
||||
<version>1.4.32</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>mage-counter-plugin</artifactId>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>org.mage</groupId>
|
||||
<artifactId>mage-root</artifactId>
|
||||
<version>1.4.31</version>
|
||||
<version>1.4.32</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>mage-plugins</artifactId>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<parent>
|
||||
<groupId>org.mage</groupId>
|
||||
<artifactId>mage-root</artifactId>
|
||||
<version>1.4.31</version>
|
||||
<version>1.4.32</version>
|
||||
</parent>
|
||||
|
||||
<groupId>org.mage</groupId>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>org.mage</groupId>
|
||||
<artifactId>mage-server-plugins</artifactId>
|
||||
<version>1.4.31</version>
|
||||
<version>1.4.32</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>mage-deck-constructed</artifactId>
|
||||
|
|
|
@ -45,6 +45,7 @@ public class CanadianHighlander extends Constructed {
|
|||
pointMap.put("Personal Tutor", 1);
|
||||
pointMap.put("Protean Hulk", 3);
|
||||
pointMap.put("Sol Ring", 3);
|
||||
pointMap.put("Spellseeker", 1);
|
||||
pointMap.put("Stoneforge Mystic", 1);
|
||||
pointMap.put("Strip Mine", 2);
|
||||
pointMap.put("Summoner's Pact", 2);
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>org.mage</groupId>
|
||||
<artifactId>mage-server-plugins</artifactId>
|
||||
<version>1.4.31</version>
|
||||
<version>1.4.32</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>mage-deck-limited</artifactId>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>org.mage</groupId>
|
||||
<artifactId>mage-server-plugins</artifactId>
|
||||
<version>1.4.31</version>
|
||||
<version>1.4.32</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>mage-game-brawlduel</artifactId>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<parent>
|
||||
<groupId>org.mage</groupId>
|
||||
<artifactId>mage-server-plugins</artifactId>
|
||||
<version>1.4.31</version>
|
||||
<version>1.4.32</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>mage-game-brawlfreeforall</artifactId>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>org.mage</groupId>
|
||||
<artifactId>mage-server-plugins</artifactId>
|
||||
<version>1.4.31</version>
|
||||
<version>1.4.32</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>mage-game-canadianhighlanderduel</artifactId>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>org.mage</groupId>
|
||||
<artifactId>mage-server-plugins</artifactId>
|
||||
<version>1.4.31</version>
|
||||
<version>1.4.32</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>mage-game-commanderduel</artifactId>
|
||||
|
|