From b3b4d0d409eaee203b3a1a58b2ceeac22d82f147 Mon Sep 17 00:00:00 2001 From: jendave Date: Sun, 7 Aug 2011 00:48:18 +0000 Subject: [PATCH] - Fixed the TableSorter.getRarity() method and it should now be compatible with the new set info. As a bonus, the new cards won in quest mode may now appear at the top of the list rather than requiring you to scroll down to the bottom of the listing. --- src/forge/TableSorter.java | 55 +++++++++++++++++++++++++++++--------- 1 file changed, 42 insertions(+), 13 deletions(-) diff --git a/src/forge/TableSorter.java b/src/forge/TableSorter.java index 635ad4649d8..f7970ae5ee3 100644 --- a/src/forge/TableSorter.java +++ b/src/forge/TableSorter.java @@ -136,19 +136,48 @@ public class TableSorter implements Comparator, NewConstants return count; } - final private Integer getRarity(Card c) - { - if(c.getRarity().equals("Common")) - return Integer.valueOf(1); - else if(c.getRarity().equals("Uncommon")) - return Integer.valueOf(2); - else if(c.getRarity().equals("Rare")) - return Integer.valueOf(3); - else if(c.getRarity().equals("Land")) - return Integer.valueOf(4); - else - return Integer.valueOf(5); - } + final private Integer getRarity(Card c) + { + String rarity = c.getRarity(); + + if (rarity.equals("new")) + return 1; + + if (!c.getCurSetCode().equals("")) { + SetInfo si = SetInfoUtil.getSetInfo_Code(c.getSets(), c.getCurSetCode()); + if (si != null) + rarity = si.Rarity; + } + + if (rarity.equals("Common")) + return 2; + else if (rarity.equals("Uncommon")) + return 3; + else if (rarity.equals("Rare")) + return 4; + else if (rarity.equals("Mythic")) + return 5; + else if (rarity.equals("Special")) + return 6; + else if (rarity.equals("Land")) + return 7; + else + return 8; + + // This older form of the method no longer works as it is not compatible with set info. + /* + if(c.getRarity().equals("Common")) + return Integer.valueOf(1); + else if(c.getRarity().equals("Uncommon")) + return Integer.valueOf(2); + else if(c.getRarity().equals("Rare")) + return Integer.valueOf(3); + else if(c.getRarity().equals("Land")) + return Integer.valueOf(4); + else + return Integer.valueOf(5); + */ + } final private Long getValue(Card c) {