show number of available stat points in menu. Fixes #869

This commit is contained in:
Phillip Thelen 2017-11-08 20:43:49 +01:00
parent 3f7f370d91
commit d4ff2dfa62
2 changed files with 17 additions and 11 deletions

View file

@ -717,4 +717,5 @@
<string name="classless">Classless</string>
<string name="class_equipment_shop_dialog">This item is only available to a specific class.\nYou can change your class from Settings.</string>
<string name="class_gear_disclaimer">You can only purchase gear for your current class</string>
<string name="available_stats" formatted="false">%d points</string>
</resources>

View file

@ -477,25 +477,30 @@ public class MainActivity extends BaseActivity implements TutorialView.OnTutoria
drawer.removeItem(MainDrawerBuilder.INSTANCE.getSIDEBAR_SKILLS());
}
} else {
IDrawerItem newItem;
PrimaryDrawerItem newItem = new PrimaryDrawerItem()
.withName(this.getString(R.string.sidebar_skills))
.withIdentifier(MainDrawerBuilder.INSTANCE.getSIDEBAR_SKILLS());
if (user.getStats().getLvl() < MIN_LEVEL_FOR_SKILLS && !hasSpecialItems) {
newItem = new PrimaryDrawerItem()
.withName(this.getString(R.string.sidebar_skills))
.withEnabled(false)
.withBadge(this.getString(R.string.unlock_lvl_11))
.withIdentifier(MainDrawerBuilder.INSTANCE.getSIDEBAR_SKILLS());
} else {
newItem = new PrimaryDrawerItem()
.withName(this.getString(R.string.sidebar_skills))
.withIdentifier(MainDrawerBuilder.INSTANCE.getSIDEBAR_SKILLS());
newItem = newItem.withEnabled(false).withBadge(this.getString(R.string.unlock_lvl_11));
}
if (item == null) {
drawer.addItemAtPosition(newItem, 1);
} else {
drawer.updateItem(newItem);
}
}
IDrawerItem statsItem = drawer.getDrawerItem(MainDrawerBuilder.INSTANCE.getSIDEBAR_STATS());
PrimaryDrawerItem newStatsItem = new PrimaryDrawerItem()
.withName(this.getString(R.string.sidebar_skills))
.withIdentifier(MainDrawerBuilder.INSTANCE.getSIDEBAR_SKILLS());
if (user.getStats() != null && user.getStats().lvl >= 0 && user.getStats().points > 0) {
newStatsItem = newStatsItem.withBadge(this.getString(R.string.available_stats, user.getStats().points));
}
if (statsItem == null) {
drawer.addItemAtPosition(newStatsItem, 2);
} else {
drawer.updateItem(newStatsItem);
}
}
}