From 9c1658abc183704a0c1c14b44ce5b64cfab8578b Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Thu, 26 Apr 2018 01:14:55 -0400 Subject: [PATCH] v0.6.5: fixed issues with previous badge changes --- .../shatteredpixeldungeon/Badges.java | 14 ++++++++++++-- .../messages/misc/misc.properties | 4 +++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Badges.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Badges.java index a2b3f04fd..ab4231d68 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Badges.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Badges.java @@ -39,6 +39,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; +import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; @@ -183,6 +184,12 @@ public class Badges { "RARE_SENIOR", "RARE_ACIDIC", "RARE", "TUTORIAL_WARRIOR", "TUTORIAL_MAGE")); } + private static final HashMap renamedBadges = new HashMap<>(); + static{ + //0.6.5 + renamedBadges.put("CHAMPION", "CHAMPION_1"); + } + private static HashSet restore( Bundle bundle ) { HashSet badges = new HashSet(); if (bundle == null) return badges; @@ -190,6 +197,9 @@ public class Badges { String[] names = bundle.getStringArray( BADGES ); for (int i=0; i < names.length; i++) { try { + if (renamedBadges.containsKey(names[i])){ + names[i] = renamedBadges.get(names[i]); + } if (!removedBadges.contains(names[i])){ badges.add( Badge.valueOf( names[i] ) ); } @@ -761,7 +771,7 @@ public class Badges { local.add( Badge.HAPPY_END ); } } - + public static void validateHappyEnd() { displayBadge( Badge.HAPPY_END ); } @@ -851,7 +861,7 @@ public class Badges { leaveBest( filtered, Badge.ALL_SCROLLS_IDENTIFIED, Badge.ALL_ITEMS_IDENTIFIED ); leaveBest( filtered, Badge.GAMES_PLAYED_1, Badge.GAMES_PLAYED_2, Badge.GAMES_PLAYED_3, Badge.GAMES_PLAYED_4 ); leaveBest( filtered, Badge.CHAMPION_1, Badge.CHAMPION_2, Badge.CHAMPION_3 ); - + ArrayList list = new ArrayList( filtered ); Collections.sort( list ); diff --git a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/misc/misc.properties b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/misc/misc.properties index 2fcbe4f1e..f2f7b1bd0 100644 --- a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/misc/misc.properties +++ b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/misc/misc.properties @@ -62,7 +62,9 @@ badges$badge.games_played_2=50 games played badges$badge.games_played_3=250 games played badges$badge.games_played_4=1000 games played badges$badge.happy_end=Happy end -badges$badge.champion=Challenge won +badges$badge.champion_1=Won with a Challenge +badges$badge.champion_2=Won with 3 Challenges +badges$badge.champion_3=Won with 6 Challenges challenges.no_food=On diet challenges.no_food_desc=Food is scarce, so make every bite count!\n\n- Regular rations and pasties are replaced with small rations\n- Mystery meat and blandfruit are removed\n- Horn of Plenty is removed