(StringBuffer noImageFound, StringBuffer cardNotImplemented)
| 763 | return preferences_avails; |
| 764 | } |
| 765 | public Pair<Integer, Integer> audit(StringBuffer noImageFound, StringBuffer cardNotImplemented) { |
| 766 | Queue<String> EDITION_Q = new ConcurrentLinkedQueue<>(); |
| 767 | Queue<String> NIF_Q = new ConcurrentLinkedQueue<>(); |
| 768 | Queue<String> CNI_Q = new ConcurrentLinkedQueue<>(); |
| 769 | Queue<String> TOKEN_Q = new ConcurrentLinkedQueue<>(); |
| 770 | boolean nifHeader = false; |
| 771 | boolean cniHeader = false; |
| 772 | final Pattern funnyCardCollectorNumberPattern = Pattern.compile("^F★?\\d+★?"); |
| 773 | for (CardEdition e : editions) { |
| 774 | if (CardEdition.Type.FUNNY.equals(e.getType())) |
| 775 | continue; |
| 776 | |
| 777 | Map<String, Pair<Boolean, Integer>> cardCount = new HashMap<>(); |
| 778 | List<CompletableFuture<?>> futures = new ArrayList<>(); |
| 779 | for (CardEdition.EditionEntry c : e.getObtainableCards()) { |
| 780 | int amount = 1; |
| 781 | |
| 782 | if (cardCount.containsKey(c.name())) { |
| 783 | amount = cardCount.get(c.name()).getRight() + 1; |
| 784 | } |
| 785 | |
| 786 | cardCount.put(c.name(), Pair.of(c.collectorNumber() != null && funnyCardCollectorNumberPattern.matcher(c.collectorNumber()).matches(), amount)); |
| 787 | } |
| 788 | |
| 789 | // loop through the cards in this edition, considering art variations... |
| 790 | for (Map.Entry<String, Pair<Boolean, Integer>> entry : cardCount.entrySet()) { |
| 791 | futures.add(CompletableFuture.supplyAsync(()-> { |
| 792 | final String c = entry.getKey(); |
| 793 | final int artID = entry.getValue().getRight(); |
| 794 | final boolean isFunny = entry.getValue().getLeft(); |
| 795 | PaperCard cp = getCommonCards().getCard(c, e.getCode(), artID); |
| 796 | if (cp == null) { |
| 797 | cp = getVariantCards().getCard(c, e.getCode(), artID); |
| 798 | } |
| 799 | if (cp == null) { |
| 800 | if (isFunny) //skip funny cards |
| 801 | return null; |
| 802 | if (!loadNonLegalCards && CardEdition.Type.FUNNY.equals(e.getType())) |
| 803 | return null; |
| 804 | EDITION_Q.add(e.getCode() + "_" + e.getName()); |
| 805 | CNI_Q.add(e.getCode() + "_" + c + "\n"); |
| 806 | return null; |
| 807 | } |
| 808 | // check the front image |
| 809 | String imagePath = ImageUtil.getImageRelativePath(cp, "", true, false); |
| 810 | if (imagePath != null) { |
| 811 | File file = ImageKeys.getImageFile(imagePath); |
| 812 | if (file == null && ImageKeys.hasSetLookup(imagePath)) |
| 813 | file = ImageKeys.setLookUpFile(imagePath, imagePath +"border"); |
| 814 | if (file == null) { |
| 815 | if (imagePath.isEmpty()) |
| 816 | return null; |
| 817 | EDITION_Q.add(e.getCode() + "_" + e.getName()); |
| 818 | NIF_Q.add(e.getCode() + "_" + imagePath + "\n"); |
| 819 | } |
| 820 | } |
| 821 | // check the back face |
| 822 | if (cp.hasBackFace()) { |
no test coverage detected