hall format/errata page improvements
- Fixed help > format page not rendering - Fixed latest errata block incorrectly interpreting set 3 errata as set 4 - Added Recent Errata section to the top of the Help > PC Errata section
This commit is contained in:
@@ -22,7 +22,8 @@ import io.netty.handler.codec.http.HttpRequest;
|
||||
import io.netty.handler.codec.http.QueryStringDecoder;
|
||||
import io.netty.handler.codec.http.multipart.HttpPostRequestDecoder;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;import org.w3c.dom.Document;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
@@ -414,8 +415,13 @@ public class HallRequestHandler extends LotroServerRequestHandler implements Uri
|
||||
|
||||
private void getErrataInfo(HttpRequest request, ResponseWriter responseWriter) throws CardNotFoundException {
|
||||
|
||||
var errata = _library.getErrata();
|
||||
String json = JsonUtils.Serialize(errata);
|
||||
var recentErrata = _formatLibrary.getFormat("pc_errata").getRecentErrata();
|
||||
|
||||
var errataInfo = new HashMap<String, Object>();
|
||||
errataInfo.put("all", _library.getErrata());
|
||||
errataInfo.put("recent", recentErrata);
|
||||
|
||||
String json = JsonUtils.Serialize(errataInfo);
|
||||
|
||||
responseWriter.writeJsonResponse(json);
|
||||
}
|
||||
|
||||
@@ -6,9 +6,12 @@
|
||||
//$("#errata-readout").text(JSON.stringify(json, null, 2));
|
||||
var top = $("<div style='display:flex; flex-direction:column; gap:20px; justify-content:center; align-items:center;'></div>");
|
||||
|
||||
var results = {};
|
||||
for(var bp in json) {
|
||||
var info = json[bp];
|
||||
var bot = $("<div style='display:flex; flex-direction:column; gap:20px; justify-content:center; align-items:center;'></div>");
|
||||
|
||||
var recentResults = {};
|
||||
var allResults = {};
|
||||
for(var bp in json.all) {
|
||||
var info = json.all[bp];
|
||||
var eid = info.ErrataIDs.PC;
|
||||
var text = info.LinkText;
|
||||
text = text.replace(eid, bp + "," + eid);
|
||||
@@ -19,42 +22,90 @@
|
||||
var setID = parseInt(parts[0]);
|
||||
var cardID = parseInt(parts[1]);
|
||||
|
||||
if(setID in results) {
|
||||
results[setID][cardID] = text;
|
||||
if(setID in allResults) {
|
||||
allResults[setID][cardID] = text;
|
||||
}
|
||||
else {
|
||||
results[setID] = {};
|
||||
results[setID][cardID] = text;
|
||||
allResults[setID] = {};
|
||||
allResults[setID][cardID] = text;
|
||||
}
|
||||
}
|
||||
//debugger;
|
||||
var collator = new Intl.Collator(undefined, {numeric: true, sensitivity: 'base'});
|
||||
var sets = Object.keys(results).sort(collator.compare);
|
||||
|
||||
for(var set in sets) {
|
||||
var setdiv = $("<div style='display:flex; flex-direction:column; gap:10px; flex-wrap: wrap; width:70%; row-gap:10px; column-gap:30px; '></div>");
|
||||
top.append($("<div style='margin:auto; font-size: 140%; position:relative; top:20px; bottom:10px;'>Set " + sets[set] + "</div>"));
|
||||
for(var bp in json.recent) {
|
||||
var info = json.recent[bp];
|
||||
var eid = info.ErrataIDs.PC;
|
||||
var text = info.LinkText;
|
||||
text = text.replace(eid, bp + "," + eid);
|
||||
//console.log(text);
|
||||
//result.append(text);
|
||||
|
||||
var parts = bp.split("_");
|
||||
var setID = parseInt(parts[0]);
|
||||
var cardID = parseInt(parts[1]);
|
||||
|
||||
if(setID in recentResults) {
|
||||
recentResults[setID][cardID] = text;
|
||||
}
|
||||
else {
|
||||
recentResults[setID] = {};
|
||||
recentResults[setID][cardID] = text;
|
||||
}
|
||||
}
|
||||
debugger;
|
||||
var collator = new Intl.Collator(undefined, {numeric: true, sensitivity: 'base'});
|
||||
var recentSets = Object.keys(recentResults).sort(collator.compare);
|
||||
var allSets = Object.keys(allResults).sort(collator.compare);
|
||||
|
||||
for(let set in recentSets) {
|
||||
let setdiv = $("<div style='display:flex; flex-direction:column; gap:10px; flex-wrap: wrap; width:70%; row-gap:10px; column-gap:30px; '></div>");
|
||||
top.append($("<div style='margin:auto; font-size: 140%; position:relative; top:20px; bottom:10px;'>Set " + recentSets[set] + "</div>"));
|
||||
|
||||
//(# * 28) / 2
|
||||
//debugger;
|
||||
var cards = Object.keys(results[sets[set]]).sort(collator.compare);
|
||||
for(var card in cards) {
|
||||
var cardspan = $("<span></span>");
|
||||
let cards = Object.keys(recentResults[recentSets[set]]).sort(collator.compare);
|
||||
for(let card in cards) {
|
||||
let cardspan = $("<span></span>");
|
||||
|
||||
var html = results[sets[set]][cards[card]];
|
||||
cardspan.append(results[sets[set]][cards[card]]);
|
||||
let html = recentResults[recentSets[set]][cards[card]];
|
||||
cardspan.append(html);
|
||||
|
||||
setdiv.append(cardspan);
|
||||
}
|
||||
|
||||
|
||||
setdiv.css({"height": "" + (((cards.length * 28) / 1.8) + 30) + "px"});
|
||||
setdiv.css({"height": "" + (((cards.length * 29) / 1.8) + 30) + "px"});
|
||||
|
||||
top.append(setdiv);
|
||||
}
|
||||
|
||||
debugger;
|
||||
for(let set in allSets) {
|
||||
let setdiv = $("<div style='display:flex; flex-direction:column; gap:10px; flex-wrap: wrap; width:70%; row-gap:10px; column-gap:30px; '></div>");
|
||||
bot.append($("<div style='margin:auto; font-size: 140%; position:relative; top:20px; bottom:10px;'>Set " + allSets[set] + "</div>"));
|
||||
|
||||
//(# * 28) / 2
|
||||
//debugger;
|
||||
let cards = Object.keys(allResults[allSets[set]]).sort(collator.compare);
|
||||
for(let card in cards) {
|
||||
let cardspan = $("<span></span>");
|
||||
|
||||
let html = allResults[allSets[set]][cards[card]];
|
||||
cardspan.append(html);
|
||||
|
||||
setdiv.append(cardspan);
|
||||
}
|
||||
|
||||
|
||||
setdiv.css({"height": "" + (((cards.length * 29) / 1.8) + 30) + "px"});
|
||||
|
||||
bot.append(setdiv);
|
||||
}
|
||||
console.log(bot);
|
||||
$("#all-errata-readout").html(bot);
|
||||
|
||||
console.log(top);
|
||||
$("#recent-errata-readout").html(top);
|
||||
|
||||
$("#errata-readout").html(top);
|
||||
}, hall.hallErrorMap());
|
||||
}
|
||||
);
|
||||
@@ -66,12 +117,13 @@
|
||||
<p>
|
||||
Each of the released errata have had a full writeup on the PC's thoughts and justifications <a href="https://wiki.lotrtcgpc.net/wiki/PC_Errata">here on the LOTR-TCG wiki</a>.
|
||||
</p>
|
||||
<p>
|
||||
Cards on the <a href="https://docs.google.com/document/d/1ECobwVqgpQtUUEN4drxyvHntp1GX91WNaHcfAWjlHeQ/edit#">Errata Probation List can be viewed here</a>. If you have suggestions for errata, please bring it up on the <a href="https://discord.com/channels/699957633121255515/1047679707728060617">#errata forum on the PC Discord</a>.
|
||||
</p>
|
||||
<p>
|
||||
Below you can find a quick reference allowing you to quickly compare released errata.
|
||||
</p>
|
||||
<div id="errata-readout" />
|
||||
<h1>Recent Errata</h1>
|
||||
<div id="recent-errata-readout"></div>
|
||||
|
||||
<h1>All PC Errata</h1>
|
||||
<div id="all-errata-readout"></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -38,7 +38,7 @@ var chat;
|
||||
var bpid = ids[i];
|
||||
var card = new Card(bpid, "SPECIAL", "hint", "");
|
||||
horiz = horiz || card.horizontal;
|
||||
floatCardDiv.append(createFullCardDiv(card.imageUrl, card.foil, card.horizontal));
|
||||
floatCardDiv.append(Card.CreateFullCardDiv(card.imageUrl, null, card.foil, card.horizontal));
|
||||
}
|
||||
|
||||
infoDialog.append(floatCardDiv);
|
||||
|
||||
@@ -128,10 +128,9 @@
|
||||
hall: false
|
||||
# Fill this up with the current batch of errata for it to show up on the playtest server.
|
||||
valid: [
|
||||
"0_56", "0_57", "0_58", "0_59", "0_60",
|
||||
"51_50", "51_63", "51_303", "51_310",
|
||||
"52_76", "52_85", "52_104", "52_110",
|
||||
"54_7", "54_8", "54_14", "54_20", "54_25", "54_50", "54_80", "54_85", "54_103",
|
||||
"53_7", "53_8", "53_14", "53_20", "53_25", "53_50", "53_80", "53_85", "53_103",
|
||||
"54_65", "54_67", "54_68", "54_71", "54_76", "54_78", "54_80", "54_81", "54_85", "54_86", "54_245", "54_276", "54_280", "54_289",
|
||||
"55_7", "55_10", "55_13", "55_50", "55_85", "55_86", "55_92", "55_121",
|
||||
"56_22", "56_23",
|
||||
|
||||
@@ -96,6 +96,7 @@ public class JSONDefs {
|
||||
public String getPCErrata() {
|
||||
return ErrataIDs.get(PC_Errata);
|
||||
}
|
||||
public void addPCErrata(String errataBP) { ErrataIDs.put(PC_Errata, errataBP); }
|
||||
}
|
||||
|
||||
public static class PlayHistoryStats {
|
||||
|
||||
@@ -310,7 +310,7 @@ public class LotroCardBlueprintLibrary {
|
||||
int setID = Integer.parseInt(parts[0]);
|
||||
String cardID = parts[1];
|
||||
JSONDefs.ErrataInfo card = null;
|
||||
String base = id;
|
||||
String base;
|
||||
if (setID >= 50 && setID <= 69) {
|
||||
base = "" + (setID - 50) + "_" + cardID;
|
||||
} else if (setID >= 70 && setID <= 89) {
|
||||
@@ -339,7 +339,7 @@ public class LotroCardBlueprintLibrary {
|
||||
|
||||
}
|
||||
|
||||
card.ErrataIDs.put(JSONDefs.ErrataInfo.PC_Errata, id);
|
||||
card.addPCErrata(id);
|
||||
}
|
||||
|
||||
collectionReady.release();
|
||||
|
||||
@@ -78,4 +78,5 @@ public interface LotroFormat {
|
||||
Adventure getAdventure();
|
||||
JSONDefs.Format Serialize();
|
||||
void generateBlockFilter(Map<String, LotroFormat> allFormats, Map<String, SetDefinition> allSets);
|
||||
Map<String, JSONDefs.ErrataInfo> getRecentErrata();
|
||||
}
|
||||
|
||||
@@ -168,11 +168,11 @@ public class GameUtils {
|
||||
if(override == null || override.isEmpty()) {
|
||||
override = culture.toString().toLowerCase();
|
||||
}
|
||||
return "<span class='cultureHint' ><img src='images/cultures/" + override + ".png'></span>";
|
||||
return "<span class='cultureHint' ><img src='images/cultures/" + override + ".png'/></span>";
|
||||
}
|
||||
|
||||
public static String getCultureImage(Culture culture) {
|
||||
return "<span class='cultureHint' value='" + culture.toString() + "'><img src='images/cultures/" + culture.toString().toLowerCase() + ".png'> "
|
||||
return "<span class='cultureHint' value='" + culture.toString() + "'><img src='images/cultures/" + culture.toString().toLowerCase() + ".png'/> "
|
||||
+ culture.getHumanReadable() + "</span>";
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ public class GameUtils {
|
||||
for (PhysicalCard card : cards)
|
||||
sb.append(GameUtils.getFullName(card) + ", ");
|
||||
|
||||
if (sb.length() == 0)
|
||||
if (sb.isEmpty())
|
||||
return "none";
|
||||
else
|
||||
return sb.substring(0, sb.length() - 2);
|
||||
|
||||
@@ -48,6 +48,7 @@ public class DefaultLotroFormat implements LotroFormat {
|
||||
|
||||
private final List<String> _blockDefs = new ArrayList<>();
|
||||
private final List<JSONDefs.BlockFilter> _blockFilters = new ArrayList<>();
|
||||
private final Map<String, JSONDefs.ErrataInfo> _recentErrataInfo;
|
||||
|
||||
|
||||
public DefaultLotroFormat(AdventureLibrary adventureLibrary, LotroCardBlueprintLibrary library, JSONDefs.Format def) throws InvalidPropertiesFormatException{
|
||||
@@ -96,6 +97,36 @@ public class DefaultLotroFormat implements LotroFormat {
|
||||
|
||||
if(def.blocks != null)
|
||||
this._blockDefs.addAll(def.blocks);
|
||||
|
||||
_recentErrataInfo = new HashMap<>();
|
||||
|
||||
if(_code.equals("pc_errata")) {
|
||||
for(String errata : _validCards) {
|
||||
var split = errata.split("_");
|
||||
String base = _library.getErrataBase(split[0]) + "_" + split[1];
|
||||
|
||||
try {
|
||||
var basecard = _library.getLotroCardBlueprint(base);
|
||||
var info = new JSONDefs.ErrataInfo();
|
||||
info.BaseID = base;
|
||||
info.Name = GameUtils.getFullName(_library.getLotroCardBlueprint(base));
|
||||
info.LinkText = GameUtils.getDeluxeCardLink(errata, basecard);
|
||||
info.ErrataIDs = new HashMap<>();
|
||||
info.addPCErrata(errata);
|
||||
_recentErrataInfo.put(base, info);
|
||||
}
|
||||
catch(CardNotFoundException ignored) {
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, JSONDefs.ErrataInfo> getRecentErrata() {
|
||||
return _recentErrataInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user