mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 02:38:02 +00:00
update auditer
This commit is contained in:
@@ -322,6 +322,8 @@ public final class ImageKeys {
|
|||||||
: CACHE_CARD_PICS_SUBDIR.get(edition); // may use custom paths though
|
: CACHE_CARD_PICS_SUBDIR.get(edition); // may use custom paths though
|
||||||
}
|
}
|
||||||
public static boolean hasSetLookup(String filename) {
|
public static boolean hasSetLookup(String filename) {
|
||||||
|
if (filename == null)
|
||||||
|
return false;
|
||||||
if (!StaticData.instance().getSetLookup().isEmpty()) {
|
if (!StaticData.instance().getSetLookup().isEmpty()) {
|
||||||
return StaticData.instance().getSetLookup().keySet().stream().anyMatch(filename::startsWith);
|
return StaticData.instance().getSetLookup().keySet().stream().anyMatch(filename::startsWith);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,9 @@ import org.apache.commons.lang3.tuple.Pair;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -427,7 +430,7 @@ public class StaticData {
|
|||||||
public void setBrawlPredicate(Predicate<PaperCard> brawlPredicate) { this.brawlPredicate = brawlPredicate; }
|
public void setBrawlPredicate(Predicate<PaperCard> brawlPredicate) { this.brawlPredicate = brawlPredicate; }
|
||||||
|
|
||||||
public Predicate<PaperCard> getStandardPredicate() { return standardPredicate; }
|
public Predicate<PaperCard> getStandardPredicate() { return standardPredicate; }
|
||||||
|
|
||||||
public Predicate<PaperCard> getPioneerPredicate() { return pioneerPredicate; }
|
public Predicate<PaperCard> getPioneerPredicate() { return pioneerPredicate; }
|
||||||
|
|
||||||
public Predicate<PaperCard> getModernPredicate() { return modernPredicate; }
|
public Predicate<PaperCard> getModernPredicate() { return modernPredicate; }
|
||||||
@@ -763,19 +766,20 @@ public class StaticData {
|
|||||||
return preferences_avails;
|
return preferences_avails;
|
||||||
}
|
}
|
||||||
public Pair<Integer, Integer> audit(StringBuffer noImageFound, StringBuffer cardNotImplemented) {
|
public Pair<Integer, Integer> audit(StringBuffer noImageFound, StringBuffer cardNotImplemented) {
|
||||||
int missingCount = 0;
|
Queue<String> EDITION_Q = new ConcurrentLinkedQueue<>();
|
||||||
int notImplementedCount = 0;
|
Queue<String> NIF_Q = new ConcurrentLinkedQueue<>();
|
||||||
|
Queue<String> CNI_Q = new ConcurrentLinkedQueue<>();
|
||||||
|
Queue<String> TOKEN_Q = new ConcurrentLinkedQueue<>();
|
||||||
|
boolean nifHeader = false;
|
||||||
|
boolean cniHeader = false;
|
||||||
for (CardEdition e : editions) {
|
for (CardEdition e : editions) {
|
||||||
if (CardEdition.Type.FUNNY.equals(e.getType()))
|
if (CardEdition.Type.FUNNY.equals(e.getType()))
|
||||||
continue;
|
continue;
|
||||||
boolean nifHeader = false;
|
|
||||||
boolean cniHeader = false;
|
|
||||||
boolean tokenHeader = false;
|
|
||||||
|
|
||||||
String imagePath;
|
AtomicInteger artIndex = new AtomicInteger(1);
|
||||||
int artIndex = 1;
|
|
||||||
|
|
||||||
HashMap<String, Pair<Boolean, Integer>> cardCount = new HashMap<>();
|
Map<String, Pair<Boolean, Integer>> cardCount = new HashMap<>();
|
||||||
|
List<CompletableFuture<Integer>> futures = new ArrayList<>();
|
||||||
for (CardEdition.CardInSet c : e.getAllCardsInSet()) {
|
for (CardEdition.CardInSet c : e.getAllCardsInSet()) {
|
||||||
if (cardCount.containsKey(c.name)) {
|
if (cardCount.containsKey(c.name)) {
|
||||||
cardCount.put(c.name, Pair.of(c.collectorNumber != null && c.collectorNumber.startsWith("F"), cardCount.get(c.name).getRight() + 1));
|
cardCount.put(c.name, Pair.of(c.collectorNumber != null && c.collectorNumber.startsWith("F"), cardCount.get(c.name).getRight() + 1));
|
||||||
@@ -786,104 +790,158 @@ public class StaticData {
|
|||||||
|
|
||||||
// loop through the cards in this edition, considering art variations...
|
// loop through the cards in this edition, considering art variations...
|
||||||
for (Map.Entry<String, Pair<Boolean, Integer>> entry : cardCount.entrySet()) {
|
for (Map.Entry<String, Pair<Boolean, Integer>> entry : cardCount.entrySet()) {
|
||||||
String c = entry.getKey();
|
futures.add(CompletableFuture.supplyAsync(()-> {
|
||||||
artIndex = entry.getValue().getRight();
|
final String c = entry.getKey();
|
||||||
|
final int artID = entry.getValue().getRight();
|
||||||
PaperCard cp = getCommonCards().getCard(c, e.getCode(), artIndex);
|
final boolean isFunny = entry.getValue().getLeft();
|
||||||
if (cp == null) {
|
PaperCard cp = getCommonCards().getCard(c, e.getCode(), artID);
|
||||||
cp = getVariantCards().getCard(c, e.getCode(), artIndex);
|
if (cp == null) {
|
||||||
}
|
cp = getVariantCards().getCard(c, e.getCode(), artID);
|
||||||
|
|
||||||
if (cp == null) {
|
|
||||||
if (entry.getValue().getLeft()) //skip funny cards
|
|
||||||
continue;
|
|
||||||
if (!loadNonLegalCards && CardEdition.Type.FUNNY.equals(e.getType()))
|
|
||||||
continue;
|
|
||||||
if (!cniHeader) {
|
|
||||||
cardNotImplemented.append("\nEdition: ").append(e.getName()).append(" ").append("(").append(e.getCode()).append("/").append(e.getCode2()).append(")\n");
|
|
||||||
cniHeader = true;
|
|
||||||
}
|
}
|
||||||
cardNotImplemented.append(" ").append(c).append("\n");
|
if (cp == null) {
|
||||||
notImplementedCount++;
|
if (isFunny) //skip funny cards
|
||||||
continue;
|
return 0;
|
||||||
}
|
if (!loadNonLegalCards && CardEdition.Type.FUNNY.equals(e.getType()))
|
||||||
|
return 0;
|
||||||
// check the front image
|
EDITION_Q.add(e.getCode() + "_" + e.getName());
|
||||||
imagePath = ImageUtil.getImageRelativePath(cp, "", true, false);
|
CNI_Q.add(e.getCode() + "_" + c + "\n");
|
||||||
if (imagePath != null) {
|
return 0;
|
||||||
File file = ImageKeys.getImageFile(imagePath);
|
|
||||||
if (file == null && ImageKeys.hasSetLookup(imagePath))
|
|
||||||
file = ImageKeys.setLookUpFile(imagePath, imagePath+"border");
|
|
||||||
if (file == null) {
|
|
||||||
if (!nifHeader) {
|
|
||||||
noImageFound.append("Edition: ").append(e.getName()).append(" ").append("(").append(e.getCode()).append("/").append(e.getCode2()).append(")\n");
|
|
||||||
nifHeader = true;
|
|
||||||
}
|
|
||||||
noImageFound.append(" ").append(imagePath).append("\n");
|
|
||||||
missingCount++;
|
|
||||||
}
|
}
|
||||||
}
|
// check the front image
|
||||||
|
String imagePath = ImageUtil.getImageRelativePath(cp, "", true, false);
|
||||||
// check the back face
|
|
||||||
if (cp.hasBackFace()) {
|
|
||||||
imagePath = ImageUtil.getImageRelativePath(cp, "back", true, false);
|
|
||||||
if (imagePath != null) {
|
if (imagePath != null) {
|
||||||
File file = ImageKeys.getImageFile(imagePath);
|
File file = ImageKeys.getImageFile(imagePath);
|
||||||
if (file == null && ImageKeys.hasSetLookup(imagePath))
|
if (file == null && ImageKeys.hasSetLookup(imagePath))
|
||||||
file = ImageKeys.setLookUpFile(imagePath, imagePath+"border");
|
file = ImageKeys.setLookUpFile(imagePath, imagePath +"border");
|
||||||
if (file == null) {
|
if (file == null) {
|
||||||
if (!nifHeader) {
|
if (imagePath.isEmpty())
|
||||||
noImageFound.append("Edition: ").append(e.getName()).append(" ").append("(").append(e.getCode()).append("/").append(e.getCode2()).append(")\n");
|
return 0;
|
||||||
nifHeader = true;
|
EDITION_Q.add(e.getCode() + "_" + e.getName());
|
||||||
}
|
NIF_Q.add(e.getCode() + "_" + imagePath + "\n");
|
||||||
noImageFound.append(" ").append(imagePath).append("\n");
|
|
||||||
missingCount++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
// check the back face
|
||||||
|
if (cp.hasBackFace()) {
|
||||||
|
imagePath = ImageUtil.getImageRelativePath(cp, "back", true, false);
|
||||||
|
if (imagePath != null) {
|
||||||
|
File file = ImageKeys.getImageFile(imagePath);
|
||||||
|
if (file == null && ImageKeys.hasSetLookup(imagePath))
|
||||||
|
file = ImageKeys.setLookUpFile(imagePath, imagePath +"border");
|
||||||
|
if (file == null) {
|
||||||
|
if (imagePath.isEmpty())
|
||||||
|
return 0;
|
||||||
|
EDITION_Q.add(e.getCode() + "_" + e.getName());
|
||||||
|
NIF_Q.add(e.getCode() + "_" + imagePath + "\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Audit token images here...
|
// TODO: Audit token images here...
|
||||||
for(Map.Entry<String, Integer> tokenEntry : e.getTokens().entrySet()) {
|
for(Map.Entry<String, Integer> tokenEntry : e.getTokens().entrySet()) {
|
||||||
String name = tokenEntry.getKey();
|
futures.add(CompletableFuture.supplyAsync(()-> {
|
||||||
artIndex = tokenEntry.getValue();
|
String name = tokenEntry.getKey();
|
||||||
try {
|
artIndex.set(tokenEntry.getValue());
|
||||||
PaperToken token = getAllTokens().getToken(name, e.getCode());
|
try {
|
||||||
if (token == null) {
|
PaperToken token = getAllTokens().getToken(name, e.getCode());
|
||||||
continue;
|
if (token == null) {
|
||||||
}
|
return 0;
|
||||||
|
|
||||||
for(int i = 0; i < artIndex; i++) {
|
|
||||||
String imgKey = token.getImageKey(i);
|
|
||||||
File file = ImageKeys.getImageFile(imgKey);
|
|
||||||
if (file == null) {
|
|
||||||
if (!nifHeader) {
|
|
||||||
noImageFound.append("Edition: ").append(e.getName()).append(" ").append("(").append(e.getCode()).append("/").append(e.getCode2()).append(")\n");
|
|
||||||
nifHeader = true;
|
|
||||||
}
|
|
||||||
if (!tokenHeader) {
|
|
||||||
noImageFound.append("\nTOKENS\n");
|
|
||||||
tokenHeader = true;
|
|
||||||
}
|
|
||||||
noImageFound.append(" ").append(token.getImageFilename(i + 1)).append("\n");
|
|
||||||
missingCount++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for(int i = 0; i < artIndex.get(); i++) {
|
||||||
|
String imgKey = token.getImageKey(i);
|
||||||
|
File file = ImageKeys.getImageFile(imgKey);
|
||||||
|
if (file == null) {
|
||||||
|
EDITION_Q.add(e.getCode() + "_" + e.getName());
|
||||||
|
TOKEN_Q.add(e.getCode() + "_" + token.getImageFilename(i + 1) + "\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch(Exception ex) {
|
||||||
|
System.out.println("No Token found: " + name + " in " + e.getName());
|
||||||
}
|
}
|
||||||
} catch(Exception ex) {
|
return 0;
|
||||||
System.out.println("No Token found: " + name + " in " + e.getName());
|
}));
|
||||||
|
}
|
||||||
|
CompletableFuture<?>[] futuresArray = futures.toArray(new CompletableFuture<?>[0]);
|
||||||
|
CompletableFuture.allOf(futuresArray).join();
|
||||||
|
futures.clear();
|
||||||
|
}
|
||||||
|
List<String> NIF = new ArrayList<>(NIF_Q).stream().sorted().toList();
|
||||||
|
List<String> CNI = new ArrayList<>(CNI_Q).stream().sorted().toList();
|
||||||
|
List<String> TOK = new ArrayList<>(TOKEN_Q).stream().sorted().toList();
|
||||||
|
List<String> sorted_editions = EDITION_Q.stream().distinct().sorted().toList();
|
||||||
|
for (String edition : sorted_editions) {
|
||||||
|
String[] arr = edition.split("_");
|
||||||
|
String code = arr[0];
|
||||||
|
boolean NIF_TITLE = false, CNI_TITLE = false, TOK_TITLE = false;
|
||||||
|
for (String nif : NIF) {
|
||||||
|
if (nif.startsWith(code)) {
|
||||||
|
if (!nifHeader) {
|
||||||
|
noImageFound.append("\n-------------------\n");
|
||||||
|
noImageFound.append("NO IMAGE FOUND LIST\n");
|
||||||
|
noImageFound.append("-------------------\n\n");
|
||||||
|
nifHeader = true;
|
||||||
|
}
|
||||||
|
if (!NIF_TITLE) {
|
||||||
|
noImageFound.append(edition.replace(code + "_","")).append(" (").append(code).append(")").append("\n");
|
||||||
|
NIF_TITLE = true;
|
||||||
|
}
|
||||||
|
noImageFound.append(" ").append(nif.replace(code + "_", ""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (nifHeader)
|
if (NIF_TITLE)
|
||||||
noImageFound.append("\n");
|
noImageFound.append("\n");
|
||||||
|
for (String tok : TOK) {
|
||||||
|
if (tok.startsWith(code)) {
|
||||||
|
if (!nifHeader) {
|
||||||
|
noImageFound.append("\n-------------------\n");
|
||||||
|
noImageFound.append("NO IMAGE FOUND LIST\n");
|
||||||
|
noImageFound.append("-------------------\n\n");
|
||||||
|
nifHeader = true;
|
||||||
|
}
|
||||||
|
if (!NIF_TITLE) {
|
||||||
|
noImageFound.append(edition.replace(code + "_","")).append(" (").append(code).append(")").append("\n");
|
||||||
|
NIF_TITLE = true;
|
||||||
|
}
|
||||||
|
if (!TOK_TITLE) {
|
||||||
|
noImageFound.append(" TOKENS\n");
|
||||||
|
TOK_TITLE = true;
|
||||||
|
}
|
||||||
|
noImageFound.append(" ").append(tok.replace(code + "_", ""));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (TOK_TITLE)
|
||||||
|
noImageFound.append("\n");
|
||||||
|
for (String cni : CNI) {
|
||||||
|
if (cni.startsWith(code)) {
|
||||||
|
if (!cniHeader) {
|
||||||
|
cardNotImplemented.append("\n-------------------\n");
|
||||||
|
cardNotImplemented.append("UNIMPLEMENTED CARD LIST\n");
|
||||||
|
cardNotImplemented.append("-------------------\n\n");
|
||||||
|
cniHeader = true;
|
||||||
|
}
|
||||||
|
if (!CNI_TITLE) {
|
||||||
|
cardNotImplemented.append(edition.replace(code + "_","")).append(" (").append(code).append(")").append("\n");
|
||||||
|
CNI_TITLE = true;
|
||||||
|
}
|
||||||
|
cardNotImplemented.append(" ").append(cni.replace(code + "_", ""));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (CNI_TITLE)
|
||||||
|
cardNotImplemented.append("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
String totalStats = "Missing images: " + missingCount + "\nUnimplemented cards: " + notImplementedCount + "\n";
|
final int missingImages = NIF.size() + TOK.size();
|
||||||
|
final int unimplemenedCards = CNI.size();
|
||||||
|
String totalStats = "Missing images: " + missingImages + "\nUnimplemented cards: " + unimplemenedCards + "\n";
|
||||||
cardNotImplemented.append("\n-----------\n");
|
cardNotImplemented.append("\n-----------\n");
|
||||||
cardNotImplemented.append(totalStats);
|
cardNotImplemented.append(totalStats);
|
||||||
cardNotImplemented.append("-----------\n\n");
|
cardNotImplemented.append("-----------\n\n");
|
||||||
|
|
||||||
noImageFound.append(cardNotImplemented); // combine things together...
|
noImageFound.append(cardNotImplemented); // combine things together...
|
||||||
return Pair.of(missingCount, notImplementedCount);
|
return Pair.of(missingImages, unimplemenedCards);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String prettifyCardArtPreferenceName(CardDb.CardArtPreference preference) {
|
private String prettifyCardArtPreferenceName(CardDb.CardArtPreference preference) {
|
||||||
|
|||||||
@@ -216,14 +216,6 @@ public enum VSubmenuDownloaders implements IVSubmenu<CSubmenuDownloaders> {
|
|||||||
public void auditUpdate(FTextArea tar, FScrollPane scr) {
|
public void auditUpdate(FTextArea tar, FScrollPane scr) {
|
||||||
StringBuffer nifSB = new StringBuffer(); // NO IMAGE FOUND BUFFER
|
StringBuffer nifSB = new StringBuffer(); // NO IMAGE FOUND BUFFER
|
||||||
StringBuffer cniSB = new StringBuffer(); // CARD NOT IMPLEMENTED BUFFER
|
StringBuffer cniSB = new StringBuffer(); // CARD NOT IMPLEMENTED BUFFER
|
||||||
|
|
||||||
nifSB.append("\n\n-------------------\n");
|
|
||||||
nifSB.append("NO IMAGE FOUND LIST\n");
|
|
||||||
nifSB.append("-------------------\n\n");
|
|
||||||
|
|
||||||
cniSB.append("\n\n-------------------\n");
|
|
||||||
cniSB.append("UNIMPLEMENTED CARD LIST\n");
|
|
||||||
cniSB.append("-------------------\n\n");
|
|
||||||
|
|
||||||
Pair<Integer, Integer> totalAudit = StaticData.instance().audit(nifSB, cniSB);
|
Pair<Integer, Integer> totalAudit = StaticData.instance().audit(nifSB, cniSB);
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import org.apache.commons.lang3.tuple.Pair;
|
|||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class that will create the world from the configuration
|
* Class that will create the world from the configuration
|
||||||
@@ -325,7 +326,7 @@ public class World implements Disposable, SaveFileContent {
|
|||||||
|
|
||||||
final int[] biomeIndex = {-1};
|
final int[] biomeIndex = {-1};
|
||||||
currentTime[0] = measureGenerationTime("loading data", currentTime[0]);
|
currentTime[0] = measureGenerationTime("loading data", currentTime[0]);
|
||||||
HashMap<BiomeStructureData, BiomeStructure> structureDataMap = new HashMap<>();
|
Map<BiomeStructureData, BiomeStructure> structureDataMap = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
//////////////////
|
//////////////////
|
||||||
///////// calculation structure position with wavefunctioncollapse
|
///////// calculation structure position with wavefunctioncollapse
|
||||||
|
|||||||
@@ -61,14 +61,6 @@ public class FilesPage extends TabPage<SettingsScreen> {
|
|||||||
StringBuffer nifSB = new StringBuffer(); // NO IMAGE FOUND BUFFER
|
StringBuffer nifSB = new StringBuffer(); // NO IMAGE FOUND BUFFER
|
||||||
StringBuffer cniSB = new StringBuffer(); // CARD NOT IMPLEMENTED BUFFER
|
StringBuffer cniSB = new StringBuffer(); // CARD NOT IMPLEMENTED BUFFER
|
||||||
|
|
||||||
nifSB.append("\n\n-------------------\n");
|
|
||||||
nifSB.append("NO IMAGE FOUND LIST\n");
|
|
||||||
nifSB.append("-------------------\n\n");
|
|
||||||
|
|
||||||
cniSB.append("\n\n-------------------\n");
|
|
||||||
cniSB.append("UNIMPLEMENTED CARD LIST\n");
|
|
||||||
cniSB.append("-------------------\n\n");
|
|
||||||
|
|
||||||
Pair<Integer, Integer> totalAudit = StaticData.instance().audit(nifSB, cniSB);
|
Pair<Integer, Integer> totalAudit = StaticData.instance().audit(nifSB, cniSB);
|
||||||
String msg = nifSB.toString();
|
String msg = nifSB.toString();
|
||||||
String title = "Missing images: " + totalAudit.getLeft() + "\nUnimplemented cards: " + totalAudit.getRight();
|
String title = "Missing images: " + totalAudit.getLeft() + "\nUnimplemented cards: " + totalAudit.getRight();
|
||||||
|
|||||||
Reference in New Issue
Block a user