mirror of
https://github.com/correl/mage.git
synced 2024-12-01 03:00:09 +00:00
Added option to deactivate to ask th eplayer in which order cards go to gaveyard.
This commit is contained in:
parent
0f37d0fcd0
commit
ce26bc8ed0
12 changed files with 127 additions and 129 deletions
|
@ -739,14 +739,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());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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>
|
||||
|
@ -201,12 +201,7 @@
|
|||
<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"/>
|
||||
|
@ -214,10 +209,9 @@
|
|||
</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 min="0" pref="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</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="<html>If activated and multiple cards go to the graveyard at the same time<br>
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">
|
||||
|
|
|
@ -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(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.getSession().updatePreferencesForServer(
|
||||
getSelectedAvatar(),
|
||||
dialog.showAbilityPickerForced.isSelected(),
|
||||
dialog.cbAllowRequestToShowHandCards.isSelected(),
|
||||
dialog.cbConfirmEmptyManaPool.isSelected(),
|
||||
getUserSkipPrioritySteps(),
|
||||
MageFrame.getPreferences().get(KEY_CONNECT_FLAG, "world.png"));
|
||||
MageFrame.getSession().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.getSession().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.getSession().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.png"),
|
||||
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;
|
||||
|
|
|
@ -35,6 +35,7 @@ import java.net.NetworkInterface;
|
|||
import java.net.SocketException;
|
||||
import java.util.Enumeration;
|
||||
import mage.players.net.UserSkipPrioritySteps;
|
||||
import mage.view.UserDataView;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -54,12 +55,14 @@ public class Connection {
|
|||
private int clientCardDatabaseVersion;
|
||||
private boolean forceDBComparison;
|
||||
|
||||
private int avatarId;
|
||||
private boolean showAbilityPickerForced;
|
||||
private boolean allowRequestShowHandCards;
|
||||
private boolean confirmEmptyManaPool;
|
||||
private String flagName;
|
||||
private UserSkipPrioritySteps userSkipPrioritySteps;
|
||||
private UserDataView userData;
|
||||
|
||||
// private int avatarId;
|
||||
// private boolean showAbilityPickerForced;
|
||||
// private boolean allowRequestShowHandCards;
|
||||
// private boolean confirmEmptyManaPool;
|
||||
// private String flagName;
|
||||
// private UserSkipPrioritySteps userSkipPrioritySteps;
|
||||
|
||||
private static final String serialization = "?serializationtype=jboss";
|
||||
private static final String transport = "bisocket";
|
||||
|
@ -221,45 +224,12 @@ public class Connection {
|
|||
return null;
|
||||
}
|
||||
|
||||
public int getAvatarId() {
|
||||
return avatarId;
|
||||
public void setUserData(UserDataView userData) {
|
||||
this.userData= userData;
|
||||
}
|
||||
|
||||
public void setAvatarId(int avatarId) {
|
||||
this.avatarId = avatarId;
|
||||
}
|
||||
|
||||
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 UserDataView getUserData() {
|
||||
return userData;
|
||||
}
|
||||
|
||||
public boolean isForceDBComparison() {
|
||||
|
@ -269,13 +239,4 @@ public class Connection {
|
|||
public void setForceDBComparison(boolean forceDBComparison) {
|
||||
this.forceDBComparison = forceDBComparison;
|
||||
}
|
||||
|
||||
public String getFlagName() {
|
||||
return flagName;
|
||||
}
|
||||
|
||||
public void setFlagName(String flagName) {
|
||||
this.flagName = flagName;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -275,16 +275,10 @@ public class SessionImpl implements Session {
|
|||
this.sessionId = callbackClient.getSessionId();
|
||||
boolean registerResult;
|
||||
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
|
||||
registerResult = server.registerClient(connection.getUsername(), sessionId, client.getVersion());
|
||||
if (registerResult) {
|
||||
server.setUserData(connection.getUsername(), sessionId, userDataView);
|
||||
server.setUserData(connection.getUsername(), sessionId, connection.getUserData());
|
||||
}
|
||||
} else {
|
||||
registerResult = server.registerAdmin(connection.getPassword(), sessionId, client.getVersion());
|
||||
|
@ -1397,11 +1391,10 @@ public class SessionImpl implements Session {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean updatePreferencesForServer(int avatarId, boolean showAbilityPickerForced, boolean allowRequestShowHandCards, boolean confirmEmptyManaPool, UserSkipPrioritySteps userSkipPrioritySteps, String flagName) {
|
||||
public boolean updatePreferencesForServer(UserDataView userData) {
|
||||
try {
|
||||
if (isConnected()) {
|
||||
UserDataView userDataView = new UserDataView(avatarId, showAbilityPickerForced, allowRequestShowHandCards, confirmEmptyManaPool, userSkipPrioritySteps, flagName);
|
||||
server.setUserData(connection.getUsername(), sessionId, userDataView);
|
||||
server.setUserData(connection.getUsername(), sessionId, userData);
|
||||
}
|
||||
return true;
|
||||
} catch (MageException ex) {
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
*/
|
||||
package mage.remote.interfaces;
|
||||
|
||||
import mage.players.net.UserSkipPrioritySteps;
|
||||
import mage.view.UserDataView;
|
||||
|
||||
/**
|
||||
* @author noxx
|
||||
|
@ -36,5 +36,5 @@ public interface ClientData {
|
|||
|
||||
String getUserName();
|
||||
|
||||
boolean updatePreferencesForServer(int avatarId, boolean showAbilityPickerForced, boolean allowRequestShowHandCards, boolean confirmEmptyManaPool, UserSkipPrioritySteps userSkipPrioritySteps, String flagName);
|
||||
boolean updatePreferencesForServer(UserDataView userData);
|
||||
}
|
||||
|
|
|
@ -115,7 +115,7 @@ public class PlayerView implements Serializable {
|
|||
if (player.getUserData() != null) {
|
||||
this.userDataView = new UserDataView(player.getUserData());
|
||||
} else {
|
||||
this.userDataView = new UserDataView(0, false, false, true, null,"world.png");
|
||||
this.userDataView = UserDataView.getDefaultUserDataView();
|
||||
}
|
||||
|
||||
for (CommandObject commandObject : game.getState().getCommand()) {
|
||||
|
|
|
@ -18,15 +18,22 @@ public class UserDataView implements Serializable {
|
|||
protected boolean confirmEmptyManaPool;
|
||||
protected UserSkipPrioritySteps userSkipPrioritySteps;
|
||||
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,
|
||||
boolean confirmEmptyManaPool, UserSkipPrioritySteps userSkipPrioritySteps, String flagName) {
|
||||
boolean confirmEmptyManaPool, UserSkipPrioritySteps userSkipPrioritySteps, String flagName, boolean askMoveToGraveOrder) {
|
||||
this.avatarId = avatarId;
|
||||
this.showAbilityPickerForced = showAbilityPickerForced;
|
||||
this.allowRequestShowHandCards = allowRequestShowHandCards;
|
||||
this.userSkipPrioritySteps = userSkipPrioritySteps;
|
||||
this.confirmEmptyManaPool = confirmEmptyManaPool;
|
||||
this.flagName = flagName;
|
||||
this.askMoveToGraveOrder = askMoveToGraveOrder;
|
||||
|
||||
}
|
||||
|
||||
public UserDataView(UserData userData) {
|
||||
|
@ -37,6 +44,7 @@ public class UserDataView implements Serializable {
|
|||
this.userSkipPrioritySteps = userData.getUserSkipPrioritySteps();
|
||||
this.confirmEmptyManaPool = userData.confirmEmptyManaPool();
|
||||
this.flagName = userData.getFlagName();
|
||||
this.askMoveToGraveOrder = userData.askMoveToGraveOrder();
|
||||
}
|
||||
|
||||
public int getAvatarId() {
|
||||
|
@ -63,4 +71,8 @@ public class UserDataView implements Serializable {
|
|||
return flagName;
|
||||
}
|
||||
|
||||
public boolean askMoveToGraveOrder() {
|
||||
return askMoveToGraveOrder;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -175,7 +175,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
public ComputerPlayer(String name, RangeOfInfluence range) {
|
||||
super(name, range);
|
||||
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<>();
|
||||
}
|
||||
|
||||
|
|
|
@ -142,7 +142,7 @@ public class Session {
|
|||
if (user == null) {
|
||||
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())) {
|
||||
logger.info("Error connecting Admin!");
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ public class Session {
|
|||
userData = new UserData(UserGroup.PLAYER, userDataView.getAvatarId(),
|
||||
userDataView.isShowAbilityPickerForced(), userDataView.allowRequestShowHandCards(),
|
||||
userDataView.confirmEmptyManaPool(), userDataView.getUserSkipPrioritySteps(),
|
||||
userDataView.getFlagName());
|
||||
userDataView.getFlagName(), userDataView.askMoveToGraveOrder());
|
||||
user.setUserData(userData);
|
||||
} else {
|
||||
if (userDataView.getAvatarId() == 51) { // Update special avatar if first avatar is selected
|
||||
|
@ -168,6 +168,7 @@ public class Session {
|
|||
userData.setAllowRequestShowHandCards(userDataView.allowRequestShowHandCards());
|
||||
userData.setUserSkipPrioritySteps(userDataView.getUserSkipPrioritySteps());
|
||||
userData.setConfirmEmptyManaPool(userDataView.confirmEmptyManaPool());
|
||||
userData.setAskMoveToGraveOrder(userDataView.askMoveToGraveOrder());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -2936,10 +2936,12 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
if (choosingPlayer == null) {
|
||||
continue;
|
||||
}
|
||||
boolean chooseOrder = true;
|
||||
if (cards.size() > 2) {
|
||||
boolean chooseOrder = false;
|
||||
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);
|
||||
}
|
||||
}
|
||||
if (chooseOrder) {
|
||||
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);
|
||||
|
|
|
@ -16,10 +16,11 @@ public class UserData implements Serializable {
|
|||
protected boolean confirmEmptyManaPool;
|
||||
protected UserSkipPrioritySteps userSkipPrioritySteps;
|
||||
protected String flagName;
|
||||
protected boolean askMoveToGraveOrder;
|
||||
|
||||
public UserData(UserGroup userGroup, int avatarId, boolean showAbilityPickerForced,
|
||||
boolean allowRequestShowHandCards, boolean confirmEmptyManaPool, UserSkipPrioritySteps userSkipPrioritySteps,
|
||||
String flagName) {
|
||||
String flagName, boolean askMoveToGraveOrder) {
|
||||
this.groupId = userGroup.getGroupId();
|
||||
this.avatarId = avatarId;
|
||||
this.showAbilityPickerForced = showAbilityPickerForced;
|
||||
|
@ -85,4 +86,12 @@ public class UserData implements Serializable {
|
|||
return flagName;
|
||||
}
|
||||
|
||||
public boolean askMoveToGraveOrder() {
|
||||
return askMoveToGraveOrder;
|
||||
}
|
||||
|
||||
public void setAskMoveToGraveOrder(boolean askMoveToGraveOrder) {
|
||||
this.askMoveToGraveOrder = askMoveToGraveOrder;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue