diff --git a/Mage.Client/config/config.properties b/Mage.Client/config/config.properties deleted file mode 100644 index 29478a9683..0000000000 --- a/Mage.Client/config/config.properties +++ /dev/null @@ -1,18 +0,0 @@ -server-name=localhost -port=17171 -remote-server=mage-server -cards-resource-path=/home/loki/.wine/drive_c/Program Files/Wizards of the Coast/Magic Online/Graphics/Cards/ -symbols-resource-path=/home/loki/.wine/drive_c/Program Files/Wizards of the Coast/Magic Online/Graphics/Chat/chat_graphic_typingicon_ -resource-path=/home/loki/.wine/drive_c/Program Files/Wizards of the Coast/Magic Online/Graphics/Cards/Pics/ -#cards-resource-path=resources/images/cards/ -#symbols-resource-path=resources/images/symbols/ -#resource-path=resources/images/ -card-scaling-factor=0.4 -card-scaling-factor-enlarged=0.5 -hand-scaling-factor=1.3 - -# parameters for debugging and testing faster -default-deck-path=C:\\Users\\836D~1\\AppData\\Local\\Temp\\tempDeck1577fd51-f098-420e-8794-c22d2c0602d99142449166006085381.dck -# 0: Human,1: Computer - mad, 2: Computer - Draft Bot -default-other-player-index=1 -default-computer-name=computer diff --git a/Mage.Client/release/config/config.properties b/Mage.Client/release/config/config.properties deleted file mode 100644 index c0e7f07d09..0000000000 --- a/Mage.Client/release/config/config.properties +++ /dev/null @@ -1,14 +0,0 @@ -server-name=localhost -port=17171 -remote-server=mage-server -cards-resource-path=resources/images/cards/ -symbols-resource-path=resources/images/symbols/ -resource-path=resources/images/ - -card-scaling-factor=0.4 -card-scaling-factor-enlarged=0.5 -hand-scaling-factor=1.3 - -# 0: Human,1: Computer - mad, 2: Computer - Draft Bot -default-other-player-index=1 -default-computer-name=computer diff --git a/Mage.Client/release/readme.txt b/Mage.Client/release/readme.txt index cde5e139c8..cb4c055c01 100644 --- a/Mage.Client/release/readme.txt +++ b/Mage.Client/release/readme.txt @@ -17,7 +17,7 @@ Extact the client and the server to separate folders. To play a game you can either connect to a server or start your own server. To connect to a server you will need to know the server name or IP address and the port. To start a server run the startServer.bat command. If you want to use a different -port or change the timeout setting then modify the config.properties file in the +port or change the timeout setting then modify the config.xml file in the config folder. To launch the client run the startClient.bat command. Click on the connect button on diff --git a/Mage.Client/src/main/java/mage/client/MageFrame.java b/Mage.Client/src/main/java/mage/client/MageFrame.java index e1ecf3717f..0117e7e325 100644 --- a/Mage.Client/src/main/java/mage/client/MageFrame.java +++ b/Mage.Client/src/main/java/mage/client/MageFrame.java @@ -1315,7 +1315,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient { if (startPort > 0) { instance.currentConnection.setPort(startPort); } else { - instance.currentConnection.setPort(MagePreferences.getServerPortWithDefault(Config.port)); + instance.currentConnection.setPort(MagePreferences.getServerPortWithDefault(ClientDefaultSettings.port)); } PreferencesDialog.setProxyInformation(instance.currentConnection); instance.currentConnection.setPassword(startPassword); diff --git a/Mage.Client/src/main/java/mage/client/cards/Card.java b/Mage.Client/src/main/java/mage/client/cards/Card.java index 92f83e3195..3b885411d2 100644 --- a/Mage.Client/src/main/java/mage/client/cards/Card.java +++ b/Mage.Client/src/main/java/mage/client/cards/Card.java @@ -7,7 +7,7 @@ import mage.cards.TextPopup; import mage.cards.action.ActionCallback; import mage.client.MageFrame; import mage.client.game.PlayAreaPanel; -import mage.client.util.Config; +import mage.client.util.ClientDefaultSettings; import mage.client.util.DefaultActionCallback; import mage.client.util.ImageHelper; import mage.client.util.gui.ArrowBuilder; @@ -68,7 +68,7 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis this.gameId = gameId; this.card = card; this.bigCard = bigCard; - small = new BufferedImage(Config.dimensions.getFrameWidth(), Config.dimensions.getFrameHeight(), BufferedImage.TYPE_INT_RGB); + small = new BufferedImage(ClientDefaultSettings.dimensions.getFrameWidth(), ClientDefaultSettings.dimensions.getFrameHeight(), BufferedImage.TYPE_INT_RGB); backgroundName = getBackgroundName(); background = ImageHelper.getBackground(card, backgroundName); @@ -120,7 +120,7 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis gSmall.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); gSmall.setColor(Color.BLACK); - gSmall.drawImage(ImageHelper.scaleImage(image, Config.dimensions.getFrameWidth(), Config.dimensions.getFrameHeight()), 0, 0, this); + gSmall.drawImage(ImageHelper.scaleImage(image, ClientDefaultSettings.dimensions.getFrameWidth(), ClientDefaultSettings.dimensions.getFrameHeight()), 0, 0, this); gImage.setFont(new Font("Arial", Font.PLAIN, NAME_FONT_MAX_SIZE)); gImage.drawString(card.getName() + "TEST", CONTENT_MAX_XOFFSET, NAME_MAX_YOFFSET); @@ -136,16 +136,16 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis gImage.dispose(); - gSmall.setFont(new Font("Arial", Font.PLAIN, Config.dimensions.getNameFontSize())); - gSmall.drawString(card.getName() + "TEST2", Config.dimensions.getContentXOffset(), Config.dimensions.getNameYOffset()); + gSmall.setFont(new Font("Arial", Font.PLAIN, ClientDefaultSettings.dimensions.getNameFontSize())); + gSmall.drawString(card.getName() + "TEST2", ClientDefaultSettings.dimensions.getContentXOffset(), ClientDefaultSettings.dimensions.getNameYOffset()); if (card.isCreature()) { - gSmall.drawString(card.getPower() + "/-/" + card.getToughness(), Config.dimensions.getPowBoxTextLeft(), Config.dimensions.getPowBoxTextTop()); + gSmall.drawString(card.getPower() + "/-/" + card.getToughness(), ClientDefaultSettings.dimensions.getPowBoxTextLeft(), ClientDefaultSettings.dimensions.getPowBoxTextTop()); } else if (card.isPlanesWalker()) { - gSmall.drawString(card.getLoyalty(), Config.dimensions.getPowBoxTextLeft(), Config.dimensions.getPowBoxTextTop()); + gSmall.drawString(card.getLoyalty(), ClientDefaultSettings.dimensions.getPowBoxTextLeft(), ClientDefaultSettings.dimensions.getPowBoxTextTop()); } if (!card.getCardTypes().isEmpty()) { - gSmall.drawString(cardType, Config.dimensions.getContentXOffset(), Config.dimensions.getTypeYOffset()); + gSmall.drawString(cardType, ClientDefaultSettings.dimensions.getContentXOffset(), ClientDefaultSettings.dimensions.getTypeYOffset()); } drawText(); @@ -346,11 +346,11 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis tooltipPopup.hide(); } PopupFactory factory = PopupFactory.getSharedInstance(); - tooltipPopup = factory.getPopup(this, tooltipText, (int) this.getLocationOnScreen().getX() + Config.dimensions.getFrameWidth(), (int) this.getLocationOnScreen().getY() + 40); + tooltipPopup = factory.getPopup(this, tooltipText, (int) this.getLocationOnScreen().getX() + ClientDefaultSettings.dimensions.getFrameWidth(), (int) this.getLocationOnScreen().getY() + 40); tooltipPopup.show(); //hack to get tooltipPopup to resize to fit text tooltipPopup.hide(); - tooltipPopup = factory.getPopup(this, tooltipText, (int) this.getLocationOnScreen().getX() + Config.dimensions.getFrameWidth(), (int) this.getLocationOnScreen().getY() + 40); + tooltipPopup = factory.getPopup(this, tooltipText, (int) this.getLocationOnScreen().getX() + ClientDefaultSettings.dimensions.getFrameWidth(), (int) this.getLocationOnScreen().getY() + 40); tooltipPopup.show(); tooltipShowing = true; diff --git a/Mage.Client/src/main/java/mage/client/cards/Cards.java b/Mage.Client/src/main/java/mage/client/cards/Cards.java index 2723a50d3f..b1ee32f74f 100644 --- a/Mage.Client/src/main/java/mage/client/cards/Cards.java +++ b/Mage.Client/src/main/java/mage/client/cards/Cards.java @@ -11,7 +11,7 @@ import mage.client.dialog.PreferencesDialog; import mage.client.plugins.impl.Plugins; import mage.client.util.CardsViewUtil; - import mage.client.util.Config; + import mage.client.util.ClientDefaultSettings; import mage.client.util.GUISizeHelper; import mage.view.*; import org.apache.log4j.Logger; @@ -212,7 +212,7 @@ private Dimension getCardDimension() { if (cardDimension == null) { - cardDimension = new Dimension(Config.dimensions.getFrameWidth(), Config.dimensions.getFrameHeight()); + cardDimension = new Dimension(ClientDefaultSettings.dimensions.getFrameWidth(), ClientDefaultSettings.dimensions.getFrameHeight()); } return cardDimension; } diff --git a/Mage.Client/src/main/java/mage/client/cards/Permanent.java b/Mage.Client/src/main/java/mage/client/cards/Permanent.java index cde8528da7..9ca5154c2d 100644 --- a/Mage.Client/src/main/java/mage/client/cards/Permanent.java +++ b/Mage.Client/src/main/java/mage/client/cards/Permanent.java @@ -11,7 +11,7 @@ package mage.client.cards; import mage.cards.CardDimensions; import mage.cards.MagePermanent; import mage.cards.Sets; -import mage.client.util.Config; +import mage.client.util.ClientDefaultSettings; import mage.client.util.TransformedImageCache; import mage.view.CounterView; import mage.view.PermanentView; @@ -49,7 +49,7 @@ public class Permanent extends Card { super(permanent, bigCard, dimensions, gameId); this.setSize(this.getPreferredSize()); this.permanent = permanent; - tappedImage = new BufferedImage(Config.dimensions.getFrameHeight(), Config.dimensions.getFrameWidth(), BufferedImage.TYPE_INT_RGB); + tappedImage = new BufferedImage(ClientDefaultSettings.dimensions.getFrameHeight(), ClientDefaultSettings.dimensions.getFrameWidth(), BufferedImage.TYPE_INT_RGB); } public UUID getPermanentId() { @@ -173,10 +173,10 @@ public class Permanent extends Card { g2.setColor(Color.BLACK); } if (permanent.isTapped()) { - g2.drawRect(0, 0, Config.dimensions.getFrameHeight() - 1, Config.dimensions.getFrameWidth() - 1); + g2.drawRect(0, 0, ClientDefaultSettings.dimensions.getFrameHeight() - 1, ClientDefaultSettings.dimensions.getFrameWidth() - 1); } else { - g2.drawRect(0, 0, Config.dimensions.getFrameWidth() - 1, Config.dimensions.getFrameHeight() - 1); + g2.drawRect(0, 0, ClientDefaultSettings.dimensions.getFrameWidth() - 1, ClientDefaultSettings.dimensions.getFrameHeight() - 1); } } @@ -206,10 +206,10 @@ public class Permanent extends Card { @Override public Dimension getPreferredSize() { if (permanent != null && permanent.isTapped()) { - return new Dimension(Config.dimensions.getFrameHeight(), Config.dimensions.getFrameWidth()); + return new Dimension(ClientDefaultSettings.dimensions.getFrameHeight(), ClientDefaultSettings.dimensions.getFrameWidth()); } else { - return new Dimension(Config.dimensions.getFrameWidth(), Config.dimensions.getFrameHeight()); + return new Dimension(ClientDefaultSettings.dimensions.getFrameWidth(), ClientDefaultSettings.dimensions.getFrameHeight()); } } @@ -229,7 +229,7 @@ public class Permanent extends Card { tooltipPopup.hide(); } PopupFactory factory = PopupFactory.getSharedInstance(); - int x = (int) this.getLocationOnScreen().getX() + (permanent.isTapped()? Config.dimensions.getFrameHeight() : Config.dimensions.getFrameWidth()); + int x = (int) this.getLocationOnScreen().getX() + (permanent.isTapped()? ClientDefaultSettings.dimensions.getFrameHeight() : ClientDefaultSettings.dimensions.getFrameWidth()); int y = (int) this.getLocationOnScreen().getY() + 40; tooltipPopup = factory.getPopup(this, tooltipText, x, y); tooltipPopup.show(); diff --git a/Mage.Client/src/main/java/mage/client/components/ext/dlg/IDialogPanel.java b/Mage.Client/src/main/java/mage/client/components/ext/dlg/IDialogPanel.java index 9d9863c77b..fa274ffca4 100644 --- a/Mage.Client/src/main/java/mage/client/components/ext/dlg/IDialogPanel.java +++ b/Mage.Client/src/main/java/mage/client/components/ext/dlg/IDialogPanel.java @@ -1,7 +1,7 @@ package mage.client.components.ext.dlg; import mage.client.components.ImageButton; -import mage.client.util.Config; +import mage.client.util.ClientDefaultSettings; import org.jdesktop.swingx.JXPanel; import javax.swing.*; @@ -71,7 +71,7 @@ public abstract class IDialogPanel extends JXPanel { protected Dimension getCardDimension() { if (cardDimension == null) { - cardDimension = new Dimension(Config.dimensions.getFrameWidth(), Config.dimensions.getFrameHeight()); + cardDimension = new Dimension(ClientDefaultSettings.dimensions.getFrameWidth(), ClientDefaultSettings.dimensions.getFrameHeight()); } return cardDimension; } diff --git a/Mage.Client/src/main/java/mage/client/deckeditor/collection/viewer/MageBook.java b/Mage.Client/src/main/java/mage/client/deckeditor/collection/viewer/MageBook.java index d6879ec3dd..226d09a7eb 100644 --- a/Mage.Client/src/main/java/mage/client/deckeditor/collection/viewer/MageBook.java +++ b/Mage.Client/src/main/java/mage/client/deckeditor/collection/viewer/MageBook.java @@ -10,7 +10,7 @@ import mage.client.cards.BigCard; import mage.client.components.HoverButton; import mage.client.dialog.PreferencesDialog; import mage.client.plugins.impl.Plugins; -import mage.client.util.Config; +import mage.client.util.ClientDefaultSettings; import mage.client.util.ImageHelper; import mage.client.util.NaturalOrderCardNumberComparator; import mage.client.util.audio.AudioManager; @@ -405,7 +405,7 @@ public class MageBook extends JComponent { private void addCard(CardView card, BigCard bigCard, UUID gameId, Rectangle rectangle) { if (cardDimension == null) { - cardDimension = new Dimension(Config.dimensions.getFrameWidth(), Config.dimensions.getFrameHeight()); + cardDimension = new Dimension(ClientDefaultSettings.dimensions.getFrameWidth(), ClientDefaultSettings.dimensions.getFrameHeight()); } final MageCard cardImg = Plugins.instance.getMageCard(card, bigCard, cardDimension, gameId, true, true, PreferencesDialog.getRenderMode(), true); cardImg.setBounds(rectangle); @@ -442,7 +442,7 @@ public class MageBook extends JComponent { private void addToken(Token token, BigCard bigCard, UUID gameId, Rectangle rectangle) { if (cardDimension == null) { - cardDimension = new Dimension(Config.dimensions.getFrameWidth(), Config.dimensions.getFrameHeight()); + cardDimension = new Dimension(ClientDefaultSettings.dimensions.getFrameWidth(), ClientDefaultSettings.dimensions.getFrameHeight()); } PermanentToken newToken = new PermanentToken(token, null, token.getOriginalExpansionSetCode(), null); newToken.removeSummoningSickness(); diff --git a/Mage.Client/src/main/java/mage/client/deckeditor/table/TableModel.java b/Mage.Client/src/main/java/mage/client/deckeditor/table/TableModel.java index dacaf0df74..ba145ddb6f 100644 --- a/Mage.Client/src/main/java/mage/client/deckeditor/table/TableModel.java +++ b/Mage.Client/src/main/java/mage/client/deckeditor/table/TableModel.java @@ -7,7 +7,7 @@ import mage.client.cards.ICardGrid; import mage.client.deckeditor.SortSetting; import mage.client.plugins.impl.Plugins; import mage.client.util.ClientEventType; -import mage.client.util.Config; +import mage.client.util.ClientDefaultSettings; import mage.client.util.Event; import mage.client.util.Listener; import mage.client.util.gui.GuiDisplayUtil; @@ -249,8 +249,8 @@ public class TableModel extends AbstractTableModel implements ICardGrid { private void addCard(CardView card, BigCard bigCard, UUID gameId) { if (cardDimension == null) { - cardDimension = new Dimension(Config.dimensions.getFrameWidth(), - Config.dimensions.getFrameHeight()); + cardDimension = new Dimension(ClientDefaultSettings.dimensions.getFrameWidth(), + ClientDefaultSettings.dimensions.getFrameHeight()); } cards.put(card.getId(), card); 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 33d1b75b29..3fb22126d2 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/ConnectDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/ConnectDialog.java @@ -6,7 +6,7 @@ import mage.choices.ChoiceImpl; import mage.client.MageFrame; import mage.client.SessionHandler; import mage.client.preference.MagePreferences; -import mage.client.util.Config; +import mage.client.util.ClientDefaultSettings; import mage.client.util.gui.countryBox.CountryItemEditor; import mage.client.util.sets.ConstructedFormats; import mage.remote.Connection; @@ -59,9 +59,9 @@ public class ConnectDialog extends MageDialog { } public void showDialog() { - String serverAddress = MagePreferences.getServerAddressWithDefault(Config.serverName); + String serverAddress = MagePreferences.getServerAddressWithDefault(ClientDefaultSettings.serverName); this.txtServer.setText(serverAddress); - this.txtPort.setText(Integer.toString(MagePreferences.getServerPortWithDefault(Config.port))); + this.txtPort.setText(Integer.toString(MagePreferences.getServerPortWithDefault(ClientDefaultSettings.port))); this.txtUserName.setText(MagePreferences.getUserName(serverAddress)); this.txtPassword.setText(MagePreferences.getPassword(serverAddress)); this.chkAutoConnect.setSelected(Boolean.parseBoolean(MageFrame.getPreferences().get(KEY_CONNECT_AUTO_CONNECT, "false"))); @@ -512,9 +512,9 @@ public class ConnectDialog extends MageDialog { return; } // txtPassword is not checked here, because authentication might be disabled by the server config. - if (Integer.valueOf(txtPort.getText()) < 1 || Integer.valueOf(txtPort.getText()) > 65535) { + if (Integer.parseInt(txtPort.getText()) < 1 || Integer.parseInt(txtPort.getText()) > 65535) { JOptionPane.showMessageDialog(rootPane, "Invalid port number"); - txtPort.setText(Integer.toString(MagePreferences.getServerPortWithDefault(Config.port))); + txtPort.setText(Integer.toString(MagePreferences.getServerPortWithDefault(ClientDefaultSettings.port))); return; } @@ -522,7 +522,7 @@ public class ConnectDialog extends MageDialog { try { connection = new Connection(); connection.setHost(this.txtServer.getText().trim()); - connection.setPort(Integer.valueOf(this.txtPort.getText().trim())); + connection.setPort(Integer.parseInt(this.txtPort.getText().trim())); connection.setUsername(this.txtUserName.getText().trim()); connection.setPassword(String.valueOf(this.txtPassword.getPassword()).trim()); connection.setForceDBComparison(this.chkForceUpdateDB.isSelected() || RepositoryUtil.isDatabaseEmpty()); diff --git a/Mage.Client/src/main/java/mage/client/dialog/PreferencesDialog.java b/Mage.Client/src/main/java/mage/client/dialog/PreferencesDialog.java index 0f26b4f9da..94eb137e2a 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/PreferencesDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/PreferencesDialog.java @@ -4,7 +4,7 @@ import mage.client.MageFrame; import mage.client.SessionHandler; import mage.client.components.KeyBindButton; import mage.client.util.CardLanguage; -import mage.client.util.Config; +import mage.client.util.ClientDefaultSettings; import mage.client.util.GUISizeHelper; import mage.client.util.ImageHelper; import mage.client.util.gui.BufferedImageBuilder; @@ -3475,8 +3475,8 @@ public class PreferencesDialog extends javax.swing.JDialog { private static void loadProxySettings(Preferences prefs) { dialog.cbProxyType.setSelectedItem(Connection.ProxyType.valueOf(MageFrame.getPreferences().get(KEY_PROXY_TYPE, "NONE").toUpperCase(Locale.ENGLISH))); - load(prefs, dialog.txtProxyServer, KEY_PROXY_ADDRESS, Config.serverName); - load(prefs, dialog.txtProxyPort, KEY_PROXY_PORT, Integer.toString(Config.port)); + load(prefs, dialog.txtProxyServer, KEY_PROXY_ADDRESS, ClientDefaultSettings.serverName); + load(prefs, dialog.txtProxyPort, KEY_PROXY_PORT, Integer.toString(ClientDefaultSettings.port)); load(prefs, dialog.txtProxyUserName, KEY_PROXY_USERNAME, ""); load(prefs, dialog.rememberPswd, KEY_PROXY_REMEMBER, "true", "false"); if (dialog.rememberPswd.isSelected()) { diff --git a/Mage.Client/src/main/java/mage/client/game/BattlefieldPanel.java b/Mage.Client/src/main/java/mage/client/game/BattlefieldPanel.java index 5de8d21ac2..af839050f0 100644 --- a/Mage.Client/src/main/java/mage/client/game/BattlefieldPanel.java +++ b/Mage.Client/src/main/java/mage/client/game/BattlefieldPanel.java @@ -12,7 +12,7 @@ import mage.client.cards.Permanent; import mage.client.dialog.PreferencesDialog; import mage.client.plugins.impl.Plugins; - import mage.client.util.Config; + import mage.client.util.ClientDefaultSettings; import mage.client.util.GUISizeHelper; import mage.client.util.audio.AudioManager; import mage.client.util.layout.CardLayoutStrategy; @@ -226,7 +226,7 @@ private void addPermanent(PermanentView permanent, final int count) { if (cardDimension == null) { - cardDimension = new Dimension(Config.dimensions.getFrameWidth(), Config.dimensions.getFrameHeight()); + cardDimension = new Dimension(ClientDefaultSettings.dimensions.getFrameWidth(), ClientDefaultSettings.dimensions.getFrameHeight()); } final MagePermanent perm = Plugins.instance.getMagePermanent(permanent, bigCard, cardDimension, gameId, true, PreferencesDialog.getRenderMode(), true); diff --git a/Mage.Client/src/main/java/mage/client/plugins/impl/Plugins.java b/Mage.Client/src/main/java/mage/client/plugins/impl/Plugins.java index b4f849aacd..8c5d98e47b 100644 --- a/Mage.Client/src/main/java/mage/client/plugins/impl/Plugins.java +++ b/Mage.Client/src/main/java/mage/client/plugins/impl/Plugins.java @@ -10,7 +10,7 @@ import mage.client.cards.Permanent; import mage.client.dialog.PreferencesDialog; import mage.client.plugins.MagePlugins; import mage.client.plugins.adapters.MageActionCallback; -import mage.client.util.Config; +import mage.client.util.ClientDefaultSettings; import mage.interfaces.PluginException; import mage.interfaces.plugin.CardPlugin; import mage.interfaces.plugin.CounterPlugin; @@ -99,7 +99,7 @@ public enum Plugins implements MagePlugins { mageActionCallback.setCardPreviewComponent(bigCard); return cardPlugin.getMagePermanent(card, dimension, gameId, mageActionCallback, false, !MageFrame.isLite() && loadImage, renderMode, needFullPermanentRender); } else { - return new Permanent(card, bigCard, Config.dimensions, gameId); + return new Permanent(card, bigCard, ClientDefaultSettings.dimensions, gameId); } } @@ -112,7 +112,7 @@ public enum Plugins implements MagePlugins { } return cardPlugin.getMageCard(card, dimension, gameId, mageActionCallback, false, !MageFrame.isLite() && loadImage, renderMode, needFullPermanentRender); } else { - return new Card(card, bigCard, Config.dimensions, gameId); + return new Card(card, bigCard, ClientDefaultSettings.dimensions, gameId); } } diff --git a/Mage.Client/src/main/java/mage/client/preference/MagePreferences.java b/Mage.Client/src/main/java/mage/client/preference/MagePreferences.java index 37e84edc6d..d6cd584e42 100644 --- a/Mage.Client/src/main/java/mage/client/preference/MagePreferences.java +++ b/Mage.Client/src/main/java/mage/client/preference/MagePreferences.java @@ -2,7 +2,7 @@ package mage.client.preference; import com.google.common.collect.Sets; import mage.client.MageFrame; -import mage.client.util.Config; +import mage.client.util.ClientDefaultSettings; import java.util.Set; import java.util.prefs.BackingStoreException; @@ -144,8 +144,8 @@ public final class MagePreferences { } public static void saveLastServer() { - lastServerAddress = getServerAddressWithDefault(Config.serverName); - lastServerPort = getServerPortWithDefault(Config.port); + lastServerAddress = getServerAddressWithDefault(ClientDefaultSettings.serverName); + lastServerPort = getServerPortWithDefault(ClientDefaultSettings.port); lastServerUser = getUserName(lastServerAddress); lastServerPassword = getPassword(lastServerAddress); } 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 c735906900..6645b4ab16 100644 --- a/Mage.Client/src/main/java/mage/client/table/NewPlayerPanel.java +++ b/Mage.Client/src/main/java/mage/client/table/NewPlayerPanel.java @@ -9,14 +9,12 @@ package mage.client.table; import java.io.File; import java.io.IOException; -import java.util.Locale; import javax.swing.*; -import javax.swing.filechooser.FileFilter; import mage.cards.decks.DeckFileFilter; import mage.client.MageFrame; import mage.client.deck.generator.DeckGenerator; -import mage.client.util.Config; +import mage.client.util.ClientDefaultSettings; /** * @@ -36,14 +34,10 @@ public class NewPlayerPanel extends javax.swing.JPanel { fcSelectDeck.addChoosableFileFilter(new DeckFileFilter("dck", "XMage's deck files (*.dck)")); String deckPath = MageFrame.getPreferences().get("defaultDeckPath", ""); if (deckPath.isEmpty()) { - if (Config.defaultDeckPath != null) { - deckPath = Config.defaultDeckPath; - } + deckPath = ClientDefaultSettings.deckPath; } this.txtPlayerDeck.setText(deckPath); - if (Config.defaultComputerName != null) { - this.txtPlayerName.setText(Config.defaultComputerName); - } + this.txtPlayerName.setText(ClientDefaultSettings.computerName); } public void setPlayerName(String playerName) { 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 99d0dae109..ae68ccddd6 100644 --- a/Mage.Client/src/main/java/mage/client/table/TablePlayerPanel.java +++ b/Mage.Client/src/main/java/mage/client/table/TablePlayerPanel.java @@ -10,7 +10,7 @@ package mage.client.table; import mage.cards.decks.importer.DeckImporter; import mage.client.SessionHandler; -import mage.client.util.Config; +import mage.client.util.ClientDefaultSettings; import mage.client.util.Event; import mage.client.util.Listener; import mage.players.PlayerType; @@ -38,11 +38,11 @@ public class TablePlayerPanel extends javax.swing.JPanel { public void init(int playerNum, PlayerType playerType) { cbPlayerType.setModel(new DefaultComboBoxModel(SessionHandler.getPlayerTypes())); this.lblPlayerNum.setText("Player " + playerNum); - if (Config.defaultOtherPlayerIndex != null) { - if (Integer.valueOf(Config.defaultOtherPlayerIndex) >= cbPlayerType.getItemCount()) { + if (ClientDefaultSettings.otherPlayerIndex != null) { + Integer index = Integer.parseInt(ClientDefaultSettings.otherPlayerIndex); + if (index >= cbPlayerType.getItemCount()) { cbPlayerType.setSelectedIndex(cbPlayerType.getItemCount() - 1); } else { - Integer index = Integer.parseInt(Config.defaultOtherPlayerIndex); cbPlayerType.setSelectedIndex(index); } } diff --git a/Mage.Client/src/main/java/mage/client/unusedFiles/CombatGroup.java b/Mage.Client/src/main/java/mage/client/unusedFiles/CombatGroup.java index da6b77dae1..eb8cd77a44 100644 --- a/Mage.Client/src/main/java/mage/client/unusedFiles/CombatGroup.java +++ b/Mage.Client/src/main/java/mage/client/unusedFiles/CombatGroup.java @@ -10,7 +10,7 @@ package mage.client.unusedFiles; //package mage.client.game; import java.util.UUID; import mage.client.cards.BigCard; -import mage.client.util.Config; +import mage.client.util.ClientDefaultSettings; import mage.client.util.GUISizeHelper; import mage.view.CombatGroupView; @@ -61,9 +61,9 @@ public class CombatGroup extends javax.swing.JPanel { attackers = new mage.client.cards.Cards(); lblDefender = new javax.swing.JLabel(); - blockers.setPreferredSize(new java.awt.Dimension(Config.dimensions.getFrameWidth() + 8, Config.dimensions.getFrameHeight() + 25)); + blockers.setPreferredSize(new java.awt.Dimension(ClientDefaultSettings.dimensions.getFrameWidth() + 8, ClientDefaultSettings.dimensions.getFrameHeight() + 25)); - attackers.setPreferredSize(new java.awt.Dimension(Config.dimensions.getFrameWidth() + 8, Config.dimensions.getFrameHeight() + 25)); + attackers.setPreferredSize(new java.awt.Dimension(ClientDefaultSettings.dimensions.getFrameWidth() + 8, ClientDefaultSettings.dimensions.getFrameHeight() + 25)); lblDefender.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); lblDefender.setText("Defender"); diff --git a/Mage.Client/src/main/java/mage/client/util/ClientDefaultSettings.java b/Mage.Client/src/main/java/mage/client/util/ClientDefaultSettings.java new file mode 100644 index 0000000000..7d4d529516 --- /dev/null +++ b/Mage.Client/src/main/java/mage/client/util/ClientDefaultSettings.java @@ -0,0 +1,35 @@ +package mage.client.util; + +import mage.cards.CardDimensions; + +/** + * @author JayDi85 + */ +public final class ClientDefaultSettings { + + public static final String serverName; + public static final int port; + public static final double cardScalingFactor; + public static final double cardScalingFactorEnlarged; + public static final double handScalingFactor; + public static final CardDimensions dimensions; + public static final CardDimensions dimensionsEnlarged; + + public static final String deckPath; + public static final String otherPlayerIndex; + public static final String computerName; + + static { + // default values + serverName = "localhost"; + port = 17171; + cardScalingFactor = 0.4; + cardScalingFactorEnlarged = 0.5; + handScalingFactor = 1.3; + deckPath = ""; + otherPlayerIndex = "1"; // combobox default, example: 0: Human, 1: Computer - mad, 2: Computer - Draft Bot + computerName = "computer"; + dimensions = new CardDimensions(cardScalingFactor); + dimensionsEnlarged = new CardDimensions(cardScalingFactorEnlarged); + } +} diff --git a/Mage.Client/src/main/java/mage/client/util/Config.java b/Mage.Client/src/main/java/mage/client/util/Config.java deleted file mode 100644 index 459ee469b9..0000000000 --- a/Mage.Client/src/main/java/mage/client/util/Config.java +++ /dev/null @@ -1,73 +0,0 @@ -package mage.client.util; - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.util.Properties; -import mage.cards.CardDimensions; -import org.apache.log4j.Logger; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public final class Config { - - // TODO: Remove this class completely - private static final Logger logger = Logger.getLogger(Config.class); - - public static final String remoteServer; - public static final String serverName; - public static final int port; - public static final double cardScalingFactor; - public static final double cardScalingFactorEnlarged; - public static final double handScalingFactor; - public static final CardDimensions dimensions; - public static final CardDimensions dimensionsEnlarged; - - public static final String defaultGameType; - public static final String defaultDeckPath; - public static final String defaultOtherPlayerIndex; - public static final String defaultComputerName; - - static { - Properties p = new Properties(); - boolean fileFound = true; - try (FileInputStream fis = new FileInputStream(new File("config/config.properties"))) { - p.load(fis); - } catch (IOException ex) { - fileFound = false; - } - if (fileFound) { - serverName = p.getProperty("server-name"); - port = Integer.parseInt(p.getProperty("port")); - remoteServer = p.getProperty("remote-server"); - cardScalingFactor = Double.valueOf(p.getProperty("card-scaling-factor")); - cardScalingFactorEnlarged = Double.valueOf(p.getProperty("card-scaling-factor-enlarged")); - handScalingFactor = Double.valueOf(p.getProperty("hand-scaling-factor")); - defaultGameType = p.getProperty("default-game-type", "Human"); - defaultDeckPath = p.getProperty("default-deck-path"); - defaultOtherPlayerIndex = p.getProperty("default-other-player-index"); - defaultComputerName = p.getProperty("default-computer-name"); - - dimensions = new CardDimensions(cardScalingFactor); - dimensionsEnlarged = new CardDimensions(cardScalingFactorEnlarged); - } else { // Take some default valies for netbeans design view - serverName = "localhost"; - port = 17171; - remoteServer = "mage-server"; - cardScalingFactor = 0.4; - cardScalingFactorEnlarged = 0.5; - handScalingFactor = 1.3; - defaultGameType = p.getProperty("default-game-type", "Human"); - defaultDeckPath = ""; - defaultOtherPlayerIndex = "1"; - defaultComputerName = "AI Computer"; - - dimensions = new CardDimensions(cardScalingFactor); - dimensionsEnlarged = new CardDimensions(cardScalingFactorEnlarged); - } - - } - -} diff --git a/Mage.Client/src/main/java/mage/client/util/resources/config.properties b/Mage.Client/src/main/java/mage/client/util/resources/config.properties deleted file mode 100644 index b550d59982..0000000000 --- a/Mage.Client/src/main/java/mage/client/util/resources/config.properties +++ /dev/null @@ -1,7 +0,0 @@ -server-name=localhost -port=17171 -remote-server=mage-server -cards-resource-path=resources/images/cards/ -symbols-resource-path=resources/images/symbols/ -resource-path=resources/images/ -card-scaling-factor=0.4 \ No newline at end of file diff --git a/Mage.Server/release/readme.txt b/Mage.Server/release/readme.txt index 0299e81ada..5e9e90c4f9 100644 --- a/Mage.Server/release/readme.txt +++ b/Mage.Server/release/readme.txt @@ -17,7 +17,7 @@ Extact the client and the server to separate folders. To play a game you can either connect to a server or start your own server. To connect to a server you will need to know the server name or IP address and the port. To start a server run the startServer.bat command. If you want to use a different -port or change the timeout setting then modify the config.properties file in the +port or change the timeout setting then modify the config.xml file in the config folder. To launch the client run the startClient.bat command. Click on the connect button on