diff --git a/Mage.Client/pom.xml b/Mage.Client/pom.xml index 0a31a25152..6cee9993c4 100644 --- a/Mage.Client/pom.xml +++ b/Mage.Client/pom.xml @@ -6,7 +6,7 @@ org.mage mage-root - 0.7 + 0.7.2 org.mage diff --git a/Mage.Client/src/main/java/mage/client/MageFrame.java b/Mage.Client/src/main/java/mage/client/MageFrame.java index 1b853c4434..40e43e579e 100644 --- a/Mage.Client/src/main/java/mage/client/MageFrame.java +++ b/Mage.Client/src/main/java/mage/client/MageFrame.java @@ -76,6 +76,7 @@ import mage.client.draft.DraftPane; import mage.client.game.GamePane; import mage.client.table.TablesPane; import mage.client.tournament.TournamentPane; +import mage.utils.MageVersion; import org.apache.log4j.Logger; /** @@ -90,6 +91,7 @@ public class MageFrame extends javax.swing.JFrame { private static Preferences prefs = Preferences.userNodeForPackage(MageFrame.class); private JLabel title; private Rectangle titleRectangle; + private static MageVersion version = new MageVersion(0, 7, 2); /** * @return the session @@ -106,12 +108,16 @@ public class MageFrame extends javax.swing.JFrame { return prefs; } + public static MageVersion getVersion() { + return version; + } + /** * Creates new form MageFrame */ public MageFrame() { - setTitle("Mage, version 0.7.1"); + setTitle("Mage, version " + version); EDTExceptionHandler.registerExceptionHandler(); addWindowListener(new WindowAdapter() { diff --git a/Mage.Client/src/main/java/mage/client/dialog/AboutDialog.form b/Mage.Client/src/main/java/mage/client/dialog/AboutDialog.form index 97a9f75100..e400d2a952 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/AboutDialog.form +++ b/Mage.Client/src/main/java/mage/client/dialog/AboutDialog.form @@ -1,4 +1,4 @@ - +
@@ -22,27 +22,28 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + @@ -57,8 +58,8 @@ - - + + @@ -81,7 +82,7 @@ - + @@ -91,7 +92,7 @@ - + diff --git a/Mage.Client/src/main/java/mage/client/dialog/AboutDialog.java b/Mage.Client/src/main/java/mage/client/dialog/AboutDialog.java index 8d21f496c0..da979cb588 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/AboutDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/AboutDialog.java @@ -34,6 +34,8 @@ package mage.client.dialog; +import mage.client.MageFrame; + /** * * @author BetaSteward_at_googlemail.com @@ -47,7 +49,7 @@ public class AboutDialog extends MageDialog { } public void showDialog() { - this.lblVersion.setText(MageDialog.class.getPackage().getImplementationVersion()); + this.lblVersion.setText(MageFrame.getVersion().toString()); this.setLocation(100, 100); this.setVisible(true); } @@ -66,7 +68,6 @@ public class AboutDialog extends MageDialog { lblVersion = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); - jLabel4 = new javax.swing.JLabel(); setTitle("About MAGE"); @@ -77,42 +78,35 @@ public class AboutDialog extends MageDialog { } }); - jLabel1.setText("MAGE client, version 0.7.1"); + jLabel1.setText("MAGE client"); - lblVersion.setText("version"); + lblVersion.setText("0.0.0"); jLabel2.setText("Courtesy: BetaSteward@googlemail.com"); - - jLabel3.setText("Devs: BetaSteward, Nantuko84, Eugen.Rivniy, maurer.it"); - //jLabel4.setText("Thanks: KLo, Cosmo & Fritz"); + jLabel3.setText("Devs: BetaSteward, Nantuko84, Eugen.Rivniy, maurer.it, Viserion Dragonbourne"); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() - .addContainerGap(159, Short.MAX_VALUE) - .addComponent(btnOk) - .addContainerGap()) .addGroup(layout.createSequentialGroup() .addContainerGap() - .addComponent(jLabel1) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(lblVersion) - .addContainerGap(109, Short.MAX_VALUE)) - .addGroup(layout.createSequentialGroup() - .addContainerGap() - .addComponent(jLabel2) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addGroup(layout.createSequentialGroup() - .addContainerGap() - .addComponent(jLabel3) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addGroup(layout.createSequentialGroup() - .addContainerGap() - .addComponent(jLabel4) - .addContainerGap(75, Short.MAX_VALUE)) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addContainerGap()) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addComponent(btnOk) + .addContainerGap()) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel1) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(lblVersion) + .addContainerGap(311, Short.MAX_VALUE)) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel2) + .addContainerGap(203, Short.MAX_VALUE)))) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) @@ -124,10 +118,8 @@ public class AboutDialog extends MageDialog { .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jLabel3) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jLabel4) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 23, Short.MAX_VALUE) + .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, 40, Short.MAX_VALUE) + .addGap(18, 18, 18) .addComponent(btnOk) .addContainerGap()) ); @@ -144,7 +136,6 @@ public class AboutDialog extends MageDialog { private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; - private javax.swing.JLabel jLabel4; private javax.swing.JLabel lblVersion; // End of variables declaration//GEN-END:variables diff --git a/Mage.Client/src/main/java/mage/client/dialog/JoinTableDialog.java b/Mage.Client/src/main/java/mage/client/dialog/JoinTableDialog.java index f86b64a96f..840f1ad0d4 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/JoinTableDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/JoinTableDialog.java @@ -136,7 +136,7 @@ public class JoinTableDialog extends MageDialog { private void btnOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOKActionPerformed Session session = MageFrame.getSession(); try { - joined = session.joinTable(roomId, tableId, this.newPlayerPanel.getPlayerName(), "Human", Sets.loadDeck(this.newPlayerPanel.getDeckFile())); + joined = session.joinTable(roomId, tableId, this.newPlayerPanel.getPlayerName(), "Human", 1, Sets.loadDeck(this.newPlayerPanel.getDeckFile())); } catch (Exception ex) { handleError(ex); } diff --git a/Mage.Client/src/main/java/mage/client/dialog/NewTableDialog.java b/Mage.Client/src/main/java/mage/client/dialog/NewTableDialog.java index d571f61504..8290b72937 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/NewTableDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/NewTableDialog.java @@ -310,7 +310,7 @@ public class NewTableDialog extends MageDialog { options.setWinsNeeded((Integer)this.spnNumWins.getValue()); table = session.createTable(roomId, options); try { - if (session.joinTable(roomId, table.getTableId(), this.player1Panel.getPlayerName(), "Human", Sets.loadDeck(this.player1Panel.getDeckFile()))) { + if (session.joinTable(roomId, table.getTableId(), this.player1Panel.getPlayerName(), "Human", 1, Sets.loadDeck(this.player1Panel.getDeckFile()))) { for (TablePlayerPanel player: players) { if (!player.getPlayerType().equals("Human")) { if (!player.joinTable(roomId, table.getTableId())) { diff --git a/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.java b/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.java index 56be4033ac..2b8539be4f 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.java @@ -296,7 +296,7 @@ public class NewTournamentDialog extends MageDialog { tOptions.getMatchOptions().setAttackOption(MultiplayerAttackOption.LEFT); tOptions.getMatchOptions().setRange(RangeOfInfluence.ALL); table = session.createTournamentTable(roomId, tOptions); - if (session.joinTournamentTable(roomId, table.getTableId(), this.txtPlayer1Name.getText(), "Human")) { + if (session.joinTournamentTable(roomId, table.getTableId(), this.txtPlayer1Name.getText(), "Human", 1)) { for (TournamentPlayerPanel player: players) { if (!player.getPlayerType().equals("Human")) { if (!player.joinTournamentTable(roomId, table.getTableId())) { diff --git a/Mage.Client/src/main/java/mage/client/remote/Session.java b/Mage.Client/src/main/java/mage/client/remote/Session.java index 5da0ebde1a..b6c7b3e7a6 100644 --- a/Mage.Client/src/main/java/mage/client/remote/Session.java +++ b/Mage.Client/src/main/java/mage/client/remote/Session.java @@ -97,7 +97,7 @@ public class Session { this.server = (Server) reg.lookup(Config.remoteServer); this.userName = userName; this.client = new Client(this, frame, userName); - sessionId = server.registerClient(userName, client.getId()); + sessionId = server.registerClient(userName, client.getId(), frame.getVersion()); callbackDaemon = new CallbackClientDaemon(sessionId, client, server); serverState = server.getServerState(); logger.info("Connected to RMI server at " + serverName + ":" + port); @@ -262,9 +262,9 @@ public class Session { return false; } - public boolean joinTable(UUID roomId, UUID tableId, String playerName, String playerType, DeckCardLists deckList) { + public boolean joinTable(UUID roomId, UUID tableId, String playerName, String playerType, int skill, DeckCardLists deckList) { try { - return server.joinTable(sessionId, roomId, tableId, playerName, playerType, deckList); + return server.joinTable(sessionId, roomId, tableId, playerName, playerType, skill, deckList); } catch (RemoteException ex) { handleRemoteException(ex); } catch (MageException ex) { @@ -275,9 +275,9 @@ public class Session { return false; } - public boolean joinTournamentTable(UUID roomId, UUID tableId, String playerName, String playerType) { + public boolean joinTournamentTable(UUID roomId, UUID tableId, String playerName, String playerType, int skill) { try { - return server.joinTournamentTable(sessionId, roomId, tableId, playerName, playerType); + return server.joinTournamentTable(sessionId, roomId, tableId, playerName, playerType, skill); } catch (RemoteException ex) { handleRemoteException(ex); } catch (MageException ex) { diff --git a/Mage.Client/src/main/java/mage/client/table/NewPlayerPanel.form b/Mage.Client/src/main/java/mage/client/table/NewPlayerPanel.form index 7f540a394e..ff87eade9e 100644 --- a/Mage.Client/src/main/java/mage/client/table/NewPlayerPanel.form +++ b/Mage.Client/src/main/java/mage/client/table/NewPlayerPanel.form @@ -1,4 +1,4 @@ - + @@ -26,11 +26,22 @@ - - + + - + + + + + + + + + + + + @@ -40,12 +51,15 @@ + + - + + @@ -54,9 +68,6 @@ - - - @@ -64,9 +75,6 @@ - - - @@ -80,5 +88,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Mage.Client/src/main/java/mage/client/table/NewPlayerPanel.java b/Mage.Client/src/main/java/mage/client/table/NewPlayerPanel.java index 17cb50293e..db848e24ad 100644 --- a/Mage.Client/src/main/java/mage/client/table/NewPlayerPanel.java +++ b/Mage.Client/src/main/java/mage/client/table/NewPlayerPanel.java @@ -36,10 +36,8 @@ package mage.client.table; import java.io.File; import java.io.IOException; - import javax.swing.JFileChooser; import javax.swing.filechooser.FileFilter; - import mage.client.MageFrame; import mage.client.deck.generator.DeckGenerator; import mage.client.util.Config; @@ -62,7 +60,7 @@ public class NewPlayerPanel extends javax.swing.JPanel { if (Config.defaultComputerName != null) this.txtPlayerName.setText(Config.defaultComputerName); } - public void setPlayerName(String playerName) { + public void setPlayerName(String playerName) { this.txtPlayerName.setText(playerName); this.txtPlayerName.setEditable(false); this.txtPlayerName.setEnabled(false); @@ -89,7 +87,7 @@ public class NewPlayerPanel extends javax.swing.JPanel { this.txtPlayerDeck.setText(path); } } - + public String getPlayerName() { return this.txtPlayerName.getText(); } @@ -98,14 +96,17 @@ public class NewPlayerPanel extends javax.swing.JPanel { return this.txtPlayerDeck.getText(); } + public int getLevel() { + return Integer.valueOf((String)this.cbLevel.getSelectedItem()); + } + /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") - // - // + // //GEN-BEGIN:initComponents private void initComponents() { lblPlayerName = new javax.swing.JLabel(); @@ -114,11 +115,11 @@ public class NewPlayerPanel extends javax.swing.JPanel { txtPlayerDeck = new javax.swing.JTextField(); btnPlayerDeck = new javax.swing.JButton(); btnGenerate = new javax.swing.JButton(); - - lblPlayerName.setLabelFor(txtPlayerName); + lblLevel = new javax.swing.JLabel(); + cbLevel = new javax.swing.JComboBox(); + lblPlayerName.setText("Name:"); - lblPlayerDeck.setLabelFor(txtPlayerDeck); lblPlayerDeck.setText("Deck:"); btnPlayerDeck.setText("..."); @@ -127,14 +128,18 @@ public class NewPlayerPanel extends javax.swing.JPanel { btnPlayerDeckActionPerformed(evt); } }); - - btnGenerate.setText("Generate deck"); + + btnGenerate.setText("Generate"); btnGenerate.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnGenerateActionPerformed(evt); } }); + lblLevel.setText("Skill:"); + + cbLevel.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" })); + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( @@ -147,50 +152,56 @@ public class NewPlayerPanel extends javax.swing.JPanel { .addComponent(lblPlayerName)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(txtPlayerName, javax.swing.GroupLayout.DEFAULT_SIZE, 405, Short.MAX_VALUE) - .addComponent(txtPlayerDeck, javax.swing.GroupLayout.DEFAULT_SIZE, 405, Short.MAX_VALUE)) + .addComponent(txtPlayerName, javax.swing.GroupLayout.DEFAULT_SIZE, 321, Short.MAX_VALUE) + .addComponent(txtPlayerDeck, javax.swing.GroupLayout.DEFAULT_SIZE, 321, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(btnPlayerDeck, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - ) - .addComponent(btnGenerate) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addComponent(btnPlayerDeck, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(btnGenerate, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addComponent(lblLevel) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(cbLevel, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)))) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(txtPlayerName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(lblPlayerName)) + .addComponent(lblPlayerName) + .addComponent(lblLevel) + .addComponent(cbLevel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(3, 3, 3) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblPlayerDeck) .addComponent(txtPlayerDeck, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(btnPlayerDeck, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGap(3, 3, 3) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(btnGenerate) - ) - ) + .addComponent(btnPlayerDeck, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(btnGenerate, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE))) ); - } + }// //GEN-END:initComponents private void btnPlayerDeckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPlayerDeckActionPerformed playerLoadDeck(); - }//GEN-LAST:event_btnPlayerDeckActionPerformed +}//GEN-LAST:event_btnPlayerDeckActionPerformed - private void btnGenerateActionPerformed(java.awt.event.ActionEvent evt) { + private void btnGenerateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGenerateActionPerformed generateDeck(); - } + }//GEN-LAST:event_btnGenerateActionPerformed + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton btnGenerate; private javax.swing.JButton btnPlayerDeck; + private javax.swing.JComboBox cbLevel; + private javax.swing.JLabel lblLevel; private javax.swing.JLabel lblPlayerDeck; private javax.swing.JLabel lblPlayerName; private javax.swing.JTextField txtPlayerDeck; private javax.swing.JTextField txtPlayerName; // End of variables declaration//GEN-END:variables - private javax.swing.JButton btnGenerate; } class DeckFilter extends FileFilter { diff --git a/Mage.Client/src/main/java/mage/client/table/TablePlayerPanel.form b/Mage.Client/src/main/java/mage/client/table/TablePlayerPanel.form index a6d7e3602e..eaf7c22dac 100644 --- a/Mage.Client/src/main/java/mage/client/table/TablePlayerPanel.form +++ b/Mage.Client/src/main/java/mage/client/table/TablePlayerPanel.form @@ -1,4 +1,4 @@ - +
@@ -11,45 +11,10 @@ + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -61,8 +26,6 @@ - - diff --git a/Mage.Client/src/main/java/mage/client/table/TablePlayerPanel.java b/Mage.Client/src/main/java/mage/client/table/TablePlayerPanel.java index 636d953685..c9ae2a4c7f 100644 --- a/Mage.Client/src/main/java/mage/client/table/TablePlayerPanel.java +++ b/Mage.Client/src/main/java/mage/client/table/TablePlayerPanel.java @@ -73,20 +73,18 @@ public class TablePlayerPanel extends javax.swing.JPanel { cbPlayerType.setModel(new DefaultComboBoxModel(session.getPlayerTypes())); this.lblPlayerNum.setText("Player " + playerNum); if (Config.defaultOtherPlayerIndex != null) { - try { + if (Integer.valueOf(Config.defaultOtherPlayerIndex) >= cbPlayerType.getItemCount()) + cbPlayerType.setSelectedIndex(cbPlayerType.getItemCount() - 1); + else { Integer index = Integer.parseInt(Config.defaultOtherPlayerIndex); cbPlayerType.setSelectedIndex(index); } - catch (NumberFormatException e) {} - catch (IllegalArgumentException iae) { - logger.warning("Wrong parameter for default AI type in config."); - } } } public boolean joinTable(UUID roomId, UUID tableId) throws FileNotFoundException, IOException, ClassNotFoundException { if (!this.cbPlayerType.getSelectedItem().equals("Human")) { - return session.joinTable(roomId, tableId, this.newPlayerPanel.getPlayerName(), (String)this.cbPlayerType.getSelectedItem(), Sets.loadDeck(this.newPlayerPanel.getDeckFile())); + return session.joinTable(roomId, tableId, this.newPlayerPanel.getPlayerName(), (String)this.cbPlayerType.getSelectedItem(), this.newPlayerPanel.getLevel(), Sets.loadDeck(this.newPlayerPanel.getDeckFile())); } return true; } diff --git a/Mage.Client/src/main/java/mage/client/table/TablesPanel.java b/Mage.Client/src/main/java/mage/client/table/TablesPanel.java index 048335df88..05e4e64af4 100644 --- a/Mage.Client/src/main/java/mage/client/table/TablesPanel.java +++ b/Mage.Client/src/main/java/mage/client/table/TablesPanel.java @@ -101,7 +101,7 @@ public class TablesPanel extends javax.swing.JPanel implements Observer { if (state.equals("Join")) { if (isTournament) { logger.info("Joining tournament " + tableId); - if (session.joinTournamentTable(roomId, tableId, session.getUserName(), "Human")) + if (session.joinTournamentTable(roomId, tableId, session.getUserName(), "Human", 1)) tableWaitingDialog.showDialog(roomId, tableId, true); } else { @@ -311,8 +311,8 @@ public class TablesPanel extends javax.swing.JPanel implements Observer { options.setRange(RangeOfInfluence.ALL); options.setWinsNeeded(1); table = session.createTable(roomId, options); - session.joinTable(roomId, table.getTableId(), "Human", "Human", Sets.loadDeck("test.dck")); - session.joinTable(roomId, table.getTableId(), "Computer", "Computer - default", Sets.loadDeck("test.dck")); + session.joinTable(roomId, table.getTableId(), "Human", "Human", 1, Sets.loadDeck("test.dck")); + session.joinTable(roomId, table.getTableId(), "Computer", "Computer - default", 1, Sets.loadDeck("test.dck")); hideTables(); session.startGame(roomId, table.getTableId()); } catch (Exception ex) { diff --git a/Mage.Client/src/main/java/mage/client/table/TournamentPlayerPanel.form b/Mage.Client/src/main/java/mage/client/table/TournamentPlayerPanel.form index 4baefc8e21..a7a2cba1d1 100644 --- a/Mage.Client/src/main/java/mage/client/table/TournamentPlayerPanel.form +++ b/Mage.Client/src/main/java/mage/client/table/TournamentPlayerPanel.form @@ -21,7 +21,7 @@ - + @@ -76,16 +76,22 @@ + + + + - + - + + + @@ -99,6 +105,29 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Mage.Client/src/main/java/mage/client/table/TournamentPlayerPanel.java b/Mage.Client/src/main/java/mage/client/table/TournamentPlayerPanel.java index 466b08bd09..ecf9485760 100644 --- a/Mage.Client/src/main/java/mage/client/table/TournamentPlayerPanel.java +++ b/Mage.Client/src/main/java/mage/client/table/TournamentPlayerPanel.java @@ -66,7 +66,7 @@ public class TournamentPlayerPanel extends javax.swing.JPanel { public boolean joinTournamentTable(UUID roomId, UUID tableId) { if (!this.cbPlayerType.getSelectedItem().equals("Human")) { - return session.joinTournamentTable(roomId, tableId, this.txtPlayerName.getText(), (String)this.cbPlayerType.getSelectedItem()); + return session.joinTournamentTable(roomId, tableId, this.txtPlayerName.getText(), (String)this.cbPlayerType.getSelectedItem(), Integer.valueOf((String)this.cbLevel.getSelectedItem())); } return true; } @@ -87,6 +87,8 @@ public class TournamentPlayerPanel extends javax.swing.JPanel { pnlPlayerName = new javax.swing.JPanel(); txtPlayerName = new javax.swing.JTextField(); jLabel2 = new javax.swing.JLabel(); + jLabel3 = new javax.swing.JLabel(); + cbLevel = new javax.swing.JComboBox(); jLabel1.setLabelFor(cbPlayerType); jLabel1.setText("Type:"); @@ -98,24 +100,34 @@ public class TournamentPlayerPanel extends javax.swing.JPanel { } }); - lblPlayerNum.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + lblPlayerNum.setFont(new java.awt.Font("Tahoma", 1, 11)); lblPlayerNum.setText("Player Num:"); jLabel2.setText("Name:"); + jLabel3.setText("Skill:"); + + cbLevel.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" })); + javax.swing.GroupLayout pnlPlayerNameLayout = new javax.swing.GroupLayout(pnlPlayerName); pnlPlayerName.setLayout(pnlPlayerNameLayout); pnlPlayerNameLayout.setHorizontalGroup( pnlPlayerNameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pnlPlayerNameLayout.createSequentialGroup() + .addComponent(jLabel3) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(cbLevel, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(txtPlayerName, javax.swing.GroupLayout.DEFAULT_SIZE, 189, Short.MAX_VALUE)) + .addComponent(txtPlayerName, javax.swing.GroupLayout.DEFAULT_SIZE, 225, Short.MAX_VALUE)) ); pnlPlayerNameLayout.setVerticalGroup( pnlPlayerNameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pnlPlayerNameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(txtPlayerName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(cbLevel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel3) .addComponent(jLabel2)) ); @@ -128,7 +140,7 @@ public class TournamentPlayerPanel extends javax.swing.JPanel { .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(cbPlayerType, javax.swing.GroupLayout.PREFERRED_SIZE, 175, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(cbPlayerType, javax.swing.GroupLayout.PREFERRED_SIZE, 138, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(pnlPlayerName, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); @@ -158,9 +170,11 @@ public class TournamentPlayerPanel extends javax.swing.JPanel { // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JComboBox cbLevel; private javax.swing.JComboBox cbPlayerType; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; private javax.swing.JLabel lblPlayerNum; private javax.swing.JPanel pnlPlayerName; private javax.swing.JTextField txtPlayerName; diff --git a/Mage.Client/src/main/java/mage/client/util/Config.java b/Mage.Client/src/main/java/mage/client/util/Config.java index caa06d122c..9a010f0574 100644 --- a/Mage.Client/src/main/java/mage/client/util/Config.java +++ b/Mage.Client/src/main/java/mage/client/util/Config.java @@ -49,15 +49,7 @@ public class Config { public static final String remoteServer; public static final String serverName; public static final int port; - public static final String cardsResourcePath; - public static final String frameResourcePath; - public static final String powerboxResourcePath; - public static final String cardArtResourcePath; - public static final String symbolsResourcePath; - public static final String setIconsResourcePath; - public static final String resourcePath; public static final double cardScalingFactor; - public static final boolean useResource; public static final CardDimensions dimensions; public static final String defaultGameType; @@ -75,8 +67,6 @@ public class Config { serverName = p.getProperty("server-name"); port = Integer.parseInt(p.getProperty("port")); remoteServer = p.getProperty("remote-server"); - cardsResourcePath = p.getProperty("cards-resource-path"); - resourcePath = p.getProperty("resource-path"); cardScalingFactor = Double.valueOf(p.getProperty("card-scaling-factor")); defaultGameType = p.getProperty("default-game-type", "Human"); defaultDeckPath = p.getProperty("default-deck-path"); @@ -84,23 +74,6 @@ public class Config { defaultComputerName = p.getProperty("default-computer-name"); dimensions = new CardDimensions(cardScalingFactor); - File test = new File(cardsResourcePath); - if (test.isDirectory()) { - useResource = false; - frameResourcePath = cardsResourcePath + "Frame" + File.separator; - powerboxResourcePath = cardsResourcePath + "PowerBox" + File.separator; - cardArtResourcePath = cardsResourcePath + "Pics" + File.separator; - setIconsResourcePath = cardsResourcePath + "Icon" + File.separator; - symbolsResourcePath = p.getProperty("symbols-resource-path"); - } - else { - useResource = true; - frameResourcePath = resourcePath + "cards/frame/"; - powerboxResourcePath = resourcePath + "cards/powerbox/"; - cardArtResourcePath = resourcePath + "cards/art/"; - setIconsResourcePath = resourcePath + "cards/icon/"; - symbolsResourcePath = resourcePath + "symbols/"; - } } } diff --git a/Mage.Client/src/main/java/mage/client/util/Frames.java b/Mage.Client/src/main/java/mage/client/util/Frames.java deleted file mode 100644 index 92554d7fe9..0000000000 --- a/Mage.Client/src/main/java/mage/client/util/Frames.java +++ /dev/null @@ -1,72 +0,0 @@ -/* -* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without modification, are -* permitted provided that the following conditions are met: -* -* 1. Redistributions of source code must retain the above copyright notice, this list of -* conditions and the following disclaimer. -* -* 2. Redistributions in binary form must reproduce the above copyright notice, this list -* of conditions and the following disclaimer in the documentation and/or other materials -* provided with the distribution. -* -* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED -* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR -* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -* The views and conclusions contained in the software and documentation are those of the -* authors and should not be interpreted as representing official policies, either expressed -* or implied, of BetaSteward_at_googlemail.com. -*/ - -package mage.client.util; - -import static mage.constants.Constants.*; -import java.awt.image.BufferedImage; -import java.io.File; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class Frames { - - public static BufferedImage Black = ImageHelper.loadImage(Config.frameResourcePath + "8 black.png", FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT); - public static BufferedImage Blue = ImageHelper.loadImage(Config.frameResourcePath + "8 blue.png", FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT); - public static BufferedImage Gold = ImageHelper.loadImage(Config.frameResourcePath + "8 gold.png", FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT); - public static BufferedImage Green = ImageHelper.loadImage(Config.frameResourcePath + "8 green.png", FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT); - public static BufferedImage Grey = ImageHelper.loadImage(Config.frameResourcePath + "8 grey.png", FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT); - public static BufferedImage Red = ImageHelper.loadImage(Config.frameResourcePath + "8 red.png", FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT); - public static BufferedImage White = ImageHelper.loadImage(Config.frameResourcePath + "8 white.png", FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT); - public static BufferedImage BlackRed = ImageHelper.loadImage(Config.frameResourcePath + "black to red hybrid.png", FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT); - public static BufferedImage BlackGreen = ImageHelper.loadImage(Config.frameResourcePath + "eve hybrid black to green.png", FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT); - public static BufferedImage BlueBlack = ImageHelper.loadImage(Config.frameResourcePath + "blue_to_black_hybrid.png", FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT); - public static BufferedImage BlueRed = ImageHelper.loadImage(Config.frameResourcePath + "eve hybrid blue to red.png", FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT); - public static BufferedImage GreenBlue = ImageHelper.loadImage(Config.frameResourcePath + "eve hybrid green to blue.png", FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT); - public static BufferedImage GreenWhite = ImageHelper.loadImage(Config.frameResourcePath + "green_to_white_hybrid.png", FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT); - public static BufferedImage RedGreen = ImageHelper.loadImage(Config.frameResourcePath + "red_to_green_hybrid.png", FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT); - public static BufferedImage RedWhite = ImageHelper.loadImage(Config.frameResourcePath + "eve hybrid red to white.png", FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT); - public static BufferedImage WhiteBlack = ImageHelper.loadImage(Config.frameResourcePath + "eve hybrid white to black.png", FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT); - public static BufferedImage WhiteBlue = ImageHelper.loadImage(Config.frameResourcePath + "white_to_blue_hybrid.png", FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT); - - public static BufferedImage Forest = ImageHelper.loadImage(Config.frameResourcePath + "8 land mana green.png", FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT); - public static BufferedImage Island = ImageHelper.loadImage(Config.frameResourcePath + "8 land mana blue.png", FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT); - public static BufferedImage Mountain = ImageHelper.loadImage(Config.frameResourcePath + "8 land mana red.png", FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT); - public static BufferedImage Plains = ImageHelper.loadImage(Config.frameResourcePath + "8 land mana white.png", FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT); - public static BufferedImage Swamp = ImageHelper.loadImage(Config.frameResourcePath + "8 land mana black.png", FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT); - public static BufferedImage Land = ImageHelper.loadImage(Config.frameResourcePath + "8 multiland nomana colorless.png", FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT); - - public static BufferedImage Effect = ImageHelper.loadImage(Config.frameResourcePath + "Effects" + File.separator +"effect0.png", FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT); - - public static BufferedImage PowBoxLeft = ImageHelper.loadImage(Config.powerboxResourcePath + "graphic_card_powerbox_a_left.png"); - public static BufferedImage PowBoxMid = ImageHelper.loadImage(Config.powerboxResourcePath + "graphic_card_powerbox_a_middle.png"); - public static BufferedImage PowBoxRight = ImageHelper.loadImage(Config.powerboxResourcePath + "graphic_card_powerbox_a_right.png"); - -} diff --git a/Mage.Client/src/main/java/mage/client/util/ImageHelper.java b/Mage.Client/src/main/java/mage/client/util/ImageHelper.java index 75b77b35d3..6f1a33b246 100644 --- a/Mage.Client/src/main/java/mage/client/util/ImageHelper.java +++ b/Mage.Client/src/main/java/mage/client/util/ImageHelper.java @@ -30,7 +30,6 @@ package mage.client.util; import static mage.constants.Constants.*; -import java.awt.Color; import java.awt.Graphics2D; import java.awt.Image; import java.awt.RenderingHints; @@ -38,7 +37,6 @@ import java.awt.image.BufferedImage; import java.awt.image.ImageObserver; import java.awt.image.MemoryImageSource; import java.awt.image.PixelGrabber; -import java.io.File; import java.io.IOException; import java.io.InputStream; import java.util.HashMap; @@ -46,14 +44,9 @@ import java.util.List; import javax.imageio.ImageIO; -import mage.Constants.CardType; -import mage.Constants.Rarity; import mage.cards.CardDimensions; import mage.client.components.arcane.UI; -import mage.sets.Sets; -import mage.view.AbilityView; import mage.view.CardView; -import mage.view.StackAbilityView; import com.mortennobel.imagescaling.ResampleOp; @@ -88,10 +81,7 @@ public class ImageHelper { public static BufferedImage loadImage(String ref) { if (!images.containsKey(ref)) { try { - if (Config.useResource) - images.put(ref, ImageIO.read(ImageHelper.class.getResourceAsStream(ref))); - else - images.put(ref, ImageIO.read(new File(ref))); + images.put(ref, ImageIO.read(ImageHelper.class.getResourceAsStream(ref))); } catch (Exception e) { return null; } @@ -105,139 +95,10 @@ public class ImageHelper { } BufferedImage background = new BufferedImage(FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT, BufferedImage.TYPE_INT_RGB); - Graphics2D g = (Graphics2D) background.getGraphics(); - g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - g.setColor(Color.WHITE); - g.fillRect(0, 0, FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT); - if (card instanceof StackAbilityView || card instanceof AbilityView) { - g.drawImage(Frames.Effect, 0, 0, Color.WHITE, null); - } - else { - g.drawImage(getFrame(card), 0, 0, Color.WHITE, null); - if (card.getArt() != null && !card.getArt().equals("")) { - BufferedImage art = loadImage(Config.cardArtResourcePath + card.getArt(), ART_MAX_WIDTH, ART_MAX_HEIGHT); - g.drawImage(art, CONTENT_MAX_XOFFSET, ART_MAX_YOFFSET, null); - } - - if (card.getExpansionSetCode() != null && card.getExpansionSetCode().length() > 0 && card.getRarity() != null && card.getRarity() != Rarity.NA) { - try { - String symbolCode = Sets.getInstance().get(card.getExpansionSetCode()).getSymbolCode(); - if (symbolCode != null && symbolCode.length() > 0) { - StringBuilder sb = new StringBuilder(); - sb.append(Config.setIconsResourcePath).append("graphic_").append(symbolCode).append("_").append(card.getRarity().getSymbolCode()).append(".png"); - BufferedImage icon = loadImage(sb.toString(), ICON_MAX_HEIGHT); - if (icon != null) - g.drawImage(icon, ICON_MAX_XOFFSET - icon.getWidth(), ICON_MAX_YOFFSET, null); - } - } catch (Exception e) { - e.printStackTrace(); - } catch (Error er) { - er.printStackTrace(); - } - } - - if (card.getCardTypes() != null && (card.getCardTypes().contains(CardType.CREATURE) || card.getCardTypes().contains(CardType.PLANESWALKER))) { - g.drawImage(Frames.PowBoxLeft, POWBOX_MAX_LEFT, POWBOX_MAX_TOP, null); - g.drawImage(Frames.PowBoxMid, POWBOX_MAX_LEFT + 7, POWBOX_MAX_TOP, null); - g.drawImage(Frames.PowBoxRight, POWBOX_MAX_LEFT + 38, POWBOX_MAX_TOP, null); - } - } - - g.dispose(); - backgrounds.put(backgroundName, background); return background; } - protected static BufferedImage getFrame(CardView card) { - - if (card.getCardTypes().contains(CardType.LAND)) { - return getLandFrame(card); - } - else { - if (card.getColor().isColorless()) { - return Frames.Grey; - } else if (card.getColor().isMulticolored()) { - if (card.getColor().getColorCount() > 2) - return Frames.Gold; - if (card.getColor().isBlack() && card.getColor().isRed()) { - if (Frames.BlackRed != null) - return Frames.BlackRed; - } - else if (card.getColor().isBlack() && card.getColor().isGreen()) { - if (Frames.BlackGreen != null) - return Frames.BlackGreen; - } - else if (card.getColor().isBlack() && card.getColor().isBlue()) { - if (Frames.BlueBlack != null) - return Frames.BlueBlack; - } - else if (card.getColor().isRed() && card.getColor().isBlue()) { - if (Frames.BlueRed != null) - return Frames.BlueRed; - } - else if (card.getColor().isGreen() && card.getColor().isBlue()) { - if (Frames.GreenBlue != null) - return Frames.GreenBlue; - } - else if (card.getColor().isGreen() && card.getColor().isWhite()) { - if (Frames.GreenWhite != null) - return Frames.GreenWhite; - } - else if (card.getColor().isRed() && card.getColor().isGreen()) { - if (Frames.RedGreen != null) - return Frames.RedGreen; - } - else if (card.getColor().isRed() && card.getColor().isWhite()) { - if (Frames.RedWhite != null) - return Frames.RedWhite; - } - else if (card.getColor().isWhite() && card.getColor().isBlack()) { - if (Frames.WhiteBlack != null) - return Frames.WhiteBlack; - } - else if (card.getColor().isWhite() && card.getColor().isBlue()) { - if (Frames.WhiteBlue != null) - return Frames.WhiteBlue; - } - return Frames.Gold; - } else { - if (card.getColor().isBlack()) { - return Frames.Black; - } else if (card.getColor().isBlue()) { - return Frames.Blue; - } else if (card.getColor().isRed()) { - return Frames.Red; - } else if (card.getColor().isGreen()) { - return Frames.Green; - } else if (card.getColor().isWhite()) { - return Frames.White; - } - } - } - return Frames.Grey; - } - - protected static BufferedImage getLandFrame(CardView card) { - if (card.getSuperTypes().contains("Basic")) { - if (card.getSubTypes().contains("Forest")) { - return Frames.Forest; - } - else if (card.getSubTypes().contains("Island")) { - return Frames.Island; - } - else if (card.getSubTypes().contains("Mountain")) { - return Frames.Mountain; - } - else if (card.getSubTypes().contains("Plains")) { - return Frames.Plains; - } - else if (card.getSubTypes().contains("Swamp")) { - return Frames.Swamp; - } - } - return Frames.Land; - } public static BufferedImage scaleImage(BufferedImage image, int width, int height) { BufferedImage scaledImage = image; @@ -291,15 +152,8 @@ public class ImageHelper { int costLeft = xOffset; for (int i = costs.size() - 1; i >= 0; i--) { String symbol = costs.get(i); - Image image = Symbols.getSymbol(symbol); - if (image != null) { - g.drawImage(image, costLeft, yOffset, o); - costLeft -= SYMBOL_MAX_SPACE; - } - else { - g.drawString(symbol, costLeft, yOffset + SYMBOL_MAX_SPACE); - costLeft -= SYMBOL_MAX_SPACE + 4; - } + g.drawString(symbol, costLeft, yOffset + SYMBOL_MAX_SPACE); + costLeft -= SYMBOL_MAX_SPACE + 4; } } } diff --git a/Mage.Client/src/main/java/mage/client/util/Symbols.java b/Mage.Client/src/main/java/mage/client/util/Symbols.java deleted file mode 100644 index 8d2c2cbdf1..0000000000 --- a/Mage.Client/src/main/java/mage/client/util/Symbols.java +++ /dev/null @@ -1,96 +0,0 @@ -/* -* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without modification, are -* permitted provided that the following conditions are met: -* -* 1. Redistributions of source code must retain the above copyright notice, this list of -* conditions and the following disclaimer. -* -* 2. Redistributions in binary form must reproduce the above copyright notice, this list -* of conditions and the following disclaimer in the documentation and/or other materials -* provided with the distribution. -* -* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED -* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR -* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -* The views and conclusions contained in the software and documentation are those of the -* authors and should not be interpreted as representing official policies, either expressed -* or implied, of BetaSteward_at_googlemail.com. -*/ - -package mage.client.util; - -import java.awt.Image; -import java.util.HashMap; -import java.util.Map; -import static mage.constants.Constants.*; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class Symbols { - - public static Map symbols = new HashMap(); - - static { - symbols.put("{B}", ImageHelper.loadImage(Config.symbolsResourcePath + "mana_black.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT)); - symbols.put("{U}", ImageHelper.loadImage(Config.symbolsResourcePath + "mana_blue.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT)); - symbols.put("{G}", ImageHelper.loadImage(Config.symbolsResourcePath + "mana_green.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT)); - symbols.put("{R}", ImageHelper.loadImage(Config.symbolsResourcePath + "mana_red.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT)); - symbols.put("{W}", ImageHelper.loadImage(Config.symbolsResourcePath + "mana_white.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT)); - - symbols.put("{0}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_0.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT)); - symbols.put("{1}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_1.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT)); - symbols.put("{2}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_2.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT)); - symbols.put("{3}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_3.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT)); - symbols.put("{4}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_4.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT)); - symbols.put("{5}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_5.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT)); - symbols.put("{6}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_6.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT)); - symbols.put("{7}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_7.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT)); - symbols.put("{8}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_8.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT)); - symbols.put("{9}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_9.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT)); - symbols.put("{10}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_10.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT)); - symbols.put("{11}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_11.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT)); - symbols.put("{12}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_12.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT)); - symbols.put("{13}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_13.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT)); - symbols.put("{14}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_14.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT)); - symbols.put("{15}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_15.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT)); - symbols.put("{16}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_16.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT)); - symbols.put("{X}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_x.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT)); - - symbols.put("{B/G}", ImageHelper.loadImage(Config.symbolsResourcePath + "black_green.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT)); - symbols.put("{B/R}", ImageHelper.loadImage(Config.symbolsResourcePath + "black_red.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT)); - symbols.put("{U/B}", ImageHelper.loadImage(Config.symbolsResourcePath + "blue_black.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT)); - symbols.put("{U/R}", ImageHelper.loadImage(Config.symbolsResourcePath + "blue_red.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT)); - symbols.put("{G/B}", ImageHelper.loadImage(Config.symbolsResourcePath + "green_blue.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT)); - symbols.put("{G/W}", ImageHelper.loadImage(Config.symbolsResourcePath + "green_white.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT)); - symbols.put("{R/G}", ImageHelper.loadImage(Config.symbolsResourcePath + "red_green.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT)); - symbols.put("{R/W}", ImageHelper.loadImage(Config.symbolsResourcePath + "red_white.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT)); - symbols.put("{W/B}", ImageHelper.loadImage(Config.symbolsResourcePath + "white_black.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT)); - symbols.put("{W/U}", ImageHelper.loadImage(Config.symbolsResourcePath + "white_blue.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT)); - - symbols.put("{2/B}", ImageHelper.loadImage(Config.symbolsResourcePath + "two_black.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT)); - symbols.put("{2/U}", ImageHelper.loadImage(Config.symbolsResourcePath + "two_blue.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT)); - symbols.put("{2/G}", ImageHelper.loadImage(Config.symbolsResourcePath + "two_green.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT)); - symbols.put("{2/R}", ImageHelper.loadImage(Config.symbolsResourcePath + "two_red.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT)); - symbols.put("{2/W}", ImageHelper.loadImage(Config.symbolsResourcePath + "two_white.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT)); - - } - - public static Image getSymbol(String symbol) { - - if (symbols.containsKey(symbol)) - return(symbols.get(symbol)); - return null; - - } -} diff --git a/Mage.Common/pom.xml b/Mage.Common/pom.xml index 0dff51732f..c72cd6a530 100644 --- a/Mage.Common/pom.xml +++ b/Mage.Common/pom.xml @@ -7,7 +7,7 @@ org.mage mage-root - 0.7 + 0.7.2 Mage-Common diff --git a/Mage.Common/src/mage/interfaces/Server.java b/Mage.Common/src/mage/interfaces/Server.java index 1d17c15a25..84a28ff557 100644 --- a/Mage.Common/src/mage/interfaces/Server.java +++ b/Mage.Common/src/mage/interfaces/Server.java @@ -37,6 +37,7 @@ import mage.cards.decks.DeckCardLists; import mage.game.GameException; import mage.game.tournament.TournamentOptions; import mage.interfaces.callback.CallbackServer; +import mage.utils.MageVersion; import mage.view.DraftPickView; import mage.view.TableView; import mage.view.GameView; @@ -48,7 +49,7 @@ import mage.view.TournamentView; */ public interface Server extends Remote, CallbackServer { - public UUID registerClient(String userName, UUID clientId) throws RemoteException, MageException; + public UUID registerClient(String userName, UUID clientId, MageVersion version) throws RemoteException, MageException; public void deregisterClient(UUID sessionId) throws RemoteException, MageException; public void ack(String message, UUID sessionId) throws RemoteException, MageException; @@ -57,8 +58,8 @@ public interface Server extends Remote, CallbackServer { //table methods public TableView createTable(UUID sessionId, UUID roomId, MatchOptions matchOptions) throws RemoteException, MageException; public TableView createTournamentTable(UUID sessionId, UUID roomId, TournamentOptions tournamentOptions) throws RemoteException, MageException; - public boolean joinTable(UUID sessionId, UUID roomId, UUID tableId, String name, String playerType, DeckCardLists deckList) throws RemoteException, MageException, GameException; - public boolean joinTournamentTable(UUID sessionId, UUID roomId, UUID tableId, String name, String playerType) throws RemoteException, MageException, GameException; + public boolean joinTable(UUID sessionId, UUID roomId, UUID tableId, String name, String playerType, int skill, DeckCardLists deckList) throws RemoteException, MageException, GameException; + public boolean joinTournamentTable(UUID sessionId, UUID roomId, UUID tableId, String name, String playerType, int skill) throws RemoteException, MageException, GameException; public boolean submitDeck(UUID sessionId, UUID tableId, DeckCardLists deckList) throws RemoteException, MageException, GameException; public boolean watchTable(UUID sessionId, UUID roomId, UUID tableId) throws RemoteException, MageException; public void leaveTable(UUID sessionId, UUID roomId, UUID tableId) throws RemoteException, MageException; diff --git a/Mage.Common/src/mage/interfaces/ServerState.java b/Mage.Common/src/mage/interfaces/ServerState.java index aa338dc36f..4282d5bb58 100644 --- a/Mage.Common/src/mage/interfaces/ServerState.java +++ b/Mage.Common/src/mage/interfaces/ServerState.java @@ -30,6 +30,7 @@ package mage.interfaces; import java.io.Serializable; import java.util.List; +import mage.utils.MageVersion; import mage.view.GameTypeView; import mage.view.TournamentTypeView; @@ -44,13 +45,15 @@ public class ServerState implements Serializable { private String[] playerTypes; private String[] deckTypes; private boolean testMode; + private MageVersion version; - public ServerState(List gameTypes, List tournamentTypes, String[] playerTypes, String[] deckTypes, boolean testMode) { + public ServerState(List gameTypes, List tournamentTypes, String[] playerTypes, String[] deckTypes, boolean testMode, MageVersion version) { this.gameTypes = gameTypes; this.tournamentTypes = tournamentTypes; this.playerTypes = playerTypes; this.deckTypes = deckTypes; this.testMode = testMode; + this.version = version; } public List getGameTypes() { @@ -73,4 +76,7 @@ public class ServerState implements Serializable { return testMode; } + public MageVersion getVersion() { + return version; + } } diff --git a/Mage.Common/src/mage/utils/MageVersion.java b/Mage.Common/src/mage/utils/MageVersion.java new file mode 100644 index 0000000000..9901ac9398 --- /dev/null +++ b/Mage.Common/src/mage/utils/MageVersion.java @@ -0,0 +1,77 @@ +/* +* Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without modification, are +* permitted provided that the following conditions are met: +* +* 1. Redistributions of source code must retain the above copyright notice, this list of +* conditions and the following disclaimer. +* +* 2. Redistributions in binary form must reproduce the above copyright notice, this list +* of conditions and the following disclaimer in the documentation and/or other materials +* provided with the distribution. +* +* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED +* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR +* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* The views and conclusions contained in the software and documentation are those of the +* authors and should not be interpreted as representing official policies, either expressed +* or implied, of BetaSteward_at_googlemail.com. +*/ + +package mage.utils; + +import java.io.Serializable; + +/** + * + * @author BetaSteward_at_googlemail.com + */ +public class MageVersion implements Serializable, Comparable { + + private int major; + private int minor; + private int patch; + + public MageVersion(int major, int minor, int patch) { + this.major = major; + this.minor = minor; + this.patch = patch; + } + + public int getMajor() { + return major; + } + + public int getMinor() { + return minor; + } + + public int getPatch() { + return patch; + } + + @Override + public String toString() { + return major + "." + minor + "." + patch; + } + + @Override + public int compareTo(MageVersion o) { + if (major != o.major) + return major - o.major; + if (minor != o.minor) + return minor - o.minor; + if (patch != o.patch) + return patch - o.patch; + return 0; + } + +} diff --git a/Mage.Plugins/Mage.Card.Plugin/pom.xml b/Mage.Plugins/Mage.Card.Plugin/pom.xml index c9e6457ce5..93335e8524 100644 --- a/Mage.Plugins/Mage.Card.Plugin/pom.xml +++ b/Mage.Plugins/Mage.Card.Plugin/pom.xml @@ -7,7 +7,7 @@ org.mage Mage-Plugins - 0.7 + 0.7.2 Mage-Card-Plugin diff --git a/Mage.Plugins/Mage.Counter.Plugin/pom.xml b/Mage.Plugins/Mage.Counter.Plugin/pom.xml index 6667a4c489..23405a2cf6 100644 --- a/Mage.Plugins/Mage.Counter.Plugin/pom.xml +++ b/Mage.Plugins/Mage.Counter.Plugin/pom.xml @@ -7,7 +7,7 @@ org.mage Mage-Plugins - 0.7 + 0.7.2 Mage-Counter-Plugin diff --git a/Mage.Plugins/Mage.Rating.Plugin/pom.xml b/Mage.Plugins/Mage.Rating.Plugin/pom.xml index b7cb695097..0614420bdb 100644 --- a/Mage.Plugins/Mage.Rating.Plugin/pom.xml +++ b/Mage.Plugins/Mage.Rating.Plugin/pom.xml @@ -6,7 +6,7 @@ org.mage Mage-Plugins - 0.7 + 0.7.2 org.mage diff --git a/Mage.Plugins/Mage.Theme.Plugin/pom.xml b/Mage.Plugins/Mage.Theme.Plugin/pom.xml index da88118434..b844e4ea4e 100644 --- a/Mage.Plugins/Mage.Theme.Plugin/pom.xml +++ b/Mage.Plugins/Mage.Theme.Plugin/pom.xml @@ -6,7 +6,7 @@ org.mage Mage-Plugins - 0.7 + 0.7.2 Mage-Theme-Plugin diff --git a/Mage.Plugins/pom.xml b/Mage.Plugins/pom.xml index 29d2396cbe..8867e120ec 100644 --- a/Mage.Plugins/pom.xml +++ b/Mage.Plugins/pom.xml @@ -7,7 +7,7 @@ org.mage mage-root - 0.7 + 0.7.2 Mage-Plugins diff --git a/Mage.Server.Plugins/Mage.Deck.Constructed/pom.xml b/Mage.Server.Plugins/Mage.Deck.Constructed/pom.xml index b5dfb9f06d..7c434e18eb 100644 --- a/Mage.Server.Plugins/Mage.Deck.Constructed/pom.xml +++ b/Mage.Server.Plugins/Mage.Deck.Constructed/pom.xml @@ -7,7 +7,7 @@ org.mage Mage-Server-Plugins - 0.7 + 0.7.2 Mage-Deck-Constructed diff --git a/Mage.Server.Plugins/Mage.Deck.Limited/pom.xml b/Mage.Server.Plugins/Mage.Deck.Limited/pom.xml index 30e6a1550f..bb296eb64b 100644 --- a/Mage.Server.Plugins/Mage.Deck.Limited/pom.xml +++ b/Mage.Server.Plugins/Mage.Deck.Limited/pom.xml @@ -7,7 +7,7 @@ org.mage Mage-Server-Plugins - 0.7 + 0.7.2 Mage-Deck-Limited diff --git a/Mage.Server.Plugins/Mage.Game.FreeForAll/pom.xml b/Mage.Server.Plugins/Mage.Game.FreeForAll/pom.xml index ff120e8b57..5bdc159d76 100644 --- a/Mage.Server.Plugins/Mage.Game.FreeForAll/pom.xml +++ b/Mage.Server.Plugins/Mage.Game.FreeForAll/pom.xml @@ -7,7 +7,7 @@ org.mage Mage-Server-Plugins - 0.7 + 0.7.2 Mage-Game-FreeForAll diff --git a/Mage.Server.Plugins/Mage.Game.TwoPlayerDuel/pom.xml b/Mage.Server.Plugins/Mage.Game.TwoPlayerDuel/pom.xml index 322a596bb6..8a8ce714ee 100644 --- a/Mage.Server.Plugins/Mage.Game.TwoPlayerDuel/pom.xml +++ b/Mage.Server.Plugins/Mage.Game.TwoPlayerDuel/pom.xml @@ -7,7 +7,7 @@ org.mage Mage-Server-Plugins - 0.7 + 0.7.2 Mage-Game-TwoPlayerDuel diff --git a/Mage.Server.Plugins/Mage.Player.AI.MA/pom.xml b/Mage.Server.Plugins/Mage.Player.AI.MA/pom.xml index 6647b2aba2..82fa1822bf 100644 --- a/Mage.Server.Plugins/Mage.Player.AI.MA/pom.xml +++ b/Mage.Server.Plugins/Mage.Player.AI.MA/pom.xml @@ -7,7 +7,7 @@ org.mage Mage-Server-Plugins - 0.7 + 0.7.2 Mage-Player-AI-MA diff --git a/Mage.Server.Plugins/Mage.Player.AI/pom.xml b/Mage.Server.Plugins/Mage.Player.AI/pom.xml index f3924d4733..d6e3959ba7 100644 --- a/Mage.Server.Plugins/Mage.Player.AI/pom.xml +++ b/Mage.Server.Plugins/Mage.Player.AI/pom.xml @@ -7,7 +7,7 @@ org.mage Mage-Server-Plugins - 0.7 + 0.7.2 Mage-Player-AI diff --git a/Mage.Server.Plugins/Mage.Player.AIMinimax/pom.xml b/Mage.Server.Plugins/Mage.Player.AIMinimax/pom.xml index 0fe861a6f4..c64bc06701 100644 --- a/Mage.Server.Plugins/Mage.Player.AIMinimax/pom.xml +++ b/Mage.Server.Plugins/Mage.Player.AIMinimax/pom.xml @@ -7,7 +7,7 @@ org.mage Mage-Server-Plugins - 0.7 + 0.7.2 Mage-Player-AIMinimax diff --git a/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/ComputerPlayer2.java b/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/ComputerPlayer2.java index 65ba13978e..5e9c992cf2 100644 --- a/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/ComputerPlayer2.java +++ b/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/ComputerPlayer2.java @@ -176,6 +176,7 @@ public class ComputerPlayer2 extends ComputerPlayer implements if (usedStack) pass(); } + logger.info("Turn " + game.getTurnNum() + " Step " + game.getStep().toString() + " Player " + name + " Life " + life); } protected void calculateActions(Game game) { @@ -337,7 +338,11 @@ public class ComputerPlayer2 extends ComputerPlayer implements } catch (InterruptedException ex) { logger.fatal("can't sleep"); } - logger.info("Calculated " + root.nodeCount + " nodes in 30s"); + long endTime = System.nanoTime(); + long duration = endTime - startTime; + logger.info("Timeout - Calculated " + root.nodeCount + " nodes in " + duration/1000000000.0 + "s"); + nodeCount += root.nodeCount; + thinkTime += duration; } catch (ExecutionException e) { logger.fatal("Simulation error", e); task.cancel(true); diff --git a/Mage.Server.Plugins/Mage.Player.Human/pom.xml b/Mage.Server.Plugins/Mage.Player.Human/pom.xml index 0d67db54ad..557de8d31b 100644 --- a/Mage.Server.Plugins/Mage.Player.Human/pom.xml +++ b/Mage.Server.Plugins/Mage.Player.Human/pom.xml @@ -7,7 +7,7 @@ org.mage Mage-Server-Plugins - 0.7 + 0.7.2 Mage-Player-Human diff --git a/Mage.Server.Plugins/Mage.Tournament.BoosterDraft/pom.xml b/Mage.Server.Plugins/Mage.Tournament.BoosterDraft/pom.xml index d53bdc741f..dc3b65f703 100644 --- a/Mage.Server.Plugins/Mage.Tournament.BoosterDraft/pom.xml +++ b/Mage.Server.Plugins/Mage.Tournament.BoosterDraft/pom.xml @@ -7,7 +7,7 @@ org.mage Mage-Server-Plugins - 0.7 + 0.7.2 Mage-Tournament-BoosterDraft diff --git a/Mage.Server.Plugins/Mage.Tournament.Sealed/pom.xml b/Mage.Server.Plugins/Mage.Tournament.Sealed/pom.xml index d7fd434b00..d7f0bfa058 100644 --- a/Mage.Server.Plugins/Mage.Tournament.Sealed/pom.xml +++ b/Mage.Server.Plugins/Mage.Tournament.Sealed/pom.xml @@ -7,7 +7,7 @@ org.mage Mage-Server-Plugins - 0.7 + 0.7.2 Mage-Tournament-Sealed diff --git a/Mage.Server.Plugins/pom.xml b/Mage.Server.Plugins/pom.xml index f386386b8a..de611ba850 100644 --- a/Mage.Server.Plugins/pom.xml +++ b/Mage.Server.Plugins/pom.xml @@ -6,7 +6,7 @@ org.mage mage-root - 0.7 + 0.7.2 Mage-Server-Plugins diff --git a/Mage.Server/pom.xml b/Mage.Server/pom.xml index 28e7855fe8..db26a5a387 100644 --- a/Mage.Server/pom.xml +++ b/Mage.Server/pom.xml @@ -6,7 +6,7 @@ org.mage mage-root - 0.7 + 0.7.2 Mage-Server diff --git a/Mage.Server/src/main/java/mage/server/Main.java b/Mage.Server/src/main/java/mage/server/Main.java index 8817f8710c..9fb146277e 100644 --- a/Mage.Server/src/main/java/mage/server/Main.java +++ b/Mage.Server/src/main/java/mage/server/Main.java @@ -43,6 +43,7 @@ import mage.server.util.ConfigSettings; import mage.server.util.config.Plugin; import mage.server.util.config.GamePlugin; import mage.util.Copier; +import mage.utils.MageVersion; import org.apache.log4j.Logger; /** @@ -55,7 +56,7 @@ public class Main { private final static String testModeArg = "-testMode="; private final static String pluginFolder = "plugins"; - private final static String version = "0.7.1"; + private static MageVersion version = new MageVersion(0, 7, 2); public static PluginClassLoader classLoader = new PluginClassLoader(); public static ServerImpl server; @@ -166,4 +167,8 @@ public class Main { } } + public static MageVersion getVersion() { + return version; + } + } diff --git a/Mage.Server/src/main/java/mage/server/ServerImpl.java b/Mage.Server/src/main/java/mage/server/ServerImpl.java index 003739a716..c4bf233e57 100644 --- a/Mage.Server/src/main/java/mage/server/ServerImpl.java +++ b/Mage.Server/src/main/java/mage/server/ServerImpl.java @@ -55,6 +55,7 @@ import mage.server.game.ReplayManager; import mage.server.tournament.TournamentFactory; import mage.server.tournament.TournamentManager; import mage.server.util.ThreadExecutor; +import mage.utils.MageVersion; import mage.view.ChatMessage.MessageColor; import mage.view.DraftPickView; import mage.view.GameView; @@ -105,10 +106,13 @@ public class ServerImpl extends RemoteServer implements Server { } @Override - public UUID registerClient(String userName, UUID clientId) throws MageException, RemoteException { + public UUID registerClient(String userName, UUID clientId, MageVersion version) throws MageException, RemoteException { - UUID sessionId = SessionManager.getInstance().createSession(userName, clientId); + UUID sessionId = null; try { + if (version.compareTo(Main.getVersion()) != 0) + throw new MageException("Wrong client version " + version + ", expecting version " + Main.getVersion()); + sessionId = SessionManager.getInstance().createSession(userName, clientId); logger.info("Session " + sessionId + " created for user " + userName + " at " + getClientHost()); } catch (Exception ex) { handleException(ex); @@ -161,7 +165,7 @@ public class ServerImpl extends RemoteServer implements Server { } @Override - public boolean joinTable(UUID sessionId, UUID roomId, UUID tableId, String name, String playerType, DeckCardLists deckList) throws MageException, GameException { + public boolean joinTable(UUID sessionId, UUID roomId, UUID tableId, String name, String playerType, int skill, DeckCardLists deckList) throws MageException, GameException { try { boolean ret = GamesRoomManager.getInstance().getRoom(roomId).joinTable(sessionId, tableId, name, playerType, deckList); logger.info("Session " + sessionId + " joined table " + tableId); @@ -176,7 +180,7 @@ public class ServerImpl extends RemoteServer implements Server { } @Override - public boolean joinTournamentTable(UUID sessionId, UUID roomId, UUID tableId, String name, String playerType) throws MageException, GameException { + public boolean joinTournamentTable(UUID sessionId, UUID roomId, UUID tableId, String name, String playerType, int skill) throws MageException, GameException { try { boolean ret = GamesRoomManager.getInstance().getRoom(roomId).joinTournamentTable(sessionId, tableId, name, playerType); logger.info("Session " + sessionId + " joined table " + tableId); @@ -726,7 +730,8 @@ public class ServerImpl extends RemoteServer implements Server { TournamentFactory.getInstance().getTournamentTypes(), PlayerFactory.getInstance().getPlayerTypes().toArray(new String[0]), DeckValidatorFactory.getInstance().getDeckTypes().toArray(new String[0]), - testMode); + testMode, + Main.getVersion()); } catch (Exception ex) { handleException(ex); diff --git a/Mage.Sets/pom.xml b/Mage.Sets/pom.xml index 7e11f2fbfd..eabb9c3cb6 100644 --- a/Mage.Sets/pom.xml +++ b/Mage.Sets/pom.xml @@ -7,7 +7,7 @@ org.mage mage-root - 0.7 + 0.7.2 org.mage diff --git a/Mage/pom.xml b/Mage/pom.xml index 2ccc5f3542..957752219f 100644 --- a/Mage/pom.xml +++ b/Mage/pom.xml @@ -7,7 +7,7 @@ org.mage mage-root - 0.7 + 0.7.2 Mage diff --git a/pom.xml b/pom.xml index e4f6c08bc7..3bd0580380 100644 --- a/pom.xml +++ b/pom.xml @@ -6,11 +6,23 @@ org.mage mage-root - 0.7 + 0.7.2 pom Mage Root Mage Root POM - + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.0.2 + + 1.6 + 1.6 + + + + Mage Mage.Common @@ -34,6 +46,6 @@ - 0.7 + 0.7.2