Move Booster Box to Editions File

This commit is contained in:
friarsol
2021-02-19 23:37:48 -05:00
parent 77a14c7d71
commit 846e89e522
18 changed files with 37 additions and 160 deletions

View File

@@ -149,6 +149,7 @@ public class StaticData {
}
}
// TODO Remove these in favor of them being associated to the Edition
/** @return {@link forge.util.storage.IStorage}<{@link forge.item.SealedProduct.Template}> */
public IStorage<FatPack.Template> getFatPacks() {
if (fatPacks == null)
@@ -156,12 +157,6 @@ public class StaticData {
return fatPacks;
}
public IStorage<BoosterBox.Template> getBoosterBoxes() {
if (boosterBoxes == null)
boosterBoxes = new StorageBase<>("Booster boxes", new BoosterBox.Template.Reader(blockDataFolder + "boosterboxes.txt"));
return boosterBoxes;
}
/** @return {@link forge.util.storage.IStorage}<{@link forge.item.SealedProduct.Template}> */
public final IStorage<SealedProduct.Template> getTournamentPacks() {
if (tournaments == null)

View File

@@ -143,20 +143,26 @@ public final class CardEdition implements Comparable<CardEdition> { // immutable
private Type type;
private String name;
private String alias = null;
private String prerelease = null;
private boolean whiteBorder = false;
// SealedProduct
private String prerelease = null;
private int boosterBoxCount = 36;
// Booster/draft info
private boolean smallSetOverride = false;
private boolean foilAlwaysInCommonSlot = false;
private FoilType foilType = FoilType.NOT_SUPPORTED;
private double foilChanceInBooster = 0;
private boolean foilAlwaysInCommonSlot = false;
private double chanceReplaceCommonWith = 0;
private String slotReplaceCommonWith = "Common";
private String additionalSheetForFoils = "";
private String additionalUnlockSet = "";
private boolean smallSetOverride = false;
private String boosterMustContain = "";
private String boosterReplaceSlotFromPrintSheet = "";
private String[] chaosDraftThemes = new String[0];
private String doublePickDuringDraft = "";
private String[] chaosDraftThemes = new String[0];
private final ListMultimap<String, CardInSet> cardMap;
private final Map<String, Integer> tokenNormalized;
// custom print sheets that will be loaded lazily
@@ -220,7 +226,10 @@ public final class CardEdition implements Comparable<CardEdition> { // immutable
public Type getType() { return type; }
public String getName() { return name; }
public String getAlias() { return alias; }
public String getPrerelease() { return prerelease; }
public int getBoosterBoxCount() { return boosterBoxCount; }
public FoilType getFoilType() { return foilType; }
public double getFoilChanceInBooster() { return foilChanceInBooster; }
public boolean getFoilAlwaysInCommonSlot() { return foilAlwaysInCommonSlot; }
@@ -448,6 +457,7 @@ public final class CardEdition implements Comparable<CardEdition> { // immutable
}
res.type = enumType;
res.prerelease = section.get("Prerelease", null);
res.boosterBoxCount = Integer.parseInt(section.get("BoosterBox", "36"));
switch(section.get("foil", "newstyle").toLowerCase()) {
case "notsupported":
@@ -671,7 +681,7 @@ public final class CardEdition implements Comparable<CardEdition> { // immutable
private static class CanMakeBoosterBox implements Predicate<CardEdition> {
@Override
public boolean apply(final CardEdition subject) {
return StaticData.instance().getBoosterBoxes().contains(subject.getCode());
return subject.getBoosterBoxCount() > 0;
}
}

View File

@@ -36,7 +36,10 @@ public class BoosterBox extends BoxedProduct {
public static final Function<CardEdition, BoosterBox> FN_FROM_SET = new Function<CardEdition, BoosterBox>() {
@Override
public BoosterBox apply(final CardEdition arg1) {
BoosterBox.Template d = StaticData.instance().getBoosterBoxes().get(arg1.getCode());
if (arg1.getBoosterBoxCount() <= 0) {
return null;
}
BoosterBox.Template d = new Template(arg1);
if (d == null) { return null; }
return new BoosterBox(arg1.getName(), d, d.cntBoosters);
}
@@ -72,40 +75,13 @@ public class BoosterBox extends BoxedProduct {
public static class Template extends SealedProduct.Template {
private final int cntBoosters;
public int getCntBoosters() { return cntBoosters; }
private Template(String edition, int boosters, Iterable<Pair<String, Integer>> itrSlots)
{
super(edition, itrSlots);
cntBoosters = boosters;
private Template(CardEdition edition) {
super(edition.getCode(), new ArrayList<>());
cntBoosters = edition.getBoosterBoxCount();
}
public static final class Reader extends StorageReaderFile<Template> {
public Reader(String pathname) {
super(pathname, FN_GET_NAME);
}
@Override
protected Template read(String line, int i) {
String[] headAndData = TextUtil.split(line, ':', 2);
final String edition = headAndData[0];
final String[] data = TextUtil.splitWithParenthesis(headAndData[1], ',');
int nBoosters = 6;
List<Pair<String, Integer>> slots = new ArrayList<>();
for(String slotDesc : data) {
String[] kv = TextUtil.split(slotDesc, ' ', 2);
if (kv[1].startsWith("Booster"))
nBoosters = Integer.parseInt(kv[0]);
else
slots.add(ImmutablePair.of(kv[1], Integer.parseInt(kv[0])));
}
return new BoosterBox.Template(edition, nBoosters, slots);
}
}
@Override
public String toString() {
if (0 >= cntBoosters) {

View File

@@ -1,118 +0,0 @@
LEA: 36 Boosters
LEB: 36 Boosters
2ED: 36 Boosters
ARN: 60 Boosters
3ED: 36 Boosters
ATQ: 60 Boosters
LEG: 36 Boosters
DRK: 60 Boosters
FEM: 60 Boosters
4ED: 36 Boosters
CHR: 45 Boosters
HML: 60 Boosters
ICE: 36 Boosters
ALL: 45 Boosters
MIR: 36 Boosters
VIS: 36 Boosters
5ED: 36 Boosters
WTH: 36 Boosters
TMP: 36 Boosters
STH: 36 Boosters
EXO: 36 Boosters
USG: 36 Boosters
ULG: 36 Boosters
6ED: 36 Boosters
UDS: 36 Boosters
MMQ: 36 Boosters
NMS: 36 Boosters
PCY: 36 Boosters
INV: 36 Boosters
PLS: 36 Boosters
7ED: 36 Boosters
APC: 36 Boosters
ODY: 36 Boosters
TOR: 36 Boosters
JUD: 36 Boosters
ONS: 36 Boosters
LGN: 36 Boosters
SCG: 36 Boosters
8ED: 36 Boosters
MRD: 36 Boosters
DST: 36 Boosters
5DN: 36 Boosters
CHK: 36 Boosters
BOK: 36 Boosters
SOK: 36 Boosters
9ED: 36 Boosters
RAV: 36 Boosters
GPT: 36 Boosters
DIS: 36 Boosters
CSP: 36 Boosters
TSP: 36 Boosters
PLC: 36 Boosters
FUT: 36 Boosters
10E: 36 Boosters
LRW: 36 Boosters
MOR: 36 Boosters
SHM: 36 Boosters
EVE: 36 Boosters
ALA: 36 Boosters
CFX: 36 Boosters
ARB: 36 Boosters
M10: 36 Boosters
ZEN: 36 Boosters
WWK: 36 Boosters
ROE: 36 Boosters
M11: 36 Boosters
SOM: 36 Boosters
MBS: 36 Boosters
NPH: 36 Boosters
M12: 36 Boosters
ISD: 36 Boosters
DKA: 36 Boosters
AVR: 36 Boosters
M13: 36 Boosters
RTR: 36 Boosters
GTC: 36 Boosters
DGM: 36 Boosters
MMA: 24 Boosters
M14: 36 Boosters
THS: 36 Boosters
CNS: 36 Boosters
BNG: 36 Boosters
JOU: 36 Boosters
M15: 36 Boosters
KTK: 36 Boosters
FRF: 36 Boosters
DTK: 36 Boosters
MM2: 24 Boosters
ORI: 36 Boosters
BFZ: 36 Boosters
OGW: 36 Boosters
SOI: 36 Boosters
EMN: 36 Boosters
CN2: 36 Boosters
KLD: 36 Boosters
AER: 36 Boosters
MM3: 24 Boosters
AKH: 36 Boosters
HOU: 36 Boosters
XLN: 36 Boosters
RIX: 36 Boosters
A25: 24 Boosters
DOM: 36 Boosters
BBD: 36 Boosters
M19: 36 Boosters
GRN: 36 Boosters
UMA: 24 Boosters
RNA: 36 Boosters
WAR: 36 Boosters
MH1: 36 Boosters
M20: 36 Boosters
ELD: 36 Boosters
THB: 36 Boosters
MB1: 24 Boosters
IKO: 36 Boosters
M21: 36 Boosters
ZNR: 36 Boosters
KHM: 36 Boosters

View File

@@ -7,6 +7,7 @@ MciCode=ai
Type=Expansion
BoosterCovers=1
Booster=8 Common, 3 Uncommon, 1 Rare
BoosterBox=45
Foil=NotSupported
[cards]

View File

@@ -7,6 +7,7 @@ MciCode=aq
Type=Expansion
BoosterCovers=1
Booster=6 Common, 2 UncommonRare
BoosterBox=60
Foil=NotSupported
[cards]

View File

@@ -7,6 +7,7 @@ MciCode=an
Type=Expansion
BoosterCovers=1
Booster=6 Common, 2 UncommonRare
BoosterBox=60
Foil=NotSupported
[cards]

View File

@@ -8,6 +8,7 @@ Type=Reprint
Border=White
BoosterCovers=1
Booster=9 Common, 3 UncommonRare
BoosterBox=45
Foil=NotSupported
[cards]

View File

@@ -6,6 +6,7 @@ Code2=COM
Alias=CMD
MciCode=cmd
Type=Other
BoosterBox=0
[cards]
39 C AEthersnipe

View File

@@ -7,6 +7,7 @@ MciCode=fe
Type=Expansion
BoosterCovers=1
Booster=5 Common, 2 Uncommon, 1 Rare
BoosterBox=60
Foil=NotSupported
[cards]

View File

@@ -7,6 +7,7 @@ MciCode=hl
Type=Expansion
BoosterCovers=1
Booster=6 Common, 2 UncommonRare
BoosterBox=60
Foil=NotSupported
[cards]

View File

@@ -6,6 +6,7 @@ MciCode=a25
Type=Reprint
BoosterCovers=3
Booster=11 Common, 3 Uncommon, 1 RareMythic
BoosterBox=24
FoilChanceInBooster=100
ChaosDraftThemes=MASTERS_SET

View File

@@ -7,6 +7,7 @@ MciCode=mh1
Type=Other
BoosterCovers=5
Booster=10 Common:!fromSheet("MH1 Secret Cards"), 3 Uncommon:!fromSheet("MH1 Secret Cards"), 1 RareMythic:!fromSheet("MH1 Secret Cards"), 1 fromSheet("MH1 Lands")
BoosterBox=24
ChaosDraftThemes=MASTERS_SET;GRAVEYARD_MATTERS

View File

@@ -6,6 +6,7 @@ MciCode=mm2
Type=Reprint
BoosterCovers=3
Booster=11 Common, 3 Uncommon, 1 RareMythic
BoosterBox=24
FoilChanceInBooster=100
ChaosDraftThemes=MASTERS_SET

View File

@@ -6,6 +6,7 @@ MciCode=mm3
Type=Reprint
BoosterCovers=3
Booster=11 Common, 3 Uncommon, 1 RareMythic
BoosterBox=24
FoilChanceInBooster=100
ChaosDraftThemes=MASTERS_SET;GRAVEYARD_MATTERS

View File

@@ -6,6 +6,7 @@ MciCode=mma
Type=Reprint
BoosterCovers=3
Booster=11 Common, 3 Uncommon, 1 RareMythic
BoosterBox=24
FoilChanceInBooster=100
ChaosDraftThemes=MASTERS_SET

View File

@@ -7,6 +7,7 @@ MciCode=dk
Type=Expansion
BoosterCovers=1
Booster=6 Common, 2 UncommonRare
BoosterBox=60
Foil=NotSupported
[cards]

View File

@@ -7,6 +7,7 @@ MciCode=uma
Type=Reprint
BoosterCovers=3
Booster=11 Common, 3 Uncommon, 1 RareMythic
BoosterBox=24
FoilChanceInBooster=100
ChaosDraftThemes=MASTERS_SET;GRAVEYARD_MATTERS