mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 18:58:00 +00:00
update ImageKey for Other
This commit is contained in:
@@ -1001,14 +1001,14 @@ public class StaticData {
|
|||||||
if (realSetCode != null) {
|
if (realSetCode != null) {
|
||||||
CardEdition.EditionEntry ee = this.editions.get(realSetCode).findOther(name);
|
CardEdition.EditionEntry ee = this.editions.get(realSetCode).findOther(name);
|
||||||
if (ee != null) { // TODO add collector Number and new ImageKey format
|
if (ee != null) { // TODO add collector Number and new ImageKey format
|
||||||
return ImageKeys.getTokenKey(name + "_" + realSetCode.toLowerCase());
|
return ImageKeys.getTokenKey(String.format("%s|%s|%s", name, realSetCode, ee.collectorNumber()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (CardEdition e : this.editions) {
|
for (CardEdition e : this.editions) {
|
||||||
CardEdition.EditionEntry ee = e.findOther(name);
|
CardEdition.EditionEntry ee = e.findOther(name);
|
||||||
if (ee != null) { // TODO add collector Number and new ImageKey format
|
if (ee != null) { // TODO add collector Number and new ImageKey format
|
||||||
return ImageKeys.getTokenKey(name + "_" + e.getCode().toLowerCase());
|
return ImageKeys.getTokenKey(String.format("%s|%s|%s", name, e.getCode(), ee.collectorNumber()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// final fallback
|
// final fallback
|
||||||
|
|||||||
@@ -65,9 +65,9 @@ public class PaperToken implements InventoryItemFromSet, IPaperCard {
|
|||||||
if (collectorNumber != null && !collectorNumber.isEmpty() && edition != null && edition.getTokens().containsKey(imageFileName)) {
|
if (collectorNumber != null && !collectorNumber.isEmpty() && edition != null && edition.getTokens().containsKey(imageFileName)) {
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
// count the one with the same collectorNumber
|
// count the one with the same collectorNumber
|
||||||
for (CardEdition.TokenInSet t : edition.getTokens().get(imageFileName)) {
|
for (CardEdition.EditionEntry t : edition.getTokens().get(imageFileName)) {
|
||||||
++idx;
|
++idx;
|
||||||
if (!t.collectorNumber.equals(collectorNumber)) {
|
if (!t.collectorNumber().equals(collectorNumber)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// TODO make better image file names when collector number is known
|
// TODO make better image file names when collector number is known
|
||||||
|
|||||||
@@ -46,10 +46,10 @@ public class TokenDb implements ITokenDatabase {
|
|||||||
|
|
||||||
public void preloadTokens() {
|
public void preloadTokens() {
|
||||||
for (CardEdition edition : this.editions) {
|
for (CardEdition edition : this.editions) {
|
||||||
for (Map.Entry<String, Collection<CardEdition.TokenInSet>> inSet : edition.getTokens().asMap().entrySet()) {
|
for (Map.Entry<String, Collection<CardEdition.EditionEntry>> inSet : edition.getTokens().asMap().entrySet()) {
|
||||||
String name = inSet.getKey();
|
String name = inSet.getKey();
|
||||||
String fullName = String.format("%s_%s", name, edition.getCode().toLowerCase());
|
String fullName = String.format("%s_%s", name, edition.getCode().toLowerCase());
|
||||||
for (CardEdition.TokenInSet t : inSet.getValue()) {
|
for (CardEdition.EditionEntry t : inSet.getValue()) {
|
||||||
allTokenByName.put(fullName, addTokenInSet(edition, name, t));
|
allTokenByName.put(fullName, addTokenInSet(edition, name, t));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -65,14 +65,14 @@ public class TokenDb implements ITokenDatabase {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (CardEdition.TokenInSet t : edition.getTokens().get(name)) {
|
for (CardEdition.EditionEntry t : edition.getTokens().get(name)) {
|
||||||
allTokenByName.put(fullName, addTokenInSet(edition, name, t));
|
allTokenByName.put(fullName, addTokenInSet(edition, name, t));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected PaperToken addTokenInSet(CardEdition edition, String name, CardEdition.TokenInSet t) {
|
protected PaperToken addTokenInSet(CardEdition edition, String name, CardEdition.EditionEntry t) {
|
||||||
return new PaperToken(rulesByName.get(name), edition, name, t.collectorNumber, t.artistName);
|
return new PaperToken(rulesByName.get(name), edition, name, t.collectorNumber(), t.artistName());
|
||||||
}
|
}
|
||||||
|
|
||||||
// try all editions to find token
|
// try all editions to find token
|
||||||
|
|||||||
Reference in New Issue
Block a user