Added - choosing sealed formats for open play can be done by json modification + json reload
This commit is contained in:
@@ -97,15 +97,6 @@ public class TournamentRequestHandler extends LotroServerRequestHandler implemen
|
|||||||
private void getTournamentFormats(HttpRequest request, ResponseWriter responseWriter) {
|
private void getTournamentFormats(HttpRequest request, ResponseWriter responseWriter) {
|
||||||
JSONDefs.PlayerMadeTournamentAvailableFormats data = new JSONDefs.PlayerMadeTournamentAvailableFormats();
|
JSONDefs.PlayerMadeTournamentAvailableFormats data = new JSONDefs.PlayerMadeTournamentAvailableFormats();
|
||||||
|
|
||||||
Map<String, String> availableSealedFormats = new HashMap<>();
|
|
||||||
availableSealedFormats.put("single_fotr_block_sealed", "Fellowship Block Sealed");
|
|
||||||
availableSealedFormats.put("single_ttt_block_sealed", "Towers Block Sealed");
|
|
||||||
availableSealedFormats.put("single_ts_sealed", "Towers Standard Sealed");
|
|
||||||
availableSealedFormats.put("single_rotk_block_sealed", "King Block Sealed");
|
|
||||||
availableSealedFormats.put("single_movie_sealed", "Movie Sealed");
|
|
||||||
availableSealedFormats.put("single_wotr_block_sealed", "War of the Ring Block Sealed");
|
|
||||||
availableSealedFormats.put("single_th_block_sealed", "Hunters Block Sealed");
|
|
||||||
|
|
||||||
Map<String, String> availableSoloDraftFormats = new HashMap<>();
|
Map<String, String> availableSoloDraftFormats = new HashMap<>();
|
||||||
availableSoloDraftFormats.put("fotr_draft", "Fellowship Block");
|
availableSoloDraftFormats.put("fotr_draft", "Fellowship Block");
|
||||||
availableSoloDraftFormats.put("ttt_draft", "Towers Block");
|
availableSoloDraftFormats.put("ttt_draft", "Towers Block");
|
||||||
@@ -115,9 +106,8 @@ public class TournamentRequestHandler extends LotroServerRequestHandler implemen
|
|||||||
data.constructed = _formatLibrary.getHallFormats().values().stream()
|
data.constructed = _formatLibrary.getHallFormats().values().stream()
|
||||||
.map(constructedFormat -> new JSONDefs.ItemStub(constructedFormat.getCode(), constructedFormat.getName()))
|
.map(constructedFormat -> new JSONDefs.ItemStub(constructedFormat.getCode(), constructedFormat.getName()))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
data.sealed = _formatLibrary.GetAllSealedTemplates().values().stream()
|
data.sealed = _formatLibrary.getAllHallSealedTemplates().values().stream()
|
||||||
.filter(sealedEventDefinition -> availableSealedFormats.containsKey(sealedEventDefinition.GetID()))
|
.map(sealed -> new JSONDefs.ItemStub(sealed.GetID(), sealed.GetName().substring(3)))
|
||||||
.map(sealed -> new JSONDefs.ItemStub(sealed.GetID(), availableSealedFormats.get(sealed.GetID())))
|
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
data.soloDrafts = orderedSoloDrafts.stream()
|
data.soloDrafts = orderedSoloDrafts.stream()
|
||||||
.filter(code -> _soloDraftDefinitions.getAllSoloDrafts().values().stream().anyMatch(soloDraft -> code.equals(soloDraft.getCode()))).map(code -> new JSONDefs.ItemStub(code, availableSoloDraftFormats.get(code)))
|
.filter(code -> _soloDraftDefinitions.getAllSoloDrafts().values().stream().anyMatch(soloDraft -> code.equals(soloDraft.getCode()))).map(code -> new JSONDefs.ItemStub(code, availableSoloDraftFormats.get(code)))
|
||||||
|
|||||||
@@ -492,6 +492,7 @@
|
|||||||
name: 15 Single Series Fellowship Block Sealed
|
name: 15 Single Series Fellowship Block Sealed
|
||||||
id: single_fotr_block_sealed
|
id: single_fotr_block_sealed
|
||||||
format: limited_fotr
|
format: limited_fotr
|
||||||
|
hall: true
|
||||||
seriesProduct: [
|
seriesProduct: [
|
||||||
[
|
[
|
||||||
1x(S)FotR Block Choice - Starter
|
1x(S)FotR Block Choice - Starter
|
||||||
@@ -509,6 +510,7 @@
|
|||||||
name: 16 Single Series Towers Block Sealed
|
name: 16 Single Series Towers Block Sealed
|
||||||
id: single_ttt_block_sealed
|
id: single_ttt_block_sealed
|
||||||
format: limited_ttt
|
format: limited_ttt
|
||||||
|
hall: true
|
||||||
seriesProduct: [
|
seriesProduct: [
|
||||||
[
|
[
|
||||||
1x(S)TTT Block Choice - Starter
|
1x(S)TTT Block Choice - Starter
|
||||||
@@ -526,6 +528,7 @@
|
|||||||
name: 17 Single Series Towers Standard Sealed
|
name: 17 Single Series Towers Standard Sealed
|
||||||
id: single_ts_sealed
|
id: single_ts_sealed
|
||||||
format: limited_ttt
|
format: limited_ttt
|
||||||
|
hall: true
|
||||||
seriesProduct: [
|
seriesProduct: [
|
||||||
[
|
[
|
||||||
1x(S)TS Special Choice - Starter
|
1x(S)TS Special Choice - Starter
|
||||||
@@ -544,6 +547,7 @@
|
|||||||
name: 18 Single Series King Block Sealed
|
name: 18 Single Series King Block Sealed
|
||||||
id: single_rotk_block_sealed
|
id: single_rotk_block_sealed
|
||||||
format: limited_king
|
format: limited_king
|
||||||
|
hall: true
|
||||||
seriesProduct: [
|
seriesProduct: [
|
||||||
[
|
[
|
||||||
1x(S)RotK Block Choice - Starter
|
1x(S)RotK Block Choice - Starter
|
||||||
@@ -567,6 +571,7 @@
|
|||||||
name: 19 Single Series Movie Sealed
|
name: 19 Single Series Movie Sealed
|
||||||
id: single_movie_sealed
|
id: single_movie_sealed
|
||||||
format: limited_king
|
format: limited_king
|
||||||
|
hall: true
|
||||||
seriesProduct: [
|
seriesProduct: [
|
||||||
[
|
[
|
||||||
1x(S)Movie Special Choice - Starter
|
1x(S)Movie Special Choice - Starter
|
||||||
@@ -588,6 +593,7 @@
|
|||||||
name: 20 Single Series War of the Ring Block Sealed
|
name: 20 Single Series War of the Ring Block Sealed
|
||||||
id: single_wotr_block_sealed
|
id: single_wotr_block_sealed
|
||||||
format: limited_shadows
|
format: limited_shadows
|
||||||
|
hall: true
|
||||||
seriesProduct: [
|
seriesProduct: [
|
||||||
[
|
[
|
||||||
1x(S)WotR Choice - Starter
|
1x(S)WotR Choice - Starter
|
||||||
@@ -611,6 +617,7 @@
|
|||||||
name: 21 Single Series Hunters Block Sealed
|
name: 21 Single Series Hunters Block Sealed
|
||||||
id: single_th_block_sealed
|
id: single_th_block_sealed
|
||||||
format: limited_hunters
|
format: limited_hunters
|
||||||
|
hall: true
|
||||||
seriesProduct: [
|
seriesProduct: [
|
||||||
[
|
[
|
||||||
1x(S)HU Block Choice - Starter
|
1x(S)HU Block Choice - Starter
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ public class JSONDefs {
|
|||||||
public String id;
|
public String id;
|
||||||
public String format;
|
public String format;
|
||||||
public List<List<String>> seriesProduct;
|
public List<List<String>> seriesProduct;
|
||||||
|
public boolean hall = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ItemStub {
|
public static class ItemStub {
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ public class LotroFormatLibrary {
|
|||||||
private final Map<String, LotroFormat> _hallFormats = new LinkedHashMap<>();
|
private final Map<String, LotroFormat> _hallFormats = new LinkedHashMap<>();
|
||||||
|
|
||||||
private final Map<String, SealedEventDefinition> _sealedTemplates = new LinkedHashMap<>();
|
private final Map<String, SealedEventDefinition> _sealedTemplates = new LinkedHashMap<>();
|
||||||
|
private final Map<String, SealedEventDefinition> _hallSealedTemplates = new LinkedHashMap<>();
|
||||||
|
|
||||||
private final AdventureLibrary _adventureLibrary;
|
private final AdventureLibrary _adventureLibrary;
|
||||||
private final LotroCardBlueprintLibrary _cardLibrary;
|
private final LotroCardBlueprintLibrary _cardLibrary;
|
||||||
@@ -48,6 +49,7 @@ public class LotroFormatLibrary {
|
|||||||
try {
|
try {
|
||||||
collectionReady.acquire();
|
collectionReady.acquire();
|
||||||
_sealedTemplates.clear();
|
_sealedTemplates.clear();
|
||||||
|
_hallSealedTemplates.clear();
|
||||||
loadSealedTemplates(_sealedPath);
|
loadSealedTemplates(_sealedPath);
|
||||||
collectionReady.release();
|
collectionReady.release();
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
@@ -88,12 +90,15 @@ public class LotroFormatLibrary {
|
|||||||
for (var def : defs) {
|
for (var def : defs) {
|
||||||
if(def == null)
|
if(def == null)
|
||||||
continue;
|
continue;
|
||||||
var sealed = new SealedEventDefinition(def.name, def.id, _allFormats.get(def.format), def.seriesProduct);
|
var sealed = new SealedEventDefinition(def.name, def.id, _allFormats.get(def.format), def.seriesProduct, def.hall);
|
||||||
|
|
||||||
if(_sealedTemplates.containsKey(def.id)) {
|
if(_sealedTemplates.containsKey(def.id)) {
|
||||||
System.out.println("Overwriting existing sealed definition '" + def.id + "'!");
|
System.out.println("Overwriting existing sealed definition '" + def.id + "'!");
|
||||||
}
|
}
|
||||||
_sealedTemplates.put(def.id, sealed);
|
_sealedTemplates.put(def.id, sealed);
|
||||||
|
if (def.hall) {
|
||||||
|
_hallSealedTemplates.put(def.id, sealed);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@@ -224,6 +229,18 @@ public class LotroFormatLibrary {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Map<String, SealedEventDefinition> getAllHallSealedTemplates() {
|
||||||
|
try {
|
||||||
|
collectionReady.acquire();
|
||||||
|
var data = Collections.unmodifiableMap(_hallSealedTemplates);
|
||||||
|
collectionReady.release();
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
catch (InterruptedException exp) {
|
||||||
|
throw new RuntimeException("FormatLibrary.getAllHallSealedTemplates() interrupted: ", exp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public SealedEventDefinition GetSealedTemplateByFormatCode(String formatCode) {
|
public SealedEventDefinition GetSealedTemplateByFormatCode(String formatCode) {
|
||||||
try {
|
try {
|
||||||
collectionReady.acquire();
|
collectionReady.acquire();
|
||||||
|
|||||||
@@ -14,11 +14,13 @@ public class SealedEventDefinition {
|
|||||||
private final String _id;
|
private final String _id;
|
||||||
private final LotroFormat _format;
|
private final LotroFormat _format;
|
||||||
private final List<List<CardCollection.Item>> _seriesProduct = new ArrayList<>();
|
private final List<List<CardCollection.Item>> _seriesProduct = new ArrayList<>();
|
||||||
|
private final boolean _hallVisible;
|
||||||
|
|
||||||
public SealedEventDefinition(String name, String id, LotroFormat format, List<List<String>> product) {
|
public SealedEventDefinition(String name, String id, LotroFormat format, List<List<String>> product, boolean hallVisible) {
|
||||||
_name = name;
|
_name = name;
|
||||||
_id = id;
|
_id = id;
|
||||||
_format = format;
|
_format = format;
|
||||||
|
_hallVisible = hallVisible;
|
||||||
|
|
||||||
for(var serie : product) {
|
for(var serie : product) {
|
||||||
List<CardCollection.Item> items = new ArrayList<>();
|
List<CardCollection.Item> items = new ArrayList<>();
|
||||||
@@ -47,6 +49,7 @@ public class SealedEventDefinition {
|
|||||||
seriesProduct = _seriesProduct.stream()
|
seriesProduct = _seriesProduct.stream()
|
||||||
.map(x->x.stream().map(CardCollection.Item::toString).collect(Collectors.toList()))
|
.map(x->x.stream().map(CardCollection.Item::toString).collect(Collectors.toList()))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
hall = _hallVisible;
|
||||||
}};
|
}};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user