Hotfix PaperCard edition issues

This commit is contained in:
Chris H
2025-06-01 22:48:06 -04:00
parent 7fa89cbc2e
commit be6f345127

View File

@@ -347,13 +347,34 @@ public class PaperCard implements Comparable<IPaperCard>, InventoryItemFromSet,
if (pc == null) { if (pc == null) {
pc = StaticData.instance().getVariantCards().getCard(name, edition, artIndex); pc = StaticData.instance().getVariantCards().getCard(name, edition, artIndex);
if (pc == null) { if (pc == null) {
throw new IOException(TextUtil.concatWithSpace("Card", name, "not found")); System.out.println("PaperCard: " + name + " not found with set and index " + edition + ", " + artIndex);
pc = readObjectAlternate(name, edition);
if (pc == null) {
throw new IOException(TextUtil.concatWithSpace("Card", name, "not found with set and index", edition, Integer.toString(artIndex)));
}
System.out.println("Alternate object found: " + pc.getName() + ", " + pc.getEdition() + ", " + pc.getArtIndex());
} }
} }
rules = pc.getRules(); rules = pc.getRules();
rarity = pc.getRarity(); rarity = pc.getRarity();
} }
private IPaperCard readObjectAlternate(String name, String edition) throws ClassNotFoundException, IOException {
IPaperCard pc = StaticData.instance().getCommonCards().getCard(name, edition);
if (pc == null) {
pc = StaticData.instance().getVariantCards().getCard(name, edition);
}
if (pc == null) {
pc = StaticData.instance().getCommonCards().getCard(name);
if (pc == null) {
pc = StaticData.instance().getVariantCards().getCard(name);
}
}
return pc;
}
@Serial @Serial
private Object readResolve() throws ObjectStreamException { private Object readResolve() throws ObjectStreamException {
//If we deserialize an old PaperCard with no flags, reinitialize as a fresh copy to set default flags. //If we deserialize an old PaperCard with no flags, reinitialize as a fresh copy to set default flags.