mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
Fix so FatPacks load
Fix references to non-existant quest icon files
This commit is contained in:
@@ -56,7 +56,7 @@ public class StaticData {
|
|||||||
this.boosters = new StorageBase<SealedProduct.Template>("Boosters", editions.getBoosterGenerator());
|
this.boosters = new StorageBase<SealedProduct.Template>("Boosters", editions.getBoosterGenerator());
|
||||||
this.specialBoosters = new StorageBase<SealedProduct.Template>("Special boosters", new SealedProduct.Template.Reader(new File(blockDataFolder, "boosters-special.txt")));
|
this.specialBoosters = new StorageBase<SealedProduct.Template>("Special boosters", new SealedProduct.Template.Reader(new File(blockDataFolder, "boosters-special.txt")));
|
||||||
this.tournaments = new StorageBase<SealedProduct.Template>("Starter sets", new SealedProduct.Template.Reader(new File(blockDataFolder, "starters.txt")));
|
this.tournaments = new StorageBase<SealedProduct.Template>("Starter sets", new SealedProduct.Template.Reader(new File(blockDataFolder, "starters.txt")));
|
||||||
this.fatPacks = new StorageBase<FatPack.Template>("Fat packs", new FatPack.Template.Reader("res/blockdata/fatpacks.txt"));
|
this.fatPacks = new StorageBase<FatPack.Template>("Fat packs", new FatPack.Template.Reader(blockDataFolder + "fatpacks.txt"));
|
||||||
this.printSheets = new StorageBase<PrintSheet>("Special print runs", new PrintSheet.Reader(new File(blockDataFolder, "printsheets.txt")));
|
this.printSheets = new StorageBase<PrintSheet>("Special print runs", new PrintSheet.Reader(new File(blockDataFolder, "printsheets.txt")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -79,8 +79,9 @@ public final class CardDb implements ICardDatabase {
|
|||||||
|
|
||||||
public static CardRequest fromString(String name) {
|
public static CardRequest fromString(String name) {
|
||||||
boolean isFoil = name.endsWith(foilSuffix);
|
boolean isFoil = name.endsWith(foilSuffix);
|
||||||
if( isFoil )
|
if (isFoil) {
|
||||||
name = name.substring(0, name.length() - foilSuffix.length());
|
name = name.substring(0, name.length() - foilSuffix.length());
|
||||||
|
}
|
||||||
|
|
||||||
String[] nameParts = TextUtil.split(name, NameSetSeparator);
|
String[] nameParts = TextUtil.split(name, NameSetSeparator);
|
||||||
|
|
||||||
@@ -95,8 +96,9 @@ public final class CardDb implements ICardDatabase {
|
|||||||
|
|
||||||
int artIndex = artPos > 0 ? Integer.parseInt(nameParts[artPos]) : 0;
|
int artIndex = artPos > 0 ? Integer.parseInt(nameParts[artPos]) : 0;
|
||||||
String setName = setPos > 0 ? nameParts[setPos] : null;
|
String setName = setPos > 0 ? nameParts[setPos] : null;
|
||||||
if( "???".equals(setName) )
|
if ("???".equals(setName)) {
|
||||||
setName = null;
|
setName = null;
|
||||||
|
}
|
||||||
|
|
||||||
return new CardRequest(cardName, setName, artIndex, isFoil);
|
return new CardRequest(cardName, setName, artIndex, isFoil);
|
||||||
}
|
}
|
||||||
@@ -109,8 +111,9 @@ public final class CardDb implements ICardDatabase {
|
|||||||
List<String> missingCards = new ArrayList<String>();
|
List<String> missingCards = new ArrayList<String>();
|
||||||
for (CardEdition e : editions.getOrderedEditions()) {
|
for (CardEdition e : editions.getOrderedEditions()) {
|
||||||
boolean isCoreExpSet = e.getType() == CardEdition.Type.CORE || e.getType() == CardEdition.Type.EXPANSION || e.getType() == CardEdition.Type.REPRINT;
|
boolean isCoreExpSet = e.getType() == CardEdition.Type.CORE || e.getType() == CardEdition.Type.EXPANSION || e.getType() == CardEdition.Type.REPRINT;
|
||||||
if(logMissingPerEdition && isCoreExpSet)
|
if (logMissingPerEdition && isCoreExpSet) {
|
||||||
System.out.print(e.getName() + " (" + e.getCards().length + " cards)");
|
System.out.print(e.getName() + " (" + e.getCards().length + " cards)");
|
||||||
|
}
|
||||||
String lastCardName = null;
|
String lastCardName = null;
|
||||||
int artIdx = 1;
|
int artIdx = 1;
|
||||||
for (CardEdition.CardInSet cis : e.getCards()) {
|
for (CardEdition.CardInSet cis : e.getCards()) {
|
||||||
@@ -121,21 +124,25 @@ public final class CardDb implements ICardDatabase {
|
|||||||
lastCardName = cis.name;
|
lastCardName = cis.name;
|
||||||
}
|
}
|
||||||
CardRules cr = rulesByName.get(lastCardName);
|
CardRules cr = rulesByName.get(lastCardName);
|
||||||
if( cr != null )
|
if (cr != null) {
|
||||||
addCard(new PaperCard(cr, e.getCode(), cis.rarity, artIdx));
|
addCard(new PaperCard(cr, e.getCode(), cis.rarity, artIdx));
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
missingCards.add(cis.name);
|
missingCards.add(cis.name);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (isCoreExpSet && logMissingPerEdition) {
|
if (isCoreExpSet && logMissingPerEdition) {
|
||||||
if(missingCards.isEmpty())
|
if (missingCards.isEmpty()) {
|
||||||
System.out.println(" ... 100% ");
|
System.out.println(" ... 100% ");
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
int missing = (e.getCards().length - missingCards.size()) * 10000 / e.getCards().length;
|
int missing = (e.getCards().length - missingCards.size()) * 10000 / e.getCards().length;
|
||||||
System.out.printf(" ... %.2f%% (%s missing: %s)%n", missing * 0.01f, Lang.nounWithAmount(missingCards.size(), "card"), StringUtils.join(missingCards, " | "));
|
System.out.printf(" ... %.2f%% (%s missing: %s)%n", missing * 0.01f, Lang.nounWithAmount(missingCards.size(), "card"), StringUtils.join(missingCards, " | "));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( isCoreExpSet && logMissingSummary )
|
if (isCoreExpSet && logMissingSummary) {
|
||||||
allMissingCards.addAll(missingCards);
|
allMissingCards.addAll(missingCards);
|
||||||
|
}
|
||||||
missingCards.clear();
|
missingCards.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,8 +151,7 @@ public final class CardDb implements ICardDatabase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (CardRules cr : rulesByName.values()) {
|
for (CardRules cr : rulesByName.values()) {
|
||||||
if( !allCardsByName.containsKey(cr.getName()) )
|
if (!allCardsByName.containsKey(cr.getName())) {
|
||||||
{
|
|
||||||
System.err.println("The card " + cr.getName() + " was not assigned to any set. Adding it to UNKNOWN set... to fix see res/cardeditions/ folder. ");
|
System.err.println("The card " + cr.getName() + " was not assigned to any set. Adding it to UNKNOWN set... to fix see res/cardeditions/ folder. ");
|
||||||
addCard(new PaperCard(cr, CardEdition.UNKNOWN.getCode(), CardRarity.Special, 1));
|
addCard(new PaperCard(cr, CardEdition.UNKNOWN.getCode(), CardRarity.Special, 1));
|
||||||
}
|
}
|
||||||
@@ -176,24 +182,27 @@ public final class CardDb implements ICardDatabase {
|
|||||||
@Override
|
@Override
|
||||||
public PaperCard getCard(final String cardName, String setName) {
|
public PaperCard getCard(final String cardName, String setName) {
|
||||||
CardRequest request = CardRequest.fromString(cardName);
|
CardRequest request = CardRequest.fromString(cardName);
|
||||||
if(setName != null)
|
if (setName != null) {
|
||||||
request.edition = setName;
|
request.edition = setName;
|
||||||
|
}
|
||||||
return tryGetCard(request);
|
return tryGetCard(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PaperCard getCard(final String cardName, String setName, int artIndex) {
|
public PaperCard getCard(final String cardName, String setName, int artIndex) {
|
||||||
CardRequest request = CardRequest.fromString(cardName);
|
CardRequest request = CardRequest.fromString(cardName);
|
||||||
if(setName != null)
|
if (setName != null) {
|
||||||
request.edition = setName;
|
request.edition = setName;
|
||||||
if(artIndex > 0)
|
}
|
||||||
|
if (artIndex > 0) {
|
||||||
request.artIndex = artIndex;
|
request.artIndex = artIndex;
|
||||||
|
}
|
||||||
return tryGetCard(request);
|
return tryGetCard(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
private PaperCard tryGetCard(CardRequest request) {
|
private PaperCard tryGetCard(CardRequest request) {
|
||||||
Collection<PaperCard> cards = allCardsByName.get(request.cardName);
|
Collection<PaperCard> cards = allCardsByName.get(request.cardName);
|
||||||
if ( null == cards ) return null;
|
if (null == cards) { return null; }
|
||||||
|
|
||||||
PaperCard result = null;
|
PaperCard result = null;
|
||||||
|
|
||||||
@@ -211,8 +220,9 @@ public final class CardDb implements ICardDatabase {
|
|||||||
candidates.add(pc);
|
candidates.add(pc);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (candidates.isEmpty())
|
if (candidates.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
result = Aggregates.random(candidates);
|
result = Aggregates.random(candidates);
|
||||||
} else {
|
} else {
|
||||||
for (PaperCard pc : cards) {
|
for (PaperCard pc : cards) {
|
||||||
@@ -222,7 +232,7 @@ public final class CardDb implements ICardDatabase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( result == null ) return null;
|
if (result == null) { return null; }
|
||||||
|
|
||||||
return request.isFoil ? getFoiled(result) : result;
|
return request.isFoil ? getFoiled(result) : result;
|
||||||
}
|
}
|
||||||
@@ -267,12 +277,14 @@ public final class CardDb implements ICardDatabase {
|
|||||||
for (int i = 0 ; i < sz ; i++) {
|
for (int i = 0 ; i < sz ; i++) {
|
||||||
PaperCard pc = cards.get(i);
|
PaperCard pc = cards.get(i);
|
||||||
CardEdition ed = editions.get(pc.getEdition());
|
CardEdition ed = editions.get(pc.getEdition());
|
||||||
if(fromSet != null && !fromSet.accept(ed))
|
if (fromSet != null && !fromSet.accept(ed)) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if ((artIndex < 0 || pc.getArtIndex() == artIndex) && (printedBefore == null || ed.getDate().before(printedBefore))) {
|
if ((artIndex < 0 || pc.getArtIndex() == artIndex) && (printedBefore == null || ed.getDate().before(printedBefore))) {
|
||||||
if( fromSet == SetPreference.LatestCoreExp || fromSet == SetPreference.Latest )
|
if (fromSet == SetPreference.LatestCoreExp || fromSet == SetPreference.Latest) {
|
||||||
return pc;
|
return pc;
|
||||||
|
}
|
||||||
return cards.get(i + MyRandom.getRandom().nextInt(sz-i));
|
return cards.get(i + MyRandom.getRandom().nextInt(sz-i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -360,9 +372,11 @@ public final class CardDb implements ICardDatabase {
|
|||||||
@Override
|
@Override
|
||||||
public boolean apply(final PaperCard subject) {
|
public boolean apply(final PaperCard subject) {
|
||||||
Collection<PaperCard> cc = allCardsByName.get(subject.getName());
|
Collection<PaperCard> cc = allCardsByName.get(subject.getName());
|
||||||
for(PaperCard c : cc)
|
for (PaperCard c : cc) {
|
||||||
if (sets.contains(c.getEdition()))
|
if (sets.contains(c.getEdition())) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -416,16 +430,19 @@ public final class CardDb implements ICardDatabase {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
cE = CardEdition.UNKNOWN;
|
cE = CardEdition.UNKNOWN;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Write to log that attempt,
|
// Write to log that attempt,
|
||||||
if (cR == CardRarity.Unknown )
|
if (cR == CardRarity.Unknown) {
|
||||||
System.err.println(String.format("An unknown card found when loading Forge decks: \"%s\" Forge does not know of such a card's existence. Have you mistyped the card name?", cardName));
|
System.err.println(String.format("An unknown card found when loading Forge decks: \"%s\" Forge does not know of such a card's existence. Have you mistyped the card name?", cardName));
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
System.err.println(String.format("An unsupported card was requested: \"%s\" from \"%s\" set. We're sorry, but you cannot use this card yet.", request.cardName, cE.getName()));
|
System.err.println(String.format("An unsupported card was requested: \"%s\" from \"%s\" set. We're sorry, but you cannot use this card yet.", request.cardName, cE.getName()));
|
||||||
|
}
|
||||||
|
|
||||||
return new PaperCard(CardRules.getUnsupportedCardNamed(request.cardName), cE.getCode(), cR, 1);
|
return new PaperCard(CardRules.getUnsupportedCardNamed(request.cardName), cE.getCode(), cR, 1);
|
||||||
|
|
||||||
@@ -453,8 +470,9 @@ public final class CardDb implements ICardDatabase {
|
|||||||
for (CardEdition e : editions.getOrderedEditions()) {
|
for (CardEdition e : editions.getOrderedEditions()) {
|
||||||
int artIdx = 1;
|
int artIdx = 1;
|
||||||
for (CardInSet cis : e.getCards()) {
|
for (CardInSet cis : e.getCards()) {
|
||||||
if( !cis.name.equals(cardName) )
|
if (!cis.name.equals(cardName)) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
paperCards.add(new PaperCard(rules, e.getCode(), cis.rarity, artIdx++));
|
paperCards.add(new PaperCard(rules, e.getCode(), cis.rarity, artIdx++));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -467,21 +485,23 @@ public final class CardDb implements ICardDatabase {
|
|||||||
lastEdition = tuple.getKey();
|
lastEdition = tuple.getKey();
|
||||||
}
|
}
|
||||||
CardEdition ed = editions.get(lastEdition);
|
CardEdition ed = editions.get(lastEdition);
|
||||||
if(null == ed)
|
if (null == ed) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
paperCards.add(new PaperCard(rules, lastEdition, tuple.getValue(), artIdx++));
|
paperCards.add(new PaperCard(rules, lastEdition, tuple.getValue(), artIdx++));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(paperCards.isEmpty())
|
if (paperCards.isEmpty()) {
|
||||||
paperCards.add(new PaperCard(rules, CardEdition.UNKNOWN.getCode(), CardRarity.Special, 1));
|
paperCards.add(new PaperCard(rules, CardEdition.UNKNOWN.getCode(), CardRarity.Special, 1));
|
||||||
|
}
|
||||||
// 2. add them to db
|
// 2. add them to db
|
||||||
for (PaperCard paperCard : paperCards)
|
for (PaperCard paperCard : paperCards) {
|
||||||
addCard(paperCard);
|
addCard(paperCard);
|
||||||
|
}
|
||||||
// 3. reindex can be temporary disabled and run after the whole batch of rules is added to db.
|
// 3. reindex can be temporary disabled and run after the whole batch of rules is added to db.
|
||||||
if(immediateReindex)
|
if (immediateReindex) {
|
||||||
reIndex();
|
reIndex();
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
public void removeCard(String name) {
|
public void removeCard(String name) {
|
||||||
@@ -491,11 +511,14 @@ public final class CardDb implements ICardDatabase {
|
|||||||
Iterator<PaperCard> it = allCards.iterator();
|
Iterator<PaperCard> it = allCards.iterator();
|
||||||
while(it.hasNext()) {
|
while(it.hasNext()) {
|
||||||
PaperCard pc = it.next();
|
PaperCard pc = it.next();
|
||||||
if( pc.getName().equalsIgnoreCase(name))
|
if (pc.getName().equalsIgnoreCase(name)) {
|
||||||
it.remove();
|
it.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void rebuildIndex() { reIndex(); }
|
}
|
||||||
|
public void rebuildIndex() {
|
||||||
|
reIndex();
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isImmediateReindex() {
|
public boolean isImmediateReindex() {
|
||||||
return immediateReindex;
|
return immediateReindex;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package forge.screens.home.quest;
|
package forge.screens.home.quest;
|
||||||
|
|
||||||
|
import forge.assets.FSkinProp;
|
||||||
import forge.model.FModel;
|
import forge.model.FModel;
|
||||||
import forge.quest.data.QuestPreferences;
|
import forge.quest.data.QuestPreferences;
|
||||||
import forge.quest.data.QuestPreferences.QPref;
|
import forge.quest.data.QuestPreferences.QPref;
|
||||||
@@ -59,7 +60,7 @@ public class QuestPreferencesHandler extends SkinnedPanel {
|
|||||||
pnlRewards.setLayout(new MigLayout("insets 0, gap 0, wrap 2"));
|
pnlRewards.setLayout(new MigLayout("insets 0, gap 0, wrap 2"));
|
||||||
|
|
||||||
pnlRewards.add(new FLabel.Builder().text("Rewards")
|
pnlRewards.add(new FLabel.Builder().text("Rewards")
|
||||||
.icon(new FSkin.UnskinnedIcon("res/images/icons/CoinIcon.png")).build(),
|
.icon(FSkin.getImage(FSkinProp.ICO_QUEST_COIN)).build(),
|
||||||
"w 100%!, h 30px!, span 2 1");
|
"w 100%!, h 30px!, span 2 1");
|
||||||
pnlRewards.add(lblErrRewards, "w 100%!, h 30px!, span 2 1");
|
pnlRewards.add(lblErrRewards, "w 100%!, h 30px!, span 2 1");
|
||||||
|
|
||||||
@@ -100,7 +101,7 @@ public class QuestPreferencesHandler extends SkinnedPanel {
|
|||||||
pnlDifficulty.setOpaque(false);
|
pnlDifficulty.setOpaque(false);
|
||||||
pnlDifficulty.setLayout(new MigLayout("insets 0, gap 0, wrap 5"));
|
pnlDifficulty.setLayout(new MigLayout("insets 0, gap 0, wrap 5"));
|
||||||
|
|
||||||
pnlDifficulty.add(new FLabel.Builder().text("Difficulty Adjustments").icon(new FSkin.UnskinnedIcon("res/images/icons/NotesIcon.png")).build(), "w 100%!, h 30px!, span 5 1");
|
pnlDifficulty.add(new FLabel.Builder().text("Difficulty Adjustments").icon(FSkin.getImage(FSkinProp.ICO_QUEST_NOTES)).build(), "w 100%!, h 30px!, span 5 1");
|
||||||
pnlDifficulty.add(lblErrDifficulty, "w 100%!, h 30px!, span 5 1");
|
pnlDifficulty.add(lblErrDifficulty, "w 100%!, h 30px!, span 5 1");
|
||||||
|
|
||||||
constraints1 = "w 60px!, h 26px!";
|
constraints1 = "w 60px!, h 26px!";
|
||||||
@@ -183,7 +184,7 @@ public class QuestPreferencesHandler extends SkinnedPanel {
|
|||||||
pnlBooster.setLayout(new MigLayout("insets 0, gap 0, wrap 2"));
|
pnlBooster.setLayout(new MigLayout("insets 0, gap 0, wrap 2"));
|
||||||
|
|
||||||
pnlBooster.add(new FLabel.Builder().text("Booster Pack Ratios")
|
pnlBooster.add(new FLabel.Builder().text("Booster Pack Ratios")
|
||||||
.icon(new FSkin.UnskinnedIcon("res/images/icons/BookIcon.png")).build(),
|
.icon(FSkin.getImage(FSkinProp.ICO_QUEST_BOOK)).build(),
|
||||||
"w 100%!, h 30px!, span 2 1");
|
"w 100%!, h 30px!, span 2 1");
|
||||||
pnlBooster.add(lblErrBooster, "w 100%!, h 30px!, span 2 1");
|
pnlBooster.add(lblErrBooster, "w 100%!, h 30px!, span 2 1");
|
||||||
|
|
||||||
@@ -203,7 +204,7 @@ public class QuestPreferencesHandler extends SkinnedPanel {
|
|||||||
pnlShop.setLayout(new MigLayout("insets 0, gap 0, wrap 2"));
|
pnlShop.setLayout(new MigLayout("insets 0, gap 0, wrap 2"));
|
||||||
|
|
||||||
pnlShop.add(new FLabel.Builder().text("Shop Preferences")
|
pnlShop.add(new FLabel.Builder().text("Shop Preferences")
|
||||||
.icon(new FSkin.UnskinnedIcon("res/images/icons/CoinIcon.png")).build(), "w 100%!, h 30px!, span 2 1");
|
.icon(FSkin.getImage(FSkinProp.ICO_QUEST_COIN)).build(), "w 100%!, h 30px!, span 2 1");
|
||||||
pnlShop.add(lblErrShop, "w 100%!, h 30px!, span 2 1");
|
pnlShop.add(lblErrShop, "w 100%!, h 30px!, span 2 1");
|
||||||
|
|
||||||
constraints1 = "w 60px, h 26px!";
|
constraints1 = "w 60px, h 26px!";
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ public class CardDatabaseHelper {
|
|||||||
|
|
||||||
private static void initialize() {
|
private static void initialize() {
|
||||||
final CardStorageReader reader = new CardStorageReader(ForgeConstants.CARD_DATA_DIR, null, null);
|
final CardStorageReader reader = new CardStorageReader(ForgeConstants.CARD_DATA_DIR, null, null);
|
||||||
staticData = new StaticData(reader, "res/editions", "res/blockdata");
|
staticData = new StaticData(reader, ForgeConstants.EDITIONS_DIR, ForgeConstants.BLOCK_DATA_DIR);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean hasBeenInitialized() {
|
private static boolean hasBeenInitialized() {
|
||||||
|
|||||||
Reference in New Issue
Block a user