Merge branch 'master' into Network_Upgrade

Conflicts:
	Mage.Client/src/main/java/mage/client/chat/ChatPanel.java
	Mage.Client/src/main/java/mage/client/dialog/PreferencesDialog.java
	Mage.Client/src/main/java/mage/client/table/TablesPanel.java
	Mage.Common/src/mage/remote/SessionImpl.java
	Mage.Server/src/main/java/mage/server/Session.java
This commit is contained in:
betasteward 2015-06-20 23:00:34 -04:00
commit f4aff4a121
894 changed files with 23817 additions and 4981 deletions

View file

@ -835,14 +835,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
}
public void setUserPrefsToConnection(Connection connection) {
int avatarId = PreferencesDialog.getSelectedAvatar();
connection.setAvatarId(avatarId);
boolean showAbilityPickerForced = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_SHOW_ABILITY_PICKER_FORCED, "true").equals("true");
connection.setShowAbilityPickerForced(showAbilityPickerForced);
connection.setAllowRequestShowHandCards(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GAME_ALLOW_REQUEST_SHOW_HAND_CARDS, "true").equals("true"));
connection.setConfirmEmptyManaPool(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GAME_CONFIRM_EMPTY_MANA_POOL, "true").equals("true"));
connection.setUserSkipPrioritySteps(PreferencesDialog.getUserSkipPrioritySteps());
connection.setFlagName(MageFrame.getPreferences().get(KEY_CONNECT_FLAG, "world.png"));
connection.setUserData(PreferencesDialog.getUserData());
}
/**

View file

@ -96,7 +96,7 @@
<Component class="javax.swing.JTable" name="jTablePlayers">
<Properties>
<Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="this.tableModel" type="code"/>
<Connection code="this.userTableModel" type="code"/>
</Property>
<Property name="toolTipText" type="java.lang.String" value="Connected players"/>
<Property name="autoscrolls" type="boolean" value="false"/>

View file

@ -37,25 +37,20 @@ import java.awt.Color;
import java.awt.event.KeyEvent;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JTextField;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.JTableHeader;
import javax.swing.table.TableColumnModel;
import mage.client.MageFrame;
import mage.client.dialog.PreferencesDialog;
import static mage.client.dialog.PreferencesDialog.KEY_TABLES_COLUMNS_ORDER;
import static mage.client.dialog.PreferencesDialog.KEY_TABLES_COLUMNS_WIDTH;
import static mage.client.dialog.PreferencesDialog.KEY_USERS_COLUMNS_ORDER;
import static mage.client.dialog.PreferencesDialog.KEY_USERS_COLUMNS_WIDTH;
import mage.client.util.MageTableRowSorter;
import mage.client.util.gui.TableUtil;
import mage.client.util.audio.AudioManager;
import mage.client.util.gui.countryBox.CountryCellRenderer;
import mage.remote.MageRemoteException;
import mage.view.ChatMessage;
//import mage.remote.Session;
@ -63,7 +58,6 @@ import mage.view.ChatMessage.MessageColor;
import mage.view.ChatMessage.MessageType;
import mage.view.RoomUsersView;
import mage.view.UsersView;
import org.apache.log4j.Logger;
import org.mage.card.arcane.ManaSymbols;
import org.mage.network.Client;
@ -72,13 +66,11 @@ import org.mage.network.Client;
* @author BetaSteward_at_googlemail.com, nantuko
*/
public class ChatPanel extends javax.swing.JPanel {
private static final Logger logger = Logger.getLogger(ChatPanel.class);
private UUID chatId;
private Client client;
private final List<String> players = new ArrayList<>();
private final TableModel tableModel;
private final UserTableModel userTableModel;
/**
* Chat message color for opponents.
*/
@ -156,14 +148,15 @@ public class ChatPanel extends javax.swing.JPanel {
* @param addPlayersTab
*/
public ChatPanel(boolean addPlayersTab) {
tableModel = new TableModel();
userTableModel = new UserTableModel();
initComponents();
setBackground(new Color(0, 0, 0, ALPHA));
jTablePlayers.setBackground(new Color(0, 0, 0, ALPHA));
jTablePlayers.setForeground(Color.white);
jTablePlayers.setRowSorter(new MageTableRowSorter(tableModel));
jTablePlayers.setRowSorter(new MageTableRowSorter(userTableModel));
TableUtil.setColumnWidthAndOrder(jTablePlayers, defaultColumnsWidth, KEY_USERS_COLUMNS_WIDTH, KEY_USERS_COLUMNS_ORDER);
jTablePlayers.setDefaultRenderer(Icon.class, new CountryCellRenderer());
if (jScrollPaneTxt != null) {
jScrollPaneTxt.setBackground(new Color(0, 0, 0, ALPHA));
@ -387,13 +380,10 @@ public class ChatPanel extends javax.swing.JPanel {
return this.jSplitPane1.getDividerLocation();
}
class TableModel extends AbstractTableModel {
class UserTableModel extends AbstractTableModel {
private final String[] columnNames = new String[]{" ","Players", "Info", "Games", "Connection"};
private UsersView[] players = new UsersView[0];
private Map<String, ImageIcon> flagIconCache = new HashMap<>();
public void loadData(RoomUsersView roomUserInfo) throws MageRemoteException {
// RoomUsersView roomUserInfo = roomUserInfoList.iterator().next();
@ -401,8 +391,8 @@ public class ChatPanel extends javax.swing.JPanel {
JTableHeader th = jTablePlayers.getTableHeader();
TableColumnModel tcm = th.getColumnModel();
tcm.getColumn(1).setHeaderValue("Players (" + this.players.length + ")");
tcm.getColumn(3).setHeaderValue(
tcm.getColumn(jTablePlayers.convertColumnIndexToView(1)).setHeaderValue("Players (" + this.players.length + ")");
tcm.getColumn(jTablePlayers.convertColumnIndexToView(3)).setHeaderValue(
"Games " + roomUserInfo.getNumberActiveGames() +
(roomUserInfo.getNumberActiveGames() != roomUserInfo.getNumberGameThreads() ? " (T:" + roomUserInfo.getNumberGameThreads():" (") +
" limit: " + roomUserInfo.getNumberMaxGames() + ")");
@ -424,7 +414,7 @@ public class ChatPanel extends javax.swing.JPanel {
public Object getValueAt(int arg0, int arg1) {
switch (arg1) {
case 0:
return getCountryFlagIcon(players[arg0].getFlagName());
return players[arg0].getFlagName();
case 1:
return players[arg0].getUserName();
case 2:
@ -463,18 +453,7 @@ public class ChatPanel extends javax.swing.JPanel {
return false;
}
private ImageIcon getCountryFlagIcon(String countryCode) {
ImageIcon flagIcon = flagIconCache.get(countryCode);
if (flagIcon == null) {
flagIcon = new javax.swing.ImageIcon(getClass().getResource("/flags/" + countryCode +".png"));
if (flagIcon.getImage() == null) {
logger.warn("Country flag resource not found: " + countryCode);
} else {
flagIconCache.put(countryCode, flagIcon);
}
}
return flagIcon;
}
}
@ -516,7 +495,7 @@ public class ChatPanel extends javax.swing.JPanel {
jScrollPanePlayers.setBorder(null);
jTablePlayers.setModel(this.tableModel);
jTablePlayers.setModel(this.userTableModel);
jTablePlayers.setToolTipText("Connected players");
jTablePlayers.setAutoscrolls(false);
jTablePlayers.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
@ -584,7 +563,7 @@ public class ChatPanel extends javax.swing.JPanel {
public void setRoomUserInfo(RoomUsersView view) {
try {
tableModel.loadData(view);
userTableModel.loadData(view);
} catch (Exception ex) {
this.players.clear();
}

View file

@ -44,7 +44,7 @@ public class CollectionViewerPane extends MagePane {
public CollectionViewerPane() {
boolean initialized = false;
this.setTitle("Collection Viewier");
this.setTitle("Collection Viewer");
if (Plugins.getInstance().isThemePluginLoaded()) {
Map<String, JComponent> uiComponents = new HashMap<String, JComponent>();
JComponent container = Plugins.getInstance().updateTablePanel(uiComponents);

View file

@ -52,9 +52,9 @@
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel3" min="-2" pref="21" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel4" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="62" max="32767" attributes="0"/>
<EmptySpace pref="71" max="32767" attributes="0"/>
<Component id="btnOk" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
@ -82,17 +82,17 @@
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="text" type="java.lang.String" value="Courtesy: BetaSteward@googlemail.com. Site: http://XMage.info/"/>
<Property name="text" type="java.lang.String" value="Courtesy: BetaSteward@googlemail.com. Site: http://XMage.de/"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel3">
<Properties>
<Property name="text" type="java.lang.String" value="Devs: BetaSteward, Noxx, Eugen.Rivniy, North, LevelX2, Jeff, Plopman, dustinconrad, emerald000. "/>
<Property name="text" type="java.lang.String" value="Devs: BetaSteward, Noxx, Eugen.Rivniy, North, LevelX2, Jeff, Plopman, dustinconrad, emerald000.,"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel4">
<Properties>
<Property name="text" type="java.lang.String" value="Thanks: maurer.it, Rafbill, Alvin, cbt33, Quercitron."/>
<Property name="text" type="java.lang.String" value="fireshoes, lunaskyrise, mnapoleon, jgod, LoneFox."/>
</Properties>
</Component>
</SubComponents>

View file

@ -88,11 +88,11 @@ public class AboutDialog extends MageDialog {
lblVersion.setText("0.0.0");
jLabel2.setText("Courtesy: BetaSteward@googlemail.com. Site: http://XMage.info/");
jLabel2.setText("Courtesy: BetaSteward@googlemail.com. Site: http://XMage.de/");
jLabel3.setText("Devs: BetaSteward, Noxx, Eugen.Rivniy, North, LevelX2, Jeff, Plopman, dustinconrad, emerald000. ");
jLabel3.setText("Devs: BetaSteward, Noxx, Eugen.Rivniy, North, LevelX2, Jeff, Plopman, dustinconrad, emerald000.,");
jLabel4.setText("Thanks: maurer.it, Rafbill, Alvin, cbt33, Quercitron.");
jLabel4.setText("fireshoes, lunaskyrise, mnapoleon, jgod, LoneFox.");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
@ -122,9 +122,9 @@ public class AboutDialog extends MageDialog {
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 62, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 71, Short.MAX_VALUE)
.addComponent(btnOk)
.addContainerGap())
);

View file

@ -82,10 +82,10 @@
<EmptySpace max="-2" attributes="0"/>
<Component id="main_card" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="main_game" min="-2" max="-2" attributes="0"/>
<Component id="main_game" pref="189" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="main_gamelog" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="40" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@ -159,7 +159,7 @@
<Property name="toolTipText" type="java.lang.String" value=""/>
<Property name="actionCommand" type="java.lang.String" value=""/>
<Property name="cursor" type="java.awt.Cursor" editor="org.netbeans.modules.form.editors2.CursorEditor">
<Color id="Standardcursor"/>
<Color id="Default Cursor"/>
</Property>
</Properties>
<Events>
@ -173,7 +173,7 @@
<Property name="toolTipText" type="java.lang.String" value="Write the card&apos;s name on the card to make the card name more recognizable."/>
<Property name="actionCommand" type="java.lang.String" value=""/>
<Property name="cursor" type="java.awt.Cursor" editor="org.netbeans.modules.form.editors2.CursorEditor">
<Color id="Standardcursor"/>
<Color id="Default Cursor"/>
</Property>
</Properties>
<Events>
@ -201,23 +201,17 @@
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="cbAllowRequestToShowHandCards" min="-2" pref="546" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="103" groupAlignment="1" max="-2" attributes="0">
<Component id="showPlayerNamesPermanently" alignment="0" max="32767" attributes="0"/>
<Component id="nonLandPermanentsInOnePile" alignment="0" max="32767" attributes="0"/>
<Component id="showAbilityPickerForced" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="cbShowStormCounter" alignment="0" min="-2" pref="546" max="-2" attributes="0"/>
<Component id="cbConfirmEmptyManaPool" alignment="0" min="-2" pref="546" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<Component id="cbAllowRequestToShowHandCards" min="-2" pref="546" max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" max="-2" attributes="0">
<Component id="showPlayerNamesPermanently" alignment="0" max="32767" attributes="0"/>
<Component id="nonLandPermanentsInOnePile" alignment="0" max="32767" attributes="0"/>
<Component id="showAbilityPickerForced" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="cbShowStormCounter" alignment="0" min="-2" pref="546" max="-2" attributes="0"/>
<Component id="cbConfirmEmptyManaPool" alignment="0" min="-2" pref="546" max="-2" attributes="0"/>
<Component id="cbAskMoveToGraveOrder" alignment="0" min="-2" pref="546" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@ -235,6 +229,9 @@
<Component id="cbShowStormCounter" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="cbConfirmEmptyManaPool" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="cbAskMoveToGraveOrder" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@ -307,6 +304,17 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cbConfirmEmptyManaPoolActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JCheckBox" name="cbAskMoveToGraveOrder">
<Properties>
<Property name="selected" type="boolean" value="true"/>
<Property name="text" type="java.lang.String" value="Ask player for setting order cards go to graveyard"/>
<Property name="toolTipText" type="java.lang.String" value="&lt;html&gt;If activated and multiple cards go to the graveyard at the same time&lt;br&gt;&#xa;the player is asked to set the order of the cards."/>
<Property name="horizontalAlignment" type="int" value="2"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cbAskMoveToGraveOrderActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="main_gamelog">

View file

@ -66,6 +66,7 @@ import mage.client.util.gui.BufferedImageBuilder;
import mage.players.net.UserSkipPrioritySteps;
import mage.remote.Connection;
import mage.remote.Connection.ProxyType;
import mage.view.UserDataView;
import org.apache.log4j.Logger;
/**
@ -86,6 +87,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
public static final String KEY_GAME_ALLOW_REQUEST_SHOW_HAND_CARDS = "gameAllowRequestShowHandCards";
public static final String KEY_GAME_SHOW_STORM_COUNTER = "gameShowStormCounter";
public static final String KEY_GAME_CONFIRM_EMPTY_MANA_POOL = "gameConfirmEmptyManaPool";
public static final String KEY_GAME_ASK_MOVE_TO_GRAVE_ORDER = "gameAskMoveToGraveORder";
public static final String KEY_GAME_LOG_AUTO_SAVE = "gameLogAutoSave";
@ -346,6 +348,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
cbAllowRequestToShowHandCards = new javax.swing.JCheckBox();
cbShowStormCounter = new javax.swing.JCheckBox();
cbConfirmEmptyManaPool = new javax.swing.JCheckBox();
cbAskMoveToGraveOrder = new javax.swing.JCheckBox();
main_gamelog = new javax.swing.JPanel();
cbGameLogAutoSave = new javax.swing.JCheckBox();
tabPhases = new javax.swing.JPanel();
@ -570,6 +573,16 @@ public class PreferencesDialog extends javax.swing.JDialog {
}
});
cbAskMoveToGraveOrder.setSelected(true);
cbAskMoveToGraveOrder.setText("Ask player for setting order cards go to graveyard");
cbAskMoveToGraveOrder.setToolTipText("<html>If activated and multiple cards go to the graveyard at the same time<br>\nthe player is asked to set the order of the cards.");
cbAskMoveToGraveOrder.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
cbAskMoveToGraveOrder.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cbAskMoveToGraveOrderActionPerformed(evt);
}
});
javax.swing.GroupLayout main_gameLayout = new javax.swing.GroupLayout(main_game);
main_game.setLayout(main_gameLayout);
main_gameLayout.setHorizontalGroup(
@ -577,18 +590,15 @@ public class PreferencesDialog extends javax.swing.JDialog {
.addGroup(main_gameLayout.createSequentialGroup()
.addContainerGap()
.addGroup(main_gameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(main_gameLayout.createSequentialGroup()
.addComponent(cbAllowRequestToShowHandCards, javax.swing.GroupLayout.PREFERRED_SIZE, 546, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(main_gameLayout.createSequentialGroup()
.addGroup(main_gameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(main_gameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(showPlayerNamesPermanently, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(nonLandPermanentsInOnePile, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(showAbilityPickerForced, javax.swing.GroupLayout.Alignment.LEADING))
.addComponent(cbShowStormCounter, javax.swing.GroupLayout.PREFERRED_SIZE, 546, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(cbConfirmEmptyManaPool, javax.swing.GroupLayout.PREFERRED_SIZE, 546, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(0, 0, Short.MAX_VALUE))))
.addComponent(cbAllowRequestToShowHandCards, javax.swing.GroupLayout.PREFERRED_SIZE, 546, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(main_gameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(showPlayerNamesPermanently, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(nonLandPermanentsInOnePile, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(showAbilityPickerForced, javax.swing.GroupLayout.Alignment.LEADING))
.addComponent(cbShowStormCounter, javax.swing.GroupLayout.PREFERRED_SIZE, 546, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(cbConfirmEmptyManaPool, javax.swing.GroupLayout.PREFERRED_SIZE, 546, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(cbAskMoveToGraveOrder, javax.swing.GroupLayout.PREFERRED_SIZE, 546, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
main_gameLayout.setVerticalGroup(
main_gameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@ -603,7 +613,10 @@ public class PreferencesDialog extends javax.swing.JDialog {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(cbShowStormCounter)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(cbConfirmEmptyManaPool))
.addComponent(cbConfirmEmptyManaPool)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(cbAskMoveToGraveOrder)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
nonLandPermanentsInOnePile.getAccessibleContext().setAccessibleName("nonLandPermanentsInOnePile");
@ -651,10 +664,10 @@ public class PreferencesDialog extends javax.swing.JDialog {
.addContainerGap()
.addComponent(main_card, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(main_game, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(main_game, javax.swing.GroupLayout.PREFERRED_SIZE, 189, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(main_gamelog, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(40, Short.MAX_VALUE))
.addContainerGap())
);
main_card.getAccessibleContext().setAccessibleName("Game panel");
@ -1626,7 +1639,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(exitButton, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
.addComponent(tabsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 595, Short.MAX_VALUE)
.addComponent(tabsPanel)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@ -1655,6 +1668,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
save(prefs, dialog.cbAllowRequestToShowHandCards, KEY_GAME_ALLOW_REQUEST_SHOW_HAND_CARDS, "true", "false", UPDATE_CACHE_POLICY);
save(prefs, dialog.cbShowStormCounter, KEY_GAME_SHOW_STORM_COUNTER, "true", "false", UPDATE_CACHE_POLICY);
save(prefs, dialog.cbConfirmEmptyManaPool, KEY_GAME_CONFIRM_EMPTY_MANA_POOL, "true", "false", UPDATE_CACHE_POLICY);
save(prefs, dialog.cbAskMoveToGraveOrder, KEY_GAME_ASK_MOVE_TO_GRAVE_ORDER, "true", "false", UPDATE_CACHE_POLICY);
save(prefs, dialog.cbGameLogAutoSave, KEY_GAME_LOG_AUTO_SAVE, "true", "false", UPDATE_CACHE_POLICY);
// Phases
@ -1717,13 +1731,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
}
try {
MageFrame.getClient().updatePreferencesForServer(
getSelectedAvatar(),
dialog.showAbilityPickerForced.isSelected(),
dialog.cbAllowRequestToShowHandCards.isSelected(),
dialog.cbConfirmEmptyManaPool.isSelected(),
getUserSkipPrioritySteps(),
MageFrame.getPreferences().get(KEY_CONNECT_FLAG, "world.png"));
MageFrame.getClient().updatePreferencesForServer(getUserData());
prefs.flush();
} catch (BackingStoreException ex) {
@ -1978,6 +1986,10 @@ public class PreferencesDialog extends javax.swing.JDialog {
// TODO add your handling code here:
}//GEN-LAST:event_cbConfirmEmptyManaPoolActionPerformed
private void cbAskMoveToGraveOrderActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbAskMoveToGraveOrderActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_cbAskMoveToGraveOrderActionPerformed
private void showProxySettings() {
if (cbProxyType.getSelectedItem() == Connection.ProxyType.SOCKS) {
this.pnlProxy.setVisible(true);
@ -2055,6 +2067,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
load(prefs, dialog.cbAllowRequestToShowHandCards, KEY_GAME_ALLOW_REQUEST_SHOW_HAND_CARDS, "true");
load(prefs, dialog.cbShowStormCounter, KEY_GAME_SHOW_STORM_COUNTER, "true");
load(prefs, dialog.cbConfirmEmptyManaPool, KEY_GAME_CONFIRM_EMPTY_MANA_POOL, "true");
load(prefs, dialog.cbAskMoveToGraveOrder, KEY_GAME_ASK_MOVE_TO_GRAVE_ORDER, "true");
load(prefs, dialog.cbGameLogAutoSave, KEY_GAME_LOG_AUTO_SAVE, "true");
@ -2395,26 +2408,32 @@ public class PreferencesDialog extends javax.swing.JDialog {
public void mousePressed(MouseEvent e) {
if (selectedAvatarId != id) {
setSelectedId(id);
MageFrame.getClient().updatePreferencesForServer(
id,
PreferencesDialog.getCachedValue(PreferencesDialog.KEY_SHOW_TOOLTIPS_ANY_ZONE, "true").equals("true"),
PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GAME_ALLOW_REQUEST_SHOW_HAND_CARDS, "true").equals("true"),
PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GAME_CONFIRM_EMPTY_MANA_POOL, "true").equals("true"),
getUserSkipPrioritySteps(),
MageFrame.getPreferences().get(KEY_CONNECT_FLAG, "world.png")
);
MageFrame.getClient().updatePreferencesForServer(getUserData());
}
}
});
}
}
public static UserDataView getUserData(){
return new UserDataView(
getSelectedAvatar(),
PreferencesDialog.getCachedValue(PreferencesDialog.KEY_SHOW_TOOLTIPS_ANY_ZONE, "true").equals("true"),
PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GAME_ALLOW_REQUEST_SHOW_HAND_CARDS, "true").equals("true"),
PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GAME_CONFIRM_EMPTY_MANA_POOL, "true").equals("true"),
getUserSkipPrioritySteps(),
MageFrame.getPreferences().get(KEY_CONNECT_FLAG, "world"),
PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GAME_ASK_MOVE_TO_GRAVE_ORDER, "true").equals("true")
);
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnBattlefieldBGMBrowse;
private javax.swing.JButton btnBrowseBackgroundImage;
private javax.swing.JButton btnBrowseBattlefieldImage;
private javax.swing.JButton btnBrowseImageLocation;
private javax.swing.JCheckBox cbAllowRequestToShowHandCards;
private javax.swing.JCheckBox cbAskMoveToGraveOrder;
private javax.swing.JCheckBox cbCheckForNewImages;
private javax.swing.JCheckBox cbConfirmEmptyManaPool;
private javax.swing.JCheckBox cbEnableBattlefieldBGM;

View file

@ -569,8 +569,12 @@ public class PlayAreaPanel extends javax.swing.JPanel {
}
public void setMenuStates(boolean manaPoolAutomatic, boolean manaPoolAutomaticRestricted) {
manaPoolMenuItem1.setSelected(manaPoolAutomatic);
manaPoolMenuItem2.setSelected(manaPoolAutomaticRestricted);
if (manaPoolMenuItem1 != null) {
manaPoolMenuItem1.setSelected(manaPoolAutomatic);
}
if (manaPoolMenuItem2 != null) {
manaPoolMenuItem2.setSelected(manaPoolAutomaticRestricted);
}
}
private mage.client.game.BattlefieldPanel battlefieldPanel;

View file

@ -1148,7 +1148,8 @@ public class TablesPanel extends javax.swing.JPanel {
options.setMatchTimeLimit(MatchTimeLimit.NONE);
options.setFreeMulligans(2);
options.setSkillLevel(SkillLevel.CASUAL);
table = client.createTable(roomId, options);
options.setRollbackTurnsAllowed(true);
table = client.createTable(roomId, options);
client.joinTable(roomId, table.getTableId(), "Human", "Human", 1, DeckImporterUtil.importDeck("test.dck"),"");
client.joinTable(roomId, table.getTableId(), "Computer", "Computer - mad", 5, DeckImporterUtil.importDeck("test.dck"),"");

View file

@ -0,0 +1,80 @@
/*
* 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.gui.countryBox;
import java.awt.Component;
import java.util.HashMap;
import java.util.Map;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;
import org.apache.log4j.Logger;
/**
*
* @author LevelX2
*/
public class CountryCellRenderer extends DefaultTableCellRenderer {
private static final Logger logger = Logger.getLogger(CountryCellRenderer.class);
private final Map<String, ImageIcon> flagIconCache = new HashMap<>();
private final Map<String, String> countryMap = new HashMap<>();
public CountryCellRenderer() {
for( int i = 0; i <= CountryComboBox.countryList.length - 1; i++) {
countryMap.put(CountryComboBox.countryList[i][1],CountryComboBox.countryList[i][0]);
}
}
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
JLabel label = (JLabel)super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
if(table.convertColumnIndexToView(0) == column) {
label.setToolTipText(countryMap.get((String)value));
label.setIcon(getCountryFlagIcon((String)value));
label.setText("");
}
return label;
}
private ImageIcon getCountryFlagIcon(String countryCode) {
ImageIcon flagIcon = flagIconCache.get(countryCode);
if (flagIcon == null) {
flagIcon = new javax.swing.ImageIcon(getClass().getResource("/flags/" + countryCode + (countryCode.endsWith(".png") ? "" :".png")));
if (flagIcon.getImage() == null) {
logger.warn("Country flag resource not found: " + countryCode);
} else {
flagIconCache.put(countryCode, flagIcon);
}
}
return flagIcon;
}
}

View file

@ -29,7 +29,7 @@ public class ConstructedFormats {
public static final String MODERN = "- Modern";
private static final Map<String, List<String>> underlyingSetCodesPerFormat = new HashMap<>();
private static final List<String> formats = new ArrayList<String>();
private static final List<String> formats = new ArrayList<>();
private ConstructedFormats() {
}
@ -59,7 +59,7 @@ public class ConstructedFormats {
else {
cutoff = new GregorianCalendar(calendar.get(Calendar.YEAR) - 2, Calendar.SEPTEMBER, 1);
}
final Map<String, ExpansionInfo> expansionInfo = new HashMap<String, ExpansionInfo>();
final Map<String, ExpansionInfo> expansionInfo = new HashMap<>();
for (ExpansionInfo set : ExpansionRepository.instance.getAll()) {
expansionInfo.put(set.getName(), set);
formats.add(set.getName());

View file

@ -27,11 +27,11 @@ import org.mage.plugins.card.utils.CardImageUtils;
* This class stores ALL card images in a cache with soft values. this means
* that the images may be garbage collected when they are not needed any more, but will
* be kept as long as possible.
*
*
* Key format: "<cardname>#<setname>#<type>#<collectorID>#<param>"
*
*
* where param is:
*
*
* <ul>
* <li>#Normal: request for unrotated image</li>
* <li>#Tapped: request for rotated image</li>
@ -56,7 +56,7 @@ public class ImageCache {
@Override
public BufferedImage apply(String key) {
try {
boolean usesVariousArt = false;
if (key.endsWith("#usesVariousArt")) {
usesVariousArt = true;
@ -111,7 +111,7 @@ public class ImageCache {
} catch(Exception ex) {
exists = false;
}
}
}
if (exists) {
log.debug("loading thumbnail for " + key + ", path="+thumbnailPath);
return loadImage(thumbnailFile);
@ -150,7 +150,7 @@ public class ImageCache {
return null;
}
TFile file = getTFile(path);
return loadImage(file);
return loadImage(file);
}
public static BufferedImage getManifestImage() {
@ -159,7 +159,7 @@ public class ImageCache {
String path = CardImageUtils.generateTokenImagePath(info);
if (path == null) {
return null;
}
}
TFile file = getTFile(path);
return loadImage(file);
}
@ -219,7 +219,7 @@ public class ImageCache {
private static BufferedImage getImage(String key) {
try {
BufferedImage image = imageCache.get(key);
return image;
return image;
} catch (NullPointerException ex) {
// unfortunately NullOutputException, thrown when apply() returns
// null, is not public
@ -261,7 +261,7 @@ public class ImageCache {
/**
* Load image from file
*
*
* @param file
* file to load image from
* @return {@link BufferedImage}
@ -298,6 +298,7 @@ public class ImageCache {
}
} catch (IOException e) {
log.error(e,e);
imageFile.delete();
}
return image;
}
@ -382,7 +383,7 @@ public class ImageCache {
return getFullSizeImage(original, scale);
}
public static TFile getTFile(String path) {
try {
TFile file = new TFile(path);
@ -390,6 +391,6 @@ public class ImageCache {
} catch (NullPointerException ex) {
log.warn("Imagefile does not exist: " + path);
}
return null;
return null;
}
}

View file

@ -64,6 +64,6 @@ ddd=gvl
unh=uh
dde=pvc
# Remove setname as soon as the images can be downloaded
ignore.urls=TOK,MMB,ORI
ignore.urls=TOK,MMB
# sets ordered by release time (newest goes first)
token.lookup.order=TPR,MPRP,DD3,DDO,ORI,MMB,PTC,DTK,FRF,KTK,M15,VMA,CNS,JOU,BNG,THS,DDL,M14,MMA,DGM,GTC,RTR,M13,AVR,DDI,DKA,ISD,M12,NPH,MBS,SOM,M11,ROE,DDE,WWK,ZEN,M10,GVL,ARB,DVD,CFX,JVC,ALA,EVE,SHM,EVG,MOR,LRW,10E,CLS,CHK,GRC