mirror of
https://github.com/magefree/mage.git
synced 2025-12-24 20:41:58 -08:00
Merge branch 'master' into Network_Upgrade
Conflicts: Mage.Client/src/main/java/mage/client/MageFrame.java Mage.Client/src/main/java/mage/client/chat/ChatPanel.java Mage.Client/src/main/java/mage/client/dialog/ConnectDialog.java Mage.Client/src/main/java/mage/client/dialog/UserRequestDialog.java Mage.Client/src/main/java/mage/client/game/PlayAreaPanel.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/game/GamesRoomImpl.java
This commit is contained in:
commit
38da157f8c
807 changed files with 13691 additions and 4039 deletions
|
|
@ -57,6 +57,8 @@ public class Connection {
|
|||
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";
|
||||
|
|
@ -242,6 +244,16 @@ public class Connection {
|
|||
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;
|
||||
}
|
||||
|
|
@ -258,4 +270,12 @@ public class Connection {
|
|||
this.forceDBComparison = forceDBComparison;
|
||||
}
|
||||
|
||||
public String getFlagName() {
|
||||
return flagName;
|
||||
}
|
||||
|
||||
public void setFlagName(String flagName) {
|
||||
this.flagName = flagName;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -36,5 +36,5 @@ public interface ClientData {
|
|||
|
||||
String getUserName();
|
||||
|
||||
boolean updatePreferencesForServer(int avatarId, boolean showAbilityPickerForced, boolean allowRequestShowHandCards, UserSkipPrioritySteps userSkipPrioritySteps);
|
||||
boolean updatePreferencesForServer(int avatarId, boolean showAbilityPickerForced, boolean allowRequestShowHandCards, boolean confirmEmptyManaPool, UserSkipPrioritySteps userSkipPrioritySteps, String flagName);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,6 +78,7 @@ public interface GamePlay {
|
|||
*
|
||||
* @param passPriorityAction
|
||||
* @param gameId
|
||||
* @param Data
|
||||
* @return
|
||||
*/
|
||||
boolean sendPlayerAction(PlayerAction passPriorityAction, UUID gameId, Object Data);
|
||||
|
|
|
|||
|
|
@ -114,20 +114,19 @@ public class CardView extends SimpleCardView {
|
|||
protected boolean isPlayable;
|
||||
protected boolean isChoosable;
|
||||
protected boolean selected;
|
||||
protected boolean canAttack;
|
||||
protected boolean gameObject;
|
||||
protected boolean canAttack;
|
||||
|
||||
public CardView(Card card) {
|
||||
this(card, null, null, false);
|
||||
this(card, null, false);
|
||||
}
|
||||
|
||||
public CardView(Card card, UUID cardId) {
|
||||
this(card, null, null, false);
|
||||
this(card, null, false);
|
||||
this.id = cardId;
|
||||
}
|
||||
|
||||
public CardView(Card card, Game game, UUID cardId) {
|
||||
this(card, game, null, false);
|
||||
this(card, game, false);
|
||||
this.id = cardId;
|
||||
}
|
||||
|
||||
|
|
@ -135,15 +134,12 @@ public class CardView extends SimpleCardView {
|
|||
*
|
||||
* @param card
|
||||
* @param game
|
||||
* @param cardId not used?
|
||||
* @param controlled is the card view created for the card controller - used for morph / face down cards to know which player may see information for the card
|
||||
*/
|
||||
public CardView(Card card, Game game, UUID cardId, boolean controlled) {
|
||||
super(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.getUsesVariousArt(), card.getTokenSetCode());
|
||||
public CardView(Card card, Game game, boolean controlled) {
|
||||
super(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.getUsesVariousArt(), card.getTokenSetCode(), game != null);
|
||||
// no information available for face down cards as long it's not a controlled face down morph card
|
||||
// TODO: Better handle this in Framework (but currently I'm not sure how to do it there) LevelX2
|
||||
this.gameObject = game != null;
|
||||
|
||||
// TODO: Better handle this in Framework (but currently I'm not sure how to do it there) LevelX2
|
||||
if (game != null && card.isFaceDown(game)) {
|
||||
this.fillEmpty(card, controlled);
|
||||
if (card instanceof Spell) {
|
||||
|
|
@ -241,7 +237,7 @@ public class CardView extends SimpleCardView {
|
|||
this.cardTypes = card.getCardType();
|
||||
this.subTypes = card.getSubtype();
|
||||
this.superTypes = card.getSupertype();
|
||||
this.color = card.getColor();
|
||||
this.color = card.getColor(game);
|
||||
this.canTransform = card.canTransform();
|
||||
this.flipCard = card.isFlipCard();
|
||||
this.faceDown = game != null ? card.isFaceDown(game) : false;
|
||||
|
|
@ -301,7 +297,7 @@ public class CardView extends SimpleCardView {
|
|||
}
|
||||
|
||||
public CardView(MageObject object) {
|
||||
super(object.getId(), "", 0, false, "");
|
||||
super(object.getId(), "", 0, false, "", true);
|
||||
this.name = object.getName();
|
||||
this.displayName = object.getName();
|
||||
if (object instanceof Permanent) {
|
||||
|
|
@ -317,7 +313,7 @@ public class CardView extends SimpleCardView {
|
|||
this.cardTypes = object.getCardType();
|
||||
this.subTypes = object.getSubtype();
|
||||
this.superTypes = object.getSupertype();
|
||||
this.color = object.getColor();
|
||||
this.color = object.getColor(null);
|
||||
this.manaCost = object.getManaCost().getSymbols();
|
||||
this.convertedManaCost = object.getManaCost().convertedManaCost();
|
||||
if (object instanceof PermanentToken) {
|
||||
|
|
@ -345,11 +341,12 @@ public class CardView extends SimpleCardView {
|
|||
}
|
||||
|
||||
protected CardView() {
|
||||
super(null, "", 0, false, "");
|
||||
super(null, "", 0, false, "", true);
|
||||
}
|
||||
|
||||
public CardView(EmblemView emblem) {
|
||||
this(true);
|
||||
this.gameObject = true;
|
||||
this.id = emblem.getId();
|
||||
this.mageObjectType = MageObjectType.EMBLEM;
|
||||
this.name = emblem.getName();
|
||||
|
|
@ -368,13 +365,6 @@ public class CardView extends SimpleCardView {
|
|||
fillEmpty(null, false);
|
||||
}
|
||||
|
||||
|
||||
public CardView(String name) {
|
||||
this(true);
|
||||
this.name = name;
|
||||
this.displayName = name;
|
||||
}
|
||||
|
||||
private void fillEmpty(Card card, boolean controlled) {
|
||||
this.name = "Face Down";
|
||||
this.displayName = name;
|
||||
|
|
@ -431,7 +421,7 @@ public class CardView extends SimpleCardView {
|
|||
this.cardTypes = token.getCardType();
|
||||
this.subTypes = token.getSubtype();
|
||||
this.superTypes = token.getSupertype();
|
||||
this.color = token.getColor();
|
||||
this.color = token.getColor(null);
|
||||
this.manaCost = token.getManaCost().getSymbols();
|
||||
this.rarity = Rarity.NA;
|
||||
this.type = token.getTokenType();
|
||||
|
|
@ -736,8 +726,5 @@ public class CardView extends SimpleCardView {
|
|||
public void setCanAttack(boolean canAttack) {
|
||||
this.canAttack = canAttack;
|
||||
}
|
||||
|
||||
public boolean isGameObject() {
|
||||
return gameObject;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ public class CardsView extends LinkedHashMap<UUID, CardView> {
|
|||
|
||||
public CardsView(Game game, Collection<? extends Card> cards) {
|
||||
for (Card card: cards) {
|
||||
this.put(card.getId(), new CardView(card, game, null, false));
|
||||
this.put(card.getId(), new CardView(card, game, false));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ import mage.game.command.Commander;
|
|||
public class CommanderView extends CardView implements CommandObjectView, Serializable{
|
||||
|
||||
public CommanderView(Commander commander, Card sourceCard, Game game) {
|
||||
super(sourceCard, game, null, false);
|
||||
super(sourceCard, game, false);
|
||||
this.mageObjectType = MageObjectType.COMMANDER;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,8 +41,8 @@ public class DeckView implements Serializable {
|
|||
|
||||
public DeckView(Deck deck) {
|
||||
name = deck.getName();
|
||||
cards = new SimpleCardsView(deck.getCards());
|
||||
sideboard = new SimpleCardsView(deck.getSideboard());
|
||||
cards = new SimpleCardsView(deck.getCards(), false);
|
||||
sideboard = new SimpleCardsView(deck.getSideboard(), false);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@ public class DraftPickView implements Serializable {
|
|||
protected int timeout;
|
||||
|
||||
public DraftPickView(DraftPlayer player, int timeout) {
|
||||
this.booster = new SimpleCardsView(player.getBooster());
|
||||
this.picks = new SimpleCardsView(player.getDeck().getSideboard());
|
||||
this.booster = new SimpleCardsView(player.getBooster(), false);
|
||||
this.picks = new SimpleCardsView(player.getDeck().getSideboard(), false);
|
||||
this.picking = player.isPicking();
|
||||
this.timeout = timeout;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public class ExileView extends CardsView {
|
|||
this.name = exileZone.getName();
|
||||
this.id = exileZone.getId();
|
||||
for (Card card: exileZone.getCards(game)) {
|
||||
this.put(card.getId(), new CardView(card, game, card.getId(), false));
|
||||
this.put(card.getId(), new CardView(card, game, false));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -81,6 +81,7 @@ public class GameView implements Serializable {
|
|||
private boolean special = false;
|
||||
private final boolean isPlayer;
|
||||
private final int spellsCastCurrentTurn;
|
||||
private final boolean rollbackTurnsAllowed;
|
||||
|
||||
|
||||
public GameView(GameState state, Game game, UUID createdForPlayerId, UUID watcherUserId) {
|
||||
|
|
@ -136,7 +137,7 @@ public class GameView implements Serializable {
|
|||
}
|
||||
else {
|
||||
// Spell
|
||||
stack.put(stackObject.getId(), new CardView((Spell)stackObject, game, null, stackObject.getControllerId().equals(createdForPlayerId)));
|
||||
stack.put(stackObject.getId(), new CardView((Spell)stackObject, game, stackObject.getControllerId().equals(createdForPlayerId)));
|
||||
checkPaid(stackObject.getId(), (Spell)stackObject);
|
||||
}
|
||||
//stackOrder.add(stackObject.getId());
|
||||
|
|
@ -179,7 +180,8 @@ public class GameView implements Serializable {
|
|||
spellsCastCurrentTurn = watcher.getAmountOfSpellsAllPlayersCastOnCurrentTurn();
|
||||
} else {
|
||||
spellsCastCurrentTurn = 0;
|
||||
}
|
||||
}
|
||||
rollbackTurnsAllowed = game.getOptions().rollbackTurnsAllowed;
|
||||
}
|
||||
|
||||
private void checkPaid(UUID uuid, StackAbility stackAbility) {
|
||||
|
|
@ -322,5 +324,9 @@ public class GameView implements Serializable {
|
|||
public int getSpellsCastCurrentTurn() {
|
||||
return spellsCastCurrentTurn;
|
||||
}
|
||||
|
||||
public boolean isRollbackTurnsAllowed() {
|
||||
return rollbackTurnsAllowed;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ public class LookedAtView implements Serializable {
|
|||
public LookedAtView(String name, Cards cards, Game game) {
|
||||
this.name = name;
|
||||
for (Card card: cards.getCards(game)) {
|
||||
this.cards.put(card.getId(), new SimpleCardView(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.getUsesVariousArt(), card.getTokenSetCode()));
|
||||
this.cards.put(card.getId(), new CardView(card, game, card.getId()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ public class PermanentView extends CardView {
|
|||
private final boolean attachedToPermanent;
|
||||
|
||||
public PermanentView(Permanent permanent, Card card, UUID createdForPlayerId, Game game) {
|
||||
super(permanent, game, null, permanent.getControllerId().equals(createdForPlayerId));
|
||||
super(permanent, game, permanent.getControllerId().equals(createdForPlayerId));
|
||||
this.controlled = permanent.getControllerId().equals(createdForPlayerId);
|
||||
this.rules = permanent.getRules(game);
|
||||
this.tapped = permanent.isTapped();
|
||||
|
|
|
|||
|
|
@ -95,12 +95,12 @@ public class PlayerView implements Serializable {
|
|||
|
||||
this.hasLeft = player.hasLeft();
|
||||
for (Card card: player.getGraveyard().getCards(game)) {
|
||||
graveyard.put(card.getId(), new CardView(card, game, card.getId(), false));
|
||||
graveyard.put(card.getId(), new CardView(card, game, false));
|
||||
}
|
||||
for (ExileZone exileZone : game.getExile().getExileZones()) {
|
||||
for (Card card : exileZone.getCards(game)) {
|
||||
if (player.getId().equals(card.getOwnerId())) {
|
||||
exile.put(card.getId(), new CardView(card, game, card.getId(), false)); // unnown if it's allowed to look under a face down card
|
||||
exile.put(card.getId(), new CardView(card, game, false)); // unnown if it's allowed to look under a face down card
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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, null);
|
||||
this.userDataView = new UserDataView(0, false, false, true, null,"world.png");
|
||||
}
|
||||
|
||||
for (CommandObject commandObject : game.getState().getCommand()) {
|
||||
|
|
|
|||
|
|
@ -40,12 +40,12 @@ import mage.game.Game;
|
|||
public class RevealedView implements Serializable {
|
||||
|
||||
private final String name;
|
||||
private final SimpleCardsView cards = new SimpleCardsView();
|
||||
private final CardsView cards = new CardsView();
|
||||
|
||||
public RevealedView(String name, Cards cards, Game game) {
|
||||
this.name = name;
|
||||
for (Card card: cards.getCards(game)) {
|
||||
this.cards.put(card.getId(), new SimpleCardView(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.getUsesVariousArt(), card.getTokenSetCode()));
|
||||
this.cards.put(card.getId(), new CardView(card, game, card.getId()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -53,7 +53,7 @@ public class RevealedView implements Serializable {
|
|||
return name;
|
||||
}
|
||||
|
||||
public SimpleCardsView getCards() {
|
||||
public CardsView getCards() {
|
||||
return cards;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,13 +41,18 @@ public class SimpleCardView implements Serializable {
|
|||
protected String tokenSetCode;
|
||||
protected int cardNumber;
|
||||
protected boolean usesVariousArt;
|
||||
protected boolean gameObject;
|
||||
|
||||
public SimpleCardView(UUID id, String expansionSetCode, int cardNumber, boolean usesVariousArt, String tokenSetCode) {
|
||||
this(id, expansionSetCode, cardNumber, usesVariousArt, tokenSetCode, false);
|
||||
}
|
||||
public SimpleCardView(UUID id, String expansionSetCode, int cardNumber, boolean usesVariousArt, String tokenSetCode, boolean isGameObject) {
|
||||
this.id = id;
|
||||
this.expansionSetCode = expansionSetCode;
|
||||
this.cardNumber = cardNumber;
|
||||
this.usesVariousArt = usesVariousArt;
|
||||
this.tokenSetCode = tokenSetCode;
|
||||
this.gameObject = isGameObject;
|
||||
}
|
||||
|
||||
public UUID getId() {
|
||||
|
|
@ -69,5 +74,8 @@ public class SimpleCardView implements Serializable {
|
|||
public String getTokenSetCode() {
|
||||
return tokenSetCode;
|
||||
}
|
||||
|
||||
|
||||
public boolean isGameObject() {
|
||||
return gameObject;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,9 +42,9 @@ public class SimpleCardsView extends LinkedHashMap<UUID, SimpleCardView> {
|
|||
|
||||
public SimpleCardsView() {}
|
||||
|
||||
public SimpleCardsView(Collection<Card> cards) {
|
||||
public SimpleCardsView(Collection<Card> cards, boolean isGameObject) {
|
||||
for (Card card: cards) {
|
||||
this.put(card.getId(), new SimpleCardView(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.getUsesVariousArt(), card.getTokenSetCode()));
|
||||
this.put(card.getId(), new SimpleCardView(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.getUsesVariousArt(), card.getTokenSetCode(), isGameObject));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -64,12 +64,12 @@ public class StackAbilityView extends CardView {
|
|||
this.cardTypes = ability.getCardType();
|
||||
this.subTypes = ability.getSubtype();
|
||||
this.superTypes = ability.getSupertype();
|
||||
this.color = ability.getColor();
|
||||
this.color = ability.getColor(game);
|
||||
this.manaCost = ability.getManaCost().getSymbols();
|
||||
this.cardTypes = ability.getCardType();
|
||||
this.subTypes = ability.getSubtype();
|
||||
this.superTypes = ability.getSupertype();
|
||||
this.color = ability.getColor();
|
||||
this.color = ability.getColor(game);
|
||||
this.manaCost = ability.getManaCost().getSymbols();
|
||||
this.power = ability.getPower().toString();
|
||||
this.toughness = ability.getToughness().toString();
|
||||
|
|
|
|||
|
|
@ -15,13 +15,18 @@ public class UserDataView implements Serializable {
|
|||
protected int userGroup;
|
||||
protected boolean showAbilityPickerForced;
|
||||
protected boolean allowRequestShowHandCards;
|
||||
protected boolean confirmEmptyManaPool;
|
||||
protected UserSkipPrioritySteps userSkipPrioritySteps;
|
||||
String flagName;
|
||||
|
||||
public UserDataView(int avatarId, boolean showAbilityPickerForced, boolean allowRequestShowHandCards, UserSkipPrioritySteps userSkipPrioritySteps) {
|
||||
public UserDataView(int avatarId, boolean showAbilityPickerForced, boolean allowRequestShowHandCards,
|
||||
boolean confirmEmptyManaPool, UserSkipPrioritySteps userSkipPrioritySteps, String flagName) {
|
||||
this.avatarId = avatarId;
|
||||
this.showAbilityPickerForced = showAbilityPickerForced;
|
||||
this.allowRequestShowHandCards = allowRequestShowHandCards;
|
||||
this.userSkipPrioritySteps = userSkipPrioritySteps;
|
||||
this.confirmEmptyManaPool = confirmEmptyManaPool;
|
||||
this.flagName = flagName;
|
||||
}
|
||||
|
||||
public UserDataView(UserData userData) {
|
||||
|
|
@ -30,6 +35,8 @@ public class UserDataView implements Serializable {
|
|||
this.allowRequestShowHandCards = userData.isAllowRequestShowHandCards();
|
||||
this.showAbilityPickerForced = userData.isShowAbilityPickerForced();
|
||||
this.userSkipPrioritySteps = userData.getUserSkipPrioritySteps();
|
||||
this.confirmEmptyManaPool = userData.confirmEmptyManaPool();
|
||||
this.flagName = userData.getFlagName();
|
||||
}
|
||||
|
||||
public int getAvatarId() {
|
||||
|
|
@ -47,5 +54,13 @@ public class UserDataView implements Serializable {
|
|||
public UserSkipPrioritySteps getUserSkipPrioritySteps() {
|
||||
return userSkipPrioritySteps;
|
||||
}
|
||||
|
||||
public boolean confirmEmptyManaPool() {
|
||||
return confirmEmptyManaPool;
|
||||
}
|
||||
|
||||
public String getFlagName() {
|
||||
return flagName;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,18 +37,24 @@ public class UsersView implements Serializable {
|
|||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final String flagName;
|
||||
private final String userName;
|
||||
private final String infoState;
|
||||
private final String infoGames;
|
||||
private final String infoPing;
|
||||
|
||||
public UsersView(String userName, String infoState, String infoGames, String infoPing) {
|
||||
public UsersView(String flagName, String userName, String infoState, String infoGames, String infoPing) {
|
||||
this.flagName = flagName;
|
||||
this.userName = userName;
|
||||
this.infoState = infoState;
|
||||
this.infoGames = infoGames;
|
||||
this.infoPing = infoPing;
|
||||
}
|
||||
|
||||
public String getFlagName() {
|
||||
return flagName;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue