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 // Section: Challenges related methods
// --------------------------------------------------------------------- // ---------------------------------------------------------------------

View File

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