diff --git a/gemp-lotr/gemp-lotr-cards/src/main/resources/blueprintMapping.txt b/gemp-lotr/gemp-lotr-cards/src/main/resources/blueprintMapping.txt new file mode 100644 index 000000000..d6a621fe7 --- /dev/null +++ b/gemp-lotr/gemp-lotr-cards/src/main/resources/blueprintMapping.txt @@ -0,0 +1 @@ +4_002,1_002 \ No newline at end of file diff --git a/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/game/LotroCardBlueprintLibrary.java b/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/game/LotroCardBlueprintLibrary.java index 21f3d42b4..75d35545b 100644 --- a/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/game/LotroCardBlueprintLibrary.java +++ b/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/game/LotroCardBlueprintLibrary.java @@ -1,6 +1,8 @@ package com.gempukku.lotro.game; -import java.util.Collection; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; import java.util.HashMap; import java.util.Map; @@ -11,6 +13,27 @@ public class LotroCardBlueprintLibrary { }; private Map _blueprintMap = new HashMap(); + private Map _blueprintMapping = new HashMap(); + + public LotroCardBlueprintLibrary() { + try { + BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(LotroCardBlueprintLibrary.class.getResourceAsStream("/blueprintMapping.txt"), "UTF-8")); + try { + String line; + + while ((line = bufferedReader.readLine()) != null) { + String[] split = line.split(","); + _blueprintMapping.put(split[0], split[1]); + } + } finally { + bufferedReader.close(); + } + } catch (IOException exp) { + throw new RuntimeException("Problem loading blueprint mapping", exp); + } + + } + public LotroCardBlueprint getLotroCardBlueprint(String blueprintId) { if (blueprintId.endsWith("*")) blueprintId = blueprintId.substring(0, blueprintId.length() - 1); @@ -25,21 +48,24 @@ public class LotroCardBlueprintLibrary { return blueprint; } - public void initializeLibrary(String setNo, int maxCardIndex) { - for (int i = 1; i <= maxCardIndex; i++) { - try { - getLotroCardBlueprint(setNo + "_" + i); - } catch (IllegalArgumentException exp) { - // Ignore - } - } - } - - public Collection getAllLoadedBlueprints() { - return _blueprintMap.values(); - } - + // public void initializeLibrary(String setNo, int maxCardIndex) { +// for (int i = 1; i <= maxCardIndex; i++) { +// try { +// getLotroCardBlueprint(setNo + "_" + i); +// } catch (IllegalArgumentException exp) { +// // Ignore +// } +// } +// } +// +// public Collection getAllLoadedBlueprints() { +// return _blueprintMap.values(); +// } +// private LotroCardBlueprint getBlueprint(String blueprintId) { + if (_blueprintMapping.containsKey(blueprintId)) + return getBlueprint(_blueprintMapping.get(blueprintId)); + String[] blueprintParts = blueprintId.split("_"); String setNumber = blueprintParts[0];