* Fixed some problems with new avatar handling.

This commit is contained in:
LevelX2 2015-09-27 14:50:44 +02:00
parent 23cd772fea
commit b95d7ca705
6 changed files with 19 additions and 19 deletions

View file

@ -2,6 +2,5 @@ XMage.de 1 (Europe/Germany) fast :xmage.de:17171
woogerworks (North America/USA) :xmage.woogerworks.info:17171
XMage.info 1 (Europe/France) new network code -> see forum :176.31.186.181:17171
XMage BR (South America/Brazil) :ec2-54-233-67-0.sa-east-1.compute.amazonaws.com:17171
IceMage (Europe/Netherlands) :ring0.cc:17171
Seedds Server (Asia) :115.29.203.80:17171
localhost -> connect to your local server (must be started):localhost:17171

View file

@ -61,6 +61,9 @@ import mage.client.MageFrame;
import mage.client.util.Config;
import mage.client.util.ImageHelper;
import mage.client.util.gui.BufferedImageBuilder;
import static mage.constants.Constants.DEFAULT_AVATAR_ID;
import static mage.constants.Constants.MAX_AVATAR_ID;
import static mage.constants.Constants.MIN_AVATAR_ID;
import mage.players.net.UserData;
import mage.players.net.UserGroup;
import mage.players.net.UserSkipPrioritySteps;
@ -262,9 +265,6 @@ public class PreferencesDialog extends javax.swing.JDialog {
public static String PHASE_ON = "on";
public static String PHASE_OFF = "off";
public static final int MIN_AVATAR_ID = 10;
public static final int MAX_AVATAR_ID = 32;
public static final int DEFAULT_AVATAR_ID = 10;
private static final Map<Integer, JPanel> panels = new HashMap<>();
private static final Border GREEN_BORDER = BorderFactory.createLineBorder(Color.GREEN, 3);

View file

@ -63,15 +63,15 @@ import mage.client.components.HoverButton;
import mage.client.components.MageRoundPane;
import mage.client.components.ext.dlg.DialogManager;
import mage.client.dialog.PreferencesDialog;
import static mage.client.dialog.PreferencesDialog.DEFAULT_AVATAR_ID;
import static mage.client.dialog.PreferencesDialog.MAX_AVATAR_ID;
import static mage.client.dialog.PreferencesDialog.MIN_AVATAR_ID;
import mage.client.util.CardsViewUtil;
import mage.client.util.Command;
import mage.client.util.ImageHelper;
import mage.client.util.gui.BufferedImageBuilder;
import mage.client.util.gui.countryBox.CountryUtil;
import mage.components.ImagePanel;
import static mage.constants.Constants.DEFAULT_AVATAR_ID;
import static mage.constants.Constants.MAX_AVATAR_ID;
import static mage.constants.Constants.MIN_AVATAR_ID;
import mage.constants.ManaType;
import mage.remote.Session;
import mage.utils.timer.PriorityTimer;
@ -241,8 +241,8 @@ public class PlayerPanelExt extends javax.swing.JPanel {
if (!MageFrame.isLite()) {
int id = player.getUserData().getAvatarId();
if (id <= 0 || !(id >= 1000) || (id <= MIN_AVATAR_ID && id > MAX_AVATAR_ID)) {
id = PreferencesDialog.DEFAULT_AVATAR_ID;
if (!(id >= 1000) && (id <= 0 || (id <= MIN_AVATAR_ID && id > MAX_AVATAR_ID))) {
id = DEFAULT_AVATAR_ID;
}
if (id != avatarId) {
avatarId = id;

View file

@ -67,6 +67,10 @@ public final class Constants {
public static final double SCALE_FACTOR = 0.5;
public static final int MIN_AVATAR_ID = 10;
public static final int MAX_AVATAR_ID = 32;
public static final int DEFAULT_AVATAR_ID = 10;
/**
* Time each player has during the game to play using his\her priority.
*/

View file

@ -41,7 +41,7 @@ public class MageVersion implements Serializable, Comparable<MageVersion> {
public final static int MAGE_VERSION_MAJOR = 1;
public final static int MAGE_VERSION_MINOR = 4;
public final static int MAGE_VERSION_PATCH = 4;
public final static String MAGE_VERSION_MINOR_PATCH = "v6";
public final static String MAGE_VERSION_MINOR_PATCH = "v7";
public final static String MAGE_VERSION_INFO = "";
private final int major;

View file

@ -36,6 +36,7 @@ import java.util.concurrent.locks.ReentrantLock;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import mage.MageException;
import mage.constants.Constants;
import mage.interfaces.callback.ClientCallback;
import mage.players.net.UserData;
import mage.players.net.UserGroup;
@ -157,6 +158,10 @@ public class Session {
} else {
user.getUserData().update(userData);
}
if (user.getUserData().getAvatarId() < Constants.MIN_AVATAR_ID
|| user.getUserData().getAvatarId() > Constants.MAX_AVATAR_ID) {
user.getUserData().setAvatarId(Constants.DEFAULT_AVATAR_ID);
}
if (user.getUserData().getAvatarId() == 11) {
user.getUserData().setAvatarId(updateAvatar(user.getName()));
}
@ -169,24 +174,16 @@ public class Session {
//TODO: move to separate class
//TODO: add for checking for private key
switch (userName) {
case "nantuko":
return 1000;
case "North":
return 1006;
case "BetaSteward":
return 1008;
case "loki":
return 1012;
case "Ayrat":
return 1018;
case "Bandit":
return 1020;
case "fireshoes":
return 1021;
case "Wehk":
return 66;
}
return 51;
return 11;
}
public String getId() {