mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
Add preference to enable/disable loading of Unknown Cards.
If a user don't wants to load a certain cards from deleted set/s in edition folder, you can do so by disabling this option.
This commit is contained in:
@@ -54,11 +54,11 @@ public class StaticData {
|
||||
|
||||
private static StaticData lastInstance = null;
|
||||
|
||||
public StaticData(CardStorageReader cardReader, String editionFolder, String blockDataFolder) {
|
||||
this(cardReader, null, editionFolder, blockDataFolder);
|
||||
public StaticData(CardStorageReader cardReader, String editionFolder, String blockDataFolder, boolean enableUnknownCards) {
|
||||
this(cardReader, null, editionFolder, blockDataFolder, enableUnknownCards);
|
||||
}
|
||||
|
||||
public StaticData(CardStorageReader cardReader, CardStorageReader tokenReader, String editionFolder, String blockDataFolder) {
|
||||
public StaticData(CardStorageReader cardReader, CardStorageReader tokenReader, String editionFolder, String blockDataFolder, boolean enableUnknownCards) {
|
||||
this.cardReader = cardReader;
|
||||
this.tokenReader = tokenReader;
|
||||
this.editions = new CardEdition.Collection(new CardEdition.Reader(new File(editionFolder)));
|
||||
@@ -84,8 +84,8 @@ public class StaticData {
|
||||
variantCards = new CardDb(variantsCards, editions);
|
||||
|
||||
//must initialize after establish field values for the sake of card image logic
|
||||
commonCards.initialize(false, false);
|
||||
variantCards.initialize(false, false);
|
||||
commonCards.initialize(false, false, enableUnknownCards);
|
||||
variantCards.initialize(false, false, enableUnknownCards);
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
@@ -165,7 +165,7 @@ public final class CardDb implements ICardDatabase, IDeckGenPool {
|
||||
reIndex();
|
||||
}
|
||||
|
||||
public void initialize(boolean logMissingPerEdition, boolean logMissingSummary) {
|
||||
public void initialize(boolean logMissingPerEdition, boolean logMissingSummary, boolean enableUnknownCards) {
|
||||
Set<String> allMissingCards = new LinkedHashSet<>();
|
||||
List<String> missingCards = new ArrayList<>();
|
||||
CardEdition upcomingSet = null;
|
||||
@@ -218,7 +218,7 @@ public final class CardDb implements ICardDatabase, IDeckGenPool {
|
||||
if (!contains(cr.getName())) {
|
||||
if (upcomingSet != null) {
|
||||
addCard(new PaperCard(cr, upcomingSet.getCode(), CardRarity.Unknown, 1));
|
||||
} else {
|
||||
} else if(enableUnknownCards) {
|
||||
System.err.println("The card " + cr.getName() + " was not assigned to any set. Adding it to UNKNOWN set... to fix see res/editions/ folder. ");
|
||||
addCard(new PaperCard(cr, CardEdition.UNKNOWN.getCode(), CardRarity.Special, 1));
|
||||
}
|
||||
|
||||
@@ -114,6 +114,7 @@ public enum CSubmenuPreferences implements ICDoc {
|
||||
lstControls.add(Pair.of(view.getCbRemoveArtifacts(), FPref.DECKGEN_ARTIFACTS));
|
||||
lstControls.add(Pair.of(view.getCbSingletons(), FPref.DECKGEN_SINGLETONS));
|
||||
lstControls.add(Pair.of(view.getCbEnableAICheats(), FPref.UI_ENABLE_AI_CHEATS));
|
||||
lstControls.add(Pair.of(view.getCbEnableUnknownCards(), FPref.UI_LOAD_UNKNOWN_CARDS));
|
||||
lstControls.add(Pair.of(view.getCbImageFetcher(), FPref.UI_ENABLE_ONLINE_IMAGE_FETCHER));
|
||||
lstControls.add(Pair.of(view.getCbDisplayFoil(), FPref.UI_OVERLAY_FOIL_EFFECT));
|
||||
lstControls.add(Pair.of(view.getCbRandomFoil(), FPref.UI_RANDOM_FOIL));
|
||||
|
||||
@@ -107,6 +107,7 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
|
||||
private final JCheckBox cbShowStormCount = new OptionsCheckBox(localizer.getMessage("cbShowStormCount"));
|
||||
private final JCheckBox cbRemindOnPriority = new OptionsCheckBox(localizer.getMessage("cbRemindOnPriority"));
|
||||
private final JCheckBox cbUseSentry = new OptionsCheckBox(localizer.getMessage("cbUseSentry"));
|
||||
private final JCheckBox cbEnableUnknownCards = new OptionsCheckBox("Enable Unknown Cards");
|
||||
|
||||
private final Map<FPref, KeyboardShortcutField> shortcutFields = new HashMap<>();
|
||||
|
||||
@@ -287,6 +288,9 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
|
||||
pnlPrefs.add(cbLoadHistoricFormats, titleConstraints);
|
||||
pnlPrefs.add(new NoteLabel(localizer.getMessage("nlLoadHistoricFormats")), descriptionConstraints);
|
||||
|
||||
pnlPrefs.add(cbEnableUnknownCards, titleConstraints);
|
||||
pnlPrefs.add(new NoteLabel("Enable Unknown Cards to be loaded to Unknown Set. (Requires restart)"), descriptionConstraints);
|
||||
|
||||
// Graphic Options
|
||||
pnlPrefs.add(new SectionLabel(localizer.getMessage("GraphicOptions")), sectionConstraints + ", gaptop 2%");
|
||||
|
||||
@@ -580,6 +584,11 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
|
||||
return cbEnableAICheats;
|
||||
}
|
||||
|
||||
/** @return {@link javax.swing.JCheckBox} */
|
||||
public JCheckBox getCbEnableUnknownCards() {
|
||||
return cbEnableUnknownCards;
|
||||
}
|
||||
|
||||
/** @return {@link javax.swing.JCheckBox} */
|
||||
public JCheckBox getCbImageFetcher() {
|
||||
return cbImageFetcher;
|
||||
|
||||
@@ -29,7 +29,7 @@ public class CardDatabaseHelper {
|
||||
|
||||
private static void initialize() {
|
||||
final CardStorageReader reader = new CardStorageReader(ForgeConstants.CARD_DATA_DIR, null, FModel.getPreferences().getPrefBoolean(FPref.LOAD_CARD_SCRIPTS_LAZILY));
|
||||
staticData = new StaticData(reader, ForgeConstants.EDITIONS_DIR, ForgeConstants.BLOCK_DATA_DIR);
|
||||
staticData = new StaticData(reader, ForgeConstants.EDITIONS_DIR, ForgeConstants.BLOCK_DATA_DIR, FModel.getPreferences().getPrefBoolean(FPref.UI_LOAD_UNKNOWN_CARDS));
|
||||
}
|
||||
|
||||
private static boolean hasBeenInitialized() {
|
||||
|
||||
@@ -331,6 +331,10 @@ public class SettingsPage extends TabPage<SettingsScreen> {
|
||||
Forge.showFPS = FModel.getPreferences().getPrefBoolean(FPref.UI_SHOW_FPS);
|
||||
}
|
||||
},4);
|
||||
lstSettings.addItem(new BooleanSetting(FPref.UI_LOAD_UNKNOWN_CARDS,
|
||||
"Enable Unknown Cards",
|
||||
"Enable Unknown Cards to be loaded to Unknown Set. (Requires restart)"),
|
||||
4);
|
||||
lstSettings.addItem(new CustomSelectSetting(FPref.UI_CARD_COUNTER_DISPLAY_TYPE,
|
||||
localizer.getMessage("cbpCounterDisplayType"),
|
||||
localizer.getMessage("nlCounterDisplayType"),
|
||||
|
||||
@@ -152,7 +152,7 @@ public final class FModel {
|
||||
FModel.getPreferences().getPrefBoolean(FPref.LOAD_CARD_SCRIPTS_LAZILY));
|
||||
final CardStorageReader tokenReader = new CardStorageReader(ForgeConstants.TOKEN_DATA_DIR, progressBarBridge,
|
||||
FModel.getPreferences().getPrefBoolean(FPref.LOAD_CARD_SCRIPTS_LAZILY));
|
||||
magicDb = new StaticData(reader, tokenReader, ForgeConstants.EDITIONS_DIR, ForgeConstants.BLOCK_DATA_DIR);
|
||||
magicDb = new StaticData(reader, tokenReader, ForgeConstants.EDITIONS_DIR, ForgeConstants.BLOCK_DATA_DIR, FModel.getPreferences().getPrefBoolean(FPref.UI_LOAD_UNKNOWN_CARDS));
|
||||
CardTranslation.preloadTranslation(preferences.getPref(FPref.UI_LANGUAGE), ForgeConstants.LANG_DIR);
|
||||
|
||||
//create profile dirs if they don't already exist
|
||||
|
||||
@@ -139,6 +139,7 @@ public class ForgePreferences extends PreferencesStore<ForgePreferences.FPref> {
|
||||
UI_ENABLE_PRELOAD_EXTENDED_ART("false"),
|
||||
UI_ENABLE_BORDER_MASKING("false"),
|
||||
UI_SHOW_FPS("false"),
|
||||
UI_LOAD_UNKNOWN_CARDS("true"),
|
||||
UI_ALLOW_ORDER_GRAVEYARD_WHEN_NEEDED ("Never"),
|
||||
UI_DEFAULT_FONT_SIZE("12"),
|
||||
UI_SELECT_FROM_CARD_DISPLAYS("true"),
|
||||
|
||||
Reference in New Issue
Block a user