(String[] args)
| 42 | } |
| 43 | |
| 44 | public static void main(String[] args) throws Exception { |
| 45 | if (args.length != 3) { |
| 46 | System.err.println("Usage: ForgeMatrixWriter <forge-gui-dir> <input.tsv> <output.dat>"); |
| 47 | System.exit(2); |
| 48 | } |
| 49 | |
| 50 | Path forgeGuiDir = Path.of(args[0]).toAbsolutePath().normalize(); |
| 51 | Path input = Path.of(args[1]).toAbsolutePath().normalize(); |
| 52 | Path output = Path.of(args[2]).toAbsolutePath().normalize(); |
| 53 | |
| 54 | GuiBase.setInterface(new HeadlessGui(forgeGuiDir)); |
| 55 | FModel.loadDynamicGamedata(); |
| 56 | Lang.createInstance("en-US"); |
| 57 | Localizer.getInstance().initialize("en-US", forgeGuiDir.resolve("res/languages").toString()); |
| 58 | CardTranslation.preloadTranslation("en-US", forgeGuiDir.resolve("res/languages").toString()); |
| 59 | Path emptyCustomEditions = Files.createTempDirectory("forge-empty-custom-editions"); |
| 60 | |
| 61 | StaticData cards = new StaticData( |
| 62 | new CardStorageReader(forgeGuiDir.resolve("res/cardsfolder").toString(), CardStorageReader.ProgressObserver.emptyObserver, false), |
| 63 | new CardStorageReader(forgeGuiDir.resolve("res/tokenscripts").toString(), CardStorageReader.ProgressObserver.emptyObserver, false), |
| 64 | null, |
| 65 | null, |
| 66 | forgeGuiDir.resolve("res/editions").toString(), |
| 67 | emptyCustomEditions.toString(), |
| 68 | forgeGuiDir.resolve("res/blockdata").toString(), |
| 69 | forgeGuiDir.resolve("res/setlookup").toString(), |
| 70 | "", |
| 71 | true, |
| 72 | false, |
| 73 | false, |
| 74 | false); |
| 75 | |
| 76 | HashMap<String, List<Map.Entry<PaperCard, Integer>>> matrix = new HashMap<>(); |
| 77 | int rows = 0; |
| 78 | int skippedCards = 0; |
| 79 | int skippedCommanders = 0; |
| 80 | Map<String, Integer> unknownCommanders = new LinkedHashMap<>(); |
| 81 | Map<String, Integer> unknownCards = new LinkedHashMap<>(); |
| 82 | |
| 83 | try (BufferedReader reader = Files.newBufferedReader(input, StandardCharsets.UTF_8)) { |
| 84 | String line; |
| 85 | while ((line = reader.readLine()) != null) { |
| 86 | line = line.trim(); |
| 87 | if (line.isEmpty() || line.startsWith("#")) { |
| 88 | continue; |
| 89 | } |
| 90 | |
| 91 | String[] parts = line.split("\t"); |
| 92 | if (parts.length < 3) { |
| 93 | System.err.println("Skipping malformed line: " + line); |
| 94 | continue; |
| 95 | } |
| 96 | |
| 97 | String commanderName = parts[0].trim(); |
| 98 | String cardName = parts[1].trim(); |
| 99 | int weight = Integer.parseInt(parts[2].trim()); |
| 100 | if (weight <= 0) { |
| 101 | continue; |
nothing calls this directly
no test coverage detected