Added option to deactivate to ask th eplayer in which order cards go to gaveyard.

This commit is contained in:
LevelX2 2015-06-13 12:27:50 +02:00
parent 0f37d0fcd0
commit ce26bc8ed0
12 changed files with 127 additions and 129 deletions

View file

@ -739,14 +739,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
} }
public void setUserPrefsToConnection(Connection connection) { public void setUserPrefsToConnection(Connection connection) {
int avatarId = PreferencesDialog.getSelectedAvatar(); connection.setUserData(PreferencesDialog.getUserData());
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"));
} }
/** /**

View file

@ -82,10 +82,10 @@
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="main_card" min="-2" max="-2" attributes="0"/> <Component id="main_card" min="-2" max="-2" attributes="0"/>
<EmptySpace 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"/> <EmptySpace max="-2" attributes="0"/>
<Component id="main_gamelog" min="-2" 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>
</Group> </Group>
</DimensionLayout> </DimensionLayout>
@ -201,12 +201,7 @@
<Group type="102" attributes="0"> <Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" 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"/> <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"> <Group type="103" groupAlignment="1" max="-2" attributes="0">
<Component id="showPlayerNamesPermanently" alignment="0" max="32767" attributes="0"/> <Component id="showPlayerNamesPermanently" alignment="0" max="32767" attributes="0"/>
<Component id="nonLandPermanentsInOnePile" alignment="0" max="32767" attributes="0"/> <Component id="nonLandPermanentsInOnePile" alignment="0" max="32767" attributes="0"/>
@ -214,10 +209,9 @@
</Group> </Group>
<Component id="cbShowStormCounter" alignment="0" min="-2" pref="546" max="-2" attributes="0"/> <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="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> </Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/> <EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</Group> </Group>
</Group> </Group>
</DimensionLayout> </DimensionLayout>
@ -235,6 +229,9 @@
<Component id="cbShowStormCounter" min="-2" max="-2" attributes="0"/> <Component id="cbShowStormCounter" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="cbConfirmEmptyManaPool" min="-2" 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>
</Group> </Group>
</DimensionLayout> </DimensionLayout>
@ -307,6 +304,17 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cbConfirmEmptyManaPoolActionPerformed"/> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cbConfirmEmptyManaPoolActionPerformed"/>
</Events> </Events>
</Component> </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> </SubComponents>
</Container> </Container>
<Container class="javax.swing.JPanel" name="main_gamelog"> <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.players.net.UserSkipPrioritySteps;
import mage.remote.Connection; import mage.remote.Connection;
import mage.remote.Connection.ProxyType; import mage.remote.Connection.ProxyType;
import mage.view.UserDataView;
import org.apache.log4j.Logger; 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_ALLOW_REQUEST_SHOW_HAND_CARDS = "gameAllowRequestShowHandCards";
public static final String KEY_GAME_SHOW_STORM_COUNTER = "gameShowStormCounter"; 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_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"; 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(); cbAllowRequestToShowHandCards = new javax.swing.JCheckBox();
cbShowStormCounter = new javax.swing.JCheckBox(); cbShowStormCounter = new javax.swing.JCheckBox();
cbConfirmEmptyManaPool = new javax.swing.JCheckBox(); cbConfirmEmptyManaPool = new javax.swing.JCheckBox();
cbAskMoveToGraveOrder = new javax.swing.JCheckBox();
main_gamelog = new javax.swing.JPanel(); main_gamelog = new javax.swing.JPanel();
cbGameLogAutoSave = new javax.swing.JCheckBox(); cbGameLogAutoSave = new javax.swing.JCheckBox();
tabPhases = new javax.swing.JPanel(); 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); javax.swing.GroupLayout main_gameLayout = new javax.swing.GroupLayout(main_game);
main_game.setLayout(main_gameLayout); main_game.setLayout(main_gameLayout);
main_gameLayout.setHorizontalGroup( main_gameLayout.setHorizontalGroup(
@ -577,18 +590,15 @@ public class PreferencesDialog extends javax.swing.JDialog {
.addGroup(main_gameLayout.createSequentialGroup() .addGroup(main_gameLayout.createSequentialGroup()
.addContainerGap() .addContainerGap()
.addGroup(main_gameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .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) .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) .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(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(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(showAbilityPickerForced, javax.swing.GroupLayout.Alignment.LEADING))
.addComponent(cbShowStormCounter, javax.swing.GroupLayout.PREFERRED_SIZE, 546, javax.swing.GroupLayout.PREFERRED_SIZE) .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(cbConfirmEmptyManaPool, javax.swing.GroupLayout.PREFERRED_SIZE, 546, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE)))) .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.setVerticalGroup(
main_gameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 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) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(cbShowStormCounter) .addComponent(cbShowStormCounter)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .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"); nonLandPermanentsInOnePile.getAccessibleContext().setAccessibleName("nonLandPermanentsInOnePile");
@ -651,10 +664,10 @@ public class PreferencesDialog extends javax.swing.JDialog {
.addContainerGap() .addContainerGap()
.addComponent(main_card, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(main_card, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .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) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(main_gamelog, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .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"); main_card.getAccessibleContext().setAccessibleName("Game panel");
@ -1626,7 +1639,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(exitButton, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(exitButton, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap()) .addContainerGap())
.addComponent(tabsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 595, Short.MAX_VALUE) .addComponent(tabsPanel)
); );
layout.setVerticalGroup( layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 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.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.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.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); save(prefs, dialog.cbGameLogAutoSave, KEY_GAME_LOG_AUTO_SAVE, "true", "false", UPDATE_CACHE_POLICY);
// Phases // Phases
@ -1717,13 +1731,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
} }
try { try {
MageFrame.getSession().updatePreferencesForServer( MageFrame.getSession().updatePreferencesForServer(getUserData());
getSelectedAvatar(),
dialog.showAbilityPickerForced.isSelected(),
dialog.cbAllowRequestToShowHandCards.isSelected(),
dialog.cbConfirmEmptyManaPool.isSelected(),
getUserSkipPrioritySteps(),
MageFrame.getPreferences().get(KEY_CONNECT_FLAG, "world.png"));
prefs.flush(); prefs.flush();
} catch (BackingStoreException ex) { } catch (BackingStoreException ex) {
@ -1978,6 +1986,10 @@ public class PreferencesDialog extends javax.swing.JDialog {
// TODO add your handling code here: // TODO add your handling code here:
}//GEN-LAST:event_cbConfirmEmptyManaPoolActionPerformed }//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() { private void showProxySettings() {
if (cbProxyType.getSelectedItem() == Connection.ProxyType.SOCKS) { if (cbProxyType.getSelectedItem() == Connection.ProxyType.SOCKS) {
this.pnlProxy.setVisible(true); 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.cbAllowRequestToShowHandCards, KEY_GAME_ALLOW_REQUEST_SHOW_HAND_CARDS, "true");
load(prefs, dialog.cbShowStormCounter, KEY_GAME_SHOW_STORM_COUNTER, "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.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"); 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) { public void mousePressed(MouseEvent e) {
if (selectedAvatarId != id) { if (selectedAvatarId != id) {
setSelectedId(id); setSelectedId(id);
MageFrame.getSession().updatePreferencesForServer( MageFrame.getSession().updatePreferencesForServer(getUserData());
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")
);
} }
} }
}); });
} }
} }
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.png"),
PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GAME_ASK_MOVE_TO_GRAVE_ORDER, "true").equals("true")
);
}
// Variables declaration - do not modify//GEN-BEGIN:variables // Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnBattlefieldBGMBrowse; private javax.swing.JButton btnBattlefieldBGMBrowse;
private javax.swing.JButton btnBrowseBackgroundImage; private javax.swing.JButton btnBrowseBackgroundImage;
private javax.swing.JButton btnBrowseBattlefieldImage; private javax.swing.JButton btnBrowseBattlefieldImage;
private javax.swing.JButton btnBrowseImageLocation; private javax.swing.JButton btnBrowseImageLocation;
private javax.swing.JCheckBox cbAllowRequestToShowHandCards; private javax.swing.JCheckBox cbAllowRequestToShowHandCards;
private javax.swing.JCheckBox cbAskMoveToGraveOrder;
private javax.swing.JCheckBox cbCheckForNewImages; private javax.swing.JCheckBox cbCheckForNewImages;
private javax.swing.JCheckBox cbConfirmEmptyManaPool; private javax.swing.JCheckBox cbConfirmEmptyManaPool;
private javax.swing.JCheckBox cbEnableBattlefieldBGM; private javax.swing.JCheckBox cbEnableBattlefieldBGM;

View file

@ -35,6 +35,7 @@ import java.net.NetworkInterface;
import java.net.SocketException; import java.net.SocketException;
import java.util.Enumeration; import java.util.Enumeration;
import mage.players.net.UserSkipPrioritySteps; import mage.players.net.UserSkipPrioritySteps;
import mage.view.UserDataView;
/** /**
* *
@ -54,12 +55,14 @@ public class Connection {
private int clientCardDatabaseVersion; private int clientCardDatabaseVersion;
private boolean forceDBComparison; private boolean forceDBComparison;
private int avatarId; private UserDataView userData;
private boolean showAbilityPickerForced;
private boolean allowRequestShowHandCards; // private int avatarId;
private boolean confirmEmptyManaPool; // private boolean showAbilityPickerForced;
private String flagName; // private boolean allowRequestShowHandCards;
private UserSkipPrioritySteps userSkipPrioritySteps; // private boolean confirmEmptyManaPool;
// private String flagName;
// private UserSkipPrioritySteps userSkipPrioritySteps;
private static final String serialization = "?serializationtype=jboss"; private static final String serialization = "?serializationtype=jboss";
private static final String transport = "bisocket"; private static final String transport = "bisocket";
@ -221,45 +224,12 @@ public class Connection {
return null; return null;
} }
public int getAvatarId() { public void setUserData(UserDataView userData) {
return avatarId; this.userData= userData;
} }
public void setAvatarId(int avatarId) { public UserDataView getUserData() {
this.avatarId = avatarId; return userData;
}
public boolean isShowAbilityPickerForced() {
return showAbilityPickerForced;
}
public void setShowAbilityPickerForced(boolean showAbilityPickerForced) {
this.showAbilityPickerForced = showAbilityPickerForced;
}
public boolean allowRequestShowHandCards() {
return allowRequestShowHandCards;
}
public void setAllowRequestShowHandCards(boolean allowRequestShowHandCards) {
this.allowRequestShowHandCards = allowRequestShowHandCards;
}
public boolean confirmEmptyManaPool() {
return confirmEmptyManaPool;
}
public void setConfirmEmptyManaPool(boolean confirmEmptyManaPool) {
this.confirmEmptyManaPool = confirmEmptyManaPool;
}
public UserSkipPrioritySteps getUserSkipPrioritySteps() {
return userSkipPrioritySteps;
}
public void setUserSkipPrioritySteps(UserSkipPrioritySteps userSkipPrioritySteps) {
this.userSkipPrioritySteps = userSkipPrioritySteps;
} }
public boolean isForceDBComparison() { public boolean isForceDBComparison() {
@ -269,13 +239,4 @@ public class Connection {
public void setForceDBComparison(boolean forceDBComparison) { public void setForceDBComparison(boolean forceDBComparison) {
this.forceDBComparison = forceDBComparison; this.forceDBComparison = forceDBComparison;
} }
public String getFlagName() {
return flagName;
}
public void setFlagName(String flagName) {
this.flagName = flagName;
}
} }

View file

@ -275,16 +275,10 @@ public class SessionImpl implements Session {
this.sessionId = callbackClient.getSessionId(); this.sessionId = callbackClient.getSessionId();
boolean registerResult; boolean registerResult;
if (connection.getPassword() == null) { if (connection.getPassword() == null) {
UserDataView userDataView = new UserDataView(connection.getAvatarId(),
connection.isShowAbilityPickerForced(),
connection.allowRequestShowHandCards(),
connection.confirmEmptyManaPool(),
connection.getUserSkipPrioritySteps(),
connection.getFlagName());
// for backward compatibility. don't remove twice call - first one does nothing but for version checking // for backward compatibility. don't remove twice call - first one does nothing but for version checking
registerResult = server.registerClient(connection.getUsername(), sessionId, client.getVersion()); registerResult = server.registerClient(connection.getUsername(), sessionId, client.getVersion());
if (registerResult) { if (registerResult) {
server.setUserData(connection.getUsername(), sessionId, userDataView); server.setUserData(connection.getUsername(), sessionId, connection.getUserData());
} }
} else { } else {
registerResult = server.registerAdmin(connection.getPassword(), sessionId, client.getVersion()); registerResult = server.registerAdmin(connection.getPassword(), sessionId, client.getVersion());
@ -1397,11 +1391,10 @@ public class SessionImpl implements Session {
} }
@Override @Override
public boolean updatePreferencesForServer(int avatarId, boolean showAbilityPickerForced, boolean allowRequestShowHandCards, boolean confirmEmptyManaPool, UserSkipPrioritySteps userSkipPrioritySteps, String flagName) { public boolean updatePreferencesForServer(UserDataView userData) {
try { try {
if (isConnected()) { if (isConnected()) {
UserDataView userDataView = new UserDataView(avatarId, showAbilityPickerForced, allowRequestShowHandCards, confirmEmptyManaPool, userSkipPrioritySteps, flagName); server.setUserData(connection.getUsername(), sessionId, userData);
server.setUserData(connection.getUsername(), sessionId, userDataView);
} }
return true; return true;
} catch (MageException ex) { } catch (MageException ex) {

View file

@ -27,7 +27,7 @@
*/ */
package mage.remote.interfaces; package mage.remote.interfaces;
import mage.players.net.UserSkipPrioritySteps; import mage.view.UserDataView;
/** /**
* @author noxx * @author noxx
@ -36,5 +36,5 @@ public interface ClientData {
String getUserName(); String getUserName();
boolean updatePreferencesForServer(int avatarId, boolean showAbilityPickerForced, boolean allowRequestShowHandCards, boolean confirmEmptyManaPool, UserSkipPrioritySteps userSkipPrioritySteps, String flagName); boolean updatePreferencesForServer(UserDataView userData);
} }

View file

@ -115,7 +115,7 @@ public class PlayerView implements Serializable {
if (player.getUserData() != null) { if (player.getUserData() != null) {
this.userDataView = new UserDataView(player.getUserData()); this.userDataView = new UserDataView(player.getUserData());
} else { } else {
this.userDataView = new UserDataView(0, false, false, true, null,"world.png"); this.userDataView = UserDataView.getDefaultUserDataView();
} }
for (CommandObject commandObject : game.getState().getCommand()) { for (CommandObject commandObject : game.getState().getCommand()) {

View file

@ -18,15 +18,22 @@ public class UserDataView implements Serializable {
protected boolean confirmEmptyManaPool; protected boolean confirmEmptyManaPool;
protected UserSkipPrioritySteps userSkipPrioritySteps; protected UserSkipPrioritySteps userSkipPrioritySteps;
String flagName; String flagName;
protected boolean askMoveToGraveOrder;
static UserDataView getDefaultUserDataView() {
return new UserDataView(0, false, false, true, null,"world.png", false);
}
public UserDataView(int avatarId, boolean showAbilityPickerForced, boolean allowRequestShowHandCards, public UserDataView(int avatarId, boolean showAbilityPickerForced, boolean allowRequestShowHandCards,
boolean confirmEmptyManaPool, UserSkipPrioritySteps userSkipPrioritySteps, String flagName) { boolean confirmEmptyManaPool, UserSkipPrioritySteps userSkipPrioritySteps, String flagName, boolean askMoveToGraveOrder) {
this.avatarId = avatarId; this.avatarId = avatarId;
this.showAbilityPickerForced = showAbilityPickerForced; this.showAbilityPickerForced = showAbilityPickerForced;
this.allowRequestShowHandCards = allowRequestShowHandCards; this.allowRequestShowHandCards = allowRequestShowHandCards;
this.userSkipPrioritySteps = userSkipPrioritySteps; this.userSkipPrioritySteps = userSkipPrioritySteps;
this.confirmEmptyManaPool = confirmEmptyManaPool; this.confirmEmptyManaPool = confirmEmptyManaPool;
this.flagName = flagName; this.flagName = flagName;
this.askMoveToGraveOrder = askMoveToGraveOrder;
} }
public UserDataView(UserData userData) { public UserDataView(UserData userData) {
@ -37,6 +44,7 @@ public class UserDataView implements Serializable {
this.userSkipPrioritySteps = userData.getUserSkipPrioritySteps(); this.userSkipPrioritySteps = userData.getUserSkipPrioritySteps();
this.confirmEmptyManaPool = userData.confirmEmptyManaPool(); this.confirmEmptyManaPool = userData.confirmEmptyManaPool();
this.flagName = userData.getFlagName(); this.flagName = userData.getFlagName();
this.askMoveToGraveOrder = userData.askMoveToGraveOrder();
} }
public int getAvatarId() { public int getAvatarId() {
@ -63,4 +71,8 @@ public class UserDataView implements Serializable {
return flagName; return flagName;
} }
public boolean askMoveToGraveOrder() {
return askMoveToGraveOrder;
}
} }

View file

@ -175,7 +175,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
public ComputerPlayer(String name, RangeOfInfluence range) { public ComputerPlayer(String name, RangeOfInfluence range) {
super(name, range); super(name, range);
human = false; human = false;
userData = new UserData(UserGroup.COMPUTER, 64, false, true, false, null, "Computer.png"); userData = new UserData(UserGroup.COMPUTER, 64, false, true, false, null, "Computer.png", false);
pickedCards = new ArrayList<>(); pickedCards = new ArrayList<>();
} }

View file

@ -142,7 +142,7 @@ public class Session {
if (user == null) { if (user == null) {
user = UserManager.getInstance().findUser("Admin"); user = UserManager.getInstance().findUser("Admin");
} }
user.setUserData(new UserData(UserGroup.ADMIN, 0, false, false, false, null, "world.png")); user.setUserData(new UserData(UserGroup.ADMIN, 0, false, false, false, null, "world.png", false));
if (!UserManager.getInstance().connectToSession(sessionId, user.getId())) { if (!UserManager.getInstance().connectToSession(sessionId, user.getId())) {
logger.info("Error connecting Admin!"); logger.info("Error connecting Admin!");
} }
@ -157,7 +157,7 @@ public class Session {
userData = new UserData(UserGroup.PLAYER, userDataView.getAvatarId(), userData = new UserData(UserGroup.PLAYER, userDataView.getAvatarId(),
userDataView.isShowAbilityPickerForced(), userDataView.allowRequestShowHandCards(), userDataView.isShowAbilityPickerForced(), userDataView.allowRequestShowHandCards(),
userDataView.confirmEmptyManaPool(), userDataView.getUserSkipPrioritySteps(), userDataView.confirmEmptyManaPool(), userDataView.getUserSkipPrioritySteps(),
userDataView.getFlagName()); userDataView.getFlagName(), userDataView.askMoveToGraveOrder());
user.setUserData(userData); user.setUserData(userData);
} else { } else {
if (userDataView.getAvatarId() == 51) { // Update special avatar if first avatar is selected if (userDataView.getAvatarId() == 51) { // Update special avatar if first avatar is selected
@ -168,6 +168,7 @@ public class Session {
userData.setAllowRequestShowHandCards(userDataView.allowRequestShowHandCards()); userData.setAllowRequestShowHandCards(userDataView.allowRequestShowHandCards());
userData.setUserSkipPrioritySteps(userDataView.getUserSkipPrioritySteps()); userData.setUserSkipPrioritySteps(userDataView.getUserSkipPrioritySteps());
userData.setConfirmEmptyManaPool(userDataView.confirmEmptyManaPool()); userData.setConfirmEmptyManaPool(userDataView.confirmEmptyManaPool());
userData.setAskMoveToGraveOrder(userDataView.askMoveToGraveOrder());
} }
return true; return true;
} }

View file

@ -2936,10 +2936,12 @@ public abstract class PlayerImpl implements Player, Serializable {
if (choosingPlayer == null) { if (choosingPlayer == null) {
continue; continue;
} }
boolean chooseOrder = true; boolean chooseOrder = false;
if (cards.size() > 2) { if (userData.askMoveToGraveOrder()) {
if (cards.size() > 3) {
chooseOrder = choosingPlayer.chooseUse(Outcome.Neutral, "Would you like to choose the order the cards go to graveyard?", game); chooseOrder = choosingPlayer.chooseUse(Outcome.Neutral, "Would you like to choose the order the cards go to graveyard?", game);
} }
}
if (chooseOrder) { if (chooseOrder) {
TargetCard target = new TargetCard(fromZone, new FilterCard("card to put on the top of your graveyard (last one chosen will be topmost)")); TargetCard target = new TargetCard(fromZone, new FilterCard("card to put on the top of your graveyard (last one chosen will be topmost)"));
target.setRequired(true); target.setRequired(true);

View file

@ -16,10 +16,11 @@ public class UserData implements Serializable {
protected boolean confirmEmptyManaPool; protected boolean confirmEmptyManaPool;
protected UserSkipPrioritySteps userSkipPrioritySteps; protected UserSkipPrioritySteps userSkipPrioritySteps;
protected String flagName; protected String flagName;
protected boolean askMoveToGraveOrder;
public UserData(UserGroup userGroup, int avatarId, boolean showAbilityPickerForced, public UserData(UserGroup userGroup, int avatarId, boolean showAbilityPickerForced,
boolean allowRequestShowHandCards, boolean confirmEmptyManaPool, UserSkipPrioritySteps userSkipPrioritySteps, boolean allowRequestShowHandCards, boolean confirmEmptyManaPool, UserSkipPrioritySteps userSkipPrioritySteps,
String flagName) { String flagName, boolean askMoveToGraveOrder) {
this.groupId = userGroup.getGroupId(); this.groupId = userGroup.getGroupId();
this.avatarId = avatarId; this.avatarId = avatarId;
this.showAbilityPickerForced = showAbilityPickerForced; this.showAbilityPickerForced = showAbilityPickerForced;
@ -85,4 +86,12 @@ public class UserData implements Serializable {
return flagName; return flagName;
} }
public boolean askMoveToGraveOrder() {
return askMoveToGraveOrder;
}
public void setAskMoveToGraveOrder(boolean askMoveToGraveOrder) {
this.askMoveToGraveOrder = askMoveToGraveOrder;
}
} }