Bugfixes for dealing with Set Images.

This commit is contained in:
jendave
2011-08-06 12:38:58 +00:00
parent e0ceddd205
commit 495cd577ea
10 changed files with 82 additions and 10 deletions

View File

@@ -2975,7 +2975,7 @@ public class Card extends MyObservable {
return SetInfoUtil.getMostRecentSet(Sets);
}
private String ImageFilename = "none";
private String ImageFilename = "";
public void setImageFilename(String iFN)
{

View File

@@ -11695,6 +11695,8 @@ public class CardFactory implements NewConstants {
c.setSVars(sim.getSVars());
c.setSets(sim.getSets());
c.setIntrinsicAbilities(sim.getIntrinsicAbilities());
c.setCurSetCode(sim.getCurSetCode());
c.setImageFilename(sim.getImageFilename());
return c;
}// copyStats()

View File

@@ -249,6 +249,7 @@ class CardFactory_Planeswalkers {
card2.addSpellAbility(ability3);
card2.setSVars(card.getSVars());
card2.setSets(card.getSets());
return card2;
}
@@ -496,6 +497,7 @@ class CardFactory_Planeswalkers {
card2.addSpellAbility(ability3);
card2.setSVars(card.getSVars());
card2.setSets(card.getSets());
return card2;
}
@@ -810,6 +812,7 @@ class CardFactory_Planeswalkers {
card2.addSpellAbility(ability3);
card2.setSVars(card.getSVars());
card2.setSets(card.getSets());
return card2;
}
@@ -1023,6 +1026,7 @@ class CardFactory_Planeswalkers {
card2.addSpellAbility(ability3);
card2.setSVars(card.getSVars());
card2.setSets(card.getSets());
return card2;
}
@@ -1253,6 +1257,7 @@ class CardFactory_Planeswalkers {
card2.addSpellAbility(ability3);
card2.setSVars(card.getSVars());
card2.setSets(card.getSets());
return card2;
}
@@ -1526,6 +1531,7 @@ class CardFactory_Planeswalkers {
//end ability3
card2.setSVars(card.getSVars());
card2.setSets(card.getSets());
return card2;
}
@@ -1769,6 +1775,7 @@ class CardFactory_Planeswalkers {
//end ability 3
card2.setSVars(card.getSVars());
card2.setSets(card.getSets());
return card2;
}//*************** END ************ END **************************
@@ -1890,6 +1897,7 @@ class CardFactory_Planeswalkers {
card2.addSpellAbility(ability3);
card2.setSVars(card.getSVars());
card2.setSets(card.getSets());
return card2;
}//*************** END ************ END **************************
@@ -2135,6 +2143,7 @@ class CardFactory_Planeswalkers {
card2.addSpellAbility(ability3);
card2.setSVars(card.getSVars());
card2.setSets(card.getSets());
return card2;
}//*************** END ************ END **************************
@@ -2427,6 +2436,7 @@ class CardFactory_Planeswalkers {
card2.addSpellAbility(ability3);
card2.setSVars(card.getSVars());
card2.setSets(card.getSets());
return card2;
}//*************** END ************ END **************************
@@ -2647,6 +2657,7 @@ class CardFactory_Planeswalkers {
//end ability 3
card2.setSVars(card.getSVars());
card2.setSets(card.getSets());
return card2;
}//*************** END ************ END **************************
@@ -2874,6 +2885,7 @@ class CardFactory_Planeswalkers {
card2.addSpellAbility(ability4);
card2.setSVars(card.getSVars());
card2.setSets(card.getSets());
return card2;
}//*************** END ************ END **************************
@@ -3068,6 +3080,7 @@ class CardFactory_Planeswalkers {
card2.addSpellAbility(ability3);
card2.setSVars(card.getSVars());
card2.setSets(card.getSets());
return card2;
}//*************** END ************ END **************************
@@ -3269,6 +3282,7 @@ class CardFactory_Planeswalkers {
card2.addSpellAbility(ability3);
card2.setSVars(card.getSVars());
card2.setSets(card.getSets());
return card2;
}//*************** END ************ END **************************
@@ -3519,6 +3533,7 @@ class CardFactory_Planeswalkers {
card2.addSpellAbility(ability3);
card2.setSVars(card.getSVars());
card2.setSets(card.getSets());
return card2;
}
@@ -3782,6 +3797,7 @@ class CardFactory_Planeswalkers {
card2.addSpellAbility(ability3);
card2.setSVars(card.getSVars());
card2.setSets(card.getSets());
return card2;
}//*************** END ************ END **************************

View File

@@ -290,6 +290,15 @@ public class CardUtil {
if (card.getRandomPicture() > 1)
sbKey.append(card.getRandomPicture());
f = new File(path, sbKey.toString() + ".jpg");
if (f.exists())
return sbKey.toString();
sbKey = new StringBuilder();
//Really last-ditch effort, forget the picture number
sbKey.append(GuiDisplayUtil.cleanString(card.getImageName()));
f = new File(path, sbKey.toString() + ".jpg");
if (f.exists())
return sbKey.toString();

View File

@@ -2395,6 +2395,7 @@ public class GameAction {
//}
if ((card.getSets().size() > 0) && card.getCurSetCode().equals(""))
card.setRandomSetCode();
card.setImageFilename(CardUtil.buildFilename(card));
AllZone.Computer_Library.add(card);

View File

@@ -432,6 +432,7 @@ public class Gui_BoosterDraft extends JFrame implements CardContainer, NewConsta
//add rarity to card if this is a sealed card pool
if(!Constant.Runtime.GameType[0].equals(Constant.GameType.Constructed)) c.setRarity(pack.getRarity(c.getName()));;
deckModel.addCard(c);
}//for
@@ -504,6 +505,13 @@ public class Gui_BoosterDraft extends JFrame implements CardContainer, NewConsta
for(int i = 0; i < list.size(); i++) {
c = list.get(i);
c.setRarity(pack.getRarity(c.getName()));
if (c.getCurSetCode().equals(""))
{
c.setCurSetCode(c.getMostRecentSet());
c.setImageFilename(CardUtil.buildFilename(c));
}
allCardModel.addCard(c);
}
allCardModel.resort();

View File

@@ -113,6 +113,14 @@ public class Gui_CardShop extends JFrame implements CardContainer, DeckDisplay,
if(!pack.getRarity(cardName).equals("error")) {
c.setRarity(pack.getRarity(cardName));
}
if (c.getCurSetCode().equals(""))
{
c.setCurSetCode(c.getMostRecentSet());
c.setImageFilename(CardUtil.buildFilename(c));
}
topModel.addCard(c);
}// for
@@ -123,7 +131,13 @@ public class Gui_CardShop extends JFrame implements CardContainer, DeckDisplay,
// add rarity to card if this is a sealed card pool
if(!customMenu.getGameType().equals(Constant.GameType.Constructed)) c.setRarity(pack.getRarity(c.getName()));
if (c.getCurSetCode().equals(""))
{
c.setCurSetCode(c.getMostRecentSet());
c.setImageFilename(CardUtil.buildFilename(c));
}
bottomModel.addCard(c);
}// for

View File

@@ -150,8 +150,12 @@ public class Gui_DeckEditor extends JFrame implements CardContainer, DeckDisplay
filteredOut = filterByType(c);
}
c.setCurSetCode(c.getMostRecentSet());
c.setImageFilename(CardUtil.buildFilename(c));
if (c.getCurSetCode().equals(""))
{
c.setCurSetCode(c.getMostRecentSet());
c.setImageFilename(CardUtil.buildFilename(c));
}
if(!filteredOut) {
topModel.addCard(c);
@@ -165,6 +169,12 @@ public class Gui_DeckEditor extends JFrame implements CardContainer, DeckDisplay
// add rarity to card if this is a sealed card pool
if(!customMenu.getGameType().equals(Constant.GameType.Constructed)) c.setRarity(pack.getRarity(c.getName()));
if (c.getCurSetCode().equals(""))
{
c.setCurSetCode(c.getMostRecentSet());
c.setImageFilename(CardUtil.buildFilename(c));
}
bottomModel.addCard(c);
}// for

View File

@@ -140,8 +140,12 @@ public class Gui_Quest_DeckEditor extends JFrame implements CardContainer, DeckD
if(addedList.contains(cardName)) c.setRarity("new");
c.setCurSetCode(c.getMostRecentSet());
c.setImageFilename(CardUtil.buildFilename(c));
if (c.getCurSetCode().equals(""))
{
c.setCurSetCode(c.getMostRecentSet());
c.setImageFilename(CardUtil.buildFilename(c));
}
topModel.addCard(c);
}//for
@@ -150,8 +154,13 @@ public class Gui_Quest_DeckEditor extends JFrame implements CardContainer, DeckD
for(int i = 0; i < bottom.size(); i++) {
c = bottom.get(i);
c.setRarity(pack.getRarity(c.getName()));;
if (c.getCurSetCode().equals(""))
{
c.setCurSetCode(c.getMostRecentSet());
c.setImageFilename(CardUtil.buildFilename(c));
}
bottomModel.addCard(c);
}//for

View File

@@ -174,7 +174,7 @@ public class ImageCache implements NewConstants {
* Returns the map key for a card, without any suffixes for the image size.
*/
private static String getKey(Card card) {
String key = GuiDisplayUtil.cleanString(card.getImageName());
/* String key = GuiDisplayUtil.cleanString(card.getImageName());
//if(card.isBasicLand() && card.getRandomPicture() != 0) key += card.getRandomPicture();
File path = null;
String tkn = "";
@@ -237,8 +237,11 @@ public class ImageCache implements NewConstants {
key += tkn;
// key = GuiDisplayUtil.cleanString(key);
return key;
*/
if (card.isToken() && !card.isCopiedToken())
return GuiDisplayUtil.cleanString(card.getImageName()) + TOKEN;
return card.getImageFilename(); //key;
}
/**