XMage 1.4.17V0

This commit is contained in:
LevelX2 2016-10-23 10:03:01 +02:00
parent b2bd7f5e24
commit 8b62eece68
43 changed files with 182 additions and 157 deletions

View file

@ -6,7 +6,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-root</artifactId>
<version>1.4.16</version>
<version>1.4.17</version>
</parent>
<groupId>org.mage</groupId>

View file

@ -7,7 +7,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-root</artifactId>
<version>1.4.16</version>
<version>1.4.17</version>
</parent>
<artifactId>mage-common</artifactId>

View file

@ -79,7 +79,7 @@ public interface MageServer {
List<CardInfo> getMissingCardsData(List<String> classNames);
// user methods
boolean setUserData(String userName, String sessionId, UserData userData) throws MageException;
boolean setUserData(String userName, String sessionId, UserData userData, String clientVersion) throws MageException;
void sendFeedbackMessage(String sessionId, String username, String title, String type, String message, String email) throws MageException;

View file

@ -223,7 +223,7 @@ public class SessionImpl implements Session {
// for backward compatibility. don't remove twice call - first one does nothing but for version checking
registerResult = server.connectUser(connection.getUsername(), connection.getPassword(), sessionId, client.getVersion());
if (registerResult) {
server.setUserData(connection.getUsername(), sessionId, connection.getUserData());
server.setUserData(connection.getUsername(), sessionId, connection.getUserData(), client.getVersion().toString());
}
} else {
registerResult = server.connectAdmin(connection.getAdminPassword(), sessionId, client.getVersion());
@ -1544,7 +1544,7 @@ public class SessionImpl implements Session {
public boolean updatePreferencesForServer(UserData userData) {
try {
if (isConnected()) {
server.setUserData(connection.getUsername(), sessionId, userData);
server.setUserData(connection.getUsername(), sessionId, userData, null);
}
return true;
} catch (MageException ex) {

View file

@ -40,8 +40,8 @@ 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 = 16;
public final static String MAGE_VERSION_MINOR_PATCH = "v4";
public final static int MAGE_VERSION_PATCH = 17;
public final static String MAGE_VERSION_MINOR_PATCH = "V0";
public final static String MAGE_VERSION_INFO = "";
private final int major;

View file

@ -44,8 +44,9 @@ public class UserView implements Serializable {
private final String gameInfo;
private final String userState;
private final Date muteChatUntil;
private final String clientVersion;
public UserView(String userName, String host, String sessionId, Date timeConnected, String gameInfo, String userState, Date muteChatUntil) {
public UserView(String userName, String host, String sessionId, Date timeConnected, String gameInfo, String userState, Date muteChatUntil, String clientVersion) {
this.userName = userName;
this.host = host;
this.sessionId = sessionId;
@ -53,6 +54,7 @@ public class UserView implements Serializable {
this.gameInfo = gameInfo;
this.userState = userState;
this.muteChatUntil = muteChatUntil;
this.clientVersion = clientVersion;
}
public String getUserName() {
@ -67,10 +69,6 @@ public class UserView implements Serializable {
return sessionId;
}
public Date getConnectionTime() {
return timeConnected;
}
public String getGameInfo() {
return gameInfo;
}
@ -83,4 +81,12 @@ public class UserView implements Serializable {
return muteChatUntil;
}
public String getClientVersion() {
return clientVersion;
}
public Date getTimeConnected() {
return timeConnected;
}
}

View file

@ -7,7 +7,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-plugins</artifactId>
<version>1.4.16</version>
<version>1.4.17</version>
</parent>
<artifactId>mage-counter-plugin</artifactId>

View file

@ -7,7 +7,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-root</artifactId>
<version>1.4.16</version>
<version>1.4.17</version>
</parent>
<artifactId>mage-plugins</artifactId>

View file

@ -6,7 +6,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-root</artifactId>
<version>1.4.16</version>
<version>1.4.17</version>
</parent>
<groupId>org.mage</groupId>

View file

@ -388,8 +388,9 @@ class TableUserModel extends AbstractTableModel {
public static final int POS_GAME_INFO = 4;
public static final int POS_USER_STATE = 5;
public static final int POS_CHAT_MUTE = 6;
public static final int POS_CLIENT_VERSION = 7;
private final String[] columnNames = new String[]{"User Name", "Host", "Time Connected", "SessionId", "Gameinfo", "User state", "Chat mute"};
private final String[] columnNames = new String[]{"User Name", "Host", "Time Connected", "SessionId", "Gameinfo", "User state", "Chat mute", "Client Version"};
private UserView[] users = new UserView[0];
private static final DateFormat formatterTime = new SimpleDateFormat("HH:mm:ss");
private static final DateFormat formatterTimeStamp = new SimpleDateFormat("yy-M-dd HH:mm:ss");
@ -417,7 +418,7 @@ class TableUserModel extends AbstractTableModel {
case POS_HOST:
return users[arg0].getHost();
case POS_TIME_CONNECTED:
return formatterTime.format(users[arg0].getConnectionTime());
return formatterTime.format(users[arg0].getTimeConnected());
case POS_SESSION_ID:
return users[arg0].getSessionId();
case POS_GAME_INFO:
@ -429,6 +430,8 @@ class TableUserModel extends AbstractTableModel {
return "";
}
return formatterTimeStamp.format(users[arg0].getMuteChatUntil());
case POS_CLIENT_VERSION:
return users[arg0].getClientVersion();
}
return "";
}

View file

@ -7,7 +7,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-server-plugins</artifactId>
<version>1.4.16</version>
<version>1.4.17</version>
</parent>
<artifactId>mage-deck-constructed</artifactId>

View file

@ -7,7 +7,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-server-plugins</artifactId>
<version>1.4.16</version>
<version>1.4.17</version>
</parent>
<artifactId>mage-deck-limited</artifactId>

View file

@ -7,7 +7,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-server-plugins</artifactId>
<version>1.4.16</version>
<version>1.4.17</version>
</parent>
<artifactId>mage-game-commanderduel</artifactId>

View file

@ -6,7 +6,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-server-plugins</artifactId>
<version>1.4.16</version>
<version>1.4.17</version>
</parent>
<artifactId>mage-game-commanderfreeforall</artifactId>

View file

@ -7,7 +7,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-server-plugins</artifactId>
<version>1.4.16</version>
<version>1.4.17</version>
</parent>
<artifactId>mage-game-freeforall</artifactId>

View file

@ -7,7 +7,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-server-plugins</artifactId>
<version>1.4.16</version>
<version>1.4.17</version>
</parent>
<artifactId>mage-game-momirduel</artifactId>

View file

@ -7,7 +7,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-server-plugins</artifactId>
<version>1.4.16</version>
<version>1.4.17</version>
</parent>
<artifactId>mage-game-tinyleadersduel</artifactId>

View file

@ -7,7 +7,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-server-plugins</artifactId>
<version>1.4.16</version>
<version>1.4.17</version>
</parent>
<artifactId>mage-game-twoplayerduel</artifactId>

View file

@ -7,7 +7,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-server-plugins</artifactId>
<version>1.4.16</version>
<version>1.4.17</version>
</parent>
<artifactId>mage-player-ai-draftbot</artifactId>

View file

@ -7,7 +7,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-server-plugins</artifactId>
<version>1.4.16</version>
<version>1.4.17</version>
</parent>
<artifactId>mage-player-ai-ma</artifactId>

View file

@ -7,7 +7,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-server-plugins</artifactId>
<version>1.4.16</version>
<version>1.4.17</version>
</parent>
<artifactId>mage-player-ai</artifactId>

View file

@ -7,7 +7,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-server-plugins</artifactId>
<version>1.4.16</version>
<version>1.4.17</version>
</parent>
<artifactId>mage-player-ai-mcts</artifactId>

View file

@ -7,7 +7,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-server-plugins</artifactId>
<version>1.4.16</version>
<version>1.4.17</version>
</parent>
<artifactId>mage-player-aiminimax</artifactId>

View file

@ -7,7 +7,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-server-plugins</artifactId>
<version>1.4.16</version>
<version>1.4.17</version>
</parent>
<artifactId>mage-player-human</artifactId>

View file

@ -7,7 +7,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-server-plugins</artifactId>
<version>1.4.16</version>
<version>1.4.17</version>
</parent>
<artifactId>mage-tournament-boosterdraft</artifactId>

View file

@ -7,7 +7,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-server-plugins</artifactId>
<version>1.4.16</version>
<version>1.4.17</version>
</parent>
<artifactId>mage-tournament-constructed</artifactId>

View file

@ -7,7 +7,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-server-plugins</artifactId>
<version>1.4.16</version>
<version>1.4.17</version>
</parent>
<artifactId>mage-tournament-sealed</artifactId>

View file

@ -6,7 +6,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-root</artifactId>
<version>1.4.16</version>
<version>1.4.17</version>
</parent>
<artifactId>mage-server-plugins</artifactId>

View file

@ -6,7 +6,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-root</artifactId>
<version>1.4.16</version>
<version>1.4.17</version>
</parent>
<artifactId>mage-server</artifactId>

View file

@ -65,7 +65,7 @@ public class ChatSession {
if (user != null && !clients.containsKey(userId)) {
String userName = user.getName();
clients.put(userId, userName);
broadcast(null, userName + " has joined", MessageColor.BLUE, true, MessageType.STATUS, null);
broadcast(null, userName + " has joined (" + user.getClientVersion() + ")", MessageColor.BLUE, true, MessageType.STATUS, null);
logger.trace(userName + " joined chat " + chatId);
}
}

View file

@ -211,11 +211,11 @@ public class MageServerImpl implements MageServer {
}
@Override
public boolean setUserData(final String userName, final String sessionId, final UserData userData) throws MageException {
public boolean setUserData(final String userName, final String sessionId, final UserData userData, final String clientVersion) throws MageException {
return executeWithResult("setUserData", sessionId, new ActionWithBooleanResult() {
@Override
public Boolean execute() throws MageException {
return SessionManager.getInstance().setUserData(userName, sessionId, userData);
return SessionManager.getInstance().setUserData(userName, sessionId, userData, clientVersion);
}
});
}
@ -1073,7 +1073,8 @@ public class MageServerImpl implements MageServer {
user.getConnectionTime(),
user.getGameInfo(),
user.getUserState().toString(),
user.getChatLockedUntil()
user.getChatLockedUntil(),
user.getClientVersion()
));
}
return users;

View file

@ -251,9 +251,12 @@ public class Session {
this.userId = user.getId();
}
public boolean setUserData(String userName, UserData userData) {
public boolean setUserData(String userName, UserData userData, String clientVersion) {
User user = UserManager.getInstance().getUserByName(userName);
if (user != null) {
if (clientVersion != null) {
user.setClientVersion(clientVersion);
}
if (user.getUserData() == null || user.getUserData().getGroupId() == UserGroup.DEFAULT.getGroupId()) {
user.setUserData(userData);
} else {

View file

@ -122,10 +122,10 @@ public class SessionManager {
return false;
}
public boolean setUserData(String userName, String sessionId, UserData userData) throws MageException {
public boolean setUserData(String userName, String sessionId, UserData userData, String clientVersion) throws MageException {
Session session = sessions.get(sessionId);
if (session != null) {
session.setUserData(userName, userData);
session.setUserData(userName, userData, clientVersion);
return true;
}
return false;

View file

@ -95,6 +95,7 @@ public class User {
private boolean active;
private Date lockedUntil;
private final AuthorizedUser authorizedUser;
private String clientVersion;
public User(String userName, String host, AuthorizedUser authorizedUser) {
this.userId = UUID.randomUUID();
@ -125,6 +126,7 @@ public class User {
this.watchedGames = new ArrayList<>();
this.tablesToDelete = new ArrayList<>();
this.sessionId = "";
this.clientVersion = "";
}
public String getName() {
@ -172,6 +174,14 @@ public class User {
}
}
public void setClientVersion(String clientVersion) {
this.clientVersion = clientVersion;
}
public String getClientVersion() {
return clientVersion;
}
public void setChatLockedUntil(Date chatLockedUntil) {
this.chatLockedUntil = chatLockedUntil;
updateAuthorizedUser();

View file

@ -7,7 +7,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-root</artifactId>
<version>1.4.16</version>
<version>1.4.17</version>
</parent>
<groupId>org.mage</groupId>

View file

@ -6,7 +6,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-root</artifactId>
<version>1.4.16</version>
<version>1.4.17</version>
</parent>
<groupId>org.mage</groupId>

View file

@ -6,7 +6,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-root</artifactId>
<version>1.4.16</version>
<version>1.4.17</version>
</parent>
<artifactId>mage-tests</artifactId>

View file

@ -1,16 +1,5 @@
package org.mage.test.clientside.base;
import mage.interfaces.MageException;
import mage.interfaces.Server;
import mage.interfaces.ServerState;
import mage.interfaces.callback.CallbackClient;
import mage.interfaces.callback.CallbackClientDaemon;
import mage.interfaces.callback.ClientCallback;
import mage.server.Main;
import mage.sets.Sets;
import mage.util.Logging;
import mage.view.*;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
@ -22,14 +11,25 @@ import java.util.logging.Logger;
import mage.constants.MultiplayerAttackOption;
import mage.constants.RangeOfInfluence;
import mage.game.match.MatchOptions;
import mage.interfaces.MageException;
import mage.interfaces.Server;
import mage.interfaces.ServerState;
import mage.interfaces.callback.CallbackClient;
import mage.interfaces.callback.CallbackClientDaemon;
import mage.interfaces.callback.ClientCallback;
import mage.server.Main;
import mage.sets.Sets;
import mage.util.Logging;
import mage.view.*;
/**
* Base for starting Mage server.
* Controls interactions between MageAPI and Mage Server.
* Base for starting Mage server. Controls interactions between MageAPI and Mage
* Server.
*
* @author nantuko
*/
public class MageBase {
/**
* MageBase single instance
*/
@ -96,10 +96,10 @@ public class MageBase {
Registry reg = LocateRegistry.getRegistry(serverName, port);
server = (Server) reg.lookup("mage-server");
sessionId = server.registerClient(userName, UUID.randomUUID());
CallbackClient client = new CallbackClient(){
CallbackClient client = new CallbackClient() {
@Override
public void processCallback(ClientCallback callback) {
logger.info("IN >> " + callback.getMessageId() + " - " + callback.getMethod());
logger.log(Level.INFO, "IN >> {0} - {1}", new Object[]{callback.getMessageId(), callback.getMethod()});
try {
if (callback.getMethod().equals("startGame")) {
TableClientMessage data = (TableClientMessage) callback.getData();
@ -119,14 +119,14 @@ public class MageBase {
}
} else if (callback.getMethod().equals("gameTarget")) {
GameClientMessage message = (GameClientMessage) callback.getData();
logger.info("TARGET >> " + message.getMessage() + " >> " + message.getTargets());
logger.log(Level.INFO, "TARGET >> {0} >> {1}", new Object[]{message.getMessage(), message.getTargets()});
if (message.getMessage().equals("Select a starting player")) {
logger.info(" Sending >> " + playerId);
logger.log(Level.INFO, " Sending >> {0}", playerId);
server.sendPlayerUUID(gameId, sessionId, playerId);
}
} else if (callback.getMethod().equals("gameSelect")) {
GameClientMessage message = (GameClientMessage) callback.getData();
logger.info("SELECT >> " + message.getMessage());
logger.log(Level.INFO, "SELECT >> {0}", message.getMessage());
if (phaseToWait == null) {
synchronized (sync) {
sync.wait();
@ -195,7 +195,6 @@ public class MageBase {
}
}
public boolean giveme(String cardName) throws Exception {
return server.cheat(gameId, sessionId, playerId, cardName);
}
@ -241,7 +240,7 @@ public class MageBase {
public boolean checkBattlefield(String cardName) throws Exception {
gameView = server.getGameView(gameId, sessionId, playerId);
for (PlayerView player: gameView.getPlayers()) {
for (PlayerView player : gameView.getPlayers()) {
if (player.getPlayerId().equals(playerId)) {
for (PermanentView permanent : player.getBattlefield().values()) {
if (permanent.getName().equals(cardName)) {
@ -255,7 +254,7 @@ public class MageBase {
public boolean checkGraveyardsEmpty() throws Exception {
gameView = server.getGameView(gameId, sessionId, playerId);
for (PlayerView player: gameView.getPlayers()) {
for (PlayerView player : gameView.getPlayers()) {
if (player.getGraveyard().size() > 0) {
return false;
}

View file

@ -5,7 +5,7 @@
<parent>
<artifactId>mage-root</artifactId>
<groupId>org.mage</groupId>
<version>1.4.16</version>
<version>1.4.17</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View file

@ -6,7 +6,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-root</artifactId>
<version>1.4.16</version>
<version>1.4.17</version>
</parent>
<artifactId>mage-verify</artifactId>

View file

@ -6,7 +6,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-root</artifactId>
<version>1.4.16</version>
<version>1.4.17</version>
</parent>
<artifactId>mage</artifactId>

View file

@ -108,6 +108,9 @@ git log 73a2ccda9b36552a09cb2b6a5aef37559866d7fc..head --diff-filter=A --name-st
since 1.4.16v0
git log a6747590b336329404d34f3b1780b5fe9aab7340..head --diff-filter=A --name-status | sed -ne "s/^A[^u]Mage.Sets\/src\/mage\/sets\///p" | sort > added_cards.txt
since 1.4.17V0
git log b2bd7f5e24db9a1e5c07c64e66583ec183bb5bd8..head --diff-filter=A --name-status | sed -ne "s/^A[^u]Mage.Sets\/src\/mage\/sets\///p" | sort > added_cards.txt
3. Copy added_cards.txt to trunk\Utils folder
4. Run script:
> perl extract_in_wiki_format.perl

View file

@ -6,7 +6,7 @@
<groupId>org.mage</groupId>
<artifactId>mage-root</artifactId>
<version>1.4.16</version>
<version>1.4.17</version>
<packaging>pom</packaging>
<name>Mage Root</name>
<description>Mage Root POM</description>
@ -84,7 +84,7 @@
</repositories>
<properties>
<mage-version>1.4.16</mage-version>
<mage-version>1.4.17</mage-version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>