Sealed overhaul

- Sealed events are now no longer hard-coded as 4 serie, but will instead be however many are defined in the definition
- Altered format serialization to include information on draft + sealed (optionally)
- Fixed various dialog boxes having an erroneous "closed" text in them
- reordered format canonical order due to an oversight
- Altered the league admin page to dynamically populate all drop downs with all available values (instead of hard-coding them)
This commit is contained in:
Christian 'ketura' McCarty
2022-09-11 17:46:54 -05:00
parent e086e49e86
commit 3e3043906b
20 changed files with 2135 additions and 1936 deletions

View File

@@ -3,24 +3,23 @@ package com.gempukku.lotro.async.handler;
import com.alibaba.fastjson.JSON;
import com.gempukku.lotro.async.HttpProcessingException;
import com.gempukku.lotro.async.ResponseWriter;
import com.gempukku.lotro.common.JSONDefs;
import com.gempukku.lotro.common.Side;
import com.gempukku.lotro.db.DeckDAO;
import com.gempukku.lotro.draft2.SoloDraftDefinitions;
import com.gempukku.lotro.game.*;
import com.gempukku.lotro.game.formats.LotroFormatLibrary;
import com.gempukku.lotro.league.SealedLeagueDefinition;
import com.gempukku.lotro.logic.GameUtils;
import com.gempukku.lotro.logic.vo.LotroDeck;
import io.netty.handler.codec.http.HttpMethod;
import io.netty.handler.codec.http.HttpRequest;
import io.netty.handler.codec.http.QueryStringDecoder;
import io.netty.handler.codec.http.QueryStringEncoder;
import io.netty.handler.codec.http.multipart.HttpPostRequestDecoder;
import org.apache.commons.lang.StringEscapeUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
@@ -36,6 +35,7 @@ public class DeckRequestHandler extends LotroServerRequestHandler implements Uri
private final SortAndFilterCards _sortAndFilterCards;
private final LotroCardBlueprintLibrary _library;
private final LotroFormatLibrary _formatLibrary;
private final SoloDraftDefinitions _draftLibrary;
private final LotroServer _lotroServer;
public DeckRequestHandler(Map<Type, Object> context) {
@@ -45,6 +45,7 @@ public class DeckRequestHandler extends LotroServerRequestHandler implements Uri
_library = extractObject(context, LotroCardBlueprintLibrary.class);
_formatLibrary = extractObject(context, LotroFormatLibrary.class);
_lotroServer = extractObject(context, LotroServer.class);
_draftLibrary = extractObject(context, SoloDraftDefinitions.class);
}
@Override
@@ -71,33 +72,54 @@ public class DeckRequestHandler extends LotroServerRequestHandler implements Uri
deleteDeck(request, responseWriter);
} else if (uri.equals("/stats") && request.method() == HttpMethod.POST) {
getDeckStats(request, responseWriter);
} else if (uri.equals("/formats") && request.method() == HttpMethod.GET) {
} else if (uri.equals("/formats") && request.method() == HttpMethod.POST) {
getAllFormats(request, responseWriter);
} else {
throw new HttpProcessingException(404);
}
}
public static class Format {
public String code;
public String name;
public Format(String c, String n) {
code = c;
name = n;
private void getAllFormats(HttpRequest request, ResponseWriter responseWriter) throws IOException {
HttpPostRequestDecoder postDecoder = new HttpPostRequestDecoder(request);
try {
String includeEventsStr = getFormParameterSafely(postDecoder, "includeEvents");
boolean includeEvents = includeEventsStr != null && includeEventsStr.equalsIgnoreCase("true");
String json = "{}";
if(includeEvents)
{
JSONDefs.FullFormatReadout data = new JSONDefs.FullFormatReadout();
data.Formats = _formatLibrary.getAllFormats().values().stream()
.map(LotroFormat::Serialize)
.collect(Collectors.toMap(x-> x.code, x-> x));
data.SealedTemplates = _formatLibrary.GetAllSealedTemplates().values().stream()
.map(SealedLeagueDefinition::Serialize)
.collect(Collectors.toMap(x-> x.Name, x-> x));
data.DraftTemplates = _draftLibrary.getAllSoloDrafts().values().stream()
.map(soloDraft -> new JSONDefs.ItemStub(soloDraft.getCode(), soloDraft.getFormat()))
.collect(Collectors.toMap(x-> x.code, x-> x));
json = JSON.toJSONString(data);
}
else {
Map<String, LotroFormat> formats = _formatLibrary.getHallFormats();
Object[] output = formats.entrySet().stream()
.map(x -> new JSONDefs.ItemStub(x.getKey(), x.getValue().getName()))
.toArray();
json = JSON.toJSONString(output);
}
responseWriter.writeJsonResponse(json);
} finally {
postDecoder.destroy();
}
}
private void getAllFormats(HttpRequest request, ResponseWriter responseWriter) {
Map<String, LotroFormat> formats = _formatLibrary.getHallFormats();
Object[] formats2 = formats.entrySet().stream()
.map(x -> new Format(x.getKey(), x.getValue().getName()))
.toArray();
String json = JSON.toJSONString(formats2);
responseWriter.writeJsonResponse(json);
}
private void getDeckStats(HttpRequest request, ResponseWriter responseWriter) throws IOException, HttpProcessingException, CardNotFoundException {
HttpPostRequestDecoder postDecoder = new HttpPostRequestDecoder(request);
try {

View File

@@ -665,6 +665,10 @@ table.tables tr.privateForPlayer {
flex-grow: 1;
}
.ui-tabs-anchor {
width: 100%;
}
.article {
width:max(800px, 50%);
margin-left: auto;

View File

@@ -32,7 +32,8 @@ $(document).ready(
closeOnEscape:true,
resizable:true,
modal:true,
title:"Preview window"
title:"Preview window",
closeText: ''
});
var displayPreview = function (xml) {
@@ -219,7 +220,83 @@ $(document).ready(
function () {
$(".serieData").last().clone().appendTo(".series");
});
hall.comm.getFormats(true,
function (json)
{
console.log(json);
let drafts = json.DraftTemplates;
let formats = json.Formats;
let sealed = json.SealedTemplates
console.log(drafts);
for (var prop in drafts) {
if (Object.prototype.hasOwnProperty.call(drafts, prop)) {
console.log(prop);
var item = $("<option/>")
.attr("value", prop)
.text(prop);
$("#solo-draft-format").append(item);
}
}
sortOptionsByName("#solo-draft-format");
console.log(formats);
for (var prop in formats) {
if (Object.prototype.hasOwnProperty.call(formats, prop)) {
console.log(prop);
if(formats[prop].name.includes("Limited"))
continue;
let num = ("0000" + formats[prop].order).substr(-4);
var item = $("<option/>")
.attr("value", prop)
.text("" + num + " - " + formats[prop].name);
$("#constructed-format").append(item);
}
}
sortOptionsByName("#constructed-format");
$("#constructed-format option").each(function(index) {
console.log(this);
let newText = $(this).text().replace(/\d+ - /, '');
console.log(newText);
$(this).text(newText);
});
console.log(sealed);
for (var prop in sealed) {
if (Object.prototype.hasOwnProperty.call(sealed, prop)) {
console.log(prop);
let code = sealed[prop].Format;
let serieCount = sealed[prop].SeriesProduct.length;
var item = $("<option/>")
.attr("value", prop)
.text(prop + " - " + serieCount + " Series");
$("#sealed-format").append(item);
}
}
sortOptionsByName("#sealed-format");
},
{
"400":function ()
{
alert("Could not retrieve formats.");
}
});
});
function sortOptionsByName(selector) {
$(selector).html($(selector + " option").sort(function (a, b) {
return a.text == b.text ? 0 : a.text < b.text ? -1 : 1
}))
$(selector)[0].selectedIndex = 0;
}
function leagueErrorMap(outputControl, callback=null) {
return {
@@ -244,7 +321,7 @@ function leagueErrorMap(outputControl, callback=null) {
callback();
},
"404": function() {
outputControl.html("404: Info not found. Check that your input is correctly with removed whitespace and try again.");
outputControl.html("404: Info not found. Check that your input is correct with removed whitespace and try again.");
if(callback!=null)
callback();
},
@@ -270,13 +347,13 @@ function leagueErrorMap(outputControl, callback=null) {
Start (YYYYMMDD): <input type="text" id="sealed-start"><br/>
Format:
<select id="sealed-format">
<option value="fotr_block">Fellowship block</option>
<!-- <option value="fotr_block">Fellowship block</option>
<option value="ttt_block">Towers block</option>
<option value="movie">King (Movie) block</option>
<option value="war_block">War of the Ring block</option>
<option value="hunters_block">Hunters block</option>
<option value="movie_special">Movie Special block</option>
<option value="ts_special">TS Special block</option>
<option value="ts_special">TS Special block</option> -->
</select><br/>
Series duration in days: <input type="text" id="sealed-duration" value="7"><br/>
Maximum matches in series: <input type="text" id="sealed-matches" value="5"><br/>
@@ -297,10 +374,10 @@ function leagueErrorMap(outputControl, callback=null) {
Start (YYYYMMDD): <input type="text" id="solo-draft-start"><br/>
Format:
<select id="solo-draft-format">
<option value="test_draft">Test Draft</option>
<!-- <option value="test_draft">Test Draft</option>
<option value="fotr_draft">Fellowship Draft</option>
<option value="ttt_draft">Two Towers Draft</option>
<option value="hobbit_random_draft">Hobbit Random Draft</option>
<option value="hobbit_random_draft">Hobbit Random Draft</option> -->
</select><br/>
Series duration in days: <input type="text" id="solo-draft-duration" value="7"><br/>
Maximum matches in series: <input type="text" id="solo-draft-matches" value="5"><br/>
@@ -333,8 +410,8 @@ function leagueErrorMap(outputControl, callback=null) {
<div class="serieData">
<b>Series definition:</b><br/>
Format:
<select name="format">
<option value="fotr_block">Fellowship block</option>
<select id="constructed-format" name="format">
<!-- <option value="fotr_block">Fellowship block</option>
<option value="pc_fotr_block">Fellowship block (PC)</option>
<option value="fotr1_block">Fellowship block - Set 1</option>
<option value="fotr2_block">Fellowship block - Sets 1&2</option>
@@ -373,10 +450,10 @@ function leagueErrorMap(outputControl, callback=null) {
<option value="test_pc_fotr_block">PLAYTEST FOTR (PC)</option>
<option value="test_pc_movie">PLAYTEST Movie (PC)</option>
<option value="test_pc_expanded">PLAYTEST Expanded (PC)</option>
<option value="french">French</option>
<option value="french">French</option> -->
</select><br/>
Series duration in days: <input type="text" name="serieDuration" value="7"><br/>
Maximum matches in series: <input type="text" name="maxMatches" value="5"><br/>
Serie duration in days: <input type="text" name="serieDuration" value="7"><br/>
Maximum matches per serie: <input type="text" name="maxMatches" value="5"><br/>
</div>
</div>

View File

@@ -460,8 +460,11 @@ var ChatBoxUI = Class.extend({
this.chatTalkDiv.prop('disabled', true);
this.chatTalkDiv.css({"background-color": "#ff9999"});
this.discordDiv.prop('disabled', true);
this.discordDiv.css({"background-color": "#ff9999"});
if(this.discordDiv)
{
this.discordDiv.prop('disabled', true);
this.discordDiv.css({"background-color": "#ff9999"});
}
},
chatErrorMap:function() {

View File

@@ -505,17 +505,19 @@ var GempLotrCommunication = Class.extend({
dataType:"html"
});
},
getFormats:function (callback, errorMap) {
$.ajax({
type:"GET",
url:this.url + "/deck/formats",
cache:true,
data:{ },
success:this.deliveryCheck(callback),
error:this.errorCheck(errorMap),
dataType:"json"
});
},
getFormats:function (includeEvents, callback, errorMap) {
$.ajax({
type:"POST",
url:this.url + "/deck/formats",
cache:true,
data:{
includeEvents:includeEvents
},
success:this.deliveryCheck(callback),
error:this.errorCheck(errorMap),
dataType:"json"
});
},
startChat:function (room, callback, errorMap) {
$.ajax({
type:"GET",

View File

@@ -958,7 +958,7 @@ var GempLotrDeckBuildingUI = Class.extend({
var that = this;
var currentFormat = $("#formatSelect").val();
this.comm.getFormats(
this.comm.getFormats(false,
function (json)
{
that.formatSelect.empty();

View File

@@ -27,7 +27,8 @@ function deliveryService(xml) {
closeOnEscape:false,
resizable:true,
width:400,
height:200
height:200,
closeText: ''
});
deliveryGroups[collectionName] = new NormalCardGroup(deliveryDialogs[collectionName], function (card) {

View File

@@ -408,7 +408,6 @@ var GempLotrGameUI = Class.extend({
var test = $("body");
$("body")[0].addEventListener("contextmenu",
function (event) {
//event.preventDefault();
if(!that.clickCardFunction(event))
{
event.preventDefault();

View File

@@ -14,7 +14,8 @@ var LeagueResultsUI = Class.extend({
closeOnEscape:true,
resizable:false,
modal:true,
title:"League operation"
title:"League operation",
closeText: ''
});
this.formatDialog = $("<div></div>")
@@ -23,7 +24,8 @@ var LeagueResultsUI = Class.extend({
closeOnEscape:true,
resizable:false,
modal:true,
title:"Format description"
title:"Format description",
closeText: ''
});
this.loadResults();
@@ -245,8 +247,8 @@ var LeagueResultsUI = Class.extend({
var windowWidth = $(window).width();
var windowHeight = $(window).height();
var horSpace = 230;
var vertSpace = 100;
var horSpace = 250;
var vertSpace = 120;
this.questionDialog.dialog({width:Math.min(horSpace, windowWidth), height:Math.min(vertSpace, windowHeight)});
this.questionDialog.dialog("open");

View File

@@ -292,7 +292,7 @@ input.ui-button.ui-button-icon-only {
/* button icon element(s) */
.ui-button-icon-only .ui-icon {
position: absolute;
top: 50%;
/* top: 50%; */
left: 50%;
margin-top: -8px;
margin-left: -8px;

View File

@@ -120,7 +120,7 @@
{
"name":"Towers Block",
"code":"ttt_block",
"order": 5,
"order": 9,
"sites":"TWO_TOWERS",
"cancelRingBearerSkirmish":true,
"set":[4, 5, 6]
@@ -128,7 +128,7 @@
{
"name":"Towers Open - Sets 1-4",
"code":"open_legacy",
"order": 9,
"order": 10,
"sites":"TWO_TOWERS",
"cancelRingBearerSkirmish":true,
"set":[1, 2, 3, 4],
@@ -137,7 +137,7 @@
{
"name":"Towers Block - Set 4",
"code":"ttt1_block",
"order": 10,
"order": 11,
"sites":"TWO_TOWERS",
"cancelRingBearerSkirmish":true,
"set":[4],
@@ -146,7 +146,7 @@
{
"name":"Towers Block - Sets 4-5",
"code":"ttt2_block",
"order": 11,
"order": 12,
"sites":"TWO_TOWERS",
"cancelRingBearerSkirmish":true,
"set":[4, 5],
@@ -156,7 +156,7 @@
{
"name":"Towers Standard",
"code":"towers_standard",
"order": 12,
"order": 13,
"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"],
@@ -165,7 +165,7 @@
{
"name":"Towers Standard - Sets 1-4",
"code":"ttt_standard",
"order": 13,
"order": 14,
"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"],
@@ -175,7 +175,7 @@
{
"name":"Towers Standard - Sets 1-5",
"code":"bohd_standard",
"order": 14,
"order": 15,
"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"],
@@ -185,7 +185,7 @@
{
"name":"Towers Standard - Sets 2-6",
"code":"ts_no_fotr",
"order": 15,
"order": 16,
"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"],
@@ -195,7 +195,7 @@
{
"name":"Enhanced Towers Standard",
"code":"ts_reflections",
"order": 16,
"order": 17,
"sites":"TWO_TOWERS",
"cancelRingBearerSkirmish":false,
"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"],
@@ -205,7 +205,7 @@
{
"name":"King Block",
"code":"king_block",
"order": 17,
"order": 18,
"sites":"KING",
"cancelRingBearerSkirmish":true,
"restricted":["7_49"],
@@ -214,7 +214,7 @@
{
"name":"King Block - Set 7",
"code":"king1_block",
"order": 18,
"order": 19,
"sites":"KING",
"cancelRingBearerSkirmish":true,
"restricted":["7_49"],
@@ -224,7 +224,7 @@
{
"name":"King Block - Sets 7-8",
"code":"king2_block",
"order": 19,
"order": 20,
"sites":"KING",
"cancelRingBearerSkirmish":true,
"restricted":["7_49"],
@@ -234,7 +234,7 @@
{
"name":"King Standard",
"code":"rotk_sta",
"order": 20,
"order": 21,
"sites":"KING",
"cancelRingBearerSkirmish":true,
"banned":["1_40", "1_45","1_80", "1_108", "1_139", "1_195", "1_234", "1_248", "1_313", "2_32", "2_101", "2_108", "3_38", "3_42", "3_67", "3_68", "3_106", "3_108"],
@@ -243,7 +243,7 @@
{
"name":"Movie Block - Sets 1-7",
"code":"movie7",
"order": 21,
"order": 22,
"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],
@@ -252,7 +252,7 @@
{
"name":"Movie Block - Sets 1-8",
"code":"movie8",
"order": 22,
"order": 23,
"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],
@@ -261,7 +261,7 @@
{
"name":"Movie Block - Sets 1-9",
"code":"movie9",
"order": 23,
"order": 24,
"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],
@@ -270,7 +270,7 @@
{
"name":"Movie Block - Sets 1-8, 10",
"code":"movie_sans9",
"order": 24,
"order": 25,
"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, 10],
@@ -279,7 +279,7 @@
{
"name":"Movie Block, no GLR (10R11)",
"code":"movie_exp",
"order": 25,
"order": 26,
"sites":"KING",
"banned":["8_1", "3_38", "3_106", "1_40", "2_32", "1_248", "3_108", "1_45", "10_11", "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],
@@ -288,7 +288,7 @@
{
"name":"Pre-Shadows Multipath",
"code":"multipath",
"order": 26,
"order": 27,
"sites":"SPECIAL",
"banned":["1_138", "1_311", "1_316", "1_331", "1_338", "1_354", "1_355", "1_360", "2_14", "2_75", "3_1", "3_113", "4_73", "4_338", "4_355", "4_357", "7_190", "8_20", "10_11",
"8_1", "8_3", "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", "7_156"],
@@ -298,7 +298,7 @@
{
"name":"War of the Ring Block",
"code":"war_block",
"order": 27,
"order": 28,
"sites":"SHADOWS",
"restricted":["11_132", "11_100"],
"set":[11, 12, 13]
@@ -306,7 +306,7 @@
{
"name":"War of the Ring Block - Set 11",
"code":"war_block11",
"order": 28,
"order": 29,
"sites":"SHADOWS",
"restricted":["11_132", "11_100"],
"set":[11],
@@ -315,7 +315,7 @@
{
"name":"War of the Ring Block - Sets 11-12",
"code":"war_block12",
"order": 29,
"order": 30,
"sites":"SHADOWS",
"restricted":["11_132", "11_100"],
"set":[11, 12],
@@ -324,7 +324,7 @@
{
"name":"War of the Ring Block - Sets 10-14",
"code":"war_block14",
"order": 30,
"order": 31,
"sites":"SHADOWS",
"restricted":["11_132", "11_100"],
"set":[10, 11, 12, 13, 14],
@@ -333,7 +333,7 @@
{
"name":"War of the Ring Standard",
"code":"war_standard",
"order": 31,
"order": 32,
"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]
@@ -341,7 +341,7 @@
{
"name":"Hunters Block",
"code":"hunter_block",
"order": 32,
"order": 33,
"sites":"SHADOWS",
"set":[15, 17, 18]
},
@@ -349,7 +349,7 @@
"name":"Pre-Hunters Expanded",
"code":"pre-hunters_expanded",
"sites":"SHADOWS",
"order": 33,
"order": 34,
"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]
@@ -357,7 +357,7 @@
{
"name":"Standard",
"code":"standard",
"order": 34,
"order": 35,
"sites":"SHADOWS",
"banned":["0_1-19", "0_21", "0_22", "0_30-47", "0_62-67", "8_1", "13_188", "11_114", "11_31", "10_11", "15_64", "10_2", "10_91", "11_132", "7_49", "11_100"],
"set":[0, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
@@ -365,7 +365,7 @@
{
"name":"Open",
"code":"open",
"order": 35,
"order": 36,
"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]
@@ -373,7 +373,7 @@
{
"name": "Anything Goes",
"code":"rev_tow_sta",
"order": 36,
"order": 37,
"sites": "SPECIAL",
"cancelRingBearerSkirmish":true,
"set":[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
@@ -386,7 +386,7 @@
{
"name":"French",
"code":"french",
"order": 37,
"order": 38,
"sites":"SHADOWS",
"banned":["1_40", "1_45", "1_80", "1_108", "1_138", "1_234", "1_248", "1_311", "1_313", "1_316", "2_14", "2_32", "2_75", "2_121", "3_17", "3_38", "3_42", "3_67", "3_68", "3_108", "4_73", "4_304", "5_23", "9_35", "11_31", "11_49", "11_100", "11_114", "11_132", "11_222", "11_226", "11_231", "11_232", "13_11", "13_37", "13_64", "13_188", "14_6"],
"set":[0, 1, 2, 3, 4, 5, 6, 9, 11, 12, 13, 14]
@@ -394,7 +394,7 @@
{
"name":"Second Edition",
"code":"2nd_ed",
"order": 38,
"order": 39,
"sites":"SECOND_ED",
"banned":[],
"restricted":[],
@@ -409,7 +409,7 @@
{
"name":"Hobbit: The Short Rest",
"code":"hobbit_tsr",
"order": 39,
"order": 40,
"sites":"HOBBIT",
"cancelRingBearerSkirmish":true,
"restricted":["30_2", "30_5", "30_6", "30_7", "30_8", "30_9", "30_10", "30_11", "30_12", "30_15", "30_16", "30_17", "30_18", "30_19", "30_29", "30_47", "30_48", "30_58", "31_13", "31_14", "31_16", "31_23", "31_56"],
@@ -422,7 +422,7 @@
{
"name": "Hobbit: The Clouds Burst",
"code": "hobbit_tcb",
"order": 40,
"order": 41,
"sites": "HOBBIT",
"cancelRingBearerSkirmish": true,
"restricted": ["30_2", "30_5", "30_6", "30_7", "30_8", "30_9", "30_10", "30_11", "30_12", "30_15", "30_16", "30_17", "30_18", "30_19", "30_29", "30_47", "30_48", "30_58"],
@@ -435,7 +435,7 @@
{
"name": "Hobbit: Fire and Water",
"code": "hobbit_faw",
"order": 41,
"order": 42,
"sites": "HOBBIT",
"cancelRingBearerSkirmish": true,
"restricted": ["30_2", "30_5", "30_6", "30_7", "30_8", "30_9", "30_10", "30_11", "30_12", "30_15", "30_16", "30_17", "30_18", "30_19", "30_29", "30_47", "30_48", "30_58"],
@@ -448,7 +448,7 @@
{
"name":"PLAYTEST - Fellowship Block (PC)",
"code":"test_pc_fotr_block",
"order": 42,
"order": 43,
"sites":"FELLOWSHIP",
"cancelRingBearerSkirmish":true,
"hall":true,
@@ -468,7 +468,7 @@
{
"name":"PLAYTEST - Movie Block (PC)",
"code":"test_pc_movie",
"order": 43,
"order": 44,
"sites":"KING",
"hall":true,
"playtest":true,
@@ -492,7 +492,7 @@
"name":"PLAYTEST - Expanded (PC)",
"code":"test_pc_expanded",
"sites":"SHADOWS",
"order": 44,
"order": 45,
"hall":true,
"playtest":true,
"set":[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 101, 151],

View File

@@ -1,9 +1,6 @@
package com.gempukku.lotro.common;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
public class JSONDefs {
public static class Pack {
@@ -23,6 +20,15 @@ public class JSONDefs {
public List<List<String>> SeriesProduct;
}
public static class ItemStub {
public String code;
public String name;
public ItemStub(String c, String n) {
code = c;
name = n;
}
}
public static class Format {
public String adventure;
public String code;
@@ -48,5 +54,12 @@ public class JSONDefs {
public ArrayList<String> restrictedName = new ArrayList<>();
public Map<String, String> errata = new HashMap<>();
public boolean hall = true;
}
public static class FullFormatReadout {
public Map<String, Format> Formats;
public Map<String, SealedTemplate> SealedTemplates;
public Map<String, ItemStub> DraftTemplates;
}
}

View File

@@ -1,5 +1,6 @@
package com.gempukku.lotro.game;
import com.gempukku.lotro.common.JSONDefs;
import com.gempukku.lotro.common.SitesBlock;
import com.gempukku.lotro.logic.vo.LotroDeck;
@@ -57,4 +58,5 @@ public interface LotroFormat {
public int getHandSize();
public Adventure getAdventure();
public JSONDefs.Format Serialize();
}

View File

@@ -16,10 +16,7 @@ import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.concurrent.Semaphore;
public class SoloDraftDefinitions {
@@ -113,7 +110,18 @@ public class SoloDraftDefinitions {
collectionReady.release();
return data;
} catch (InterruptedException exp) {
throw new RuntimeException("ProductLibrary.GetProduct() interrupted: ", exp);
throw new RuntimeException("SoloDraftDefinitions.getSoloDraft() interrupted: ", exp);
}
}
public Map<String, SoloDraft> getAllSoloDrafts() {
try {
collectionReady.acquire();
var data = Collections.unmodifiableMap(_draftTypes);
collectionReady.release();
return data;
} catch (InterruptedException exp) {
throw new RuntimeException("SoloDraftDefinitions.getAllSoloDrafts() interrupted: ", exp);
}
}
}

View File

@@ -655,4 +655,34 @@ public class DefaultLotroFormat implements LotroFormat {
counts.put(name, count + 1);
}
}
@Override
public JSONDefs.Format Serialize() {
return new JSONDefs.Format() {{
adventure = null;
code = _code;
name = _name;
order = _order;
surveyUrl = _surveyUrl;
sites = _siteBlock.getHumanReadable();
cancelRingBearerSkirmish = _canCancelRingBearerSkirmish;
ruleOfFour = _hasRuleOfFour;
winAtEndOfRegroup = _winAtEndOfRegroup;
winOnControlling5Sites = _winOnControlling5Sites;
playtest = _isPlaytest;
validateShadowFPCount = _validateShadowFPCount;
minimumDeckSize = _minimumDeckSize;
maximumSameName = _maximumSameName;
mulliganRule = _mulliganRule;
set = null;
banned = null;
restricted = null;
valid = null;
limit2 = null;
limit3 = null;
restrictedName = null;
errata = null;
hall = _hallVisible;
}};
}
}

View File

@@ -145,6 +145,18 @@ public class LotroFormatLibrary {
}
}
public Map<String, LotroFormat> getAllFormats() {
try {
collectionReady.acquire();
var data = Collections.unmodifiableMap(_allFormats);
collectionReady.release();
return data;
}
catch (InterruptedException exp) {
throw new RuntimeException("FormatLibrary.getAllFormats() interrupted: ", exp);
}
}
public LotroFormat getFormat(String formatCode) {
try {
collectionReady.acquire();
@@ -197,6 +209,18 @@ public class LotroFormatLibrary {
}
}
public Map<String,SealedLeagueDefinition> GetAllSealedTemplates() {
try {
collectionReady.acquire();
var data = Collections.unmodifiableMap(_sealedTemplates);
collectionReady.release();
return data;
}
catch (InterruptedException exp) {
throw new RuntimeException("FormatLibrary.GetSealedTemplate() interrupted: ", exp);
}
}
public SealedLeagueDefinition GetSealedTemplateByFormatCode(String formatCode) {
try {
collectionReady.acquire();

View File

@@ -34,12 +34,14 @@ public class NewSealedLeagueData implements LeagueData {
_collectionType = new CollectionType(params[4], params[5]);
var def = _formatLibrary.GetSealedTemplate(_leagueTemplateName);
_series = new LinkedList<>();
for (int i = 0; i < 4; i++) {
for (int i = 0; i < def.GetSerieCount(); i++) {
_series.add(
new DefaultLeagueSerieData(_leaguePrizes, true, "Serie " + (i + 1),
DateUtils.offsetDate(start, i * serieDuration), DateUtils.offsetDate(start, (i + 1) * serieDuration - 1), maxMatches,
_formatLibrary.GetSealedTemplate(_leagueTemplateName).GetFormat(), _collectionType));
def.GetFormat(), _collectionType));
}
}

View File

@@ -1,27 +1,15 @@
package com.gempukku.lotro.league;
import com.gempukku.lotro.common.JSONDefs;
import com.gempukku.lotro.game.CardCollection;
import com.gempukku.lotro.game.LotroFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
public class SealedLeagueDefinition {
//TODO:
// + flesh this out and convert NewSealedLeagueData to utilize it
// + Add sealed format loading to LotroFormatLibrary
// + Add hot reloading to LotroFormatLibrary / extend the hot reload button
// - Rename LotroFormatLibrary -> FormatLibrary
// + Alter admin panel usage to look up instead of recreating each time
// x move the static creation to FormatLibrary
// - add 5 second delay scrolldown on chat creation?
// - add resize handle to chat
// - Alter the league admin panel to dynamically generate all three format dropdowns
// -
private final String _name;
private final LotroFormat _format;
private final List<List<CardCollection.Item>> _seriesProduct = new ArrayList<>();
@@ -47,4 +35,14 @@ public class SealedLeagueDefinition {
public LotroFormat GetFormat() { return _format; }
public List<List<CardCollection.Item>> GetAllSeriesProducts() { return Collections.unmodifiableList(_seriesProduct); }
public List<CardCollection.Item> GetProductForSerie(int serie) { return Collections.unmodifiableList(_seriesProduct.get(serie)); }
public JSONDefs.SealedTemplate Serialize() {
return new JSONDefs.SealedTemplate() {{
Name = _name;
Format = _format.getCode();
SeriesProduct = _seriesProduct.stream()
.map(x->x.stream().map(CardCollection.Item::toString).collect(Collectors.toList()))
.collect(Collectors.toList());
}};
}
}

View File

@@ -1,4 +1,17 @@
TODO:
+ flesh out the SealedLeageDefinition and convert NewSealedLeagueData to utilize it
+ Add sealed format loading to LotroFormatLibrary
+ Add hot reloading to LotroFormatLibrary / extend the hot reload button
x Rename LotroFormatLibrary -> FormatLibrary
+ Alter admin panel usage to look up instead of recreating each time
x move the static creation to FormatLibrary
+ add 5 second delay scrolldown on chat creation?
+ add resize handle to chat
+ Alter the league admin panel to dynamically generate all three format dropdowns
x alter sealed admin panel to dynamically alter the number of series
+ fix sealed leagues hard-coded to 4 series
- look into adding prize definitions
- add links to the users list to their profiles
- add email column to user
- add email field to register form