diff --git a/Mage.Client/src/main/java/mage/client/dialog/ConnectDialog.form b/Mage.Client/src/main/java/mage/client/dialog/ConnectDialog.form
index c1ef452cc2..99de56d11b 100644
--- a/Mage.Client/src/main/java/mage/client/dialog/ConnectDialog.form
+++ b/Mage.Client/src/main/java/mage/client/dialog/ConnectDialog.form
@@ -3,9 +3,6 @@
diff --git a/Mage.Client/src/main/java/mage/client/dialog/ConnectDialog.java b/Mage.Client/src/main/java/mage/client/dialog/ConnectDialog.java
index 9f2258a31a..7d932d99e5 100644
--- a/Mage.Client/src/main/java/mage/client/dialog/ConnectDialog.java
+++ b/Mage.Client/src/main/java/mage/client/dialog/ConnectDialog.java
@@ -105,10 +105,6 @@ public class ConnectDialog extends MageDialog {
private void initComponents() {
lblServer = new javax.swing.JLabel();
- txtServer = new javax.swing.JTextField();
- btnFind = new javax.swing.JButton();
- lblPort = new javax.swing.JLabel();
- txtPort = new javax.swing.JTextField();
lblUserName = new javax.swing.JLabel();
txtUserName = new javax.swing.JTextField();
lblPassword = new javax.swing.JLabel();
@@ -122,47 +118,41 @@ public class ConnectDialog extends MageDialog {
lblStatus = new javax.swing.JLabel();
btnRegister = new javax.swing.JButton();
btnForgotPassword = new javax.swing.JButton();
- btnFind1 = new javax.swing.JButton();
- btnFind2 = new javax.swing.JButton();
- btnFind3 = new javax.swing.JButton();
lblFastConnect = new javax.swing.JLabel();
panelFlag = new javax.swing.JPanel();
cbFlag = new mage.client.util.gui.countryBox.CountryComboBox();
filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(5, 0), new java.awt.Dimension(4, 0), new java.awt.Dimension(5, 32767));
btnFlagSearch = new javax.swing.JButton();
+ panelFast = new javax.swing.JPanel();
+ btnFindMain = new javax.swing.JButton();
+ btnFindLocal = new javax.swing.JButton();
+ btnFindBeta = new javax.swing.JButton();
+ btnFindUs = new javax.swing.JButton();
+ btnFindOther = new javax.swing.JButton();
+ panelServer = new javax.swing.JPanel();
+ txtServer = new javax.swing.JTextField();
+ txtPort = new javax.swing.JTextField();
+ lblPort = new javax.swing.JLabel();
+ btnCheckStatus = new javax.swing.JButton();
+ filler2 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 50), new java.awt.Dimension(0, 50), new java.awt.Dimension(32767, 50));
setTitle("Connect to server");
- setNormalBounds(new java.awt.Rectangle(100, 100, 410, 307));
+ lblServer.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
lblServer.setLabelFor(txtServer);
- lblServer.setText("Server:");
-
- btnFind.setText("Find...");
- btnFind.setToolTipText("Shows the list of public servers");
- btnFind.setName("findServerBtn"); // NOI18N
- btnFind.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- findPublicServerActionPerformed(evt);
- }
- });
-
- lblPort.setLabelFor(txtPort);
- lblPort.setText("Port:");
-
- txtPort.addKeyListener(new java.awt.event.KeyAdapter() {
- public void keyTyped(java.awt.event.KeyEvent evt) {
- ConnectDialog.this.keyTyped(evt);
- }
- });
+ lblServer.setText("Server name:");
+ lblUserName.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
lblUserName.setLabelFor(txtUserName);
- lblUserName.setText("User name:");
+ lblUserName.setText("Username:");
+ lblPassword.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
lblPassword.setLabelFor(txtPassword);
lblPassword.setText("Password:");
+ lblFlag.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
lblFlag.setLabelFor(txtUserName);
- lblFlag.setText("User flag:");
+ lblFlag.setText("User's flag:");
chkAutoConnect.setText("Automatically connect to this server next time");
chkAutoConnect.setToolTipText("If active this connect dialog will not be shown if you choose to connect.
\nInstead XMage tries to connect to the last server you were connected to.");
@@ -223,55 +213,12 @@ public class ConnectDialog extends MageDialog {
}
});
- btnFind1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/flags/de.png"))); // NOI18N
- btnFind1.setText("X");
- btnFind1.setToolTipText("Connect to xmage.de (Europe, most popular)");
- btnFind1.setActionCommand("connectXmageDe");
- btnFind1.setAlignmentY(0.0F);
- btnFind1.setMargin(new java.awt.Insets(2, 2, 2, 2));
- btnFind1.setMaximumSize(new java.awt.Dimension(42, 23));
- btnFind1.setMinimumSize(new java.awt.Dimension(42, 23));
- btnFind1.setName("connectXmageDeBtn"); // NOI18N
- btnFind1.setPreferredSize(new java.awt.Dimension(23, 23));
- btnFind1.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- connectXmageDe(evt);
- }
- });
-
- btnFind2.setText("L");
- btnFind2.setToolTipText("Connect to localhost (local server)");
- btnFind2.setActionCommand("connectLocalhost");
- btnFind2.setAlignmentY(0.0F);
- btnFind2.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
- btnFind2.setMargin(new java.awt.Insets(2, 2, 2, 2));
- btnFind2.setName("connectLocalhostBtn"); // NOI18N
- btnFind2.setPreferredSize(new java.awt.Dimension(23, 23));
- btnFind2.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- connectLocalhost(evt);
- }
- });
-
- btnFind3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/flags/us.png"))); // NOI18N
- 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));
- btnFind3.setName("connectXmageusBtn"); // NOI18N
- btnFind3.setPreferredSize(new java.awt.Dimension(23, 23));
- btnFind3.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- connectXmageus(evt);
- }
- });
-
- lblFastConnect.setLabelFor(btnFind1);
- lblFastConnect.setText("Fast connect to:");
+ lblFastConnect.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
+ lblFastConnect.setLabelFor(btnFindMain);
+ lblFastConnect.setText("Connect to:");
lblFastConnect.setName(""); // NOI18N
- panelFlag.setPreferredSize(new java.awt.Dimension(189, 30));
+ panelFlag.setMinimumSize(new java.awt.Dimension(50, 33));
panelFlag.setLayout(new javax.swing.BoxLayout(panelFlag, javax.swing.BoxLayout.LINE_AXIS));
cbFlag.setEditable(true);
@@ -293,28 +240,171 @@ public class ConnectDialog extends MageDialog {
});
panelFlag.add(btnFlagSearch);
+ btnFindMain.setIcon(new javax.swing.ImageIcon(getClass().getResource("/flags/de.png"))); // NOI18N
+ btnFindMain.setText("X");
+ btnFindMain.setToolTipText("Connect to xmage.de (Europe, most popular, registration needs)");
+ btnFindMain.setActionCommand("connectXmageDe");
+ btnFindMain.setAlignmentY(0.0F);
+ btnFindMain.setMargin(new java.awt.Insets(2, 2, 2, 2));
+ btnFindMain.setMaximumSize(new java.awt.Dimension(42, 23));
+ btnFindMain.setMinimumSize(new java.awt.Dimension(42, 23));
+ btnFindMain.setName("connectXmageDeBtn"); // NOI18N
+ btnFindMain.setPreferredSize(new java.awt.Dimension(23, 23));
+ btnFindMain.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ connectXmageDe(evt);
+ }
+ });
+
+ btnFindLocal.setText("LOCAL");
+ btnFindLocal.setToolTipText("Connect to localhost (local server)");
+ btnFindLocal.setActionCommand("connectLocalhost");
+ btnFindLocal.setAlignmentY(0.0F);
+ btnFindLocal.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
+ btnFindLocal.setMargin(new java.awt.Insets(2, 2, 2, 2));
+ btnFindLocal.setName("connectLocalhostBtn"); // NOI18N
+ btnFindLocal.setPreferredSize(new java.awt.Dimension(23, 23));
+ btnFindLocal.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ connectLocalhost(evt);
+ }
+ });
+
+ btnFindBeta.setText("BETA");
+ btnFindBeta.setToolTipText("Connect to BETA server (use any username without registration)");
+ btnFindBeta.setAlignmentY(0.0F);
+ btnFindBeta.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
+ btnFindBeta.setMargin(new java.awt.Insets(2, 2, 2, 2));
+ btnFindBeta.setPreferredSize(new java.awt.Dimension(23, 23));
+ btnFindBeta.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnFindBetaconnectLocalhost(evt);
+ }
+ });
+
+ btnFindUs.setIcon(new javax.swing.ImageIcon(getClass().getResource("/flags/us.png"))); // NOI18N
+ btnFindUs.setText("P");
+ btnFindUs.setToolTipText("Connect to mtg.powersofwar.com (USA, use any username without registration)");
+ btnFindUs.setActionCommand("connectXmageus");
+ btnFindUs.setAlignmentY(0.0F);
+ btnFindUs.setMargin(new java.awt.Insets(2, 2, 2, 2));
+ btnFindUs.setName("connectXmageusBtn"); // NOI18N
+ btnFindUs.setPreferredSize(new java.awt.Dimension(23, 23));
+ btnFindUs.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ connectXmageus(evt);
+ }
+ });
+
+ btnFindOther.setText("Other servers...");
+ btnFindOther.setToolTipText("Choose server from full servers list");
+ btnFindOther.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
+ btnFindOther.setName("findServerBtn"); // NOI18N
+ btnFindOther.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ findPublicServerActionPerformed(evt);
+ }
+ });
+
+ javax.swing.GroupLayout panelFastLayout = new javax.swing.GroupLayout(panelFast);
+ panelFast.setLayout(panelFastLayout);
+ panelFastLayout.setHorizontalGroup(
+ panelFastLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(panelFastLayout.createSequentialGroup()
+ .addGap(0, 0, 0)
+ .addComponent(btnFindMain, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(btnFindUs, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(btnFindBeta, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(btnFindLocal, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(btnFindOther, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addGap(0, 0, 0))
+ );
+ panelFastLayout.setVerticalGroup(
+ panelFastLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(panelFastLayout.createSequentialGroup()
+ .addGap(0, 0, 0)
+ .addGroup(panelFastLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(btnFindMain, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(btnFindLocal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(btnFindUs, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(btnFindBeta, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(btnFindOther))
+ .addGap(0, 0, 0))
+ );
+
+ txtPort.addKeyListener(new java.awt.event.KeyAdapter() {
+ public void keyTyped(java.awt.event.KeyEvent evt) {
+ ConnectDialog.this.keyTyped(evt);
+ }
+ });
+
+ lblPort.setLabelFor(txtPort);
+ lblPort.setText("Port:");
+
+ btnCheckStatus.setIcon(new javax.swing.ImageIcon(getClass().getResource("/flags/world.png"))); // NOI18N
+ btnCheckStatus.setText("Check online status");
+ btnCheckStatus.setToolTipText("Go to servers online statuses page");
+ btnCheckStatus.setAlignmentY(0.0F);
+ btnCheckStatus.setMargin(new java.awt.Insets(2, 2, 2, 2));
+ btnCheckStatus.setPreferredSize(new java.awt.Dimension(23, 23));
+ btnCheckStatus.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnCheckStatusActionPerformed(evt);
+ }
+ });
+
+ javax.swing.GroupLayout panelServerLayout = new javax.swing.GroupLayout(panelServer);
+ panelServer.setLayout(panelServerLayout);
+ panelServerLayout.setHorizontalGroup(
+ panelServerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(panelServerLayout.createSequentialGroup()
+ .addComponent(txtServer, javax.swing.GroupLayout.PREFERRED_SIZE, 212, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(lblPort)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(txtPort, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(btnCheckStatus, javax.swing.GroupLayout.DEFAULT_SIZE, 141, Short.MAX_VALUE)
+ .addGap(0, 0, 0))
+ );
+ panelServerLayout.setVerticalGroup(
+ panelServerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(panelServerLayout.createSequentialGroup()
+ .addGap(0, 0, 0)
+ .addGroup(panelServerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(txtServer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(txtPort, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(lblPort)
+ .addComponent(btnCheckStatus, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
+ );
+
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
+ .addComponent(lblUserName, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(lblServer, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(lblFastConnect, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(lblPassword, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(lblFlag, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addGap(29, 29, 29)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
- .addComponent(lblPort)
- .addComponent(lblServer)))
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
- .addContainerGap()
- .addComponent(lblFlag)))
.addGroup(layout.createSequentialGroup()
- .addContainerGap()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(lblUserName)
- .addComponent(lblPassword, javax.swing.GroupLayout.Alignment.TRAILING))))
- .addGap(0, 0, 0)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jProxySettingsButton)
+ .addGap(0, 0, Short.MAX_VALUE))
+ .addComponent(lblStatus, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(chkForceUpdateDB, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(chkAutoConnect, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(txtUserName)
+ .addComponent(txtPassword)
+ .addComponent(panelFlag, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addComponent(btnConnect, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
@@ -323,67 +413,45 @@ public class ConnectDialog extends MageDialog {
.addComponent(btnForgotPassword, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnCancel, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addComponent(lblStatus, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(chkForceUpdateDB, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addGroup(layout.createSequentialGroup()
- .addComponent(jProxySettingsButton)
- .addGap(0, 0, Short.MAX_VALUE))
- .addComponent(chkAutoConnect, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
- .addComponent(panelFlag, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(txtServer, javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(txtUserName, javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(txtPassword, javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addComponent(txtPort, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 11, Short.MAX_VALUE)
- .addComponent(lblFastConnect)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(btnFind1, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(btnFind3, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(btnFind2, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)))
- .addGap(0, 0, 0)
- .addComponent(btnFind)))
+ .addComponent(panelFast, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(panelServer, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(filler2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(lblServer)
- .addComponent(txtServer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(btnFind))
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(panelFast, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(lblFastConnect, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(txtPort, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(lblPort)
- .addComponent(btnFind1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(btnFind2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(btnFind3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(lblFastConnect))
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(panelServer, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(lblServer, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(txtUserName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(lblUserName))
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(txtUserName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(lblUserName, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
+ .addComponent(txtPassword)
+ .addComponent(lblPassword, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
+ .addComponent(filler2, javax.swing.GroupLayout.DEFAULT_SIZE, 53, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(txtPassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(lblPassword))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(panelFlag, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblFlag, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(chkAutoConnect)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(chkForceUpdateDB)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addComponent(jProxySettingsButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(jProxySettingsButton)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(lblStatus, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
@@ -396,6 +464,8 @@ public class ConnectDialog extends MageDialog {
.addGap(23, 23, 23))
);
+ lblFastConnect.getAccessibleContext().setAccessibleName("Fast connect to:");
+
pack();
}// //GEN-END:initComponents
@@ -659,8 +729,7 @@ public class ConnectDialog extends MageDialog {
this.txtPort.setText("17171");
// Update userName and password according to the chosen server.
this.txtUserName.setText(MagePreferences.getUserName(serverAddress));
- this.txtPassword.setText(MagePreferences.getPassword(serverAddress));
-
+ this.txtPassword.setText(MagePreferences.getPassword(serverAddress)); // TODO add your handling code here:
}//GEN-LAST:event_btnFind1findPublicServerActionPerformed
private void connectLocalhost(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnFind2findPublicServerActionPerformed
@@ -682,10 +751,33 @@ public class ConnectDialog extends MageDialog {
this.txtPassword.setText(MagePreferences.getPassword(serverAddress));
}
+ private void connectBeta(java.awt.event.ActionEvent evt) {
+ String serverAddress = "xmage.today";
+ this.txtServer.setText(serverAddress);
+ this.txtPort.setText("17171");
+ // Update userName and password according to the chosen server.
+ this.txtUserName.setText(MagePreferences.getUserName(serverAddress));
+ this.txtPassword.setText(MagePreferences.getPassword(serverAddress));
+ }
+
private void btnFlagSearchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnFlagSearchActionPerformed
doFastFlagSearch();
}//GEN-LAST:event_btnFlagSearchActionPerformed
+ private void btnFindBetaconnectLocalhost(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnFindBetaconnectLocalhost
+ connectBeta(evt);
+ }//GEN-LAST:event_btnFindBetaconnectLocalhost
+
+ private void btnCheckStatusActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCheckStatusActionPerformed
+ if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) {
+ try {
+ Desktop.getDesktop().browse(new URI("http://xmageservers.online/"));
+ } catch (Exception e) {
+ //
+ }
+ }
+ }//GEN-LAST:event_btnCheckStatusActionPerformed
+
private void doFastFlagSearch() {
Choice choice = new ChoiceImpl(false);
@@ -731,11 +823,13 @@ public class ConnectDialog extends MageDialog {
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnCancel;
+ private javax.swing.JButton btnCheckStatus;
private javax.swing.JButton btnConnect;
- private javax.swing.JButton btnFind;
- private javax.swing.JButton btnFind1;
- private javax.swing.JButton btnFind2;
- private javax.swing.JButton btnFind3;
+ private javax.swing.JButton btnFindBeta;
+ private javax.swing.JButton btnFindLocal;
+ private javax.swing.JButton btnFindMain;
+ private javax.swing.JButton btnFindOther;
+ private javax.swing.JButton btnFindUs;
private javax.swing.JButton btnFlagSearch;
private javax.swing.JButton btnForgotPassword;
private javax.swing.JButton btnRegister;
@@ -743,6 +837,7 @@ public class ConnectDialog extends MageDialog {
private javax.swing.JCheckBox chkAutoConnect;
private javax.swing.JCheckBox chkForceUpdateDB;
private javax.swing.Box.Filler filler1;
+ private javax.swing.Box.Filler filler2;
private javax.swing.JButton jProxySettingsButton;
private javax.swing.JLabel lblFastConnect;
private javax.swing.JLabel lblFlag;
@@ -751,7 +846,9 @@ public class ConnectDialog extends MageDialog {
private javax.swing.JLabel lblServer;
private javax.swing.JLabel lblStatus;
private javax.swing.JLabel lblUserName;
+ private javax.swing.JPanel panelFast;
private javax.swing.JPanel panelFlag;
+ private javax.swing.JPanel panelServer;
private javax.swing.JPasswordField txtPassword;
private javax.swing.JTextField txtPort;
private javax.swing.JTextField txtServer;
diff --git a/Mage.Client/src/main/java/mage/client/table/TablesUtil.java b/Mage.Client/src/main/java/mage/client/table/TablesUtil.java
index 475be3d2f9..bdb6bc363b 100644
--- a/Mage.Client/src/main/java/mage/client/table/TablesUtil.java
+++ b/Mage.Client/src/main/java/mage/client/table/TablesUtil.java
@@ -18,6 +18,8 @@ public class TablesUtil {
searchId = ((TablesTableModel) table.getModel()).findTableAndGameInfoByRow(row);
} else if (table.getModel() instanceof MatchesTableModel) {
searchId = ((MatchesTableModel) table.getModel()).findTableAndGameInfoByRow(row);
+ } else if (table.getModel() instanceof TournamentMatchesTableModel) {
+ searchId = ((TournamentMatchesTableModel) table.getModel()).findTableAndGameInfoByRow(row);
} else {
logger.error("Not supported tables model " + table.getModel().getClass().toString());
}
@@ -31,6 +33,8 @@ public class TablesUtil {
row = ((TablesTableModel) tableModel).findRowByTableAndGameInfo(searchId);
} else if (tableModel instanceof MatchesTableModel) {
row = ((MatchesTableModel) tableModel).findRowByTableAndGameInfo(searchId);
+ } else if (tableModel instanceof TournamentMatchesTableModel) {
+ row = ((TournamentMatchesTableModel) tableModel).findRowByTableAndGameInfo(searchId);
} else {
logger.error("Not supported tables model " + tableModel.getClass().toString());
}
diff --git a/Mage.Client/src/main/java/mage/client/table/TournamentMatchesTableModel.java b/Mage.Client/src/main/java/mage/client/table/TournamentMatchesTableModel.java
new file mode 100644
index 0000000000..288a5c70f7
--- /dev/null
+++ b/Mage.Client/src/main/java/mage/client/table/TournamentMatchesTableModel.java
@@ -0,0 +1,116 @@
+package mage.client.table;
+
+import mage.view.RoundView;
+import mage.view.TournamentGameView;
+import mage.view.TournamentView;
+
+import javax.swing.table.AbstractTableModel;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author JayDi85
+ */
+public class TournamentMatchesTableModel extends AbstractTableModel {
+ public static final int ACTION_COLUMN = 4; // column the action is located
+
+ private final String[] columnNames = new String[]{"Round Number", "Players", "State", "Result", "Action"};
+ private TournamentGameView[] games = new TournamentGameView[0];
+ private boolean watchingAllowed;
+
+ public void loadData(TournamentView tournament) {
+ List views = new ArrayList<>();
+ watchingAllowed = tournament.isWatchingAllowed();
+ for (RoundView round : tournament.getRounds()) {
+ for (TournamentGameView game : round.getGames()) {
+ views.add(game);
+ }
+ }
+ games = views.toArray(new TournamentGameView[0]);
+ this.fireTableDataChanged();
+ }
+
+ public String getTableAndGameInfo(int row) {
+ return this.games[row].getTableId().toString() + ";" + games[row].toString();
+ }
+
+ public String findTableAndGameInfoByRow(int row) {
+ if (row >= 0 && row < this.games.length) {
+ return getTableAndGameInfo(row);
+ } else {
+ return null;
+ }
+ }
+
+ public int findRowByTableAndGameInfo(String tableAndGame) {
+ for (int i = 0; i < this.games.length; i++) {
+ String rowID = this.games[i].getTableId().toString() + ";" + this.games[i].toString();
+ if (tableAndGame.equals(rowID)) {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ @Override
+ public int getRowCount() {
+ return games.length;
+ }
+
+ @Override
+ public int getColumnCount() {
+ return columnNames.length;
+ }
+
+ @Override
+ public Object getValueAt(int arg0, int arg1) {
+ switch (arg1) {
+ case 0:
+ return Integer.toString(games[arg0].getRoundNum());
+ case 1:
+ return games[arg0].getPlayers();
+ case 2:
+ return games[arg0].getState();
+ case 3:
+ return games[arg0].getResult();
+ case 4:
+// if (games[arg0].getState().equals("Finished")) {
+// return "Replay";
+// }
+ if (watchingAllowed && games[arg0].getState().startsWith("Dueling")) {
+ return "Watch";
+ }
+ return "";
+ case 5:
+ return games[arg0].getTableId().toString();
+ case 6:
+ return games[arg0].getMatchId().toString();
+ case 7:
+ return games[arg0].getGameId().toString();
+
+ }
+ return "";
+ }
+
+ @Override
+ public String getColumnName(int columnIndex) {
+ String colName = "";
+
+ if (columnIndex <= getColumnCount()) {
+ colName = columnNames[columnIndex];
+ }
+
+ return colName;
+ }
+
+ @Override
+ public Class getColumnClass(int columnIndex) {
+ return String.class;
+ }
+
+ @Override
+ public boolean isCellEditable(int rowIndex, int columnIndex) {
+ return columnIndex == ACTION_COLUMN;
+ }
+
+}
\ No newline at end of file
diff --git a/Mage.Client/src/main/java/mage/client/tournament/TournamentPanel.java b/Mage.Client/src/main/java/mage/client/tournament/TournamentPanel.java
index bdafa112a5..19eeb84fdb 100644
--- a/Mage.Client/src/main/java/mage/client/tournament/TournamentPanel.java
+++ b/Mage.Client/src/main/java/mage/client/tournament/TournamentPanel.java
@@ -5,12 +5,16 @@ import mage.client.SessionHandler;
import mage.client.chat.ChatPanelBasic;
import mage.client.dialog.PreferencesDialog;
import mage.client.table.TablesButtonColumn;
+import mage.client.table.TablesUtil;
+import mage.client.table.TournamentMatchesTableModel;
import mage.client.util.Format;
import mage.client.util.GUISizeHelper;
import mage.client.util.gui.TableUtil;
import mage.client.util.gui.countryBox.CountryCellRenderer;
import mage.constants.PlayerAction;
-import mage.view.*;
+import mage.view.TournamentPlayerView;
+import mage.view.TournamentView;
+import mage.view.UserRequestMessage;
import org.apache.log4j.Logger;
import javax.swing.*;
@@ -18,7 +22,6 @@ import javax.swing.table.AbstractTableModel;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.text.DateFormat;
-import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
@@ -74,7 +77,11 @@ public class TournamentPanel extends javax.swing.JPanel {
Action action = new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
- int modelRow = Integer.valueOf(e.getActionCommand());
+ String searchID = e.getActionCommand();
+ int modelRow = TablesUtil.findTableRowFromSearchId(matchesModel, searchID);
+ if (modelRow == -1) {
+ return;
+ }
String state = (String) tableMatches.getValueAt(modelRow, tableMatches.convertColumnIndexToView(2));
String actionText = (String) tableMatches.getValueAt(modelRow, tableMatches.convertColumnIndexToView(TournamentMatchesTableModel.ACTION_COLUMN));
@@ -132,7 +139,7 @@ public class TournamentPanel extends javax.swing.JPanel {
private void saveDividerLocations() {
// save panel sizes and divider locations.
Rectangle rec = MageFrame.getDesktop().getBounds();
- String sb = Double.toString(rec.getWidth()) + 'x' + Double.toString(rec.getHeight());
+ String sb = Double.toString(rec.getWidth()) + 'x' + rec.getHeight();
PreferencesDialog.saveValue(PreferencesDialog.KEY_MAGE_PANEL_LAST_SIZE, sb);
PreferencesDialog.saveValue(PreferencesDialog.KEY_TOURNAMENT_DIVIDER_LOCATION_1, Integer.toString(this.jSplitPane1.getDividerLocation()));
PreferencesDialog.saveValue(PreferencesDialog.KEY_TOURNAMENT_DIVIDER_LOCATION_2, Integer.toString(this.jSplitPane2.getDividerLocation()));
@@ -142,7 +149,7 @@ public class TournamentPanel extends javax.swing.JPanel {
Rectangle rec = MageFrame.getDesktop().getBounds();
if (rec != null) {
String size = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_MAGE_PANEL_LAST_SIZE, null);
- String sb = Double.toString(rec.getWidth()) + 'x' + Double.toString(rec.getHeight());
+ String sb = Double.toString(rec.getWidth()) + 'x' + rec.getHeight();
// use divider positions only if screen size is the same as it was the time the settings were saved
if (size != null && size.equals(sb)) {
String location = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_TOURNAMENT_DIVIDER_LOCATION_1, null);
@@ -585,88 +592,6 @@ class TournamentPlayersTableModel extends AbstractTableModel {
}
-class TournamentMatchesTableModel extends AbstractTableModel {
-
- public static final int ACTION_COLUMN = 4; // column the action is located
-
- private final String[] columnNames = new String[]{"Round Number", "Players", "State", "Result", "Action"};
- private TournamentGameView[] games = new TournamentGameView[0];
- private boolean watchingAllowed;
-
- public void loadData(TournamentView tournament) {
- List views = new ArrayList<>();
- watchingAllowed = tournament.isWatchingAllowed();
- for (RoundView round : tournament.getRounds()) {
- for (TournamentGameView game : round.getGames()) {
- views.add(game);
- }
- }
- games = views.toArray(new TournamentGameView[0]);
- this.fireTableDataChanged();
- }
-
- @Override
- public int getRowCount() {
- return games.length;
- }
-
- @Override
- public int getColumnCount() {
- return columnNames.length;
- }
-
- @Override
- public Object getValueAt(int arg0, int arg1) {
- switch (arg1) {
- case 0:
- return Integer.toString(games[arg0].getRoundNum());
- case 1:
- return games[arg0].getPlayers();
- case 2:
- return games[arg0].getState();
- case 3:
- return games[arg0].getResult();
- case 4:
-// if (games[arg0].getState().equals("Finished")) {
-// return "Replay";
-// }
- if (watchingAllowed && games[arg0].getState().startsWith("Dueling")) {
- return "Watch";
- }
- return "";
- case 5:
- return games[arg0].getTableId().toString();
- case 6:
- return games[arg0].getMatchId().toString();
- case 7:
- return games[arg0].getGameId().toString();
-
- }
- return "";
- }
-
- @Override
- public String getColumnName(int columnIndex) {
- String colName = "";
-
- if (columnIndex <= getColumnCount()) {
- colName = columnNames[columnIndex];
- }
-
- return colName;
- }
-
- @Override
- public Class getColumnClass(int columnIndex) {
- return String.class;
- }
-
- @Override
- public boolean isCellEditable(int rowIndex, int columnIndex) {
- return columnIndex == ACTION_COLUMN;
- }
-
-}
class UpdateTournamentTask extends SwingWorker {
@@ -709,4 +634,4 @@ class UpdateTournamentTask extends SwingWorker {
}
}
-}
+}
\ No newline at end of file
diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/ScryfallImageSupportCards.java b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/ScryfallImageSupportCards.java
index 08424c69ac..f365a44143 100644
--- a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/ScryfallImageSupportCards.java
+++ b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/ScryfallImageSupportCards.java
@@ -354,6 +354,13 @@ public class ScryfallImageSupportCards {
// TODO: remove Grand Prix fix after scryfall fix image's link (that's link must be work: https://img.scryfall.com/cards/large/en/pgpx/2016b.jpg )
put("GPX/Sword of Feast and Famine", "https://img.scryfall.com/cards/large/en/pgpx/1%E2%98%85.jpg");
+
+ // TODO: remove after scryfall add lands to RNA (that's link must works: https://api.scryfall.com/cards/rna/262/en?format=image)
+ put("RNA/Plains", "https://api.scryfall.com/cards/grn/260/en?format=image");
+ put("RNA/Island", "https://api.scryfall.com/cards/grn/261/en?format=image");
+ put("RNA/Swamp", "https://api.scryfall.com/cards/grn/262/en?format=image");
+ put("RNA/Mountain", "https://api.scryfall.com/cards/grn/263/en?format=image");
+ put("RNA/Forest", "https://api.scryfall.com/cards/grn/264/en?format=image");
}
};
diff --git a/Mage.Server/src/main/java/mage/server/util/SystemUtil.java b/Mage.Server/src/main/java/mage/server/util/SystemUtil.java
index 4d6f2cb51d..41e8b9e691 100644
--- a/Mage.Server/src/main/java/mage/server/util/SystemUtil.java
+++ b/Mage.Server/src/main/java/mage/server/util/SystemUtil.java
@@ -7,9 +7,12 @@ import mage.cards.repository.CardInfo;
import mage.cards.repository.CardRepository;
import mage.choices.Choice;
import mage.choices.ChoiceImpl;
+import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
+import mage.counters.CounterType;
import mage.game.Game;
+import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.util.RandomUtil;
@@ -433,6 +436,13 @@ public final class SystemUtil {
game.addPlane((mage.game.command.Plane) plane, null, player.getId());
continue;
}
+ } else if ("loyalty".equalsIgnoreCase(command.zone)) {
+ for (Permanent perm : game.getBattlefield().getAllActivePermanents(player.getId())) {
+ if (perm.getName().equals(command.cardName) && perm.getCardType().contains(CardType.PLANESWALKER)) {
+ perm.addCounters(CounterType.LOYALTY.createInstance(command.Amount), null, game);
+ }
+ }
+ continue;
}
Zone gameZone;
diff --git a/Mage.Sets/src/mage/cards/b/BedeckBedazzle.java b/Mage.Sets/src/mage/cards/b/BedeckBedazzle.java
index 272627c856..83c3d03a17 100644
--- a/Mage.Sets/src/mage/cards/b/BedeckBedazzle.java
+++ b/Mage.Sets/src/mage/cards/b/BedeckBedazzle.java
@@ -40,7 +40,7 @@ public final class BedeckBedazzle extends SplitCard {
// Destroy target nonbasic land. Bedazzle deals 2 damage to target opponent or planeswalker.
this.getRightHalfCard().getSpellAbility().addEffect(new BedazzleEffect());
this.getRightHalfCard().getSpellAbility().addTarget(new TargetLandPermanent());
- this.getSpellAbility().addTarget(new TargetOpponentOrPlaneswalker());
+ this.getRightHalfCard().getSpellAbility().addTarget(new TargetOpponentOrPlaneswalker());
}
private BedeckBedazzle(final BedeckBedazzle card) {
diff --git a/Mage.Sets/src/mage/cards/b/BiogenicUpgrade.java b/Mage.Sets/src/mage/cards/b/BiogenicUpgrade.java
index e0f0d0b8eb..8d0622f6e4 100644
--- a/Mage.Sets/src/mage/cards/b/BiogenicUpgrade.java
+++ b/Mage.Sets/src/mage/cards/b/BiogenicUpgrade.java
@@ -9,10 +9,7 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
-import mage.constants.TargetController;
import mage.counters.CounterType;
-import mage.filter.common.FilterCreaturePermanent;
-import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.common.TargetCreaturePermanentAmount;
@@ -25,13 +22,6 @@ import java.util.UUID;
*/
public final class BiogenicUpgrade extends CardImpl {
- private static final FilterCreaturePermanent filter
- = new FilterCreaturePermanent("creatures you control");
-
- static {
- filter.add(new ControllerPredicate(TargetController.YOU));
- }
-
public BiogenicUpgrade(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{G}{G}");
@@ -40,7 +30,7 @@ public final class BiogenicUpgrade extends CardImpl {
CounterType.P1P1, 3, false,
"one, two, or three target creatures"
));
- this.getSpellAbility().addTarget(new TargetCreaturePermanentAmount(3, filter));
+ this.getSpellAbility().addTarget(new TargetCreaturePermanentAmount(3));
this.getSpellAbility().addEffect(new BiogenicUpgradeEffect());
}
diff --git a/Mage.Sets/src/mage/cards/c/CavalcadeOfCalamity.java b/Mage.Sets/src/mage/cards/c/CavalcadeOfCalamity.java
index eabf9118a8..7c7f863bad 100644
--- a/Mage.Sets/src/mage/cards/c/CavalcadeOfCalamity.java
+++ b/Mage.Sets/src/mage/cards/c/CavalcadeOfCalamity.java
@@ -65,7 +65,7 @@ class CavalcadeOfCalamityEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
return game.damagePlayerOrPlaneswalker(
- game.getCombat().getDefenderId(source.getFirstTarget()), 1,
+ game.getCombat().getDefenderId(targetPointer.getFirst(game, source)), 1,
source.getSourceId(), game, false, true
) > 0;
}
diff --git a/Mage.Sets/src/mage/cards/c/CryOfTheCarnarium.java b/Mage.Sets/src/mage/cards/c/CryOfTheCarnarium.java
index 175626dcd4..23ac8658fc 100644
--- a/Mage.Sets/src/mage/cards/c/CryOfTheCarnarium.java
+++ b/Mage.Sets/src/mage/cards/c/CryOfTheCarnarium.java
@@ -85,7 +85,7 @@ class CryOfTheCarnariumReplacementEffect extends ReplacementEffectImpl {
CryOfTheCarnariumReplacementEffect() {
super(Duration.EndOfTurn, Outcome.Exile);
- staticText = "If a creature would die this turn, exile it instead.";
+ staticText = " If a creature would die this turn, exile it instead.";
}
private CryOfTheCarnariumReplacementEffect(final CryOfTheCarnariumReplacementEffect effect) {
diff --git a/Mage.Sets/src/mage/cards/d/DomriChaosBringer.java b/Mage.Sets/src/mage/cards/d/DomriChaosBringer.java
index e0e55c4471..d05415185a 100644
--- a/Mage.Sets/src/mage/cards/d/DomriChaosBringer.java
+++ b/Mage.Sets/src/mage/cards/d/DomriChaosBringer.java
@@ -106,7 +106,7 @@ class DomriChaosBringerTriggeredAbility extends DelayedTriggeredAbility {
private final UUID spellId;
DomriChaosBringerTriggeredAbility(UUID spellId) {
- super(null, Duration.Custom, true);
+ super(null, Duration.EndOfStep, true);
this.spellId = spellId;
this.usesStack = false;
}
diff --git a/Mage.Sets/src/mage/cards/d/DovinGrandArbiter.java b/Mage.Sets/src/mage/cards/d/DovinGrandArbiter.java
index 298452a9ba..ea2400d975 100644
--- a/Mage.Sets/src/mage/cards/d/DovinGrandArbiter.java
+++ b/Mage.Sets/src/mage/cards/d/DovinGrandArbiter.java
@@ -51,7 +51,7 @@ public final class DovinGrandArbiter extends CardImpl {
new StaticValue(3), StaticFilters.FILTER_CARD,
Zone.LIBRARY, false, false, false,
Zone.HAND, false, false, false
- ).setText("Look at the top ten cards of your library. " +
+ ).setBackInRandomOrder(true).setText("Look at the top ten cards of your library. " +
"Put three of them into your hand and the rest " +
"on the bottom of your library in a random order."
), -7));
diff --git a/Mage.Sets/src/mage/cards/k/KarnLiberated.java b/Mage.Sets/src/mage/cards/k/KarnLiberated.java
index 2cecf73c70..5d96927395 100644
--- a/Mage.Sets/src/mage/cards/k/KarnLiberated.java
+++ b/Mage.Sets/src/mage/cards/k/KarnLiberated.java
@@ -1,9 +1,5 @@
-
package mage.cards.k;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.DelayedTriggeredAbility;
@@ -11,18 +7,11 @@ import mage.abilities.LoyaltyAbility;
import mage.abilities.common.PlaneswalkerEntersWithLoyaltyCountersAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ExileTargetForSourceEffect;
-import mage.cards.Card;
-import mage.cards.CardImpl;
-import mage.cards.CardSetInfo;
-import mage.cards.Cards;
-import mage.cards.CardsImpl;
-import mage.constants.CardType;
-import mage.constants.SubType;
-import mage.constants.Outcome;
-import mage.constants.SuperType;
-import mage.constants.Zone;
+import mage.cards.*;
+import mage.constants.*;
import mage.game.ExileZone;
import mage.game.Game;
+import mage.game.GameImpl;
import mage.game.command.Commander;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
@@ -34,8 +23,11 @@ import mage.target.TargetPlayer;
import mage.target.common.TargetCardInHand;
import mage.util.CardUtil;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
/**
- *
* @author bunchOfDevs
*/
public final class KarnLiberated extends CardImpl {
@@ -102,6 +94,9 @@ class KarnLiberatedEffect extends OneShotEffect {
}
}
game.getState().clear();
+ // default watchers init, TODO: remove all restart/init code to game
+ ((GameImpl) game).initGameDefaultWatchers();
+
for (Card card : game.getCards()) {
game.getState().addCard(card);
}
@@ -122,6 +117,7 @@ class KarnLiberatedEffect extends OneShotEffect {
}
}
}
+ ((GameImpl) game).initPlayerDefaultWatchers(player.getId());
player.init(game);
}
}
diff --git a/Mage.Sets/src/mage/cards/k/KayaOrzhovUsurper.java b/Mage.Sets/src/mage/cards/k/KayaOrzhovUsurper.java
index edf600b750..31b447b6e1 100644
--- a/Mage.Sets/src/mage/cards/k/KayaOrzhovUsurper.java
+++ b/Mage.Sets/src/mage/cards/k/KayaOrzhovUsurper.java
@@ -26,7 +26,7 @@ import java.util.UUID;
public final class KayaOrzhovUsurper extends CardImpl {
private static final FilterPermanent filter
- = new FilterNonlandPermanent("permanent with converted mana cost 1 or less");
+ = new FilterNonlandPermanent("nonland permanent with converted mana cost 1 or less");
static {
filter.add(new ConvertedManaCostPredicate(ComparisonType.FEWER_THAN, 2));
diff --git a/Mage.Sets/src/mage/cards/l/LumberingBattlement.java b/Mage.Sets/src/mage/cards/l/LumberingBattlement.java
index 8db020a7dc..38f3c1022c 100644
--- a/Mage.Sets/src/mage/cards/l/LumberingBattlement.java
+++ b/Mage.Sets/src/mage/cards/l/LumberingBattlement.java
@@ -11,7 +11,9 @@ import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.abilities.keyword.VigilanceAbility;
-import mage.cards.*;
+import mage.cards.Card;
+import mage.cards.CardImpl;
+import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
@@ -29,6 +31,8 @@ import mage.target.Target;
import mage.target.TargetPermanent;
import mage.util.CardUtil;
+import java.util.HashSet;
+import java.util.Set;
import java.util.UUID;
import static mage.constants.Outcome.Benefit;
@@ -106,7 +110,7 @@ class LumberingBattlementEffect extends OneShotEffect {
if (!player.choose(Outcome.Neutral, target, source.getSourceId(), game)) {
return false;
}
- Cards cards = new CardsImpl();
+ Set cards = new HashSet();
for (UUID targetId : target.getTargets()) {
Permanent permanent = game.getPermanent(targetId);
if (permanent != null) {
@@ -114,10 +118,8 @@ class LumberingBattlementEffect extends OneShotEffect {
}
}
return player.moveCardsToExile(
- cards.getCards(game), source, game, true,
- CardUtil.getExileZoneId(
- game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()
- ), sourcePerm.getIdName()
+ cards, source, game, true,
+ CardUtil.getCardExileZoneId(game, source), sourcePerm.getIdName()
);
}
}
diff --git a/Mage.Sets/src/mage/cards/p/PriestOfForgottenGods.java b/Mage.Sets/src/mage/cards/p/PriestOfForgottenGods.java
index 49f57a4df1..801350a032 100644
--- a/Mage.Sets/src/mage/cards/p/PriestOfForgottenGods.java
+++ b/Mage.Sets/src/mage/cards/p/PriestOfForgottenGods.java
@@ -29,7 +29,7 @@ import java.util.UUID;
public final class PriestOfForgottenGods extends CardImpl {
private static final FilterControlledPermanent filter
- = new FilterControlledCreaturePermanent("two other creatures");
+ = new FilterControlledCreaturePermanent("other creatures");
static {
filter.add(AnotherPredicate.instance);
diff --git a/Mage.Sets/src/mage/cards/s/SilhanaWayfinder.java b/Mage.Sets/src/mage/cards/s/SilhanaWayfinder.java
index b8ee5abb20..c6aa18b579 100644
--- a/Mage.Sets/src/mage/cards/s/SilhanaWayfinder.java
+++ b/Mage.Sets/src/mage/cards/s/SilhanaWayfinder.java
@@ -41,7 +41,7 @@ public final class SilhanaWayfinder extends CardImpl {
// When Silhana Wayfinder enters the battlefield, look at the top four cards of your library. You may reveal a creature or land card from among them and put it on top of your library. Put the rest on the bottom of your library in a random order.
this.addAbility(new EntersBattlefieldTriggeredAbility(new LookLibraryAndPickControllerEffect(
new StaticValue(4), false, new StaticValue(1), filter, Zone.LIBRARY, false,
- true, false, Zone.LIBRARY, false, true, false
+ true, true, Zone.LIBRARY, false, true, false
).setText("look at the top four cards of your library. " +
"You may reveal a creature or land card from among them " +
"and put it on top of your library. Put the rest " +
diff --git a/Mage.Sets/src/mage/cards/t/TransguildCourier.java b/Mage.Sets/src/mage/cards/t/TransguildCourier.java
index b480250f6b..2161aa0e94 100644
--- a/Mage.Sets/src/mage/cards/t/TransguildCourier.java
+++ b/Mage.Sets/src/mage/cards/t/TransguildCourier.java
@@ -1,30 +1,34 @@
package mage.cards.t;
-import java.util.UUID;
import mage.MageInt;
+import mage.abilities.common.SimpleStaticAbility;
+import mage.abilities.effects.common.InfoEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
+import mage.constants.Zone;
+
+import java.util.UUID;
/**
- *
* @author Wehk
*/
public final class TransguildCourier extends CardImpl {
public TransguildCourier(UUID ownerId, CardSetInfo setInfo) {
- super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT,CardType.CREATURE},"{4}");
+ super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{4}");
this.subtype.add(SubType.GOLEM);
this.power = new MageInt(3);
this.toughness = new MageInt(3);
-
+
this.color.setWhite(true);
this.color.setBlue(true);
this.color.setBlack(true);
this.color.setRed(true);
this.color.setGreen(true);
+ this.addAbility(new SimpleStaticAbility(Zone.ALL, new InfoEffect("{this} is all colors")));
}
public TransguildCourier(final TransguildCourier card) {
diff --git a/Mage.Sets/src/mage/cards/u/UnbreakableFormation.java b/Mage.Sets/src/mage/cards/u/UnbreakableFormation.java
index 2c53b53b4a..62ced3ec1d 100644
--- a/Mage.Sets/src/mage/cards/u/UnbreakableFormation.java
+++ b/Mage.Sets/src/mage/cards/u/UnbreakableFormation.java
@@ -6,6 +6,7 @@ import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
import mage.abilities.effects.common.counter.AddCountersAllEffect;
import mage.abilities.keyword.IndestructibleAbility;
+import mage.abilities.keyword.VigilanceAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
@@ -68,7 +69,7 @@ class UnbreakableFormationEffect extends OneShotEffect {
return false;
}
game.addEffect(new GainAbilityControlledEffect(
- IndestructibleAbility.getInstance(), Duration.EndOfTurn,
+ VigilanceAbility.getInstance(), Duration.EndOfTurn,
StaticFilters.FILTER_PERMANENT_CREATURE
), source);
return new AddCountersAllEffect(
diff --git a/Mage.Sets/src/mage/cards/w/WindstormDrake.java b/Mage.Sets/src/mage/cards/w/WindstormDrake.java
index ebb0e3595e..702a12621b 100644
--- a/Mage.Sets/src/mage/cards/w/WindstormDrake.java
+++ b/Mage.Sets/src/mage/cards/w/WindstormDrake.java
@@ -13,6 +13,7 @@ import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AbilityPredicate;
import java.util.UUID;
+import mage.abilities.effects.Effect;
/**
* @author TheElk801
@@ -20,7 +21,7 @@ import java.util.UUID;
public final class WindstormDrake extends CardImpl {
private static final FilterCreaturePermanent filter
- = new FilterCreaturePermanent("creatures you control with flying");
+ = new FilterCreaturePermanent();
static {
filter.add(new AbilityPredicate(FlyingAbility.class));
@@ -37,9 +38,11 @@ public final class WindstormDrake extends CardImpl {
this.addAbility(FlyingAbility.getInstance());
// Other creatures you control with flying get +1/+0.
- this.addAbility(new SimpleStaticAbility(new BoostControlledEffect(
+ Effect effect = new BoostControlledEffect(
1, 0, Duration.WhileOnBattlefield, filter, true
- )));
+ );
+ effect.setText("Other creatures you control with flying get +1/+0");
+ this.addAbility(new SimpleStaticAbility(effect));
}
private WindstormDrake(final WindstormDrake card) {
diff --git a/Mage/src/main/java/mage/abilities/common/OneOrMoreCountersAddedTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/OneOrMoreCountersAddedTriggeredAbility.java
index 6619fcd853..e00c6bf00d 100644
--- a/Mage/src/main/java/mage/abilities/common/OneOrMoreCountersAddedTriggeredAbility.java
+++ b/Mage/src/main/java/mage/abilities/common/OneOrMoreCountersAddedTriggeredAbility.java
@@ -48,6 +48,6 @@ public class OneOrMoreCountersAddedTriggeredAbility extends TriggeredAbilityImpl
@Override
public String getRule() {
- return "Whenever one or more " + counterType + " counters are put on {this}, " + super.getRule();
+ return "Whenever one or more " + counterType.getName() + " counters are put on {this}, " + super.getRule();
}
}
diff --git a/Mage/src/main/java/mage/abilities/costs/common/SacrificeTargetCost.java b/Mage/src/main/java/mage/abilities/costs/common/SacrificeTargetCost.java
index 7f3a4b7abe..9a5de3b076 100644
--- a/Mage/src/main/java/mage/abilities/costs/common/SacrificeTargetCost.java
+++ b/Mage/src/main/java/mage/abilities/costs/common/SacrificeTargetCost.java
@@ -27,8 +27,14 @@ public class SacrificeTargetCost extends CostImpl {
this.addTarget(target);
target.setNotTarget(true); // sacrifice is never targeted
this.text = "sacrifice "
- + ((target.getNumberOfTargets() != 1 || (target.getTargetName().startsWith("an") || target.getTargetName().startsWith("a ")))
- ? (target.getMinNumberOfTargets() == target.getMaxNumberOfTargets() && target.getMinNumberOfTargets() > 1 ? CardUtil.numberToText(target.getNumberOfTargets()) : "" ) : (target.getTargetName().startsWith("artifact") ? "an " : "a ")) + target.getTargetName();
+ + ((target.getNumberOfTargets() != 1
+ || (target.getTargetName().startsWith("an")
+ || target.getTargetName().startsWith("a ")))
+ ? (target.getMinNumberOfTargets() == target.getMaxNumberOfTargets()
+ && target.getMinNumberOfTargets() > 1
+ ? CardUtil.numberToText(target.getNumberOfTargets()) + " " : "")
+ : (target.getTargetName().startsWith("artifact") ? "an " : "a "))
+ + target.getTargetName();
target.setTargetName(target.getTargetName() + " (to sacrifice)");
}
diff --git a/Mage/src/main/java/mage/game/GameImpl.java b/Mage/src/main/java/mage/game/GameImpl.java
index 7b17f8cdd1..25ec612248 100644
--- a/Mage/src/main/java/mage/game/GameImpl.java
+++ b/Mage/src/main/java/mage/game/GameImpl.java
@@ -1063,7 +1063,7 @@ public abstract class GameImpl implements Game, Serializable {
}
- private void initGameDefaultWatchers() {
+ public void initGameDefaultWatchers() {
getState().addWatcher(new MorbidWatcher());
getState().addWatcher(new CastSpellLastTurnWatcher());
getState().addWatcher(new CastSpellYourLastTurnWatcher());
@@ -1075,7 +1075,7 @@ public abstract class GameImpl implements Game, Serializable {
getState().addWatcher(new PlayersAttackedThisTurnWatcher());
}
- private void initPlayerDefaultWatchers(UUID playerId) {
+ public void initPlayerDefaultWatchers(UUID playerId) {
getState().addWatcher(new PlayerDamagedBySourceWatcher(playerId));
getState().addWatcher(new BloodthirstWatcher(playerId));
}
diff --git a/Mage/src/main/java/mage/game/combat/Combat.java b/Mage/src/main/java/mage/game/combat/Combat.java
index 1f0e73e950..c7ab29f73c 100644
--- a/Mage/src/main/java/mage/game/combat/Combat.java
+++ b/Mage/src/main/java/mage/game/combat/Combat.java
@@ -463,7 +463,7 @@ public class Combat implements Serializable, Copyable {
target.setRequired(true);
target.setTargetName("planeswalker or player for " + creature.getLogName() + " to attack");
if (player.chooseTarget(Outcome.Damage, target, null, game)) {
- System.out.println("The player " + player.getName() + " declares an attacker here. " + creature.getName());
+ //System.out.println("The player " + player.getName() + " declares an attacker here. " + creature.getName());
player.declareAttacker(creature.getId(), target.getFirstTarget(), game, false);
}
}