mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
@@ -273,14 +273,14 @@ public final class ImageKeys {
|
|||||||
? StaticData.instance().getEditions().getCode2ByCode(edition) // by default 2-letter codes from MWS are used
|
? StaticData.instance().getEditions().getCode2ByCode(edition) // by default 2-letter codes from MWS are used
|
||||||
: CACHE_CARD_PICS_SUBDIR.get(edition); // may use custom paths though
|
: CACHE_CARD_PICS_SUBDIR.get(edition); // may use custom paths though
|
||||||
}
|
}
|
||||||
static boolean hasSetLookup(String filename) {
|
public static boolean hasSetLookup(String filename) {
|
||||||
if (!StaticData.instance().getSetLookup().isEmpty()) {
|
if (!StaticData.instance().getSetLookup().isEmpty()) {
|
||||||
return StaticData.instance().getSetLookup().keySet().stream().anyMatch(setKey -> filename.startsWith(setKey));
|
return StaticData.instance().getSetLookup().keySet().stream().anyMatch(setKey -> filename.startsWith(setKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
private static File setLookUpFile(String filename, String fullborderFile) {
|
public static File setLookUpFile(String filename, String fullborderFile) {
|
||||||
if (!StaticData.instance().getSetLookup().isEmpty()) {
|
if (!StaticData.instance().getSetLookup().isEmpty()) {
|
||||||
for (String setKey : StaticData.instance().getSetLookup().keySet()) {
|
for (String setKey : StaticData.instance().getSetLookup().keySet()) {
|
||||||
if (filename.startsWith(setKey)) {
|
if (filename.startsWith(setKey)) {
|
||||||
|
|||||||
@@ -8,9 +8,11 @@ import forge.card.PrintSheet;
|
|||||||
import forge.item.*;
|
import forge.item.*;
|
||||||
import forge.token.TokenDb;
|
import forge.token.TokenDb;
|
||||||
import forge.util.FileUtil;
|
import forge.util.FileUtil;
|
||||||
|
import forge.util.ImageUtil;
|
||||||
import forge.util.TextUtil;
|
import forge.util.TextUtil;
|
||||||
import forge.util.storage.IStorage;
|
import forge.util.storage.IStorage;
|
||||||
import forge.util.storage.StorageBase;
|
import forge.util.storage.StorageBase;
|
||||||
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@@ -45,6 +47,7 @@ public class StaticData {
|
|||||||
|
|
||||||
private boolean allowCustomCardsInDecksConformance;
|
private boolean allowCustomCardsInDecksConformance;
|
||||||
private boolean enableSmartCardArtSelection;
|
private boolean enableSmartCardArtSelection;
|
||||||
|
private boolean loadNonLegalCards;
|
||||||
|
|
||||||
// Loaded lazily:
|
// Loaded lazily:
|
||||||
private IStorage<SealedProduct.Template> boosters;
|
private IStorage<SealedProduct.Template> boosters;
|
||||||
@@ -74,6 +77,7 @@ public class StaticData {
|
|||||||
this.customCardReader = customCardReader;
|
this.customCardReader = customCardReader;
|
||||||
this.allowCustomCardsInDecksConformance = allowCustomCardsInDecksConformance;
|
this.allowCustomCardsInDecksConformance = allowCustomCardsInDecksConformance;
|
||||||
this.enableSmartCardArtSelection = enableSmartCardArtSelection;
|
this.enableSmartCardArtSelection = enableSmartCardArtSelection;
|
||||||
|
this.loadNonLegalCards = loadNonLegalCards;
|
||||||
lastInstance = this;
|
lastInstance = this;
|
||||||
List<String> funnyCards = new ArrayList<>();
|
List<String> funnyCards = new ArrayList<>();
|
||||||
List<String> filtered = new ArrayList<>();
|
List<String> filtered = new ArrayList<>();
|
||||||
@@ -752,6 +756,129 @@ public class StaticData {
|
|||||||
preferences_avails[i] = prettifyCardArtPreferenceName(preferences[i]);
|
preferences_avails[i] = prettifyCardArtPreferenceName(preferences[i]);
|
||||||
return preferences_avails;
|
return preferences_avails;
|
||||||
}
|
}
|
||||||
|
public Pair<Integer, Integer> audit(StringBuffer noImageFound, StringBuffer cardNotImplemented) {
|
||||||
|
int missingCount = 0;
|
||||||
|
int notImplementedCount = 0;
|
||||||
|
for (CardEdition e : editions) {
|
||||||
|
if (CardEdition.Type.FUNNY.equals(e.getType()))
|
||||||
|
continue;
|
||||||
|
boolean nifHeader = false;
|
||||||
|
boolean cniHeader = false;
|
||||||
|
boolean tokenHeader = false;
|
||||||
|
|
||||||
|
String imagePath;
|
||||||
|
int artIndex = 1;
|
||||||
|
|
||||||
|
HashMap<String, Pair<Boolean, Integer>> cardCount = new HashMap<>();
|
||||||
|
for (CardEdition.CardInSet c : e.getAllCardsInSet()) {
|
||||||
|
if (cardCount.containsKey(c.name)) {
|
||||||
|
cardCount.put(c.name, Pair.of(c.collectorNumber.startsWith("F"), cardCount.get(c.name).getRight() + 1));
|
||||||
|
} else {
|
||||||
|
cardCount.put(c.name, Pair.of(c.collectorNumber.startsWith("F"), 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// loop through the cards in this edition, considering art variations...
|
||||||
|
for (Map.Entry<String, Pair<Boolean, Integer>> entry : cardCount.entrySet()) {
|
||||||
|
String c = entry.getKey();
|
||||||
|
artIndex = entry.getValue().getRight();
|
||||||
|
|
||||||
|
PaperCard cp = getCommonCards().getCard(c, e.getCode(), artIndex);
|
||||||
|
if (cp == null) {
|
||||||
|
cp = getVariantCards().getCard(c, e.getCode(), artIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cp == null) {
|
||||||
|
if (entry.getValue().getLeft()) //skip funny cards
|
||||||
|
continue;
|
||||||
|
if (!loadNonLegalCards && CardEdition.Type.FUNNY.equals(e.getType()))
|
||||||
|
continue;
|
||||||
|
if (!cniHeader) {
|
||||||
|
cardNotImplemented.append("Edition: ").append(e.getName()).append(" ").append("(").append(e.getCode()).append("/").append(e.getCode2()).append(")\n");
|
||||||
|
cniHeader = true;
|
||||||
|
}
|
||||||
|
cardNotImplemented.append(" ").append(c).append("\n");
|
||||||
|
notImplementedCount++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// check the front image
|
||||||
|
imagePath = ImageUtil.getImageRelativePath(cp, false, 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 (!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 back face
|
||||||
|
if (cp.hasBackFace()) {
|
||||||
|
imagePath = ImageUtil.getImageRelativePath(cp, true, 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 (!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++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Audit token images here...
|
||||||
|
for(Map.Entry<String, Integer> tokenEntry : e.getTokens().entrySet()) {
|
||||||
|
String name = tokenEntry.getKey();
|
||||||
|
artIndex = tokenEntry.getValue();
|
||||||
|
try {
|
||||||
|
PaperToken token = getAllTokens().getToken(name, e.getCode());
|
||||||
|
if (token == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
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++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch(Exception ex) {
|
||||||
|
System.out.println("No Token found: " + name + " in " + e.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (nifHeader)
|
||||||
|
noImageFound.append("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
String totalStats = "Missing images: " + missingCount + "\nUnimplemented cards: " + notImplementedCount + "\n";
|
||||||
|
cardNotImplemented.append("\n-----------\n");
|
||||||
|
cardNotImplemented.append(totalStats);
|
||||||
|
cardNotImplemented.append("-----------\n\n");
|
||||||
|
|
||||||
|
noImageFound.append(cardNotImplemented); // combine things together...
|
||||||
|
return Pair.of(missingCount, notImplementedCount);
|
||||||
|
}
|
||||||
|
|
||||||
private String prettifyCardArtPreferenceName(CardDb.CardArtPreference preference) {
|
private String prettifyCardArtPreferenceName(CardDb.CardArtPreference preference) {
|
||||||
StringBuilder label = new StringBuilder();
|
StringBuilder label = new StringBuilder();
|
||||||
|
|||||||
@@ -7,9 +7,6 @@ import java.awt.Toolkit;
|
|||||||
import java.awt.datatransfer.StringSelection;
|
import java.awt.datatransfer.StringSelection;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
import java.io.File;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
|
|
||||||
import javax.swing.BorderFactory;
|
import javax.swing.BorderFactory;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
@@ -17,24 +14,17 @@ import javax.swing.ScrollPaneConstants;
|
|||||||
import javax.swing.SwingConstants;
|
import javax.swing.SwingConstants;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
|
|
||||||
import forge.ImageKeys;
|
|
||||||
import forge.StaticData;
|
import forge.StaticData;
|
||||||
import forge.card.CardDb;
|
|
||||||
import forge.card.CardEdition;
|
|
||||||
import forge.card.CardEdition.CardInSet;
|
|
||||||
import forge.gui.SOverlayUtils;
|
import forge.gui.SOverlayUtils;
|
||||||
import forge.gui.UiCommand;
|
import forge.gui.UiCommand;
|
||||||
import forge.gui.framework.DragCell;
|
import forge.gui.framework.DragCell;
|
||||||
import forge.gui.framework.DragTab;
|
import forge.gui.framework.DragTab;
|
||||||
import forge.gui.framework.EDocID;
|
import forge.gui.framework.EDocID;
|
||||||
import forge.item.PaperCard;
|
|
||||||
import forge.item.PaperToken;
|
|
||||||
import forge.localinstance.properties.ForgeConstants;
|
import forge.localinstance.properties.ForgeConstants;
|
||||||
import forge.localinstance.skin.FSkinProp;
|
import forge.localinstance.skin.FSkinProp;
|
||||||
import forge.screens.home.EMenuGroup;
|
import forge.screens.home.EMenuGroup;
|
||||||
import forge.screens.home.IVSubmenu;
|
import forge.screens.home.IVSubmenu;
|
||||||
import forge.screens.home.VHomeUI;
|
import forge.screens.home.VHomeUI;
|
||||||
import forge.token.TokenDb;
|
|
||||||
import forge.toolbox.FButton;
|
import forge.toolbox.FButton;
|
||||||
import forge.toolbox.FLabel;
|
import forge.toolbox.FLabel;
|
||||||
import forge.toolbox.FOverlay;
|
import forge.toolbox.FOverlay;
|
||||||
@@ -43,7 +33,6 @@ import forge.toolbox.FScrollPane;
|
|||||||
import forge.toolbox.FSkin;
|
import forge.toolbox.FSkin;
|
||||||
import forge.toolbox.FTextArea;
|
import forge.toolbox.FTextArea;
|
||||||
import forge.util.FileUtil;
|
import forge.util.FileUtil;
|
||||||
import forge.util.ImageUtil;
|
|
||||||
import forge.util.Localizer;
|
import forge.util.Localizer;
|
||||||
import forge.util.RuntimeVersion;
|
import forge.util.RuntimeVersion;
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
@@ -232,17 +221,8 @@ public enum VSubmenuDownloaders implements IVSubmenu<CSubmenuDownloaders> {
|
|||||||
* @param scr
|
* @param scr
|
||||||
*/
|
*/
|
||||||
public void auditUpdate(FTextArea tar, FScrollPane scr) {
|
public void auditUpdate(FTextArea tar, FScrollPane scr) {
|
||||||
// Get top-level Forge objects
|
StringBuffer nifSB = new StringBuffer(); // NO IMAGE FOUND BUFFER
|
||||||
CardDb cardDb = StaticData.instance().getCommonCards();
|
StringBuffer cniSB = new StringBuffer(); // CARD NOT IMPLEMENTED BUFFER
|
||||||
CardDb variantDb = StaticData.instance().getVariantCards();
|
|
||||||
TokenDb tokenDb = StaticData.instance().getAllTokens();
|
|
||||||
CardEdition.Collection editions = StaticData.instance().getEditions();
|
|
||||||
|
|
||||||
int missingCount = 0;
|
|
||||||
int notImplementedCount = 0;
|
|
||||||
|
|
||||||
final StringBuffer nifSB = new StringBuffer(); // NO IMAGE FOUND BUFFER
|
|
||||||
final StringBuffer cniSB = new StringBuffer(); // CARD NOT IMPLEMENTED BUFFER
|
|
||||||
|
|
||||||
nifSB.append("\n\n-------------------\n");
|
nifSB.append("\n\n-------------------\n");
|
||||||
nifSB.append("NO IMAGE FOUND LIST\n");
|
nifSB.append("NO IMAGE FOUND LIST\n");
|
||||||
@@ -252,118 +232,7 @@ public enum VSubmenuDownloaders implements IVSubmenu<CSubmenuDownloaders> {
|
|||||||
cniSB.append("UNIMPLEMENTED CARD LIST\n");
|
cniSB.append("UNIMPLEMENTED CARD LIST\n");
|
||||||
cniSB.append("-------------------\n\n");
|
cniSB.append("-------------------\n\n");
|
||||||
|
|
||||||
for (CardEdition e : editions) {
|
Pair<Integer, Integer> totalAudit = StaticData.instance().audit(nifSB, cniSB);
|
||||||
if (CardEdition.Type.FUNNY.equals(e.getType()))
|
|
||||||
continue;
|
|
||||||
boolean nifHeader = false;
|
|
||||||
boolean cniHeader = false;
|
|
||||||
boolean tokenHeader = false;
|
|
||||||
|
|
||||||
String imagePath;
|
|
||||||
int artIndex = 1;
|
|
||||||
|
|
||||||
HashMap<String, Pair<Boolean, Integer>> cardCount = new HashMap<>();
|
|
||||||
for (CardInSet c : e.getAllCardsInSet()) {
|
|
||||||
if (cardCount.containsKey(c.name)) {
|
|
||||||
cardCount.put(c.name, Pair.of(c.collectorNumber.startsWith("F"), cardCount.get(c.name).getRight() + 1));
|
|
||||||
} else {
|
|
||||||
cardCount.put(c.name, Pair.of(c.collectorNumber.startsWith("F"), 1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// loop through the cards in this edition, considering art variations...
|
|
||||||
for (Entry<String, Pair<Boolean, Integer>> entry : cardCount.entrySet()) {
|
|
||||||
String c = entry.getKey();
|
|
||||||
artIndex = entry.getValue().getRight();
|
|
||||||
|
|
||||||
PaperCard cp = cardDb.getCard(c, e.getCode(), artIndex);
|
|
||||||
if (cp == null) {
|
|
||||||
cp = variantDb.getCard(c, e.getCode(), artIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cp == null) {
|
|
||||||
if (entry.getValue().getLeft()) //skip funny cards
|
|
||||||
continue;
|
|
||||||
if (!cniHeader) {
|
|
||||||
cniSB.append("Edition: ").append(e.getName()).append(" ").append("(").append(e.getCode()).append("/").append(e.getCode2()).append(")\n");
|
|
||||||
cniHeader = true;
|
|
||||||
}
|
|
||||||
cniSB.append(" ").append(c).append("\n");
|
|
||||||
notImplementedCount++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// check the front image
|
|
||||||
imagePath = ImageUtil.getImageRelativePath(cp, false, true, false);
|
|
||||||
if (imagePath != null) {
|
|
||||||
File file = ImageKeys.getImageFile(imagePath);
|
|
||||||
if (file == null) {
|
|
||||||
if (!nifHeader) {
|
|
||||||
nifSB.append("Edition: ").append(e.getName()).append(" ").append("(").append(e.getCode()).append("/").append(e.getCode2()).append(")\n");
|
|
||||||
nifHeader = true;
|
|
||||||
}
|
|
||||||
nifSB.append(" ").append(imagePath).append("\n");
|
|
||||||
missingCount++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// check the back face
|
|
||||||
if (cp.hasBackFace()) {
|
|
||||||
imagePath = ImageUtil.getImageRelativePath(cp, true, true, false);
|
|
||||||
if (imagePath != null) {
|
|
||||||
File file = ImageKeys.getImageFile(imagePath);
|
|
||||||
if (file == null) {
|
|
||||||
if (!nifHeader) {
|
|
||||||
nifSB.append("Edition: ").append(e.getName()).append(" ").append("(").append(e.getCode()).append("/").append(e.getCode2()).append(")\n");
|
|
||||||
nifHeader = true;
|
|
||||||
}
|
|
||||||
nifSB.append(" ").append(imagePath).append("\n");
|
|
||||||
missingCount++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: Audit token images here...
|
|
||||||
for(Entry<String, Integer> tokenEntry : e.getTokens().entrySet()) {
|
|
||||||
String name = tokenEntry.getKey();
|
|
||||||
artIndex = tokenEntry.getValue();
|
|
||||||
try {
|
|
||||||
PaperToken token = tokenDb.getToken(name, e.getCode());
|
|
||||||
if (token == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
for(int i = 0; i < artIndex; i++) {
|
|
||||||
String imgKey = token.getImageKey(i);
|
|
||||||
File file = ImageKeys.getImageFile(imgKey);
|
|
||||||
if (file == null) {
|
|
||||||
if (!nifHeader) {
|
|
||||||
nifSB.append("Edition: ").append(e.getName()).append(" ").append("(").append(e.getCode()).append("/").append(e.getCode2()).append(")\n");
|
|
||||||
nifHeader = true;
|
|
||||||
}
|
|
||||||
if (!tokenHeader) {
|
|
||||||
nifSB.append("\nTOKENS\n");
|
|
||||||
tokenHeader = true;
|
|
||||||
}
|
|
||||||
nifSB.append(" ").append(token.getImageFilename(i + 1)).append("\n");
|
|
||||||
missingCount++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch(Exception ex) {
|
|
||||||
System.out.println("No Token found: " + name + " in " + e.getName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (nifHeader)
|
|
||||||
nifSB.append("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
String totalStats = "Missing images: " + missingCount + "\nUnimplemented cards: " + notImplementedCount + "\n";
|
|
||||||
cniSB.append("\n-----------\n");
|
|
||||||
cniSB.append(totalStats);
|
|
||||||
cniSB.append("-----------\n\n");
|
|
||||||
|
|
||||||
nifSB.append(cniSB); // combine things together...
|
|
||||||
|
|
||||||
tar.setText(nifSB.toString());
|
tar.setText(nifSB.toString());
|
||||||
tar.setCaretPosition(0); // this will move scroll view to the top...
|
tar.setCaretPosition(0); // this will move scroll view to the top...
|
||||||
@@ -378,7 +247,7 @@ public enum VSubmenuDownloaders implements IVSubmenu<CSubmenuDownloaders> {
|
|||||||
});
|
});
|
||||||
scr.getParent().add(btnClipboardCopy, "w 200!, h pref+12!, center, gaptop 10");
|
scr.getParent().add(btnClipboardCopy, "w 200!, h pref+12!, center, gaptop 10");
|
||||||
|
|
||||||
String labelText = "<html>Missing images: " + missingCount + "<br>Unimplemented cards: " + notImplementedCount + "<br>";
|
String labelText = "<html>Missing images: " + totalAudit.getLeft() + "<br>Unimplemented cards: " + totalAudit.getRight() + "<br>";
|
||||||
final FLabel statsLabel = new FLabel.Builder().text(labelText).fontSize(15).build();
|
final FLabel statsLabel = new FLabel.Builder().text(labelText).fontSize(15).build();
|
||||||
scr.getParent().add(statsLabel);
|
scr.getParent().add(statsLabel);
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,11 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
|
import forge.StaticData;
|
||||||
|
import forge.gui.FThreads;
|
||||||
import forge.gui.GuiBase;
|
import forge.gui.GuiBase;
|
||||||
|
import forge.screens.LoadingOverlay;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import com.badlogic.gdx.utils.Align;
|
import com.badlogic.gdx.utils.Align;
|
||||||
@@ -34,6 +38,7 @@ import forge.toolbox.FOptionPane;
|
|||||||
import forge.toolbox.GuiChoose;
|
import forge.toolbox.GuiChoose;
|
||||||
import forge.util.Callback;
|
import forge.util.Callback;
|
||||||
import forge.util.FileUtil;
|
import forge.util.FileUtil;
|
||||||
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
public class FilesPage extends TabPage<SettingsScreen> {
|
public class FilesPage extends TabPage<SettingsScreen> {
|
||||||
private final FGroupList<FilesItem> lstItems = add(new FGroupList<>());
|
private final FGroupList<FilesItem> lstItems = add(new FGroupList<>());
|
||||||
@@ -43,10 +48,45 @@ public class FilesPage extends TabPage<SettingsScreen> {
|
|||||||
|
|
||||||
lstItems.setListItemRenderer(new FilesItemRenderer());
|
lstItems.setListItemRenderer(new FilesItemRenderer());
|
||||||
|
|
||||||
|
lstItems.addGroup(Forge.getLocalizer().getMessage("lblCardAudit"));
|
||||||
lstItems.addGroup(Forge.getLocalizer().getMessage("ContentDownloaders"));
|
lstItems.addGroup(Forge.getLocalizer().getMessage("ContentDownloaders"));
|
||||||
lstItems.addGroup(Forge.getLocalizer().getMessage("lblStorageLocations"));
|
lstItems.addGroup(Forge.getLocalizer().getMessage("lblStorageLocations"));
|
||||||
//lstItems.addGroup("Data Import");
|
//lstItems.addGroup("Data Import");
|
||||||
|
|
||||||
|
//Auditer
|
||||||
|
lstItems.addItem(new Extra(Forge.getLocalizer().getMessage("btnListImageData"), Forge.getLocalizer().getMessage("lblListImageData")) {
|
||||||
|
@Override
|
||||||
|
public void select() {
|
||||||
|
FThreads.invokeInEdtLater(() -> LoadingOverlay.show(Forge.getLocalizer().getMessage("lblProcessingCards"), true, () -> {
|
||||||
|
StringBuffer nifSB = new StringBuffer(); // NO IMAGE FOUND 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);
|
||||||
|
String msg = nifSB.toString();
|
||||||
|
String title = "Missing images: " + totalAudit.getLeft() + "\nUnimplemented cards: " + totalAudit.getRight();
|
||||||
|
FOptionPane.showOptionDialog(msg, title, FOptionPane.INFORMATION_ICON, ImmutableList.of(Forge.getLocalizer().getMessage("lblCopy"), Forge.getLocalizer().getMessage("lblClose")), -1, new Callback<Integer>() {
|
||||||
|
@Override
|
||||||
|
public void run(Integer result) {
|
||||||
|
switch (result) {
|
||||||
|
case 0:
|
||||||
|
Forge.getClipboard().setContents(msg);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}, 0);
|
||||||
//content downloaders
|
//content downloaders
|
||||||
lstItems.addItem(new ContentDownloader(Forge.getLocalizer().getMessage("btnDownloadPics"),
|
lstItems.addItem(new ContentDownloader(Forge.getLocalizer().getMessage("btnDownloadPics"),
|
||||||
Forge.getLocalizer().getMessage("lblDownloadPics")) {
|
Forge.getLocalizer().getMessage("lblDownloadPics")) {
|
||||||
@@ -54,35 +94,35 @@ public class FilesPage extends TabPage<SettingsScreen> {
|
|||||||
protected GuiDownloadService createService() {
|
protected GuiDownloadService createService() {
|
||||||
return new GuiDownloadPicturesLQ();
|
return new GuiDownloadPicturesLQ();
|
||||||
}
|
}
|
||||||
}, 0);
|
}, 1);
|
||||||
lstItems.addItem(new ContentDownloader(Forge.getLocalizer().getMessage("btnDownloadSetPics"),
|
lstItems.addItem(new ContentDownloader(Forge.getLocalizer().getMessage("btnDownloadSetPics"),
|
||||||
Forge.getLocalizer().getMessage("lblDownloadSetPics")) {
|
Forge.getLocalizer().getMessage("lblDownloadSetPics")) {
|
||||||
@Override
|
@Override
|
||||||
protected GuiDownloadService createService() {
|
protected GuiDownloadService createService() {
|
||||||
return new GuiDownloadSetPicturesLQ();
|
return new GuiDownloadSetPicturesLQ();
|
||||||
}
|
}
|
||||||
}, 0);
|
}, 1);
|
||||||
lstItems.addItem(new ContentDownloader(Forge.getLocalizer().getMessage("btnDownloadQuestImages"),
|
lstItems.addItem(new ContentDownloader(Forge.getLocalizer().getMessage("btnDownloadQuestImages"),
|
||||||
Forge.getLocalizer().getMessage("lblDownloadQuestImages")) {
|
Forge.getLocalizer().getMessage("lblDownloadQuestImages")) {
|
||||||
@Override
|
@Override
|
||||||
protected GuiDownloadService createService() {
|
protected GuiDownloadService createService() {
|
||||||
return new GuiDownloadQuestImages();
|
return new GuiDownloadQuestImages();
|
||||||
}
|
}
|
||||||
}, 0);
|
}, 1);
|
||||||
lstItems.addItem(new ContentDownloader(Forge.getLocalizer().getMessage("btnDownloadAchievementImages"),
|
lstItems.addItem(new ContentDownloader(Forge.getLocalizer().getMessage("btnDownloadAchievementImages"),
|
||||||
Forge.getLocalizer().getMessage("lblDownloadAchievementImages")) {
|
Forge.getLocalizer().getMessage("lblDownloadAchievementImages")) {
|
||||||
@Override
|
@Override
|
||||||
protected GuiDownloadService createService() {
|
protected GuiDownloadService createService() {
|
||||||
return new GuiDownloadAchievementImages();
|
return new GuiDownloadAchievementImages();
|
||||||
}
|
}
|
||||||
}, 0);
|
}, 1);
|
||||||
lstItems.addItem(new ContentDownloader(Forge.getLocalizer().getMessage("btnDownloadPrices"),
|
lstItems.addItem(new ContentDownloader(Forge.getLocalizer().getMessage("btnDownloadPrices"),
|
||||||
Forge.getLocalizer().getMessage("lblDownloadPrices")) {
|
Forge.getLocalizer().getMessage("lblDownloadPrices")) {
|
||||||
@Override
|
@Override
|
||||||
protected GuiDownloadService createService() {
|
protected GuiDownloadService createService() {
|
||||||
return new GuiDownloadPrices();
|
return new GuiDownloadPrices();
|
||||||
}
|
}
|
||||||
}, 0);
|
}, 1);
|
||||||
lstItems.addItem(new ContentDownloader(Forge.getLocalizer().getMessage("btnDownloadSkins"),
|
lstItems.addItem(new ContentDownloader(Forge.getLocalizer().getMessage("btnDownloadSkins"),
|
||||||
Forge.getLocalizer().getMessage("lblDownloadSkins")) {
|
Forge.getLocalizer().getMessage("lblDownloadSkins")) {
|
||||||
@Override
|
@Override
|
||||||
@@ -93,7 +133,7 @@ public class FilesPage extends TabPage<SettingsScreen> {
|
|||||||
protected void finishCallback() {
|
protected void finishCallback() {
|
||||||
SettingsScreen.getSettingsScreen().getSettingsPage().refreshSkinsList();
|
SettingsScreen.getSettingsScreen().getSettingsPage().refreshSkinsList();
|
||||||
}
|
}
|
||||||
}, 0);
|
}, 1);
|
||||||
lstItems.addItem(new OptionContentDownloader(Forge.getLocalizer().getMessage("btnDownloadCJKFonts"),
|
lstItems.addItem(new OptionContentDownloader(Forge.getLocalizer().getMessage("btnDownloadCJKFonts"),
|
||||||
Forge.getLocalizer().getMessage("lblDownloadCJKFonts"),
|
Forge.getLocalizer().getMessage("lblDownloadCJKFonts"),
|
||||||
Forge.getLocalizer().getMessage("lblDownloadCJKFontPrompt")) {
|
Forge.getLocalizer().getMessage("lblDownloadCJKFontPrompt")) {
|
||||||
@@ -118,7 +158,7 @@ public class FilesPage extends TabPage<SettingsScreen> {
|
|||||||
protected void finishCallback() {
|
protected void finishCallback() {
|
||||||
SettingsScreen.getSettingsScreen().getSettingsPage().refreshCJKFontsList();
|
SettingsScreen.getSettingsScreen().getSettingsPage().refreshCJKFontsList();
|
||||||
}
|
}
|
||||||
}, 0);
|
}, 1);
|
||||||
//storage locations
|
//storage locations
|
||||||
final StorageOption cardPicsOption = new StorageOption(Forge.getLocalizer().getMessage("lblCardPicsLocation"), ForgeProfileProperties.getCardPicsDir()) {
|
final StorageOption cardPicsOption = new StorageOption(Forge.getLocalizer().getMessage("lblCardPicsLocation"), ForgeProfileProperties.getCardPicsDir()) {
|
||||||
@Override
|
@Override
|
||||||
@@ -141,7 +181,7 @@ public class FilesPage extends TabPage<SettingsScreen> {
|
|||||||
//ensure decks option is updated if needed
|
//ensure decks option is updated if needed
|
||||||
decksOption.updateDir(ForgeProfileProperties.getDecksDir());
|
decksOption.updateDir(ForgeProfileProperties.getDecksDir());
|
||||||
}
|
}
|
||||||
}, 1);
|
}, 2);
|
||||||
lstItems.addItem(new StorageOption(Forge.getLocalizer().getMessage("lblImageCacheLocation"), ForgeProfileProperties.getCacheDir()) {
|
lstItems.addItem(new StorageOption(Forge.getLocalizer().getMessage("lblImageCacheLocation"), ForgeProfileProperties.getCacheDir()) {
|
||||||
@Override
|
@Override
|
||||||
protected void onDirectoryChanged(String newDir) {
|
protected void onDirectoryChanged(String newDir) {
|
||||||
@@ -150,9 +190,9 @@ public class FilesPage extends TabPage<SettingsScreen> {
|
|||||||
//ensure card pics option is updated if needed
|
//ensure card pics option is updated if needed
|
||||||
cardPicsOption.updateDir(ForgeProfileProperties.getCardPicsDir());
|
cardPicsOption.updateDir(ForgeProfileProperties.getCardPicsDir());
|
||||||
}
|
}
|
||||||
}, 1);
|
}, 2);
|
||||||
lstItems.addItem(cardPicsOption, 1);
|
lstItems.addItem(cardPicsOption, 2);
|
||||||
lstItems.addItem(decksOption, 1);
|
lstItems.addItem(decksOption, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -201,7 +241,19 @@ public class FilesPage extends TabPage<SettingsScreen> {
|
|||||||
g.drawText(value.description, SettingsScreen.DESC_FONT, SettingsScreen.DESC_COLOR, x, y + h, w, totalHeight - h + SettingsScreen.getInsets(w), true, Align.left, false);
|
g.drawText(value.description, SettingsScreen.DESC_FONT, SettingsScreen.DESC_COLOR, x, y + h, w, totalHeight - h + SettingsScreen.getInsets(w), true, Align.left, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private abstract class Extra extends FilesItem {
|
||||||
|
Extra(String label0, String description0) {
|
||||||
|
super(label0, description0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void select() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void finishCallback() {
|
||||||
|
}
|
||||||
|
}
|
||||||
private abstract class ContentDownloader extends FilesItem {
|
private abstract class ContentDownloader extends FilesItem {
|
||||||
ContentDownloader(String label0, String description0) {
|
ContentDownloader(String label0, String description0) {
|
||||||
super(label0, description0);
|
super(label0, description0);
|
||||||
@@ -239,7 +291,7 @@ public class FilesPage extends TabPage<SettingsScreen> {
|
|||||||
@Override
|
@Override
|
||||||
public void run(String result) {
|
public void run(String result) {
|
||||||
final String url = categories.get(result);
|
final String url = categories.get(result);
|
||||||
final String name = url.substring(url.lastIndexOf("/") + 1);
|
final String name = url.substring(url.lastIndexOf("/") + 2);
|
||||||
new GuiDownloader(new GuiDownloadZipService(name, name, url, ForgeConstants.FONTS_DIR, null, null), new Callback<Boolean>() {
|
new GuiDownloader(new GuiDownloadZipService(name, name, url, ForgeConstants.FONTS_DIR, null, null), new Callback<Boolean>() {
|
||||||
@Override
|
@Override
|
||||||
public void run(Boolean finished) {
|
public void run(Boolean finished) {
|
||||||
|
|||||||
@@ -229,6 +229,8 @@ btnDownloadPics=Bilder(LQ) Karten herunterladen
|
|||||||
btnDownloadQuestImages=Bilder für Quests herunterladen
|
btnDownloadQuestImages=Bilder für Quests herunterladen
|
||||||
btnDownloadAchievementImages=Bilder für Erfolge herunterladen
|
btnDownloadAchievementImages=Bilder für Erfolge herunterladen
|
||||||
btnReportBug=Einen Fehler melden
|
btnReportBug=Einen Fehler melden
|
||||||
|
lblProcessingCards=Karten verarbeiten ...
|
||||||
|
lblCardAudit=Kartenprüfung
|
||||||
btnListImageData=Prüfe Karten- und Bilddaten
|
btnListImageData=Prüfe Karten- und Bilddaten
|
||||||
lblListImageData=Prüfe auf von Forge nicht unterstütze Karten und fehlende Kartenbilder
|
lblListImageData=Prüfe auf von Forge nicht unterstütze Karten und fehlende Kartenbilder
|
||||||
btnImportPictures=Daten importieren
|
btnImportPictures=Daten importieren
|
||||||
|
|||||||
@@ -230,6 +230,8 @@ btnDownloadPics=Download LQ Card Pictures
|
|||||||
btnDownloadQuestImages=Download Quest Images
|
btnDownloadQuestImages=Download Quest Images
|
||||||
btnDownloadAchievementImages=Download Achievement Images
|
btnDownloadAchievementImages=Download Achievement Images
|
||||||
btnReportBug=Report a Bug
|
btnReportBug=Report a Bug
|
||||||
|
lblProcessingCards=Processing Cards...
|
||||||
|
lblCardAudit=Card Audit
|
||||||
btnListImageData=Audit Card and Image Data
|
btnListImageData=Audit Card and Image Data
|
||||||
lblListImageData=Audit cards not implemented by Forge and missing card images
|
lblListImageData=Audit cards not implemented by Forge and missing card images
|
||||||
btnImportPictures=Import Data
|
btnImportPictures=Import Data
|
||||||
|
|||||||
@@ -230,6 +230,8 @@ btnDownloadPics=Descargar cartas únicas
|
|||||||
btnDownloadQuestImages=Descargar imágenes del modo aventura
|
btnDownloadQuestImages=Descargar imágenes del modo aventura
|
||||||
btnDownloadAchievementImages=Descargar imágenes de los trofeos
|
btnDownloadAchievementImages=Descargar imágenes de los trofeos
|
||||||
btnReportBug=Reportar un error
|
btnReportBug=Reportar un error
|
||||||
|
lblProcessingCards=Tarjetas de procesamiento ...
|
||||||
|
lblCardAudit=Auditoría
|
||||||
btnListImageData=Auditar cartas y datos de imagen
|
btnListImageData=Auditar cartas y datos de imagen
|
||||||
lblListImageData=Audita cartas no implementadas por Forge e imágenes de cartas faltantes
|
lblListImageData=Audita cartas no implementadas por Forge e imágenes de cartas faltantes
|
||||||
btnImportPictures=Importar datos
|
btnImportPictures=Importar datos
|
||||||
|
|||||||
@@ -229,6 +229,8 @@ btnDownloadPics=Scarica immagini delle carte a bassa qualità
|
|||||||
btnDownloadQuestImages=Scarica immagini Avventura
|
btnDownloadQuestImages=Scarica immagini Avventura
|
||||||
btnDownloadAchievementImages=Scarica immagini dei trofei
|
btnDownloadAchievementImages=Scarica immagini dei trofei
|
||||||
btnReportBug=Segnalare un bug
|
btnReportBug=Segnalare un bug
|
||||||
|
lblProcessingCards=Carte di elaborazione ...
|
||||||
|
lblCardAudit=Audit della scheda
|
||||||
btnListImageData=Verifica i dati e le immagini delle carte
|
btnListImageData=Verifica i dati e le immagini delle carte
|
||||||
lblListImageData=Verifica le carte non implementate in Forge e le immagini mancanti
|
lblListImageData=Verifica le carte non implementate in Forge e le immagini mancanti
|
||||||
btnImportPictures=Importa dati
|
btnImportPictures=Importa dati
|
||||||
|
|||||||
@@ -230,6 +230,8 @@ btnDownloadPics=LQ カード画像のダウンロード
|
|||||||
btnDownloadQuestImages=クエスト画像をダウンロード
|
btnDownloadQuestImages=クエスト画像をダウンロード
|
||||||
btnDownloadAchievementImages=実績画像のダウンロード
|
btnDownloadAchievementImages=実績画像のダウンロード
|
||||||
btnReportBug=バグを報告する
|
btnReportBug=バグを報告する
|
||||||
|
lblProcessingCards=処理カード...
|
||||||
|
lblCardAudit=カード監査
|
||||||
btnListImageData=カードと画像データの監査
|
btnListImageData=カードと画像データの監査
|
||||||
lblListImageData=Forge で実装されていないカードと欠落しているカード画像の監査
|
lblListImageData=Forge で実装されていないカードと欠落しているカード画像の監査
|
||||||
btnImportPictures=画像データのインポート
|
btnImportPictures=画像データのインポート
|
||||||
|
|||||||
@@ -231,6 +231,8 @@ btnDownloadPics=Baixar Imagens das Cartas em Baixa Qualidade
|
|||||||
btnDownloadQuestImages=Baixar Imagens das Missões
|
btnDownloadQuestImages=Baixar Imagens das Missões
|
||||||
btnDownloadAchievementImages=Baixar Imagens das Conquistas
|
btnDownloadAchievementImages=Baixar Imagens das Conquistas
|
||||||
btnReportBug=Relatar um Bug
|
btnReportBug=Relatar um Bug
|
||||||
|
lblProcessingCards=Cartões de processamento ...
|
||||||
|
lblCardAudit=Auditoria do cartão
|
||||||
btnListImageData=Auditar Cartas e Imagens
|
btnListImageData=Auditar Cartas e Imagens
|
||||||
lblListImageData=Auditar cartas não implementadas no Forge e imagens ausentes de cartas
|
lblListImageData=Auditar cartas não implementadas no Forge e imagens ausentes de cartas
|
||||||
btnImportPictures=Importar Dados
|
btnImportPictures=Importar Dados
|
||||||
|
|||||||
@@ -230,6 +230,8 @@ btnDownloadPics=下载低清卡图
|
|||||||
btnDownloadQuestImages=下载冒险图片
|
btnDownloadQuestImages=下载冒险图片
|
||||||
btnDownloadAchievementImages=下载成就图片
|
btnDownloadAchievementImages=下载成就图片
|
||||||
btnReportBug=报告错误
|
btnReportBug=报告错误
|
||||||
|
lblProcessingCards=处理卡...
|
||||||
|
lblCardAudit=卡审核
|
||||||
btnListImageData=统计牌和图片数据
|
btnListImageData=统计牌和图片数据
|
||||||
lblListImageData=统计Forge实现且缺少的图片的牌
|
lblListImageData=统计Forge实现且缺少的图片的牌
|
||||||
btnImportPictures=导入数据
|
btnImportPictures=导入数据
|
||||||
|
|||||||
Reference in New Issue
Block a user