Merge pull request #3048 from kevlahnota/newmaster2

try to fix older gauntlet/tournament saves.
This commit is contained in:
Anthony Calosa
2023-05-02 07:25:35 +08:00
committed by GitHub
2 changed files with 10 additions and 2 deletions

View File

@@ -213,7 +213,11 @@ public class GauntletIO {
final boolean foil = "1".equals(reader.getAttribute("foil")); final boolean foil = "1".equals(reader.getAttribute("foil"));
PaperCard card = FModel.getMagicDb().getOrLoadCommonCard(name, set, index, foil); PaperCard card = FModel.getMagicDb().getOrLoadCommonCard(name, set, index, foil);
if (null == card) { if (null == card) {
throw new RuntimeException("Unsupported card found in gauntlet save: " + name + " from edition " + set); //get same replacement card from any edition due to Edition updates/changes if it exists (ie Ugin, the Ineffable from edition PSLD, Mana Crypt from edition FS, Timeless Lotus from edition ???).
card = FModel.getMagicDb().getCommonCards().getCard(name);
if (card == null) //if the card is not found, notify via log instead of crashing
System.err.println("Warning: Unsupported card found in gauntlet save: " + name + " from edition " + set +". It will be removed from the gauntlet save.");
//throw new RuntimeException("Unsupported card found in gauntlet save: " + name + " from edition " + set);
} }
return card; return card;
} }

View File

@@ -188,7 +188,11 @@ public class TournamentIO {
final boolean foil = "1".equals(reader.getAttribute("foil")); final boolean foil = "1".equals(reader.getAttribute("foil"));
PaperCard card = FModel.getMagicDb().getOrLoadCommonCard(name, set, index, foil); PaperCard card = FModel.getMagicDb().getOrLoadCommonCard(name, set, index, foil);
if (null == card) { if (null == card) {
throw new RuntimeException("Unsupported card found in quest save: " + name + " from edition " + set); //get same replacement card from any edition due to Edition updates/changes if it exists (ie Ugin, the Ineffable from edition PSLD, Mana Crypt from edition FS, Timeless Lotus from edition ???).
card = FModel.getMagicDb().getCommonCards().getCard(name);
if (card == null) //if the card is not found, notify via log instead of crashing
System.err.println("Warning: Unsupported card found in quest save: " + name + " from edition " + set +". It will be removed from the quest save.");
//throw new RuntimeException("Unsupported card found in quest save: " + name + " from edition " + set);
} }
return card; return card;
} }