MCPcopy Create free account
hub / github.com/Card-Forge/forge / audit

Method audit

forge-core/src/main/java/forge/StaticData.java:765–944  ·  view source on GitHub ↗
(StringBuffer noImageFound, StringBuffer cardNotImplemented)

Source from the content-addressed store, hash-verified

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()) {

Callers 2

selectMethod · 0.80
auditUpdateMethod · 0.80

Calls 15

getCommonCardsMethod · 0.95
getVariantCardsMethod · 0.95
getImageRelativePathMethod · 0.95
getImageFileMethod · 0.95
hasSetLookupMethod · 0.95
setLookUpFileMethod · 0.95
hasBackFaceMethod · 0.95
getAllTokensMethod · 0.95
getImageKeyMethod · 0.95
getImageFilenameMethod · 0.95
getObtainableCardsMethod · 0.80
containsKeyMethod · 0.80

Tested by

no test coverage detected