Moving format definition to one configuration file.
This commit is contained in:
@@ -4,6 +4,6 @@ import com.gempukku.lotro.common.Block;
|
||||
|
||||
public abstract class AbstractNewSite extends AbstractSite {
|
||||
public AbstractNewSite(String name, int twilight, Direction direction) {
|
||||
super(name, Block.OTHER, 0, twilight, direction);
|
||||
super(name, Block.SHADOWS, 0, twilight, direction);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
package com.gempukku.lotro.common;
|
||||
|
||||
public enum Block {
|
||||
FELLOWSHIP, TWO_TOWERS, KING, OTHER
|
||||
FELLOWSHIP, TWO_TOWERS, KING, SHADOWS
|
||||
}
|
||||
|
||||
@@ -25,6 +25,11 @@
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>5.1.17</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.googlecode.json-simple</groupId>
|
||||
<artifactId>json-simple</artifactId>
|
||||
<version>1.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-dbcp</groupId>
|
||||
<artifactId>commons-dbcp</artifactId>
|
||||
|
||||
@@ -12,7 +12,7 @@ import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public abstract class DefaultLotroFormat implements LotroFormat {
|
||||
public class DefaultLotroFormat implements LotroFormat {
|
||||
private LotroCardBlueprintLibrary _library;
|
||||
private String _name;
|
||||
private Block _siteBlock;
|
||||
@@ -38,7 +38,7 @@ public abstract class DefaultLotroFormat implements LotroFormat {
|
||||
|
||||
@Override
|
||||
public final boolean isOrderedSites() {
|
||||
return _siteBlock != Block.OTHER;
|
||||
return _siteBlock != Block.SHADOWS;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
package com.gempukku.lotro.game.formats;
|
||||
|
||||
import com.gempukku.lotro.common.Block;
|
||||
import com.gempukku.lotro.game.LotroCardBlueprintLibrary;
|
||||
|
||||
public class ExpandedFormat extends DefaultLotroFormat {
|
||||
public ExpandedFormat(LotroCardBlueprintLibrary library) {
|
||||
super(library, "Expanded", Block.OTHER, true, 60, 4, true, false);
|
||||
addValidSet(0);
|
||||
addValidSet(1);
|
||||
addValidSet(2);
|
||||
addValidSet(3);
|
||||
addValidSet(4);
|
||||
addValidSet(5);
|
||||
addValidSet(6);
|
||||
addValidSet(7);
|
||||
addValidSet(8);
|
||||
addValidSet(9);
|
||||
addValidSet(10);
|
||||
addValidSet(11);
|
||||
addValidSet(12);
|
||||
addValidSet(13);
|
||||
addValidSet(14);
|
||||
addValidSet(15);
|
||||
addValidSet(16);
|
||||
addValidSet(17);
|
||||
addValidSet(18);
|
||||
addValidSet(19);
|
||||
|
||||
addBannedCard("1_45");
|
||||
addBannedCard("1_138");
|
||||
addBannedCard("1_234");
|
||||
addBannedCard("1_311");
|
||||
addBannedCard("1_313");
|
||||
addBannedCard("1_316");
|
||||
addBannedCard("2_121");
|
||||
addBannedCard("3_17");
|
||||
addBannedCard("3_38");
|
||||
addBannedCard("3_42");
|
||||
addBannedCard("3_67");
|
||||
addBannedCard("3_68");
|
||||
addBannedCard("3_108");
|
||||
addBannedCard("3_113");
|
||||
addBannedCard("4_73");
|
||||
addBannedCard("7_49");
|
||||
addBannedCard("8_1");
|
||||
addBannedCard("10_2");
|
||||
addBannedCard("10_11");
|
||||
addBannedCard("10_91");
|
||||
addBannedCard("11_31");
|
||||
addBannedCard("11_100");
|
||||
addBannedCard("11_132");
|
||||
|
||||
addRestrictedCard("1_40");
|
||||
addRestrictedCard("1_80");
|
||||
addRestrictedCard("1_108");
|
||||
addRestrictedCard("1_139");
|
||||
addRestrictedCard("1_195");
|
||||
addRestrictedCard("1_248");
|
||||
addRestrictedCard("2_32");
|
||||
addRestrictedCard("2_75");
|
||||
addRestrictedCard("3_106");
|
||||
addRestrictedCard("4_276");
|
||||
addRestrictedCard("4_304");
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package com.gempukku.lotro.game.formats;
|
||||
|
||||
import com.gempukku.lotro.common.Block;
|
||||
import com.gempukku.lotro.game.LotroCardBlueprintLibrary;
|
||||
|
||||
public class FotRBlockFormat extends DefaultLotroFormat {
|
||||
public FotRBlockFormat(LotroCardBlueprintLibrary library) {
|
||||
super(library, "Fellowship block", Block.FELLOWSHIP, true, 60, 4, true, true);
|
||||
addRestrictedCard("1_248");
|
||||
addValidSet(1);
|
||||
addValidSet(2);
|
||||
addValidSet(3);
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package com.gempukku.lotro.game.formats;
|
||||
|
||||
import com.gempukku.lotro.common.Block;
|
||||
import com.gempukku.lotro.game.LotroCardBlueprintLibrary;
|
||||
|
||||
public class KingBlockFormat extends DefaultLotroFormat {
|
||||
public KingBlockFormat(LotroCardBlueprintLibrary library) {
|
||||
super(library, "King block", Block.KING, true, 60, 4, true, true);
|
||||
addRestrictedCard("7_49");
|
||||
addValidSet(7);
|
||||
addValidSet(8);
|
||||
addValidSet(10);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package com.gempukku.lotro.game.formats;
|
||||
|
||||
import com.gempukku.lotro.common.Block;
|
||||
import com.gempukku.lotro.game.LotroCardBlueprintLibrary;
|
||||
import com.gempukku.lotro.game.LotroFormat;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
import org.json.simple.parser.ParseException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class LotroFormatLibrary {
|
||||
private Map<String, LotroFormat> _allFormats = new HashMap<String, LotroFormat>();
|
||||
private Map<String, LotroFormat> _hallFormats = new LinkedHashMap<String, LotroFormat>();
|
||||
|
||||
public LotroFormatLibrary(LotroCardBlueprintLibrary library) {
|
||||
try {
|
||||
final InputStreamReader reader = new InputStreamReader(LotroFormatLibrary.class.getResourceAsStream("/lotrFormats.json"), "UTF-8");
|
||||
try {
|
||||
JSONParser parser = new JSONParser();
|
||||
JSONArray object = (JSONArray) parser.parse(reader);
|
||||
for (Object formatDefObj : object) {
|
||||
JSONObject formatDef = (JSONObject) formatDefObj;
|
||||
String formatCode = (String) formatDef.get("code");
|
||||
String name = (String) formatDef.get("name");
|
||||
Block block = Block.valueOf((String) formatDef.get("sites"));
|
||||
Boolean cancelRingBearerSkirmish = (Boolean) formatDef.get("cancelRingBearerSkirmish");
|
||||
if (cancelRingBearerSkirmish == null)
|
||||
cancelRingBearerSkirmish = false;
|
||||
|
||||
final DefaultLotroFormat format = new DefaultLotroFormat(library, name, block, true, 60, 4, true, cancelRingBearerSkirmish);
|
||||
|
||||
JSONArray sets = (JSONArray) formatDef.get("set");
|
||||
for (Object set : sets)
|
||||
format.addValidSet(((Number) set).intValue());
|
||||
|
||||
JSONArray bannedCards = (JSONArray) formatDef.get("banned");
|
||||
if (bannedCards != null)
|
||||
for (Object bannedCard : bannedCards) {
|
||||
format.addBannedCard((String) bannedCard);
|
||||
}
|
||||
|
||||
JSONArray restrictedCards = (JSONArray) formatDef.get("restricted");
|
||||
if (restrictedCards != null)
|
||||
for (Object restricted : restrictedCards) {
|
||||
format.addRestrictedCard((String) restricted);
|
||||
}
|
||||
|
||||
_allFormats.put(formatCode, format);
|
||||
|
||||
Boolean hallFormat = (Boolean) formatDef.get("hall");
|
||||
if (hallFormat == null)
|
||||
hallFormat = true;
|
||||
if (hallFormat)
|
||||
_hallFormats.put(formatCode, format);
|
||||
}
|
||||
} catch (ParseException exp) {
|
||||
throw new RuntimeException("Problem loading LotR formats", exp);
|
||||
} finally {
|
||||
reader.close();
|
||||
}
|
||||
} catch (IOException exp) {
|
||||
throw new RuntimeException("Problem loading LotR formats", exp);
|
||||
}
|
||||
}
|
||||
|
||||
public Map<String, LotroFormat> getHallFormats() {
|
||||
return Collections.unmodifiableMap(_hallFormats);
|
||||
}
|
||||
|
||||
public LotroFormat getFormat(String formatCode) {
|
||||
return _allFormats.get(formatCode);
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
package com.gempukku.lotro.game.formats;
|
||||
|
||||
import com.gempukku.lotro.common.Block;
|
||||
import com.gempukku.lotro.game.LotroCardBlueprintLibrary;
|
||||
|
||||
public class MovieFormat extends DefaultLotroFormat {
|
||||
public MovieFormat(LotroCardBlueprintLibrary library) {
|
||||
super(library, "Movie block", Block.KING, true, 60, 4, true, false);
|
||||
addBannedCard("8_1");
|
||||
addBannedCard("3_38");
|
||||
addBannedCard("3_106");
|
||||
addBannedCard("1_40");
|
||||
addBannedCard("2_32");
|
||||
addBannedCard("1_248");
|
||||
addBannedCard("3_108");
|
||||
addBannedCard("1_45");
|
||||
addBannedCard("7_96");
|
||||
addBannedCard("3_42");
|
||||
addBannedCard("10_2");
|
||||
addBannedCard("10_91");
|
||||
addBannedCard("1_108");
|
||||
addBannedCard("1_80");
|
||||
addBannedCard("3_67");
|
||||
addBannedCard("1_195");
|
||||
addBannedCard("3_68");
|
||||
addBannedCard("1_139");
|
||||
addBannedCard("7_49");
|
||||
addBannedCard("1_313");
|
||||
addBannedCard("1_234");
|
||||
|
||||
|
||||
addValidSet(1);
|
||||
addValidSet(2);
|
||||
addValidSet(3);
|
||||
addValidSet(4);
|
||||
addValidSet(5);
|
||||
addValidSet(6);
|
||||
addValidSet(7);
|
||||
addValidSet(8);
|
||||
addValidSet(9);
|
||||
addValidSet(10);
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package com.gempukku.lotro.game.formats;
|
||||
|
||||
import com.gempukku.lotro.common.Block;
|
||||
import com.gempukku.lotro.game.LotroCardBlueprintLibrary;
|
||||
|
||||
public class OpenFormat extends DefaultLotroFormat {
|
||||
public OpenFormat(LotroCardBlueprintLibrary library) {
|
||||
super(library, "Open", Block.OTHER, true, 60, 4, true, false);
|
||||
addValidSet(0);
|
||||
addValidSet(1);
|
||||
addValidSet(2);
|
||||
addValidSet(3);
|
||||
addValidSet(4);
|
||||
addValidSet(5);
|
||||
addValidSet(6);
|
||||
addValidSet(7);
|
||||
addValidSet(8);
|
||||
addValidSet(9);
|
||||
addValidSet(10);
|
||||
addValidSet(11);
|
||||
addValidSet(12);
|
||||
addValidSet(13);
|
||||
addValidSet(14);
|
||||
addValidSet(15);
|
||||
addValidSet(16);
|
||||
addValidSet(17);
|
||||
addValidSet(18);
|
||||
addValidSet(19);
|
||||
|
||||
addRestrictedCard("1_248");
|
||||
addRestrictedCard("7_49");
|
||||
addRestrictedCard("10_2");
|
||||
addRestrictedCard("10_91");
|
||||
addRestrictedCard("11_100");
|
||||
addRestrictedCard("11_132");
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package com.gempukku.lotro.game.formats;
|
||||
|
||||
import com.gempukku.lotro.common.Block;
|
||||
import com.gempukku.lotro.game.LotroCardBlueprintLibrary;
|
||||
|
||||
public class TTTBlockFormat extends DefaultLotroFormat {
|
||||
public TTTBlockFormat(LotroCardBlueprintLibrary library) {
|
||||
super(library, "Two Towers block", Block.TWO_TOWERS, true, 60, 4, true, true);
|
||||
addValidSet(4);
|
||||
addValidSet(5);
|
||||
addValidSet(6);
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package com.gempukku.lotro.game.formats;
|
||||
|
||||
import com.gempukku.lotro.common.Block;
|
||||
import com.gempukku.lotro.game.LotroCardBlueprintLibrary;
|
||||
|
||||
public class TowersStandardFormat extends DefaultLotroFormat {
|
||||
public TowersStandardFormat(LotroCardBlueprintLibrary library) {
|
||||
super(library, "Towers Standard", Block.TWO_TOWERS, true, 60, 4, true, true);
|
||||
|
||||
addBannedCard("1_40");
|
||||
addBannedCard("1_45");
|
||||
addBannedCard("1_80");
|
||||
addBannedCard("1_108");
|
||||
addBannedCard("1_139");
|
||||
addBannedCard("1_234");
|
||||
addBannedCard("1_248");
|
||||
addBannedCard("1_313");
|
||||
addBannedCard("2_32");
|
||||
addBannedCard("2_101");
|
||||
addBannedCard("2_108");
|
||||
addBannedCard("3_38");
|
||||
addBannedCard("3_42");
|
||||
addBannedCard("3_68");
|
||||
addBannedCard("4_192");
|
||||
|
||||
addValidSet(1);
|
||||
addValidSet(2);
|
||||
addValidSet(3);
|
||||
addValidSet(4);
|
||||
addValidSet(5);
|
||||
addValidSet(6);
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.gempukku.lotro.game.formats;
|
||||
|
||||
import com.gempukku.lotro.common.Block;
|
||||
import com.gempukku.lotro.game.LotroCardBlueprintLibrary;
|
||||
|
||||
public class WarOfTheRingBlockFormat extends DefaultLotroFormat {
|
||||
public WarOfTheRingBlockFormat(LotroCardBlueprintLibrary library) {
|
||||
super(library, "War of the Ring block", Block.OTHER, true, 60, 4, true, false);
|
||||
addRestrictedCard("11_132");
|
||||
addRestrictedCard("11_100");
|
||||
addValidSet(11);
|
||||
addValidSet(12);
|
||||
addValidSet(13);
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package com.gempukku.lotro.game.formats;
|
||||
|
||||
import com.gempukku.lotro.common.Block;
|
||||
import com.gempukku.lotro.game.LotroCardBlueprintLibrary;
|
||||
|
||||
public class WarOfTheRingStandardFormat extends DefaultLotroFormat {
|
||||
public WarOfTheRingStandardFormat(LotroCardBlueprintLibrary library) {
|
||||
super(library, "War of the Ring standard", Block.OTHER, true, 60, 4, true, false);
|
||||
addValidSet(4);
|
||||
addValidSet(5);
|
||||
addValidSet(6);
|
||||
addValidSet(7);
|
||||
addValidSet(8);
|
||||
addValidSet(9);
|
||||
addValidSet(10);
|
||||
addValidSet(11);
|
||||
addValidSet(12);
|
||||
addValidSet(13);
|
||||
addValidSet(14);
|
||||
|
||||
addBannedCard("4_73");
|
||||
addBannedCard("4_276");
|
||||
addBannedCard("4_304");
|
||||
addBannedCard("7_49");
|
||||
addBannedCard("8_1");
|
||||
addBannedCard("10_2");
|
||||
addBannedCard("10_11");
|
||||
addBannedCard("10_91");
|
||||
addBannedCard("11_31");
|
||||
addBannedCard("11_100");
|
||||
addBannedCard("11_132");
|
||||
}
|
||||
}
|
||||
@@ -6,13 +6,16 @@ import com.gempukku.lotro.collection.CollectionsManager;
|
||||
import com.gempukku.lotro.db.vo.CollectionType;
|
||||
import com.gempukku.lotro.db.vo.League;
|
||||
import com.gempukku.lotro.game.*;
|
||||
import com.gempukku.lotro.game.formats.*;
|
||||
import com.gempukku.lotro.game.formats.LotroFormatLibrary;
|
||||
import com.gempukku.lotro.league.LeagueSerieData;
|
||||
import com.gempukku.lotro.league.LeagueService;
|
||||
import com.gempukku.lotro.logic.timing.GameResultListener;
|
||||
import com.gempukku.lotro.logic.vo.LotroDeck;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.locks.ReadWriteLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
|
||||
@@ -20,6 +23,7 @@ public class HallServer extends AbstractServer {
|
||||
private ChatServer _chatServer;
|
||||
private LeagueService _leagueService;
|
||||
private LotroCardBlueprintLibrary _library;
|
||||
private LotroFormatLibrary _formatLibrary;
|
||||
private CollectionsManager _collectionsManager;
|
||||
private LotroServer _lotroServer;
|
||||
|
||||
@@ -33,8 +37,6 @@ public class HallServer extends AbstractServer {
|
||||
|
||||
private boolean _shutdown;
|
||||
|
||||
private Map<String, LotroFormat> _supportedFormats = new LinkedHashMap<String, LotroFormat>();
|
||||
|
||||
private ReadWriteLock _hallDataAccessLock = new ReentrantReadWriteLock(false);
|
||||
|
||||
private Map<String, AwaitingTable> _awaitingTables = new LinkedHashMap<String, AwaitingTable>();
|
||||
@@ -42,23 +44,15 @@ public class HallServer extends AbstractServer {
|
||||
|
||||
private Map<Player, Long> _lastVisitedPlayers = new HashMap<Player, Long>();
|
||||
|
||||
public HallServer(LotroServer lotroServer, ChatServer chatServer, LeagueService leagueService, LotroCardBlueprintLibrary library, CollectionsManager collectionsManager, boolean test) {
|
||||
public HallServer(LotroServer lotroServer, ChatServer chatServer, LeagueService leagueService, LotroCardBlueprintLibrary library,
|
||||
LotroFormatLibrary formatLibrary, CollectionsManager collectionsManager, boolean test) {
|
||||
_lotroServer = lotroServer;
|
||||
_chatServer = chatServer;
|
||||
_leagueService = leagueService;
|
||||
_library = library;
|
||||
_formatLibrary = formatLibrary;
|
||||
_collectionsManager = collectionsManager;
|
||||
_chatServer.createChatRoom("Game Hall", 10);
|
||||
|
||||
addFormat("fotr_block", new FotRBlockFormat(library));
|
||||
addFormat("ttt_block", new TTTBlockFormat(library));
|
||||
addFormat("towers_standard", new TowersStandardFormat(library));
|
||||
addFormat("king_block", new KingBlockFormat(library));
|
||||
addFormat("movie", new MovieFormat(library));
|
||||
addFormat("war_block", new WarOfTheRingBlockFormat(library));
|
||||
addFormat("war_standard", new WarOfTheRingStandardFormat(library));
|
||||
addFormat("open", new OpenFormat(library));
|
||||
addFormat("expanded", new ExpandedFormat(library));
|
||||
}
|
||||
|
||||
public void setShutdown(boolean shutdown) {
|
||||
@@ -75,16 +69,12 @@ public class HallServer extends AbstractServer {
|
||||
_motd = motd;
|
||||
}
|
||||
|
||||
private void addFormat(String formatCode, LotroFormat format) {
|
||||
_supportedFormats.put(formatCode, format);
|
||||
}
|
||||
|
||||
public int getTablesCount() {
|
||||
return _awaitingTables.size() + _runningTables.size();
|
||||
}
|
||||
|
||||
public Map<String, LotroFormat> getSupportedFormats() {
|
||||
return Collections.unmodifiableMap(_supportedFormats);
|
||||
return _formatLibrary.getHallFormats();
|
||||
}
|
||||
|
||||
private void cancelWaitingTables() {
|
||||
@@ -108,7 +98,7 @@ public class HallServer extends AbstractServer {
|
||||
League league = null;
|
||||
LeagueSerieData leagueSerie = null;
|
||||
CollectionType collectionType = _allCardsCollectionType;
|
||||
LotroFormat format = _supportedFormats.get(type);
|
||||
LotroFormat format = _formatLibrary.getHallFormats().get(type);
|
||||
|
||||
if (format == null) {
|
||||
// Maybe it's a league format?
|
||||
@@ -120,7 +110,7 @@ public class HallServer extends AbstractServer {
|
||||
|
||||
if (!_leagueService.canPlayRankedGame(league, leagueSerie, player.getName()))
|
||||
throw new HallException("You have already played max games in league");
|
||||
format = _supportedFormats.get(leagueSerie.getFormat());
|
||||
format = _formatLibrary.getFormat(leagueSerie.getFormat());
|
||||
collectionType = leagueSerie.getCollectionType();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
[
|
||||
{
|
||||
"name": "Fellowship block",
|
||||
"code": "fotr_block",
|
||||
"sites": "FELLOWSHIP",
|
||||
"cancelRingBearerSkirmish": true,
|
||||
"restricted": ["1_248"],
|
||||
"set": [1,2,3]
|
||||
},
|
||||
{
|
||||
"name": "Towers block",
|
||||
"code": "ttt_block",
|
||||
"sites": "TWO_TOWERS",
|
||||
"cancelRingBearerSkirmish": true,
|
||||
"set":[4,5,6]
|
||||
},
|
||||
{
|
||||
"name": "Towers standard",
|
||||
"code":"towers_standard",
|
||||
"sites": "TWO_TOWERS",
|
||||
"cancelRingBearerSkirmish": true,
|
||||
"banned": ["1_40","1_45","1_80","1_108","1_139","1_234","1_248","1_313","2_32","2_101","2_108","3_38","3_42","3_68","4_192"],
|
||||
"set":[1,2,3,4,5,6]
|
||||
},
|
||||
{
|
||||
"name": "King block",
|
||||
"code": "king_block",
|
||||
"sites": "KING",
|
||||
"cancelRingBearerSkirmish": true,
|
||||
"restricted": ["7_49"],
|
||||
"set": [7,8,10]
|
||||
},
|
||||
{
|
||||
"name": "Movie block",
|
||||
"code": "movie",
|
||||
"sites": "KING",
|
||||
"banned": ["8_1","3_38","3_106","1_40","2_32","1_248","3_108","1_45","7_96","3_42","10_2","10_91","1_108","1_80","3_67","1_195","3_68","1_139","7_49","1_313","1_234"],
|
||||
"set": [1,2,3,4,5,6,7,8,9,10]
|
||||
},
|
||||
{
|
||||
"name": "War of the Ring block",
|
||||
"code": "war_block",
|
||||
"sites": "SHADOWS",
|
||||
"restricted": ["11_132","11_100"],
|
||||
"set": [11,12,13]
|
||||
},
|
||||
{
|
||||
"name": "War of the Ring standard",
|
||||
"code": "war_standard",
|
||||
"sites": "SHADOWS",
|
||||
"banned": ["4_73","4_276","4_304","7_49","8_1","10_2","10_11","10_91","11_31","11_100","11_132"],
|
||||
"set": [4,5,6,7,8,9,10,11,12,13,14]
|
||||
},
|
||||
{
|
||||
"name": "Open",
|
||||
"code": "open",
|
||||
"sites": "SHADOWS",
|
||||
"restricted": ["1_248","7_49","10_2","10_91","11_100","11_132"],
|
||||
"set": [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]
|
||||
},
|
||||
{
|
||||
"name": "Expanded",
|
||||
"code": "expanded",
|
||||
"sites": "SHADOWS",
|
||||
"banned": ["1_45","1_138","1_234","1_311","1_313","1_316","2_121","3_17","3_38","3_42","3_67","3_68","3_108","3_113","4_73","7_49","8_1","10_2","10_11","10_91","11_31","11_100","11_132"],
|
||||
"restricted": ["1_40","1_80","1_108","1_139","1_195","1_248","2_32","2_75","3_106","4_276","4_304"],
|
||||
"set": [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]
|
||||
}
|
||||
]
|
||||
@@ -2,8 +2,9 @@ package com.gempukku.lotro.at;
|
||||
|
||||
import com.gempukku.lotro.game.DefaultUserFeedback;
|
||||
import com.gempukku.lotro.game.LotroCardBlueprintLibrary;
|
||||
import com.gempukku.lotro.game.LotroFormat;
|
||||
import com.gempukku.lotro.game.PhysicalCard;
|
||||
import com.gempukku.lotro.game.formats.MovieFormat;
|
||||
import com.gempukku.lotro.game.formats.LotroFormatLibrary;
|
||||
import com.gempukku.lotro.logic.actions.SystemQueueAction;
|
||||
import com.gempukku.lotro.logic.decisions.AwaitingDecision;
|
||||
import com.gempukku.lotro.logic.decisions.CardActionSelectionDecision;
|
||||
@@ -12,11 +13,12 @@ import com.gempukku.lotro.logic.timing.Action;
|
||||
import com.gempukku.lotro.logic.timing.DefaultLotroGame;
|
||||
import com.gempukku.lotro.logic.timing.Effect;
|
||||
import com.gempukku.lotro.logic.vo.LotroDeck;
|
||||
import static org.junit.Assert.fail;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
public abstract class AbstractAtTest {
|
||||
protected static LotroCardBlueprintLibrary _library;
|
||||
|
||||
@@ -55,7 +57,8 @@ public abstract class AbstractAtTest {
|
||||
protected void initializeGameWithDecks(Map<String, LotroDeck> decks) throws DecisionResultInvalidException {
|
||||
_userFeedback = new DefaultUserFeedback();
|
||||
|
||||
MovieFormat format = new MovieFormat(_library);
|
||||
LotroFormatLibrary formatLibrary = new LotroFormatLibrary(_library);
|
||||
LotroFormat format = formatLibrary.getFormat("movie");
|
||||
|
||||
_game = new DefaultLotroGame(format, decks, _userFeedback, _library);
|
||||
_userFeedback.setGame(_game);
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.gempukku.lotro.game.formats;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class LotroFormatLibraryTest {
|
||||
@Test
|
||||
public void testLoad() {
|
||||
LotroFormatLibrary library = new LotroFormatLibrary(null);
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import com.gempukku.lotro.collection.DeliveryService;
|
||||
import com.gempukku.lotro.db.*;
|
||||
import com.gempukku.lotro.game.LotroCardBlueprintLibrary;
|
||||
import com.gempukku.lotro.game.LotroServer;
|
||||
import com.gempukku.lotro.game.formats.LotroFormatLibrary;
|
||||
import com.gempukku.lotro.hall.HallServer;
|
||||
import com.gempukku.lotro.league.LeagueService;
|
||||
import com.gempukku.lotro.trade.TradeServer;
|
||||
@@ -27,6 +28,7 @@ public class ServerProvider implements InjectableProvider<Context, Type> {
|
||||
private Injectable<TradeServer> _tradeServerInjectable;
|
||||
private Injectable<CollectionsManager> _collectionsManagerInjectable;
|
||||
private Injectable<DeliveryService> _deliveryServiceInjectable;
|
||||
private Injectable<LotroFormatLibrary> _lotroFormatLibraryInjectable;
|
||||
|
||||
@Context
|
||||
private PlayerDAO _playerDao;
|
||||
@@ -61,9 +63,24 @@ public class ServerProvider implements InjectableProvider<Context, Type> {
|
||||
return getTradeServerInjectable();
|
||||
if (type.equals(DeliveryService.class))
|
||||
return getDeliveryServiceInjectable();
|
||||
if (type.equals(LotroFormatLibrary.class))
|
||||
return getLotroFormatLibraryInjectable();
|
||||
return null;
|
||||
}
|
||||
|
||||
private synchronized Injectable<LotroFormatLibrary> getLotroFormatLibraryInjectable() {
|
||||
if (_lotroFormatLibraryInjectable == null) {
|
||||
final LotroFormatLibrary lotroFormatLibrary = new LotroFormatLibrary(_library);
|
||||
_lotroFormatLibraryInjectable = new Injectable<LotroFormatLibrary>() {
|
||||
@Override
|
||||
public LotroFormatLibrary getValue() {
|
||||
return lotroFormatLibrary;
|
||||
}
|
||||
};
|
||||
}
|
||||
return _lotroFormatLibraryInjectable;
|
||||
}
|
||||
|
||||
private synchronized Injectable<LeagueService> getLeagueServiceInjectable() {
|
||||
if (_leagueServerInjectable == null) {
|
||||
final LeagueService leagueService = new LeagueService(_leagueDao, _leaguePointsDao, _leagueMatchDao, getCollectionsManagerInjectable().getValue());
|
||||
@@ -92,7 +109,8 @@ public class ServerProvider implements InjectableProvider<Context, Type> {
|
||||
|
||||
private synchronized Injectable<HallServer> getHallServerInjectable() {
|
||||
if (_hallServerInjectable == null) {
|
||||
final HallServer hallServer = new HallServer(getLotroServerInjectable().getValue(), getChatServerInjectable().getValue(), getLeagueServiceInjectable().getValue(), _library, getCollectionsManagerInjectable().getValue(), false);
|
||||
final HallServer hallServer = new HallServer(getLotroServerInjectable().getValue(), getChatServerInjectable().getValue(), getLeagueServiceInjectable().getValue(), _library,
|
||||
getLotroFormatLibraryInjectable().getValue(), getCollectionsManagerInjectable().getValue(), false);
|
||||
hallServer.startServer();
|
||||
_hallServerInjectable = new Injectable<HallServer>() {
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user