mirror of
https://github.com/magefree/mage.git
synced 2025-12-29 23:12:10 -08:00
detect client version + client changes for AI skill level
This commit is contained in:
parent
0968d4c00a
commit
86f708b17a
46 changed files with 362 additions and 540 deletions
|
|
@ -37,6 +37,7 @@ import mage.cards.decks.DeckCardLists;
|
|||
import mage.game.GameException;
|
||||
import mage.game.tournament.TournamentOptions;
|
||||
import mage.interfaces.callback.CallbackServer;
|
||||
import mage.utils.MageVersion;
|
||||
import mage.view.DraftPickView;
|
||||
import mage.view.TableView;
|
||||
import mage.view.GameView;
|
||||
|
|
@ -48,7 +49,7 @@ import mage.view.TournamentView;
|
|||
*/
|
||||
public interface Server extends Remote, CallbackServer {
|
||||
|
||||
public UUID registerClient(String userName, UUID clientId) throws RemoteException, MageException;
|
||||
public UUID registerClient(String userName, UUID clientId, MageVersion version) throws RemoteException, MageException;
|
||||
public void deregisterClient(UUID sessionId) throws RemoteException, MageException;
|
||||
public void ack(String message, UUID sessionId) throws RemoteException, MageException;
|
||||
|
||||
|
|
@ -57,8 +58,8 @@ public interface Server extends Remote, CallbackServer {
|
|||
//table methods
|
||||
public TableView createTable(UUID sessionId, UUID roomId, MatchOptions matchOptions) throws RemoteException, MageException;
|
||||
public TableView createTournamentTable(UUID sessionId, UUID roomId, TournamentOptions tournamentOptions) throws RemoteException, MageException;
|
||||
public boolean joinTable(UUID sessionId, UUID roomId, UUID tableId, String name, String playerType, DeckCardLists deckList) throws RemoteException, MageException, GameException;
|
||||
public boolean joinTournamentTable(UUID sessionId, UUID roomId, UUID tableId, String name, String playerType) throws RemoteException, MageException, GameException;
|
||||
public boolean joinTable(UUID sessionId, UUID roomId, UUID tableId, String name, String playerType, int skill, DeckCardLists deckList) throws RemoteException, MageException, GameException;
|
||||
public boolean joinTournamentTable(UUID sessionId, UUID roomId, UUID tableId, String name, String playerType, int skill) throws RemoteException, MageException, GameException;
|
||||
public boolean submitDeck(UUID sessionId, UUID tableId, DeckCardLists deckList) throws RemoteException, MageException, GameException;
|
||||
public boolean watchTable(UUID sessionId, UUID roomId, UUID tableId) throws RemoteException, MageException;
|
||||
public void leaveTable(UUID sessionId, UUID roomId, UUID tableId) throws RemoteException, MageException;
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ package mage.interfaces;
|
|||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import mage.utils.MageVersion;
|
||||
import mage.view.GameTypeView;
|
||||
import mage.view.TournamentTypeView;
|
||||
|
||||
|
|
@ -44,13 +45,15 @@ public class ServerState implements Serializable {
|
|||
private String[] playerTypes;
|
||||
private String[] deckTypes;
|
||||
private boolean testMode;
|
||||
private MageVersion version;
|
||||
|
||||
public ServerState(List<GameTypeView> gameTypes, List<TournamentTypeView> tournamentTypes, String[] playerTypes, String[] deckTypes, boolean testMode) {
|
||||
public ServerState(List<GameTypeView> gameTypes, List<TournamentTypeView> tournamentTypes, String[] playerTypes, String[] deckTypes, boolean testMode, MageVersion version) {
|
||||
this.gameTypes = gameTypes;
|
||||
this.tournamentTypes = tournamentTypes;
|
||||
this.playerTypes = playerTypes;
|
||||
this.deckTypes = deckTypes;
|
||||
this.testMode = testMode;
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public List<GameTypeView> getGameTypes() {
|
||||
|
|
@ -73,4 +76,7 @@ public class ServerState implements Serializable {
|
|||
return testMode;
|
||||
}
|
||||
|
||||
public MageVersion getVersion() {
|
||||
return version;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
77
Mage.Common/src/mage/utils/MageVersion.java
Normal file
77
Mage.Common/src/mage/utils/MageVersion.java
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
* Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
package mage.utils;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class MageVersion implements Serializable, Comparable<MageVersion> {
|
||||
|
||||
private int major;
|
||||
private int minor;
|
||||
private int patch;
|
||||
|
||||
public MageVersion(int major, int minor, int patch) {
|
||||
this.major = major;
|
||||
this.minor = minor;
|
||||
this.patch = patch;
|
||||
}
|
||||
|
||||
public int getMajor() {
|
||||
return major;
|
||||
}
|
||||
|
||||
public int getMinor() {
|
||||
return minor;
|
||||
}
|
||||
|
||||
public int getPatch() {
|
||||
return patch;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return major + "." + minor + "." + patch;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(MageVersion o) {
|
||||
if (major != o.major)
|
||||
return major - o.major;
|
||||
if (minor != o.minor)
|
||||
return minor - o.minor;
|
||||
if (patch != o.patch)
|
||||
return patch - o.patch;
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue