Disable waiver amount message for last challenge level.
This commit is contained in:
BONNe 2021-09-24 12:55:41 +03:00
parent aa0336d62a
commit 644c7d6ba5
2 changed files with 23 additions and 5 deletions

View File

@ -1677,6 +1677,21 @@ public class ChallengesManager
}
/**
* Returns if the given level is last leve in given world.
*
* @param level the level
* @param world the world
* @return the boolean
*/
public boolean isLastLevel(ChallengeLevel level, World world)
{
List<ChallengeLevel> levels = this.getLevels(world);
return levels.get(levels.size() - 1) == level;
}
// ---------------------------------------------------------------------
// Section: Challenges related methods
// ---------------------------------------------------------------------

View File

@ -816,8 +816,9 @@ public abstract class CommonPanel
// Get status in single string
String status = "";
// Get requirements in single string
String waiver = this.user.getTranslationOrNothing(reference + "waiver",
"[number]", String.valueOf(level.getWaiverAmount()));
String waiver = this.manager.isLastLevel(level, this.world) ? "" :
this.user.getTranslationOrNothing(reference + "waiver",
"[number]", String.valueOf(level.getWaiverAmount()));
// Get rewards in single string
String rewards = this.generateReward(level);
@ -851,9 +852,11 @@ public abstract class CommonPanel
// Get status in single string
String status = this.generateLevelStatus(levelStatus);
// Get requirements in single string
String waiver = !levelStatus.isUnlocked() || levelStatus.isComplete() ? "" :
this.user.getTranslationOrNothing(reference + "waiver",
"[number]", String.valueOf(level.getWaiverAmount()));
String waiver = this.manager.isLastLevel(level, this.world) ||
!levelStatus.isUnlocked() ||
levelStatus.isComplete() ?
"" : this.user.getTranslationOrNothing(reference + "waiver",
"[number]", String.valueOf(level.getWaiverAmount()));
// Get rewards in single string
String rewards = !levelStatus.isUnlocked() ? "" : this.generateReward(level);